aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout
diff options
context:
space:
mode:
authorBastien Orivel <eijebong@bananium.fr>2017-10-30 12:15:30 +0100
committerBastien Orivel <eijebong@bananium.fr>2017-10-30 23:36:06 +0100
commit29b4eec14187c96a1518af6a954bd00194375382 (patch)
treec49cf779948919fb4a21c93986395ae1fd149b0b /components/layout
parentb6475cf433747a8b0cd177f0a16abae9d795e41c (diff)
downloadservo-29b4eec14187c96a1518af6a954bd00194375382.tar.gz
servo-29b4eec14187c96a1518af6a954bd00194375382.zip
Bump bitflags to 1.0 in every servo crate
Diffstat (limited to 'components/layout')
-rw-r--r--components/layout/Cargo.toml2
-rw-r--r--components/layout/block.rs158
-rw-r--r--components/layout/construct.rs66
-rw-r--r--components/layout/data.rs6
-rw-r--r--components/layout/display_list_builder.rs37
-rw-r--r--components/layout/flex.rs16
-rw-r--r--components/layout/floats.rs6
-rw-r--r--components/layout/flow.rs89
-rw-r--r--components/layout/fragment.rs127
-rw-r--r--components/layout/generated_content.rs8
-rw-r--r--components/layout/incremental.rs26
-rw-r--r--components/layout/inline.rs30
-rw-r--r--components/layout/list_item.rs4
-rw-r--r--components/layout/query.rs4
-rw-r--r--components/layout/sequential.rs14
-rw-r--r--components/layout/table.rs12
-rw-r--r--components/layout/table_cell.rs6
-rw-r--r--components/layout/table_row.rs6
-rw-r--r--components/layout/table_rowgroup.rs5
-rw-r--r--components/layout/table_wrapper.rs11
-rw-r--r--components/layout/text.rs27
-rw-r--r--components/layout/traversal.rs22
-rw-r--r--components/layout/wrapper.rs2
23 files changed, 347 insertions, 337 deletions
diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml
index 9b86c50b043..235d4e90930 100644
--- a/components/layout/Cargo.toml
+++ b/components/layout/Cargo.toml
@@ -12,7 +12,7 @@ path = "lib.rs"
[dependencies]
app_units = "0.5"
atomic_refcell = "0.1"
-bitflags = "0.8"
+bitflags = "1.0"
canvas_traits = {path = "../canvas_traits"}
euclid = "0.15"
fnv = "1.0"
diff --git a/components/layout/block.rs b/components/layout/block.rs
index aaad1d51937..57ebe275502 100644
--- a/components/layout/block.rs
+++ b/components/layout/block.rs
@@ -35,13 +35,9 @@ use display_list_builder::StackingContextCollectionState;
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
use floats::{ClearType, FloatKind, Floats, PlacementInfo};
use flow::{self, BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloatedFlag};
-use flow::{BLOCK_POSITION_IS_STATIC, CLEARS_LEFT, CLEARS_RIGHT};
-use flow::{CONTAINS_TEXT_OR_REPLACED_FRAGMENTS, INLINE_POSITION_IS_STATIC};
-use flow::{IS_ABSOLUTELY_POSITIONED, FragmentationContext, MARGINS_CANNOT_COLLAPSE};
-use flow::{ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow};
+use flow::{ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow, FragmentationContext, FlowFlags};
use flow_list::FlowList;
-use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
-use fragment::{IS_INLINE_FLEX_ITEM, IS_BLOCK_FLEX_ITEM};
+use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow, FragmentFlags};
use gfx_traits::print_tree::PrintTree;
use incremental::RelayoutMode;
use layout_debug;
@@ -57,7 +53,7 @@ use style::computed_values::{position, text_align};
use style::context::SharedStyleContext;
use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalSize, WritingMode};
use style::properties::ComputedValues;
-use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW};
+use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::computed::{LengthOrPercentageOrNone, LengthOrPercentage};
use style::values::computed::LengthOrPercentageOrAuto;
use traversal::PreorderFlowTraversal;
@@ -455,11 +451,11 @@ impl<'a> PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'a> {
// This flow might not be an absolutely positioned flow if it is the root of the tree.
let block = flow.as_mut_block();
- if !block.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if !block.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
return;
}
- if !block.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
+ if !block.base.restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW) {
return
}
@@ -513,11 +509,11 @@ pub struct BlockFlow {
}
bitflags! {
- flags BlockFlowFlags: u8 {
+ struct BlockFlowFlags: u8 {
#[doc = "If this is set, then this block flow is the root flow."]
- const IS_ROOT = 0b0000_0001,
+ const IS_ROOT = 0b0000_0001;
#[doc = "If this is set, then this block flow has overflow and it will scroll."]
- const HAS_SCROLLING_OVERFLOW = 0b0000_0010,
+ const HAS_SCROLLING_OVERFLOW = 0b0000_0010;
}
}
@@ -551,7 +547,7 @@ impl BlockFlow {
/// This determines the algorithm used to calculate inline-size, block-size, and the
/// relevant margins for this Block.
pub fn block_type(&self) -> BlockType {
- if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
if self.fragment.is_replaced() {
BlockType::AbsoluteReplaced
} else {
@@ -664,7 +660,7 @@ impl BlockFlow {
#[inline]
pub fn containing_block_size(&self, viewport_size: &Size2D<Au>, descendant: OpaqueFlow)
-> LogicalSize<Au> {
- debug_assert!(self.base.flags.contains(IS_ABSOLUTELY_POSITIONED));
+ debug_assert!(self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED));
if self.is_fixed() || self.is_root() {
// Initial containing block is the CB for the root
LogicalSize::from_physical(self.base.writing_mode, *viewport_size)
@@ -783,13 +779,13 @@ impl BlockFlow {
let mut break_at = None;
let content_box = self.fragment.content_box();
- if self.base.restyle_damage.contains(REFLOW) {
+ if self.base.restyle_damage.contains(ServoRestyleDamage::REFLOW) {
// Our current border-box position.
let mut cur_b = Au(0);
// Absolute positioning establishes a block formatting context. Don't propagate floats
// in or out. (But do propagate them between kids.)
- if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) ||
+ if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) ||
margins_may_collapse != MarginsMayCollapseFlag::MarginsMayCollapse {
self.base.floats = Floats::new(self.fragment.style.writing_mode);
}
@@ -805,7 +801,7 @@ impl BlockFlow {
let can_collapse_block_start_margin_with_kids =
margins_may_collapse == MarginsMayCollapseFlag::MarginsMayCollapse &&
- !self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) &&
+ !self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
self.fragment.border_padding.block_start == Au(0);
margin_collapse_info.initialize_block_start_margin(
&self.fragment,
@@ -816,10 +812,10 @@ impl BlockFlow {
let thread_id = self.base.thread_id;
let (mut had_floated_children, mut had_children_with_clearance) = (false, false);
for (child_index, kid) in self.base.child_iter_mut().enumerate() {
- if flow::base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if flow::base(kid).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
// Assume that the *hypothetical box* for an absolute flow starts immediately
// after the margin-end border edge of the previous flow.
- if flow::base(kid).flags.contains(BLOCK_POSITION_IS_STATIC) {
+ if flow::base(kid).flags.contains(FlowFlags::BLOCK_POSITION_IS_STATIC) {
let previous_bottom_margin = margin_collapse_info.current_float_ceiling();
flow::mut_base(kid).position.start.b = cur_b +
@@ -887,8 +883,8 @@ impl BlockFlow {
if !had_children_with_clearance &&
floats.is_present() &&
- (flow::base(kid).flags.contains(CLEARS_LEFT) ||
- flow::base(kid).flags.contains(CLEARS_RIGHT)) {
+ (flow::base(kid).flags.contains(FlowFlags::CLEARS_LEFT) ||
+ flow::base(kid).flags.contains(FlowFlags::CLEARS_RIGHT)) {
had_children_with_clearance = true
}
@@ -905,8 +901,8 @@ impl BlockFlow {
}
// Clear past the floats that came in, if necessary.
- let clearance = match (flow::base(kid).flags.contains(CLEARS_LEFT),
- flow::base(kid).flags.contains(CLEARS_RIGHT)) {
+ let clearance = match (flow::base(kid).flags.contains(FlowFlags::CLEARS_LEFT),
+ flow::base(kid).flags.contains(FlowFlags::CLEARS_RIGHT)) {
(false, false) => Au(0),
(true, false) => floats.clearance(ClearType::Left),
(false, true) => floats.clearance(ClearType::Right),
@@ -967,7 +963,7 @@ impl BlockFlow {
// Add in our block-end margin and compute our collapsible margins.
let can_collapse_block_end_margin_with_kids =
margins_may_collapse == MarginsMayCollapseFlag::MarginsMayCollapse &&
- !self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) &&
+ !self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
self.fragment.border_padding.block_end == Au(0);
let (collapsible_margins, delta) =
margin_collapse_info.finish_and_compute_collapsible_margins(
@@ -982,13 +978,13 @@ impl BlockFlow {
let is_root = self.is_root();
if is_root || self.formatting_context_type() != FormattingContextType::None ||
- self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
// The content block-size includes all the floats per CSS 2.1 § 10.6.7. The easiest
// way to handle this is to just treat it as clearance.
block_size = block_size + floats.clearance(ClearType::Both);
}
- if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
// FIXME(#2003, pcwalton): The max is taken here so that you can scroll the page,
// but this is not correct behavior according to CSS 2.1 § 10.5. Instead I think we
// should treat the root element as having `overflow: scroll` and use the layers-
@@ -1008,7 +1004,7 @@ impl BlockFlow {
}
- if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
self.propagate_early_absolute_position_info_to_children();
return None
}
@@ -1076,9 +1072,9 @@ impl BlockFlow {
// size has not yet been computed. (See `assign_inline_position_for_formatting_context()`.)
if (self.base.flags.is_float() ||
self.formatting_context_type() == FormattingContextType::None) &&
- !self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
- self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
- self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
+ !self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
+ self.base.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
+ self.fragment.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
}
break_at.and_then(|(i, child_remaining)| {
@@ -1162,7 +1158,7 @@ impl BlockFlow {
let viewport_size = LogicalSize::from_physical(self.fragment.style.writing_mode,
shared_context.viewport_size());
Some(viewport_size.block)
- } else if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) &&
+ } else if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
self.base.block_container_explicit_block_size.is_none() {
self.base.absolute_cb.explicit_block_containing_size(shared_context)
} else {
@@ -1300,7 +1296,7 @@ impl BlockFlow {
self.fragment.margin.block_end = solution.margin_block_end;
self.fragment.border_box.start.b = Au(0);
- if !self.base.flags.contains(BLOCK_POSITION_IS_STATIC) {
+ if !self.base.flags.contains(FlowFlags::BLOCK_POSITION_IS_STATIC) {
self.base.position.start.b = solution.block_start + self.fragment.margin.block_start
}
@@ -1308,8 +1304,8 @@ impl BlockFlow {
self.fragment.border_box.size.block = block_size;
self.base.position.size.block = block_size;
- self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
- self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
+ self.base.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
+ self.fragment.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
}
/// Compute inline size based using the `block_container_inline_size` set by the parent flow.
@@ -1358,7 +1354,7 @@ impl BlockFlow {
.map(|x| if x < box_border { Au(0) } else { x - box_border });
if self.is_root() { explicit_content_size = max(parent_container_size, explicit_content_size); }
// Calculate containing block inline size.
- let containing_block_size = if flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ let containing_block_size = if flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
self.containing_block_size(&shared_context.viewport_size(), opaque_self).inline
} else {
content_inline_size
@@ -1386,12 +1382,12 @@ impl BlockFlow {
// float child does not have `REFLOW` set, we must be careful to avoid touching its
// inline position, as no logic will run afterward to set its true value.
let kid_base = flow::mut_base(kid);
- let reflow_damage = if kid_base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
- REFLOW_OUT_OF_FLOW
+ let reflow_damage = if kid_base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
+ ServoRestyleDamage::REFLOW_OUT_OF_FLOW
} else {
- REFLOW
+ ServoRestyleDamage::REFLOW
};
- if kid_base.flags.contains(INLINE_POSITION_IS_STATIC) &&
+ if kid_base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) &&
kid_base.restyle_damage.contains(reflow_damage) {
kid_base.position.start.i =
if kid_mode.is_bidi_ltr() == containing_block_mode.is_bidi_ltr() {
@@ -1475,13 +1471,13 @@ impl BlockFlow {
content_box: LogicalRect<Au>) {
debug_assert!(self.formatting_context_type() != FormattingContextType::None);
- if !self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
+ if !self.base.restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW) {
return
}
// We do this first to avoid recomputing our inline size when we propagate it.
- self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
- self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
+ self.base.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
+ self.fragment.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
// The code below would completely wreck the layout if run on a flex item, however:
// * Flex items are always the children of flex containers.
@@ -1591,14 +1587,14 @@ impl BlockFlow {
// This is kind of a hack for Acid2. But it's a harmless one, because (a) this behavior
// is unspecified; (b) it matches the behavior one would intuitively expect, since
// floats don't flow around blocks that take up no space in the block direction.
- flags.remove(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
+ flags.remove(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
} else if self.fragment.is_text_or_replaced() {
- flags.insert(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
+ flags.insert(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
} else {
- flags.remove(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
+ flags.remove(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
for kid in self.base.children.iter() {
- if flow::base(kid).flags.contains(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS) {
- flags.insert(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
+ if flow::base(kid).flags.contains(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS) {
+ flags.insert(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
break
}
}
@@ -1615,7 +1611,7 @@ impl BlockFlow {
let (mut left_float_width_accumulator, mut right_float_width_accumulator) = (Au(0), Au(0));
let mut preferred_inline_size_of_children_without_text_or_replaced_fragments = Au(0);
for kid in self.base.child_iter_mut() {
- if flow::base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED) || !consult_children {
+ if flow::base(kid).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) || !consult_children {
continue
}
@@ -1625,16 +1621,16 @@ impl BlockFlow {
max(computation.content_intrinsic_sizes.minimum_inline_size,
child_base.intrinsic_inline_sizes.minimum_inline_size);
- if child_base.flags.contains(CLEARS_LEFT) {
+ if child_base.flags.contains(FlowFlags::CLEARS_LEFT) {
left_float_width = max(left_float_width, left_float_width_accumulator);
left_float_width_accumulator = Au(0)
}
- if child_base.flags.contains(CLEARS_RIGHT) {
+ if child_base.flags.contains(FlowFlags::CLEARS_RIGHT) {
right_float_width = max(right_float_width, right_float_width_accumulator);
right_float_width_accumulator = Au(0)
}
- match (float_kind, child_base.flags.contains(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS)) {
+ match (float_kind, child_base.flags.contains(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS)) {
(float::T::none, true) => {
computation.content_intrinsic_sizes.preferred_inline_size =
max(computation.content_intrinsic_sizes.preferred_inline_size,
@@ -1681,7 +1677,7 @@ impl BlockFlow {
}
pub fn compute_inline_sizes(&mut self, shared_context: &SharedStyleContext) {
- if !self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
+ if !self.base.restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW) {
return
}
@@ -1762,23 +1758,23 @@ impl BlockFlow {
}
pub fn is_inline_flex_item(&self) -> bool {
- self.fragment.flags.contains(IS_INLINE_FLEX_ITEM)
+ self.fragment.flags.contains(FragmentFlags::IS_INLINE_FLEX_ITEM)
}
pub fn is_block_flex_item(&self) -> bool {
- self.fragment.flags.contains(IS_BLOCK_FLEX_ITEM)
+ self.fragment.flags.contains(FragmentFlags::IS_BLOCK_FLEX_ITEM)
}
pub fn mark_scrolling_overflow(&mut self, has_scrolling_overflow: bool) {
if has_scrolling_overflow {
- self.flags.insert(HAS_SCROLLING_OVERFLOW);
+ self.flags.insert(BlockFlowFlags::HAS_SCROLLING_OVERFLOW);
} else {
- self.flags.remove(HAS_SCROLLING_OVERFLOW);
+ self.flags.remove(BlockFlowFlags::HAS_SCROLLING_OVERFLOW);
}
}
pub fn has_scrolling_overflow(&mut self) -> bool {
- self.flags.contains(HAS_SCROLLING_OVERFLOW)
+ self.flags.contains(BlockFlowFlags::HAS_SCROLLING_OVERFLOW)
}
// Return offset from original position because of `position: sticky`.
@@ -1824,7 +1820,7 @@ impl Flow for BlockFlow {
_ => true,
};
self.bubble_inline_sizes_for_block(consult_children);
- self.fragment.restyle_damage.remove(BUBBLE_ISIZES);
+ self.fragment.restyle_damage.remove(ServoRestyleDamage::BUBBLE_ISIZES);
}
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments.
@@ -1874,13 +1870,14 @@ impl Flow for BlockFlow {
}
let is_formatting_context = self.formatting_context_type() != FormattingContextType::None;
- if !self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) && is_formatting_context {
+ if !self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) && is_formatting_context {
self.assign_inline_position_for_formatting_context(layout_context, content_box);
}
if (self as &Flow).floats_might_flow_through() {
self.base.thread_id = parent_thread_id;
- if self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
+ if self.base.restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW |
+ ServoRestyleDamage::REFLOW) {
self.assign_block_size(layout_context);
// Don't remove the restyle damage; `assign_block_size` decides whether that is
// appropriate (which in the case of e.g. absolutely-positioned flows, it is not).
@@ -1914,7 +1911,7 @@ impl Flow for BlockFlow {
// Assign block-size for fragment if it is an image fragment.
self.fragment.assign_replaced_block_size_if_necessary();
- if !self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if !self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
self.base.position.size.block = self.fragment.border_box.size.block;
let mut block_start = AdjoiningMargins::from_margin(self.fragment.margin.block_start);
let block_end = AdjoiningMargins::from_margin(self.fragment.margin.block_end);
@@ -1924,13 +1921,14 @@ impl Flow for BlockFlow {
} else {
self.base.collapsible_margins = CollapsibleMargins::Collapse(block_start, block_end);
}
- self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
- self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
+ self.base.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
+ self.fragment.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW |
+ ServoRestyleDamage::REFLOW);
}
None
} else if self.is_root() ||
self.formatting_context_type() != FormattingContextType::None ||
- self.base.flags.contains(MARGINS_CANNOT_COLLAPSE) {
+ self.base.flags.contains(FlowFlags::MARGINS_CANNOT_COLLAPSE) {
// Root element margins should never be collapsed according to CSS § 8.3.1.
debug!("assign_block_size: assigning block_size for root flow {:?}",
flow::base(self).debug_id());
@@ -1957,7 +1955,7 @@ impl Flow for BlockFlow {
self.base.clip = max_rect();
}
- if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
let position_start = self.base.position.start.to_physical(self.base.writing_mode,
container_size);
@@ -1975,17 +1973,17 @@ impl Flow for BlockFlow {
};
if !self.base.writing_mode.is_vertical() {
- if !self.base.flags.contains(INLINE_POSITION_IS_STATIC) {
+ if !self.base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) {
self.base.stacking_relative_position.x = absolute_stacking_relative_position.x
}
- if !self.base.flags.contains(BLOCK_POSITION_IS_STATIC) {
+ if !self.base.flags.contains(FlowFlags::BLOCK_POSITION_IS_STATIC) {
self.base.stacking_relative_position.y = absolute_stacking_relative_position.y
}
} else {
- if !self.base.flags.contains(INLINE_POSITION_IS_STATIC) {
+ if !self.base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) {
self.base.stacking_relative_position.y = absolute_stacking_relative_position.y
}
- if !self.base.flags.contains(BLOCK_POSITION_IS_STATIC) {
+ if !self.base.flags.contains(FlowFlags::BLOCK_POSITION_IS_STATIC) {
self.base.stacking_relative_position.x = absolute_stacking_relative_position.x
}
}
@@ -2058,28 +2056,28 @@ impl Flow for BlockFlow {
// Process children.
for kid in self.base.child_iter_mut() {
- if flow::base(kid).flags.contains(INLINE_POSITION_IS_STATIC) ||
- flow::base(kid).flags.contains(BLOCK_POSITION_IS_STATIC) {
+ if flow::base(kid).flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) ||
+ flow::base(kid).flags.contains(FlowFlags::BLOCK_POSITION_IS_STATIC) {
let kid_base = flow::mut_base(kid);
let physical_position = kid_base.position.to_physical(kid_base.writing_mode,
container_size_for_children);
// Set the inline and block positions as necessary.
if !kid_base.writing_mode.is_vertical() {
- if kid_base.flags.contains(INLINE_POSITION_IS_STATIC) {
+ if kid_base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) {
kid_base.stacking_relative_position.x = origin_for_children.x +
physical_position.origin.x
}
- if kid_base.flags.contains(BLOCK_POSITION_IS_STATIC) {
+ if kid_base.flags.contains(FlowFlags::BLOCK_POSITION_IS_STATIC) {
kid_base.stacking_relative_position.y = origin_for_children.y +
physical_position.origin.y
}
} else {
- if kid_base.flags.contains(INLINE_POSITION_IS_STATIC) {
+ if kid_base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) {
kid_base.stacking_relative_position.y = origin_for_children.y +
physical_position.origin.y
}
- if kid_base.flags.contains(BLOCK_POSITION_IS_STATIC) {
+ if kid_base.flags.contains(FlowFlags::BLOCK_POSITION_IS_STATIC) {
kid_base.stacking_relative_position.x = origin_for_children.x +
physical_position.origin.x
}
@@ -2092,11 +2090,11 @@ impl Flow for BlockFlow {
}
fn mark_as_root(&mut self) {
- self.flags.insert(IS_ROOT)
+ self.flags.insert(BlockFlowFlags::IS_ROOT)
}
fn is_root(&self) -> bool {
- self.flags.contains(IS_ROOT)
+ self.flags.contains(BlockFlowFlags::IS_ROOT)
}
/// The 'position' property of this flow.
@@ -2122,7 +2120,7 @@ impl Flow for BlockFlow {
}
fn update_late_computed_inline_position_if_necessary(&mut self, inline_position: Au) {
- if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) &&
+ if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
self.fragment.style().logical_position().inline_start ==
LengthOrPercentageOrAuto::Auto &&
self.fragment.style().logical_position().inline_end ==
@@ -2132,7 +2130,7 @@ impl Flow for BlockFlow {
}
fn update_late_computed_block_position_if_necessary(&mut self, block_position: Au) {
- if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) &&
+ if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
self.fragment.style().logical_position().block_start ==
LengthOrPercentageOrAuto::Auto &&
self.fragment.style().logical_position().block_end ==
@@ -2748,7 +2746,7 @@ impl ISizeAndMarginsComputer for AbsoluteNonReplaced {
block: &mut BlockFlow,
solution: ISizeConstraintSolution) {
// Set the inline position of the absolute flow wrt to its containing block.
- if !block.base.flags.contains(INLINE_POSITION_IS_STATIC) {
+ if !block.base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) {
block.base.position.start.i = solution.inline_start;
}
}
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index 3ad9ffcbe8a..888348e3688 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -16,22 +16,19 @@
use ServoArc;
use block::BlockFlow;
use context::{LayoutContext, with_thread_local_font_context};
-use data::{HAS_NEWLY_CONSTRUCTED_FLOW, LayoutData};
+use data::{LayoutDataFlags, LayoutData};
use flex::FlexFlow;
use floats::FloatKind;
use flow::{self, AbsoluteDescendants, Flow, FlowClass, ImmutableFlowUtils};
-use flow::{CAN_BE_FRAGMENTED, IS_ABSOLUTELY_POSITIONED, MARGINS_CANNOT_COLLAPSE};
-use flow::{MutableFlowUtils, MutableOwnedFlowUtils};
+use flow::{FlowFlags, MutableFlowUtils, MutableOwnedFlowUtils};
use flow_ref::FlowRef;
use fragment::{CanvasFragmentInfo, ImageFragmentInfo, InlineAbsoluteFragmentInfo, SvgFragmentInfo};
-use fragment::{Fragment, GeneratedContentInfo, IframeFragmentInfo};
-use fragment::{IS_INLINE_FLEX_ITEM, IS_BLOCK_FLEX_ITEM};
+use fragment::{Fragment, GeneratedContentInfo, IframeFragmentInfo, FragmentFlags};
use fragment::{InlineAbsoluteHypotheticalFragmentInfo, TableColumnFragmentInfo};
use fragment::{InlineBlockFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
use fragment::WhitespaceStrippingResult;
use gfx::display_list::OpaqueNode;
-use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow};
-use inline::{InlineFragmentNodeInfo, LAST_FRAGMENT_OF_ELEMENT};
+use inline::{InlineFlow, InlineFragmentNodeInfo, InlineFragmentNodeFlags};
use linked_list::prepend_from;
use list_item::{ListItemFlow, ListStyleTypeContent};
use multicol::{MulticolColumnFlow, MulticolFlow};
@@ -54,7 +51,7 @@ use style::logical_geometry::Direction;
use style::properties::ComputedValues;
use style::properties::longhands::list_style_image;
use style::selector_parser::{PseudoElement, RestyleDamage};
-use style::servo::restyle_damage::{BUBBLE_ISIZES, RECONSTRUCT_FLOW};
+use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::Either;
use table::TableFlow;
use table_caption::TableCaptionFlow;
@@ -173,7 +170,7 @@ impl InlineBlockSplit {
-> InlineBlockSplit {
fragment_accumulator.enclosing_node.as_mut().expect(
"enclosing_node is None; Are {ib} splits being generated outside of an inline node?"
- ).flags.remove(LAST_FRAGMENT_OF_ELEMENT);
+ ).flags.remove(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT);
let split = InlineBlockSplit {
predecessors: mem::replace(
@@ -183,7 +180,8 @@ impl InlineBlockSplit {
flow: flow,
};
- fragment_accumulator.enclosing_node.as_mut().unwrap().flags.remove(FIRST_FRAGMENT_OF_ELEMENT);
+ fragment_accumulator.enclosing_node.as_mut().unwrap().flags.remove(
+ InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT);
split
}
@@ -258,7 +256,8 @@ impl InlineFragmentsAccumulator {
pseudo: node.get_pseudo_element_type().strip(),
style: node.style(style_context),
selected_style: node.selected_style(),
- flags: FIRST_FRAGMENT_OF_ELEMENT | LAST_FRAGMENT_OF_ELEMENT,
+ flags: InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT |
+ InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT,
}),
bidi_control_chars: None,
restyle_damage: node.restyle_damage(),
@@ -287,17 +286,18 @@ impl InlineFragmentsAccumulator {
for (index, fragment) in fragments.fragments.iter_mut().enumerate() {
let mut enclosing_node = enclosing_node.clone();
if index != 0 {
- enclosing_node.flags.remove(FIRST_FRAGMENT_OF_ELEMENT)
+ enclosing_node.flags.remove(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT)
}
if index != fragment_count - 1 {
- enclosing_node.flags.remove(LAST_FRAGMENT_OF_ELEMENT)
+ enclosing_node.flags.remove(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT)
}
fragment.add_inline_context_style(enclosing_node);
}
// Control characters are later discarded in transform_text, so they don't affect the
// is_first/is_last styles above.
- enclosing_node.flags.remove(FIRST_FRAGMENT_OF_ELEMENT | LAST_FRAGMENT_OF_ELEMENT);
+ enclosing_node.flags.remove(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT |
+ InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT);
if let Some((start, end)) = bidi_control_chars {
fragments.fragments.push_front(
@@ -493,7 +493,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
ConstructionResult::Flow(kid_flow, AbsoluteDescendants::new());
self.set_flow_construction_result(&kid, construction_result)
} else {
- if !flow::base(&*kid_flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if !flow::base(&*kid_flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
// Flush any inline fragments that we were gathering up. This allows us to
// handle {ib} splits.
let old_inline_fragment_accumulator =
@@ -621,7 +621,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
flow.set_absolute_descendants(abs_descendants);
abs_descendants = AbsoluteDescendants::new();
- if flow::base(&*flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if flow::base(&*flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
// This is now the only absolute flow in the subtree which hasn't yet
// reached its CB.
abs_descendants.push(flow.clone());
@@ -776,7 +776,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
match kid.get_construction_result() {
ConstructionResult::None => {}
ConstructionResult::Flow(flow, kid_abs_descendants) => {
- if !flow::base(&*flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if !flow::base(&*flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
opt_inline_block_splits.push_back(InlineBlockSplit::new(
&mut fragment_accumulator, node, self.style_context(), flow));
abs_descendants.push_descendants(kid_abs_descendants);
@@ -1066,7 +1066,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
abs_descendants = AbsoluteDescendants::new();
- if flow::base(&*flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if flow::base(&*flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
// This is now the only absolute flow in the subtree which hasn't yet
// reached its containing block.
abs_descendants.push(flow.clone());
@@ -1137,7 +1137,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
abs_descendants = AbsoluteDescendants::new();
- if flow::base(&*wrapper_flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if flow::base(&*wrapper_flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
// This is now the only absolute flow in the subtree which hasn't yet
// reached its containing block.
abs_descendants.push(wrapper_flow.clone());
@@ -1332,8 +1332,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
}
for kid in node.children() {
- if kid.flags().contains(HAS_NEWLY_CONSTRUCTED_FLOW) {
- kid.remove_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
+ if kid.flags().contains(LayoutDataFlags::HAS_NEWLY_CONSTRUCTED_FLOW) {
+ kid.remove_flags(LayoutDataFlags::HAS_NEWLY_CONSTRUCTED_FLOW);
need_to_reconstruct = true
}
}
@@ -1342,7 +1342,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
return false
}
- if node.restyle_damage().contains(RECONSTRUCT_FLOW) {
+ if node.restyle_damage().contains(ServoRestyleDamage::RECONSTRUCT_FLOW) {
return false
}
@@ -1436,7 +1436,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
}
};
if set_has_newly_constructed_flow_flag {
- node.insert_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
+ node.insert_flags(LayoutDataFlags::HAS_NEWLY_CONSTRUCTED_FLOW);
}
return result;
}
@@ -1452,7 +1452,7 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
// TODO: This should actually consult the table in that section to get the
// final computed value for 'display'.
fn process(&mut self, node: &ConcreteThreadSafeLayoutNode) {
- node.insert_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
+ node.insert_flags(LayoutDataFlags::HAS_NEWLY_CONSTRUCTED_FLOW);
// Bail out if this node has an ancestor with display: none.
if node.style(self.style_context()).is_in_display_none_subtree() {
@@ -1654,7 +1654,7 @@ impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
fn set_flow_construction_result(self, mut result: ConstructionResult) {
if self.can_be_fragmented() {
if let ConstructionResult::Flow(ref mut flow, _) = result {
- flow::mut_base(FlowRef::deref_mut(flow)).flags.insert(CAN_BE_FRAGMENTED);
+ flow::mut_base(FlowRef::deref_mut(flow)).flags.insert(FlowFlags::CAN_BE_FRAGMENTED);
}
}
@@ -1744,7 +1744,7 @@ impl FlowConstructionUtils for FlowRef {
fn finish(&mut self) {
if !opts::get().bubble_inline_sizes_separately {
FlowRef::deref_mut(self).bubble_inline_sizes();
- flow::mut_base(FlowRef::deref_mut(self)).restyle_damage.remove(BUBBLE_ISIZES);
+ flow::mut_base(FlowRef::deref_mut(self)).restyle_damage.remove(ServoRestyleDamage::BUBBLE_ISIZES);
}
}
}
@@ -1945,7 +1945,7 @@ impl Legalizer {
}
(FlowClass::Flex, FlowClass::Inline) => {
- flow::mut_base(FlowRef::deref_mut(child)).flags.insert(MARGINS_CANNOT_COLLAPSE);
+ flow::mut_base(FlowRef::deref_mut(child)).flags.insert(FlowFlags::MARGINS_CANNOT_COLLAPSE);
let mut block_wrapper =
Legalizer::create_anonymous_flow(context,
parent,
@@ -1954,12 +1954,12 @@ impl Legalizer {
BlockFlow::from_fragment);
{
let flag = if parent.as_flex().main_mode() == Direction::Inline {
- IS_INLINE_FLEX_ITEM
+ FragmentFlags::IS_INLINE_FLEX_ITEM
} else {
- IS_BLOCK_FLEX_ITEM
+ FragmentFlags::IS_BLOCK_FLEX_ITEM
};
let block = FlowRef::deref_mut(&mut block_wrapper).as_mut_block();
- block.base.flags.insert(MARGINS_CANNOT_COLLAPSE);
+ block.base.flags.insert(FlowFlags::MARGINS_CANNOT_COLLAPSE);
block.fragment.flags.insert(flag);
}
block_wrapper.add_new_child((*child).clone());
@@ -1971,12 +1971,12 @@ impl Legalizer {
(FlowClass::Flex, _) => {
{
let flag = if parent.as_flex().main_mode() == Direction::Inline {
- IS_INLINE_FLEX_ITEM
+ FragmentFlags::IS_INLINE_FLEX_ITEM
} else {
- IS_BLOCK_FLEX_ITEM
+ FragmentFlags::IS_BLOCK_FLEX_ITEM
};
let block = FlowRef::deref_mut(child).as_mut_block();
- block.base.flags.insert(MARGINS_CANNOT_COLLAPSE);
+ block.base.flags.insert(FlowFlags::MARGINS_CANNOT_COLLAPSE);
block.fragment.flags.insert(flag);
}
parent.add_new_child((*child).clone());
diff --git a/components/layout/data.rs b/components/layout/data.rs
index ef2195a9f31..20ff5ef2b71 100644
--- a/components/layout/data.rs
+++ b/components/layout/data.rs
@@ -60,10 +60,10 @@ impl LayoutData {
}
bitflags! {
- pub flags LayoutDataFlags: u8 {
+ pub struct LayoutDataFlags: u8 {
#[doc = "Whether a flow has been newly constructed."]
- const HAS_NEWLY_CONSTRUCTED_FLOW = 0x01,
+ const HAS_NEWLY_CONSTRUCTED_FLOW = 0x01;
#[doc = "Whether this node has been traversed by layout."]
- const HAS_BEEN_TRAVERSED = 0x02,
+ const HAS_BEEN_TRAVERSED = 0x02;
}
}
diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs
index de15a2f76d9..c8c2f043b0f 100644
--- a/components/layout/display_list_builder.rs
+++ b/components/layout/display_list_builder.rs
@@ -16,7 +16,7 @@ use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg};
use context::LayoutContext;
use euclid::{Point2D, Rect, SideOffsets2D, Size2D, Transform3D, TypedRect, TypedSize2D, Vector2D};
use flex::FlexFlow;
-use flow::{BaseFlow, Flow, IS_ABSOLUTELY_POSITIONED};
+use flow::{BaseFlow, Flow, FlowFlags};
use flow_ref::FlowRef;
use fnv::FnvHashMap;
use fragment::{CanvasFragmentSource, CoordinateSystem, Fragment, ImageFragmentInfo, ScannedTextFragmentInfo};
@@ -33,7 +33,7 @@ use gfx::display_list::{RadialGradientDisplayItem, SolidColorDisplayItem, Stacki
use gfx::display_list::{StackingContextType, StickyFrameData, TextDisplayItem, TextOrientation};
use gfx::display_list::WebRenderImageInfo;
use gfx_traits::{combine_id_with_fragment_type, FragmentType, StackingContextId};
-use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT};
+use inline::{InlineFragmentNodeFlags, InlineFlow};
use ipc_channel::ipc;
use list_item::ListItemFlow;
use model::{self, MaybeAuto};
@@ -55,7 +55,7 @@ use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalS
use style::properties::ComputedValues;
use style::properties::longhands::border_image_repeat::computed_value::RepeatKeyword;
use style::properties::style_structs;
-use style::servo::restyle_damage::REPAINT;
+use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::{Either, RGBA};
use style::values::computed::{Angle, Gradient, GradientItem, LengthOrPercentage, Percentage};
use style::values::computed::{LengthOrPercentageOrAuto, NumberOrPercentage, Position};
@@ -106,7 +106,8 @@ fn convert_repeat_mode(from: RepeatKeyword) -> RepeatMode {
fn establishes_containing_block_for_absolute(flags: StackingContextCollectionFlags,
positioning: position::T)
-> bool {
- !flags.contains(NEVER_CREATES_CONTAINING_BLOCK) && position::T::static_ != positioning
+ !flags.contains(StackingContextCollectionFlags::NEVER_CREATES_CONTAINING_BLOCK) &&
+ position::T::static_ != positioning
}
trait RgbColor {
@@ -1878,7 +1879,7 @@ impl FragmentDisplayListBuilding for Fragment {
border_painting_mode: BorderPaintingMode,
display_list_section: DisplayListSection,
clip: &Rect<Au>) {
- self.restyle_damage.remove(REPAINT);
+ self.restyle_damage.remove(ServoRestyleDamage::REPAINT);
if self.style().get_inheritedbox().visibility != visibility::T::visible {
return
}
@@ -1924,8 +1925,10 @@ impl FragmentDisplayListBuilding for Fragment {
state,
&*node.style,
Some(InlineNodeBorderInfo {
- is_first_fragment_of_element: node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT),
- is_last_fragment_of_element: node.flags.contains(LAST_FRAGMENT_OF_ELEMENT),
+ is_first_fragment_of_element:
+ node.flags.contains(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT),
+ is_last_fragment_of_element:
+ node.flags.contains(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT),
}),
border_painting_mode,
&stacking_relative_border_box,
@@ -2407,13 +2410,13 @@ impl FragmentDisplayListBuilding for Fragment {
}
bitflags! {
- pub flags StackingContextCollectionFlags: u8 {
+ pub struct StackingContextCollectionFlags: u8 {
/// This flow never establishes a containing block.
- const NEVER_CREATES_CONTAINING_BLOCK = 0b001,
+ const NEVER_CREATES_CONTAINING_BLOCK = 0b001;
/// This flow never creates a ClipScrollNode.
- const NEVER_CREATES_CLIP_SCROLL_NODE = 0b010,
+ const NEVER_CREATES_CLIP_SCROLL_NODE = 0b010;
/// This flow never creates a stacking context.
- const NEVER_CREATES_STACKING_CONTEXT = 0b100,
+ const NEVER_CREATES_STACKING_CONTEXT = 0b100;
}
}
@@ -2679,7 +2682,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
self.transform_clip_to_coordinate_space(state, preserved_state);
}
- if !flags.contains(NEVER_CREATES_CLIP_SCROLL_NODE) {
+ if !flags.contains(StackingContextCollectionFlags::NEVER_CREATES_CLIP_SCROLL_NODE) {
self.setup_clip_scroll_node_for_position(state, &stacking_relative_border_box);
self.setup_clip_scroll_node_for_overflow(state, &stacking_relative_border_box);
self.setup_clip_scroll_node_for_css_clip(state, preserved_state,
@@ -2689,7 +2692,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
// We keep track of our position so that any stickily positioned elements can
// properly determine the extent of their movement relative to scrolling containers.
- if !flags.contains(NEVER_CREATES_CONTAINING_BLOCK) {
+ if !flags.contains(StackingContextCollectionFlags::NEVER_CREATES_CONTAINING_BLOCK) {
let border_box = if self.fragment.establishes_stacking_context() {
stacking_relative_border_box
} else {
@@ -2887,7 +2890,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
parent_clipping_and_scrolling: ClippingAndScrolling,
state: &mut StackingContextCollectionState
) {
- let creation_mode = if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) ||
+ let creation_mode = if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) ||
self.fragment.style.get_box().position != position::T::static_ {
StackingContextType::PseudoPositioned
} else {
@@ -2946,7 +2949,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
border_painting_mode: BorderPaintingMode) {
let background_border_section = if self.base.flags.is_float() {
DisplayListSection::BackgroundAndBorders
- } else if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ } else if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
if self.fragment.establishes_stacking_context() {
DisplayListSection::BackgroundAndBorders
} else {
@@ -2982,7 +2985,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
&self,
flags: StackingContextCollectionFlags,
) -> BlockStackingContextType {
- if flags.contains(NEVER_CREATES_STACKING_CONTEXT) {
+ if flags.contains(StackingContextCollectionFlags::NEVER_CREATES_STACKING_CONTEXT) {
return BlockStackingContextType::NonstackingContext;
}
@@ -2990,7 +2993,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
return BlockStackingContextType::StackingContext
}
- if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
return BlockStackingContextType::PseudoStackingContext
}
diff --git a/components/layout/flex.rs b/components/layout/flex.rs
index 929b4cb1838..0e1d155f29b 100644
--- a/components/layout/flex.rs
+++ b/components/layout/flex.rs
@@ -14,8 +14,7 @@ use display_list_builder::StackingContextCollectionState;
use euclid::Point2D;
use floats::FloatKind;
use flow;
-use flow::{Flow, FlowClass, ImmutableFlowUtils, OpaqueFlow};
-use flow::{INLINE_POSITION_IS_STATIC, IS_ABSOLUTELY_POSITIONED};
+use flow::{Flow, FlowClass, ImmutableFlowUtils, OpaqueFlow, FlowFlags};
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use layout_debug;
use model::{AdjoiningMargins, CollapsibleMargins};
@@ -25,7 +24,7 @@ use std::ops::Range;
use style::computed_values::{align_content, align_self, flex_direction, flex_wrap, justify_content};
use style::logical_geometry::{Direction, LogicalSize};
use style::properties::ComputedValues;
-use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
+use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use style::values::computed::flex::FlexBasis;
use style::values::generics::flex::FlexBasis as GenericFlexBasis;
@@ -449,7 +448,7 @@ impl FlexFlow {
if !fixed_width {
for kid in self.block_flow.base.children.iter_mut() {
let base = flow::mut_base(kid);
- let is_absolutely_positioned = base.flags.contains(IS_ABSOLUTELY_POSITIONED);
+ let is_absolutely_positioned = base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED);
if !is_absolutely_positioned {
let flex_item_inline_sizes = IntrinsicISizes {
minimum_inline_size: base.intrinsic_inline_sizes.minimum_inline_size,
@@ -475,7 +474,7 @@ impl FlexFlow {
if !fixed_width {
for kid in self.block_flow.base.children.iter_mut() {
let base = flow::mut_base(kid);
- let is_absolutely_positioned = base.flags.contains(IS_ABSOLUTELY_POSITIONED);
+ let is_absolutely_positioned = base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED);
if !is_absolutely_positioned {
computation.content_intrinsic_sizes.minimum_inline_size =
max(computation.content_intrinsic_sizes.minimum_inline_size,
@@ -518,7 +517,7 @@ impl FlexFlow {
for kid in &mut self.items {
let kid_base = flow::mut_base(children.get(kid.index));
kid_base.block_container_explicit_block_size = container_block_size;
- if kid_base.flags.contains(INLINE_POSITION_IS_STATIC) {
+ if kid_base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) {
// The inline-start margin edge of the child flow is at our inline-start content
// edge, and its inline-size is our content inline-size.
kid_base.position.start.i =
@@ -855,7 +854,7 @@ impl Flow for FlexFlow {
.iter()
.enumerate()
.filter(|&(_, flow)| {
- !flow.as_block().base.flags.contains(IS_ABSOLUTELY_POSITIONED)
+ !flow.as_block().base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
})
.map(|(index, flow)| FlexItem::new(index, flow))
.collect();
@@ -873,7 +872,8 @@ impl Flow for FlexFlow {
let _scope = layout_debug_scope!("flex::assign_inline_sizes {:x}", self.block_flow.base.debug_id());
debug!("assign_inline_sizes");
- if !self.block_flow.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
+ if !self.block_flow.base.restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW |
+ ServoRestyleDamage::REFLOW) {
return
}
diff --git a/components/layout/floats.rs b/components/layout/floats.rs
index 4996a9e49e6..1203a2187ae 100644
--- a/components/layout/floats.rs
+++ b/components/layout/floats.rs
@@ -4,7 +4,7 @@
use app_units::{Au, MAX_AU};
use block::FormattingContextType;
-use flow::{self, CLEARS_LEFT, CLEARS_RIGHT, Flow, ImmutableFlowUtils};
+use flow::{self, Flow, FlowFlags, ImmutableFlowUtils};
use persistent_list::PersistentList;
use std::cmp::{max, min};
use std::fmt;
@@ -459,10 +459,10 @@ impl SpeculatedFloatPlacement {
/// flow, computes the speculated inline size of the floats flowing in.
pub fn compute_floats_in(&mut self, flow: &mut Flow) {
let base_flow = flow::base(flow);
- if base_flow.flags.contains(CLEARS_LEFT) {
+ if base_flow.flags.contains(FlowFlags::CLEARS_LEFT) {
self.left = Au(0)
}
- if base_flow.flags.contains(CLEARS_RIGHT) {
+ if base_flow.flags.contains(FlowFlags::CLEARS_RIGHT) {
self.right = Au(0)
}
}
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index 31eb4c2ebf6..9769f2070a4 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -54,7 +54,7 @@ use style::context::SharedStyleContext;
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
use style::properties::ComputedValues;
use style::selector_parser::RestyleDamage;
-use style::servo::restyle_damage::{RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT};
+use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::computed::LengthOrPercentageOrAuto;
use table::TableFlow;
use table_caption::TableCaptionFlow;
@@ -252,7 +252,7 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
if might_have_floats_in_or_out {
mut_base(self).thread_id = parent_thread_id;
self.assign_block_size(layout_context);
- mut_base(self).restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
+ mut_base(self).restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
}
might_have_floats_in_or_out
}
@@ -402,7 +402,7 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
fn contains_positioned_fragments(&self) -> bool {
self.contains_relatively_positioned_fragments() ||
- base(self).flags.contains(IS_ABSOLUTELY_POSITIONED)
+ base(self).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
}
fn contains_relatively_positioned_fragments(&self) -> bool {
@@ -591,52 +591,52 @@ impl FlowClass {
bitflags! {
#[doc = "Flags used in flows."]
- pub flags FlowFlags: u32 {
+ pub struct FlowFlags: u32 {
// text align flags
#[doc = "Whether this flow is absolutely positioned. This is checked all over layout, so a"]
#[doc = "virtual call is too expensive."]
- const IS_ABSOLUTELY_POSITIONED = 0b0000_0000_0000_0000_0100_0000,
+ const IS_ABSOLUTELY_POSITIONED = 0b0000_0000_0000_0000_0100_0000;
#[doc = "Whether this flow clears to the left. This is checked all over layout, so a"]
#[doc = "virtual call is too expensive."]
- const CLEARS_LEFT = 0b0000_0000_0000_0000_1000_0000,
+ const CLEARS_LEFT = 0b0000_0000_0000_0000_1000_0000;
#[doc = "Whether this flow clears to the right. This is checked all over layout, so a"]
#[doc = "virtual call is too expensive."]
- const CLEARS_RIGHT = 0b0000_0000_0000_0001_0000_0000,
+ const CLEARS_RIGHT = 0b0000_0000_0000_0001_0000_0000;
#[doc = "Whether this flow is left-floated. This is checked all over layout, so a"]
#[doc = "virtual call is too expensive."]
- const FLOATS_LEFT = 0b0000_0000_0000_0010_0000_0000,
+ const FLOATS_LEFT = 0b0000_0000_0000_0010_0000_0000;
#[doc = "Whether this flow is right-floated. This is checked all over layout, so a"]
#[doc = "virtual call is too expensive."]
- const FLOATS_RIGHT = 0b0000_0000_0000_0100_0000_0000,
+ const FLOATS_RIGHT = 0b0000_0000_0000_0100_0000_0000;
#[doc = "Text alignment. \
NB: If you update this, update `TEXT_ALIGN_SHIFT` below."]
- const TEXT_ALIGN = 0b0000_0000_0111_1000_0000_0000,
+ const TEXT_ALIGN = 0b0000_0000_0111_1000_0000_0000;
#[doc = "Whether this flow has a fragment with `counter-reset` or `counter-increment` \
styles."]
- const AFFECTS_COUNTERS = 0b0000_0000_1000_0000_0000_0000,
+ const AFFECTS_COUNTERS = 0b0000_0000_1000_0000_0000_0000;
#[doc = "Whether this flow's descendants have fragments that affect `counter-reset` or \
`counter-increment` styles."]
- const HAS_COUNTER_AFFECTING_CHILDREN = 0b0000_0001_0000_0000_0000_0000,
+ const HAS_COUNTER_AFFECTING_CHILDREN = 0b0000_0001_0000_0000_0000_0000;
#[doc = "Whether this flow behaves as though it had `position: static` for the purposes \
of positioning in the inline direction. This is set for flows with `position: \
static` and `position: relative` as well as absolutely-positioned flows with \
unconstrained positions in the inline direction."]
- const INLINE_POSITION_IS_STATIC = 0b0000_0010_0000_0000_0000_0000,
+ const INLINE_POSITION_IS_STATIC = 0b0000_0010_0000_0000_0000_0000;
#[doc = "Whether this flow behaves as though it had `position: static` for the purposes \
of positioning in the block direction. This is set for flows with `position: \
static` and `position: relative` as well as absolutely-positioned flows with \
unconstrained positions in the block direction."]
- const BLOCK_POSITION_IS_STATIC = 0b0000_0100_0000_0000_0000_0000,
+ const BLOCK_POSITION_IS_STATIC = 0b0000_0100_0000_0000_0000_0000;
/// Whether any ancestor is a fragmentation container
- const CAN_BE_FRAGMENTED = 0b0000_1000_0000_0000_0000_0000,
+ const CAN_BE_FRAGMENTED = 0b0000_1000_0000_0000_0000_0000;
/// Whether this flow contains any text and/or replaced fragments.
- const CONTAINS_TEXT_OR_REPLACED_FRAGMENTS = 0b0001_0000_0000_0000_0000_0000,
+ const CONTAINS_TEXT_OR_REPLACED_FRAGMENTS = 0b0001_0000_0000_0000_0000_0000;
/// Whether margins are prohibited from collapsing with this flow.
- const MARGINS_CANNOT_COLLAPSE = 0b0010_0000_0000_0000_0000_0000,
+ const MARGINS_CANNOT_COLLAPSE = 0b0010_0000_0000_0000_0000_0000;
}
}
@@ -648,20 +648,20 @@ static TEXT_ALIGN_SHIFT: usize = 11;
impl FlowFlags {
#[inline]
pub fn text_align(self) -> text_align::T {
- text_align::T::from_u32((self & TEXT_ALIGN).bits() >> TEXT_ALIGN_SHIFT).unwrap()
+ text_align::T::from_u32((self & FlowFlags::TEXT_ALIGN).bits() >> TEXT_ALIGN_SHIFT).unwrap()
}
#[inline]
pub fn set_text_align(&mut self, value: text_align::T) {
- *self = (*self & !TEXT_ALIGN) |
+ *self = (*self & !FlowFlags::TEXT_ALIGN) |
FlowFlags::from_bits(value.to_u32() << TEXT_ALIGN_SHIFT).unwrap();
}
#[inline]
pub fn float_kind(&self) -> float::T {
- if self.contains(FLOATS_LEFT) {
+ if self.contains(FlowFlags::FLOATS_LEFT) {
float::T::left
- } else if self.contains(FLOATS_RIGHT) {
+ } else if self.contains(FlowFlags::FLOATS_RIGHT) {
float::T::right
} else {
float::T::none
@@ -670,12 +670,12 @@ impl FlowFlags {
#[inline]
pub fn is_float(&self) -> bool {
- self.contains(FLOATS_LEFT) || self.contains(FLOATS_RIGHT)
+ self.contains(FlowFlags::FLOATS_LEFT) || self.contains(FlowFlags::FLOATS_RIGHT)
}
#[inline]
pub fn clears_floats(&self) -> bool {
- self.contains(CLEARS_LEFT) || self.contains(CLEARS_RIGHT)
+ self.contains(FlowFlags::CLEARS_LEFT) || self.contains(FlowFlags::CLEARS_RIGHT)
}
}
@@ -947,8 +947,8 @@ impl fmt::Debug for BaseFlow {
overflow={:?}{}{}{}",
self.stacking_context_id,
self.position,
- if self.flags.contains(FLOATS_LEFT) { "FL" } else { "" },
- if self.flags.contains(FLOATS_RIGHT) { "FR" } else { "" },
+ if self.flags.contains(FlowFlags::FLOATS_LEFT) { "FL" } else { "" },
+ if self.flags.contains(FlowFlags::FLOATS_RIGHT) { "FR" } else { "" },
self.speculated_float_placement_in,
self.speculated_float_placement_out,
self.overflow,
@@ -991,50 +991,50 @@ impl BaseFlow {
Some(style) => {
match style.get_box().position {
position::T::absolute | position::T::fixed => {
- flags.insert(IS_ABSOLUTELY_POSITIONED);
+ flags.insert(FlowFlags::IS_ABSOLUTELY_POSITIONED);
let logical_position = style.logical_position();
if logical_position.inline_start == LengthOrPercentageOrAuto::Auto &&
logical_position.inline_end == LengthOrPercentageOrAuto::Auto {
- flags.insert(INLINE_POSITION_IS_STATIC);
+ flags.insert(FlowFlags::INLINE_POSITION_IS_STATIC);
}
if logical_position.block_start == LengthOrPercentageOrAuto::Auto &&
logical_position.block_end == LengthOrPercentageOrAuto::Auto {
- flags.insert(BLOCK_POSITION_IS_STATIC);
+ flags.insert(FlowFlags::BLOCK_POSITION_IS_STATIC);
}
}
- _ => flags.insert(BLOCK_POSITION_IS_STATIC | INLINE_POSITION_IS_STATIC),
+ _ => flags.insert(FlowFlags::BLOCK_POSITION_IS_STATIC | FlowFlags::INLINE_POSITION_IS_STATIC),
}
if force_nonfloated == ForceNonfloatedFlag::FloatIfNecessary {
match style.get_box().float {
float::T::none => {}
- float::T::left => flags.insert(FLOATS_LEFT),
- float::T::right => flags.insert(FLOATS_RIGHT),
+ float::T::left => flags.insert(FlowFlags::FLOATS_LEFT),
+ float::T::right => flags.insert(FlowFlags::FLOATS_RIGHT),
}
}
match style.get_box().clear {
clear::T::none => {}
- clear::T::left => flags.insert(CLEARS_LEFT),
- clear::T::right => flags.insert(CLEARS_RIGHT),
+ clear::T::left => flags.insert(FlowFlags::CLEARS_LEFT),
+ clear::T::right => flags.insert(FlowFlags::CLEARS_RIGHT),
clear::T::both => {
- flags.insert(CLEARS_LEFT);
- flags.insert(CLEARS_RIGHT);
+ flags.insert(FlowFlags::CLEARS_LEFT);
+ flags.insert(FlowFlags::CLEARS_RIGHT);
}
}
if !style.get_counters().counter_reset.0.is_empty() ||
!style.get_counters().counter_increment.0.is_empty() {
- flags.insert(AFFECTS_COUNTERS)
+ flags.insert(FlowFlags::AFFECTS_COUNTERS)
}
}
- None => flags.insert(BLOCK_POSITION_IS_STATIC | INLINE_POSITION_IS_STATIC),
+ None => flags.insert(FlowFlags::BLOCK_POSITION_IS_STATIC | FlowFlags::INLINE_POSITION_IS_STATIC),
}
// New flows start out as fully damaged.
let mut damage = RestyleDamage::rebuild_and_reflow();
- damage.remove(RECONSTRUCT_FLOW);
+ damage.remove(ServoRestyleDamage::RECONSTRUCT_FLOW);
BaseFlow {
restyle_damage: damage,
@@ -1071,15 +1071,15 @@ impl BaseFlow {
pub fn update_flags_if_needed(&mut self, style: &ComputedValues) {
// For absolutely-positioned flows, changes to top/bottom/left/right can cause these flags
// to get out of date:
- if self.restyle_damage.contains(REFLOW_OUT_OF_FLOW) {
+ if self.restyle_damage.contains(ServoRestyleDamage::REFLOW_OUT_OF_FLOW) {
// Note: We don't need to check whether IS_ABSOLUTELY_POSITIONED has changed, because
// changes to the 'position' property trigger flow reconstruction.
- if self.flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if self.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
let logical_position = style.logical_position();
- self.flags.set(INLINE_POSITION_IS_STATIC,
+ self.flags.set(FlowFlags::INLINE_POSITION_IS_STATIC,
logical_position.inline_start == LengthOrPercentageOrAuto::Auto &&
logical_position.inline_end == LengthOrPercentageOrAuto::Auto);
- self.flags.set(BLOCK_POSITION_IS_STATIC,
+ self.flags.set(FlowFlags::BLOCK_POSITION_IS_STATIC,
logical_position.block_start == LengthOrPercentageOrAuto::Auto &&
logical_position.block_end == LengthOrPercentageOrAuto::Auto);
}
@@ -1090,7 +1090,8 @@ impl BaseFlow {
pub fn clone_with_children(&self, children: FlowList) -> BaseFlow {
BaseFlow {
children: children,
- restyle_damage: self.restyle_damage | REPAINT | REFLOW_OUT_OF_FLOW | REFLOW,
+ restyle_damage: self.restyle_damage | ServoRestyleDamage::REPAINT |
+ ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW,
parallel: FlowParallelInfo::new(),
floats: self.floats.clone(),
abs_descendants: self.abs_descendants.clone(),
@@ -1288,7 +1289,7 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
return Some(base(kid).position.start.b + baseline_offset)
}
}
- if kid.is_block_like() && !base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if kid.is_block_like() && !base(kid).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
if let Some(baseline_offset) = kid.baseline_offset_of_last_line_box_in_flow() {
return Some(base(kid).position.start.b + baseline_offset)
}
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index 654b79d67fe..e8455bff4b9 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -19,8 +19,8 @@ use gfx::display_list::{BLUR_INFLATION_FACTOR, OpaqueNode};
use gfx::text::glyph::ByteIndex;
use gfx::text::text_run::{TextRun, TextRunSlice};
use gfx_traits::StackingContextId;
-use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragmentContext, InlineFragmentNodeInfo};
-use inline::{InlineMetrics, LAST_FRAGMENT_OF_ELEMENT, LineMetrics};
+use inline::{InlineFragmentNodeFlags, InlineFragmentContext, InlineFragmentNodeInfo};
+use inline::{InlineMetrics, LineMetrics};
use ipc_channel::ipc::IpcSender;
#[cfg(debug_assertions)]
use layout_debug;
@@ -48,7 +48,7 @@ use style::logical_geometry::{Direction, LogicalMargin, LogicalRect, LogicalSize
use style::properties::ComputedValues;
use style::properties::longhands::transform::computed_value::T as TransformList;
use style::selector_parser::RestyleDamage;
-use style::servo::restyle_damage::RECONSTRUCT_FLOW;
+use style::servo::restyle_damage::ServoRestyleDamage;
use style::str::char_is_whitespace;
use style::values::{self, Either, Auto};
use style::values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAuto};
@@ -533,13 +533,13 @@ pub struct ScannedTextFragmentInfo {
}
bitflags! {
- pub flags ScannedTextFlags: u8 {
+ pub struct ScannedTextFlags: u8 {
/// Whether a line break is required after this fragment if wrapping on newlines (e.g. if
/// `white-space: pre` is in effect).
- const REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES = 0x01,
+ const REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES = 0x01;
/// Is this fragment selected?
- const SELECTED = 0x02,
+ const SELECTED = 0x02;
}
}
@@ -566,11 +566,11 @@ impl ScannedTextFragmentInfo {
}
pub fn requires_line_break_afterward_if_wrapping_on_newlines(&self) -> bool {
- self.flags.contains(REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES)
+ self.flags.contains(ScannedTextFlags::REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES)
}
pub fn selected(&self) -> bool {
- self.flags.contains(SELECTED)
+ self.flags.contains(ScannedTextFlags::SELECTED)
}
}
@@ -671,7 +671,7 @@ impl Fragment {
let writing_mode = style.writing_mode;
let mut restyle_damage = node.restyle_damage();
- restyle_damage.remove(RECONSTRUCT_FLOW);
+ restyle_damage.remove(ServoRestyleDamage::RECONSTRUCT_FLOW);
Fragment {
node: node.opaque(),
@@ -700,7 +700,7 @@ impl Fragment {
-> Fragment {
let writing_mode = style.writing_mode;
- restyle_damage.remove(RECONSTRUCT_FLOW);
+ restyle_damage.remove(ServoRestyleDamage::RECONSTRUCT_FLOW);
Fragment {
node: node,
@@ -753,7 +753,7 @@ impl Fragment {
size);
let mut restyle_damage = RestyleDamage::rebuild_and_reflow();
- restyle_damage.remove(RECONSTRUCT_FLOW);
+ restyle_damage.remove(ServoRestyleDamage::RECONSTRUCT_FLOW);
Fragment {
node: self.node,
@@ -818,7 +818,7 @@ impl Fragment {
});
debug_assert!(ellipsis_fragments.len() == 1);
ellipsis_fragment = ellipsis_fragments.fragments.into_iter().next().unwrap();
- ellipsis_fragment.flags |= IS_ELLIPSIS;
+ ellipsis_fragment.flags |= FragmentFlags::IS_ELLIPSIS;
ellipsis_fragment
}
@@ -858,35 +858,36 @@ impl Fragment {
QuantitiesIncludedInIntrinsicInlineSizes::all()
}
SpecificFragmentInfo::Table => {
- INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED |
- INTRINSIC_INLINE_SIZE_INCLUDES_PADDING |
- INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
+ QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED |
+ QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_PADDING |
+ QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
}
SpecificFragmentInfo::TableCell => {
- let base_quantities = INTRINSIC_INLINE_SIZE_INCLUDES_PADDING |
- INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
+ let base_quantities = QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_PADDING |
+ QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
if self.style.get_inheritedtable().border_collapse ==
border_collapse::T::separate {
- base_quantities | INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
+ base_quantities | QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
} else {
base_quantities
}
}
SpecificFragmentInfo::TableWrapper => {
- let base_quantities = INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS |
- INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
+ let base_quantities = QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS |
+ QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
if self.style.get_inheritedtable().border_collapse ==
border_collapse::T::separate {
- base_quantities | INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
+ base_quantities | QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
} else {
base_quantities
}
}
SpecificFragmentInfo::TableRow => {
- let base_quantities = INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
+ let base_quantities =
+ QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
if self.style.get_inheritedtable().border_collapse ==
border_collapse::T::separate {
- base_quantities | INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
+ base_quantities | QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
} else {
base_quantities
}
@@ -914,7 +915,8 @@ impl Fragment {
// FIXME(pcwalton): Percentages should be relative to any definite size per CSS-SIZING.
// This will likely need to be done by pushing down definite sizes during selector
// cascading.
- let margin = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS) {
+ let margin = if flags.contains(
+ QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS) {
let margin = style.logical_margin();
(MaybeAuto::from_style(margin.inline_start, Au(0)).specified_or_zero() +
MaybeAuto::from_style(margin.inline_end, Au(0)).specified_or_zero())
@@ -925,7 +927,8 @@ impl Fragment {
// FIXME(pcwalton): Percentages should be relative to any definite size per CSS-SIZING.
// This will likely need to be done by pushing down definite sizes during selector
// cascading.
- let padding = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_PADDING) {
+ let padding = if flags.contains(
+ QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_PADDING) {
let padding = style.logical_padding();
(padding.inline_start.to_used_value(Au(0)) +
padding.inline_end.to_used_value(Au(0)))
@@ -933,7 +936,8 @@ impl Fragment {
Au(0)
};
- let border = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_BORDER) {
+ let border = if flags.contains(
+ QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_BORDER) {
self.border_width().inline_start_end()
} else {
Au(0)
@@ -952,7 +956,7 @@ impl Fragment {
let (border_padding, margin) = self.surrounding_intrinsic_inline_size();
let mut specified = Au(0);
- if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED) {
+ if flags.contains(QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED) {
specified = MaybeAuto::from_style(style.content_inline_size(),
Au(0)).specified_or_zero();
specified = max(style.min_inline_size().to_used_value(Au(0)), specified);
@@ -1203,10 +1207,10 @@ impl Fragment {
inline_fragment_context.nodes.iter().fold(style_border_width, |accumulator, node| {
let mut this_border_width =
node.style.border_width_for_writing_mode(writing_mode);
- if !node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
+ if !node.flags.contains(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT) {
this_border_width.inline_start = Au(0)
}
- if !node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
+ if !node.flags.contains(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT) {
this_border_width.inline_end = Au(0)
}
accumulator + this_border_width
@@ -1260,13 +1264,15 @@ impl Fragment {
if let Some(ref inline_context) = self.inline_context {
for node in &inline_context.nodes {
let margin = node.style.logical_margin();
- let this_inline_start_margin = if !node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
+ let this_inline_start_margin = if !node.flags.contains(
+ InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT) {
Au(0)
} else {
MaybeAuto::from_style(margin.inline_start,
containing_block_inline_size).specified_or_zero()
};
- let this_inline_end_margin = if !node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
+ let this_inline_end_margin = if!node.flags.contains(
+ InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT) {
Au(0)
} else {
MaybeAuto::from_style(margin.inline_end,
@@ -1339,10 +1345,10 @@ impl Fragment {
let zero_padding = LogicalMargin::zero(writing_mode);
inline_fragment_context.nodes.iter().fold(zero_padding, |accumulator, node| {
let mut padding = model::padding_from_style(&*node.style, Au(0), writing_mode);
- if !node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
+ if !node.flags.contains(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT) {
padding.inline_start = Au(0)
}
- if !node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
+ if !node.flags.contains(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT) {
padding.inline_end = Au(0)
}
accumulator + padding
@@ -1584,12 +1590,12 @@ impl Fragment {
let mut border_width = node.style.logical_border_width();
let mut padding = model::padding_from_style(&*node.style, Au(0), writing_mode);
let mut margin = model::specified_margin_from_style(&*node.style, writing_mode);
- if !node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
+ if !node.flags.contains(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT) {
border_width.inline_start = Au(0);
padding.inline_start = Au(0);
margin.inline_start = Au(0);
}
- if !node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
+ if !node.flags.contains(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT) {
border_width.inline_end = Au(0);
padding.inline_end = Au(0);
margin.inline_end = Au(0);
@@ -1647,9 +1653,9 @@ impl Fragment {
let mut flags = SplitOptions::empty();
if starts_line {
- flags.insert(STARTS_LINE);
+ flags.insert(SplitOptions::STARTS_LINE);
if self.style().get_inheritedtext().overflow_wrap == overflow_wrap::T::break_word {
- flags.insert(RETRY_AT_CHARACTER_BOUNDARIES)
+ flags.insert(SplitOptions::RETRY_AT_CHARACTER_BOUNDARIES)
}
}
@@ -1667,7 +1673,7 @@ impl Fragment {
// Break at character boundaries.
let character_breaking_strategy =
text_fragment_info.run.character_slices_in_range(&text_fragment_info.range);
- flags.remove(RETRY_AT_CHARACTER_BOUNDARIES);
+ flags.remove(SplitOptions::RETRY_AT_CHARACTER_BOUNDARIES);
self.calculate_split_position_using_breaking_strategy(
character_breaking_strategy,
max_inline_size,
@@ -1830,12 +1836,12 @@ impl Fragment {
if split_is_empty || overflowing {
// If we've been instructed to retry at character boundaries (probably via
// `overflow-wrap: break-word`), do so.
- if flags.contains(RETRY_AT_CHARACTER_BOUNDARIES) {
+ if flags.contains(SplitOptions::RETRY_AT_CHARACTER_BOUNDARIES) {
let character_breaking_strategy =
text_fragment_info.run
.character_slices_in_range(&text_fragment_info.range);
let mut flags = flags;
- flags.remove(RETRY_AT_CHARACTER_BOUNDARIES);
+ flags.remove(SplitOptions::RETRY_AT_CHARACTER_BOUNDARIES);
return self.calculate_split_position_using_breaking_strategy(
character_breaking_strategy,
max_inline_size,
@@ -1844,7 +1850,7 @@ impl Fragment {
// We aren't at the start of the line, so don't overflow. Let inline layout wrap to
// the next line instead.
- if !flags.contains(STARTS_LINE) {
+ if !flags.contains(SplitOptions::STARTS_LINE) {
return None
}
}
@@ -1880,7 +1886,7 @@ impl Fragment {
this_info.range_end_including_stripped_whitespace =
other_info.range_end_including_stripped_whitespace;
if other_info.requires_line_break_afterward_if_wrapping_on_newlines() {
- this_info.flags.insert(REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES);
+ this_info.flags.insert(ScannedTextFlags::REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES);
}
if other_info.insertion_point.is_some() {
this_info.insertion_point = other_info.insertion_point;
@@ -2340,7 +2346,7 @@ impl Fragment {
// side, then we can't merge with the next fragment.
if let Some(ref inline_context) = self.inline_context {
for inline_context_node in inline_context.nodes.iter() {
- if !inline_context_node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
+ if !inline_context_node.flags.contains(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT) {
continue
}
if inline_context_node.style.logical_margin().inline_end !=
@@ -2361,7 +2367,7 @@ impl Fragment {
// preceding side, then it can't merge with us.
if let Some(ref inline_context) = other.inline_context {
for inline_context_node in inline_context.nodes.iter() {
- if !inline_context_node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
+ if !inline_context_node.flags.contains(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT) {
continue
}
if inline_context_node.style.logical_margin().inline_start !=
@@ -2807,14 +2813,15 @@ impl Fragment {
.zip(inline_context_of_next_fragment.nodes.iter().rev())
{
if !inline_context_node_from_next_fragment.flags.contains(
- LAST_FRAGMENT_OF_ELEMENT) {
+ InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT) {
continue
}
if inline_context_node_from_next_fragment.address !=
inline_context_node_from_this_fragment.address {
continue
}
- inline_context_node_from_this_fragment.flags.insert(LAST_FRAGMENT_OF_ELEMENT);
+ inline_context_node_from_this_fragment.flags.insert(
+ InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT);
}
}
}
@@ -2829,7 +2836,7 @@ impl Fragment {
inline_context_of_this_fragment.nodes.iter_mut().rev())
{
if !inline_context_node_from_prev_fragment.flags.contains(
- FIRST_FRAGMENT_OF_ELEMENT) {
+ InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT) {
continue
}
if inline_context_node_from_prev_fragment.address !=
@@ -2837,7 +2844,7 @@ impl Fragment {
continue
}
inline_context_node_from_this_fragment.flags.insert(
- FIRST_FRAGMENT_OF_ELEMENT);
+ InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT);
}
}
}
@@ -2975,23 +2982,23 @@ impl fmt::Debug for Fragment {
}
bitflags! {
- flags QuantitiesIncludedInIntrinsicInlineSizes: u8 {
- const INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS = 0x01,
- const INTRINSIC_INLINE_SIZE_INCLUDES_PADDING = 0x02,
- const INTRINSIC_INLINE_SIZE_INCLUDES_BORDER = 0x04,
- const INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED = 0x08,
+ struct QuantitiesIncludedInIntrinsicInlineSizes: u8 {
+ const INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS = 0x01;
+ const INTRINSIC_INLINE_SIZE_INCLUDES_PADDING = 0x02;
+ const INTRINSIC_INLINE_SIZE_INCLUDES_BORDER = 0x04;
+ const INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED = 0x08;
}
}
bitflags! {
// Various flags we can use when splitting fragments. See
// `calculate_split_position_using_breaking_strategy()`.
- flags SplitOptions: u8 {
+ struct SplitOptions: u8 {
#[doc = "True if this is the first fragment on the line."]
- const STARTS_LINE = 0x01,
+ const STARTS_LINE = 0x01;
#[doc = "True if we should attempt to split at character boundaries if this split fails. \
This is used to implement `overflow-wrap: break-word`."]
- const RETRY_AT_CHARACTER_BOUNDARIES = 0x02,
+ const RETRY_AT_CHARACTER_BOUNDARIES = 0x02;
}
}
@@ -3104,14 +3111,14 @@ impl Overflow {
}
bitflags! {
- pub flags FragmentFlags: u8 {
+ pub struct FragmentFlags: u8 {
// TODO(stshine): find a better name since these flags can also be used for grid item.
/// Whether this fragment represents a child in a row flex container.
- const IS_INLINE_FLEX_ITEM = 0b0000_0001,
+ const IS_INLINE_FLEX_ITEM = 0b0000_0001;
/// Whether this fragment represents a child in a column flex container.
- const IS_BLOCK_FLEX_ITEM = 0b0000_0010,
+ const IS_BLOCK_FLEX_ITEM = 0b0000_0010;
/// Whether this fragment represents the generated text from a text-overflow clip.
- const IS_ELLIPSIS = 0b0000_0100,
+ const IS_ELLIPSIS = 0b0000_0100;
}
}
diff --git a/components/layout/generated_content.rs b/components/layout/generated_content.rs
index e8e94cb25a7..153a250caf1 100644
--- a/components/layout/generated_content.rs
+++ b/components/layout/generated_content.rs
@@ -9,7 +9,7 @@
//! as possible.
use context::{LayoutContext, with_thread_local_font_context};
-use flow::{self, AFFECTS_COUNTERS, Flow, HAS_COUNTER_AFFECTING_CHILDREN, ImmutableFlowUtils};
+use flow::{self, Flow, FlowFlags, ImmutableFlowUtils};
use fragment::{Fragment, GeneratedContentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
use gfx::display_list::OpaqueNode;
use script_layout_interface::wrapper_traits::PseudoElementType;
@@ -19,7 +19,7 @@ use style::computed_values::{display, list_style_type};
use style::computed_values::content::ContentItem;
use style::properties::ComputedValues;
use style::selector_parser::RestyleDamage;
-use style::servo::restyle_damage::RESOLVE_GENERATED_CONTENT;
+use style::servo::restyle_damage::ServoRestyleDamage;
use text::TextRunScanner;
use traversal::InorderFlowTraversal;
@@ -131,8 +131,8 @@ impl<'a> InorderFlowTraversal for ResolveGeneratedContent<'a> {
#[inline]
fn should_process_subtree(&mut self, flow: &mut Flow) -> bool {
- flow::base(flow).restyle_damage.intersects(RESOLVE_GENERATED_CONTENT) ||
- flow::base(flow).flags.intersects(AFFECTS_COUNTERS | HAS_COUNTER_AFFECTING_CHILDREN)
+ flow::base(flow).restyle_damage.intersects(ServoRestyleDamage::RESOLVE_GENERATED_CONTENT) ||
+ flow::base(flow).flags.intersects(FlowFlags::AFFECTS_COUNTERS | FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN)
}
}
diff --git a/components/layout/incremental.rs b/components/layout/incremental.rs
index dd6b125938f..b3f8a58040b 100644
--- a/components/layout/incremental.rs
+++ b/components/layout/incremental.rs
@@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use flow::{self, AFFECTS_COUNTERS, Flow, HAS_COUNTER_AFFECTING_CHILDREN, IS_ABSOLUTELY_POSITIONED};
+use flow::{self, FlowFlags, Flow};
use style::computed_values::float;
use style::selector_parser::RestyleDamage;
-use style::servo::restyle_damage::{REFLOW, RECONSTRUCT_FLOW};
+use style::servo::restyle_damage::ServoRestyleDamage;
/// Used in a flow traversal to indicate whether this re-layout should be incremental or not.
#[derive(Clone, Copy, PartialEq)]
@@ -15,10 +15,10 @@ pub enum RelayoutMode {
}
bitflags! {
- pub flags SpecialRestyleDamage: u8 {
+ pub struct SpecialRestyleDamage: u8 {
#[doc = "If this flag is set, we need to reflow the entire document. This is more or less a \
temporary hack to deal with cases that we don't handle incrementally yet."]
- const REFLOW_ENTIRE_DOCUMENT = 0x01,
+ const REFLOW_ENTIRE_DOCUMENT = 0x01;
}
}
@@ -30,7 +30,7 @@ pub trait LayoutDamageComputation {
impl<'a> LayoutDamageComputation for &'a mut Flow {
fn compute_layout_damage(self) -> SpecialRestyleDamage {
let mut special_damage = SpecialRestyleDamage::empty();
- let is_absolutely_positioned = flow::base(self).flags.contains(IS_ABSOLUTELY_POSITIONED);
+ let is_absolutely_positioned = flow::base(self).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED);
// In addition to damage, we use this phase to compute whether nodes affect CSS counters.
let mut has_counter_affecting_children = false;
@@ -42,7 +42,7 @@ impl<'a> LayoutDamageComputation for &'a mut Flow {
for kid in self_base.children.iter_mut() {
let child_is_absolutely_positioned =
- flow::base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED);
+ flow::base(kid).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED);
flow::mut_base(kid).restyle_damage.insert(
parent_damage.damage_for_child(is_absolutely_positioned,
child_is_absolutely_positioned));
@@ -55,21 +55,21 @@ impl<'a> LayoutDamageComputation for &'a mut Flow {
child_is_absolutely_positioned));
has_counter_affecting_children = has_counter_affecting_children ||
- flow::base(kid).flags.intersects(AFFECTS_COUNTERS |
- HAS_COUNTER_AFFECTING_CHILDREN);
+ flow::base(kid).flags.intersects(FlowFlags::AFFECTS_COUNTERS |
+ FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN);
}
}
let self_base = flow::mut_base(self);
if self_base.flags.float_kind() != float::T::none &&
- self_base.restyle_damage.intersects(REFLOW) {
- special_damage.insert(REFLOW_ENTIRE_DOCUMENT);
+ self_base.restyle_damage.intersects(ServoRestyleDamage::REFLOW) {
+ special_damage.insert(SpecialRestyleDamage::REFLOW_ENTIRE_DOCUMENT);
}
if has_counter_affecting_children {
- self_base.flags.insert(HAS_COUNTER_AFFECTING_CHILDREN)
+ self_base.flags.insert(FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN)
} else {
- self_base.flags.remove(HAS_COUNTER_AFFECTING_CHILDREN)
+ self_base.flags.remove(FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN)
}
special_damage
@@ -78,7 +78,7 @@ impl<'a> LayoutDamageComputation for &'a mut Flow {
fn reflow_entire_document(self) {
let self_base = flow::mut_base(self);
self_base.restyle_damage.insert(RestyleDamage::rebuild_and_reflow());
- self_base.restyle_damage.remove(RECONSTRUCT_FLOW);
+ self_base.restyle_damage.remove(ServoRestyleDamage::RECONSTRUCT_FLOW);
for kid in self_base.children.iter_mut() {
kid.reflow_entire_document();
}
diff --git a/components/layout/inline.rs b/components/layout/inline.rs
index afe770f06bb..9beb1b2fb02 100644
--- a/components/layout/inline.rs
+++ b/components/layout/inline.rs
@@ -13,10 +13,10 @@ use display_list_builder::StackingContextCollectionState;
use euclid::{Point2D, Size2D};
use floats::{FloatKind, Floats, PlacementInfo};
use flow::{self, BaseFlow, Flow, FlowClass, ForceNonfloatedFlag};
-use flow::{CONTAINS_TEXT_OR_REPLACED_FRAGMENTS, EarlyAbsolutePositionInfo, OpaqueFlow};
+use flow::{FlowFlags, EarlyAbsolutePositionInfo, OpaqueFlow};
use flow_ref::FlowRef;
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
-use fragment::IS_ELLIPSIS;
+use fragment::FragmentFlags;
use fragment::SpecificFragmentInfo;
use gfx::display_list::OpaqueNode;
use gfx::font::FontMetrics;
@@ -34,7 +34,7 @@ use style::computed_values::{display, overflow_x, position, text_align, text_jus
use style::computed_values::{vertical_align, white_space};
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
use style::properties::ComputedValues;
-use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, RESOLVE_GENERATED_CONTENT};
+use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::generics::box_::VerticalAlign;
use style::values::specified::text::TextOverflowSide;
use text;
@@ -345,7 +345,7 @@ impl LineBreaker {
};
// Do not reflow truncated fragments. Reflow the original fragment only.
- let fragment = if fragment.flags.contains(IS_ELLIPSIS) {
+ let fragment = if fragment.flags.contains(FragmentFlags::IS_ELLIPSIS) {
continue
} else if let SpecificFragmentInfo::TruncatedFragment(info) = fragment.specific {
info.full
@@ -665,7 +665,7 @@ impl LineBreaker {
inline_start_fragment.border_padding.inline_end = Au(0);
if let Some(ref mut inline_context) = inline_start_fragment.inline_context {
for node in &mut inline_context.nodes {
- node.flags.remove(LAST_FRAGMENT_OF_ELEMENT);
+ node.flags.remove(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT);
}
}
inline_start_fragment.border_box.size.inline += inline_start_fragment.border_padding.inline_start;
@@ -673,7 +673,7 @@ impl LineBreaker {
inline_end_fragment.border_padding.inline_start = Au(0);
if let Some(ref mut inline_context) = inline_end_fragment.inline_context {
for node in &mut inline_context.nodes {
- node.flags.remove(FIRST_FRAGMENT_OF_ELEMENT);
+ node.flags.remove(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT);
}
}
inline_end_fragment.border_box.size.inline += inline_end_fragment.border_padding.inline_end;
@@ -897,7 +897,7 @@ impl InlineFlow {
};
if flow.fragments.fragments.iter().any(Fragment::is_unscanned_generated_content) {
- flow.base.restyle_damage.insert(RESOLVE_GENERATED_CONTENT);
+ flow.base.restyle_damage.insert(ServoRestyleDamage::RESOLVE_GENERATED_CONTENT);
}
flow
@@ -1313,7 +1313,7 @@ impl Flow for InlineFlow {
flow::mut_base(kid).floats = Floats::new(writing_mode);
}
- self.base.flags.remove(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
+ self.base.flags.remove(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
let mut intrinsic_sizes_for_flow = IntrinsicISizesContribution::new();
let mut intrinsic_sizes_for_inline_run = IntrinsicISizesContribution::new();
@@ -1372,10 +1372,10 @@ impl Flow for InlineFlow {
}
}
- fragment.restyle_damage.remove(BUBBLE_ISIZES);
+ fragment.restyle_damage.remove(ServoRestyleDamage::BUBBLE_ISIZES);
if fragment.is_text_or_replaced() {
- self.base.flags.insert(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
+ self.base.flags.insert(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
}
}
@@ -1535,9 +1535,9 @@ impl Flow for InlineFlow {
}
});
- self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
+ self.base.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
for fragment in &mut self.fragments.fragments {
- fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
+ fragment.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
}
}
@@ -1766,9 +1766,9 @@ pub struct InlineFragmentNodeInfo {
}
bitflags! {
- pub flags InlineFragmentNodeFlags: u8 {
- const FIRST_FRAGMENT_OF_ELEMENT = 0x01,
- const LAST_FRAGMENT_OF_ELEMENT = 0x02,
+ pub struct InlineFragmentNodeFlags: u8 {
+ const FIRST_FRAGMENT_OF_ELEMENT = 0x01;
+ const LAST_FRAGMENT_OF_ELEMENT = 0x02;
}
}
diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs
index 270d15b3771..1d5ca7884b3 100644
--- a/components/layout/list_item.rs
+++ b/components/layout/list_item.rs
@@ -22,7 +22,7 @@ use inline::InlineFlow;
use style::computed_values::{list_style_type, position};
use style::logical_geometry::LogicalSize;
use style::properties::ComputedValues;
-use style::servo::restyle_damage::RESOLVE_GENERATED_CONTENT;
+use style::servo::restyle_damage::ServoRestyleDamage;
#[allow(unsafe_code)]
unsafe impl ::flow::HasBaseFlow for ListItemFlow {}
@@ -56,7 +56,7 @@ impl ListItemFlow {
list_style_type::T::square |
list_style_type::T::disclosure_open |
list_style_type::T::disclosure_closed => {}
- _ => this.block_flow.base.restyle_damage.insert(RESOLVE_GENERATED_CONTENT),
+ _ => this.block_flow.base.restyle_damage.insert(ServoRestyleDamage::RESOLVE_GENERATED_CONTENT),
}
}
diff --git a/components/layout/query.rs b/components/layout/query.rs
index e6d2e250468..7fac8d3b5b1 100644
--- a/components/layout/query.rs
+++ b/components/layout/query.rs
@@ -11,7 +11,7 @@ use euclid::{Point2D, Vector2D, Rect, Size2D};
use flow::{self, Flow};
use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo};
use gfx::display_list::{DisplayList, OpaqueNode, ScrollOffsetMap};
-use inline::LAST_FRAGMENT_OF_ELEMENT;
+use inline::InlineFragmentNodeFlags;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::PipelineId;
use opaque_node::OpaqueNodeMethods;
@@ -562,7 +562,7 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
},
}
- if node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
+ if node.flags.contains(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT) {
self.has_processed_node = true;
}
} else if self.node_offset_box.is_none() {
diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs
index 86a7d90142f..57785fceee7 100644
--- a/components/layout/sequential.rs
+++ b/components/layout/sequential.rs
@@ -9,12 +9,12 @@ use context::LayoutContext;
use display_list_builder::{DisplayListBuildState, StackingContextCollectionState};
use euclid::{Point2D, Vector2D};
use floats::SpeculatedFloatPlacement;
-use flow::{self, Flow, ImmutableFlowUtils, IS_ABSOLUTELY_POSITIONED};
+use flow::{self, Flow, ImmutableFlowUtils, FlowFlags};
use fragment::{FragmentBorderBoxIterator, CoordinateSystem};
use generated_content::ResolveGeneratedContent;
use incremental::RelayoutMode;
use servo_config::opts;
-use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, STORE_OVERFLOW};
+use style::servo::restyle_damage::ServoRestyleDamage;
use traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList};
use traversal::{InorderFlowTraversal, PostorderFlowTraversal, PreorderFlowTraversal};
@@ -33,7 +33,7 @@ pub fn reflow(root: &mut Flow, layout_context: &LayoutContext, relayout_mode: Re
if relayout_mode == RelayoutMode::Force {
flow::mut_base(flow)
.restyle_damage
- .insert(REFLOW_OUT_OF_FLOW | REFLOW);
+ .insert(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
}
if assign_inline_sizes.should_process(flow) {
@@ -112,7 +112,7 @@ pub fn iterate_through_flow_tree_fragment_border_boxes(root: &mut Flow, iterator
}
pub fn store_overflow(layout_context: &LayoutContext, flow: &mut Flow) {
- if !flow::base(flow).restyle_damage.contains(STORE_OVERFLOW) {
+ if !flow::base(flow).restyle_damage.contains(ServoRestyleDamage::STORE_OVERFLOW) {
return;
}
@@ -124,20 +124,20 @@ pub fn store_overflow(layout_context: &LayoutContext, flow: &mut Flow) {
flow::mut_base(flow)
.restyle_damage
- .remove(STORE_OVERFLOW);
+ .remove(ServoRestyleDamage::STORE_OVERFLOW);
}
/// Guesses how much inline size will be taken up by floats on the left and right sides of the
/// given flow. This is needed to speculatively calculate the inline sizes of block formatting
/// contexts. The speculation typically succeeds, but if it doesn't we have to lay it out again.
pub fn guess_float_placement(flow: &mut Flow) {
- if !flow::base(flow).restyle_damage.intersects(REFLOW) {
+ if !flow::base(flow).restyle_damage.intersects(ServoRestyleDamage::REFLOW) {
return;
}
let mut floats_in = SpeculatedFloatPlacement::compute_floats_in_for_first_child(flow);
for kid in flow::mut_base(flow).child_iter_mut() {
- if flow::base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if flow::base(kid).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
// Do not propagate floats in or out, but do propogate between kids.
guess_float_placement(kid);
} else {
diff --git a/components/layout/table.rs b/components/layout/table.rs
index 37fb246935f..6e67c5536c6 100644
--- a/components/layout/table.rs
+++ b/components/layout/table.rs
@@ -11,8 +11,7 @@ use block::{BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer};
use block::{ISizeConstraintInput, ISizeConstraintSolution};
use context::LayoutContext;
use display_list_builder::{BlockFlowDisplayListBuilding, BorderPaintingMode};
-use display_list_builder::{DisplayListBuildState, NEVER_CREATES_STACKING_CONTEXT};
-use display_list_builder::StackingContextCollectionState;
+use display_list_builder::{DisplayListBuildState, StackingContextCollectionFlags, StackingContextCollectionState};
use euclid::Point2D;
use flow;
use flow::{BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUtils, OpaqueFlow};
@@ -27,7 +26,7 @@ use style::computed_values::{border_collapse, border_spacing, table_layout};
use style::context::SharedStyleContext;
use style::logical_geometry::LogicalSize;
use style::properties::ComputedValues;
-use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
+use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::CSSFloat;
use style::values::computed::LengthOrPercentageOrAuto;
use table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance};
@@ -505,7 +504,8 @@ impl Flow for TableFlow {
fn collect_stacking_contexts(&mut self, state: &mut StackingContextCollectionState) {
// Stacking contexts are collected by the table wrapper.
- self.block_flow.collect_stacking_contexts_for_block(state, NEVER_CREATES_STACKING_CONTEXT);
+ self.block_flow.collect_stacking_contexts_for_block(state,
+ StackingContextCollectionFlags::NEVER_CREATES_STACKING_CONTEXT);
}
fn repair_style(&mut self, new_style: &::ServoArc<ComputedValues>) {
@@ -735,7 +735,7 @@ impl TableLikeFlow for BlockFlow {
debug_assert!(self.fragment.style.get_inheritedtable().border_collapse ==
border_collapse::T::separate || block_direction_spacing == Au(0));
- if self.base.restyle_damage.contains(REFLOW) {
+ if self.base.restyle_damage.contains(ServoRestyleDamage::REFLOW) {
// Our current border-box position.
let block_start_border_padding = self.fragment.border_padding.block_start;
let mut current_block_offset = block_start_border_padding;
@@ -809,7 +809,7 @@ impl TableLikeFlow for BlockFlow {
}
}
- self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
+ self.base.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
}
}
diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs
index c6c438204cf..40d0c73d2a8 100644
--- a/components/layout/table_cell.rs
+++ b/components/layout/table_cell.rs
@@ -13,7 +13,7 @@ use display_list_builder::{BlockFlowDisplayListBuilding, BorderPaintingMode};
use display_list_builder::{DisplayListBuildState, StackingContextCollectionFlags};
use display_list_builder::StackingContextCollectionState;
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
-use flow::{self, Flow, FlowClass, IS_ABSOLUTELY_POSITIONED, OpaqueFlow};
+use flow::{self, Flow, FlowClass, FlowFlags, OpaqueFlow};
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use gfx_traits::print_tree::PrintTree;
use layout_debug;
@@ -102,7 +102,7 @@ impl TableCellFlow {
let mut extents = None;
for kid in flow::base(self).children.iter() {
let kid_base = flow::base(kid);
- if kid_base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if kid_base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
continue
}
let start = kid_base.position.start.b -
@@ -144,7 +144,7 @@ impl TableCellFlow {
for kid in flow::mut_base(self).children.iter_mut() {
let kid_base = flow::mut_base(kid);
- if !kid_base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ if !kid_base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
kid_base.position.start.b += offset
}
}
diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs
index 761a363881a..354535a94a0 100644
--- a/components/layout/table_row.rs
+++ b/components/layout/table_row.rs
@@ -26,7 +26,7 @@ use std::iter::{Enumerate, IntoIterator, Peekable};
use style::computed_values::{border_collapse, border_spacing, border_top_style};
use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode};
use style::properties::ComputedValues;
-use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
+use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::computed::{Color, LengthOrPercentageOrAuto};
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
use table_cell::{CollapsedBordersForCell, TableCellFlow};
@@ -114,7 +114,7 @@ impl TableRowFlow {
/// methods
#[inline(always)]
fn assign_block_size_table_row_base(&mut self, layout_context: &LayoutContext) {
- if self.block_flow.base.restyle_damage.contains(REFLOW) {
+ if self.block_flow.base.restyle_damage.contains(ServoRestyleDamage::REFLOW) {
// Per CSS 2.1 § 17.5.3, find max_y = max(computed `block-size`, minimum block-size of
// all cells).
let mut max_block_size = Au(0);
@@ -195,7 +195,7 @@ impl TableRowFlow {
}
}
- self.block_flow.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
+ self.block_flow.base.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
}
pub fn populate_collapsed_border_spacing<'a, I>(
diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs
index 0639f02dbf5..c70a99e16ac 100644
--- a/components/layout/table_rowgroup.rs
+++ b/components/layout/table_rowgroup.rs
@@ -10,7 +10,7 @@ use app_units::Au;
use block::{BlockFlow, ISizeAndMarginsComputer};
use context::LayoutContext;
use display_list_builder::{BlockFlowDisplayListBuilding, DisplayListBuildState};
-use display_list_builder::{NEVER_CREATES_CONTAINING_BLOCK, StackingContextCollectionState};
+use display_list_builder::{StackingContextCollectionFlags, StackingContextCollectionState};
use euclid::Point2D;
use flow::{Flow, FlowClass, OpaqueFlow};
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
@@ -184,7 +184,8 @@ impl Flow for TableRowGroupFlow {
}
fn collect_stacking_contexts(&mut self, state: &mut StackingContextCollectionState) {
- self.block_flow.collect_stacking_contexts_for_block(state, NEVER_CREATES_CONTAINING_BLOCK);
+ self.block_flow.collect_stacking_contexts_for_block(state,
+ StackingContextCollectionFlags::NEVER_CREATES_CONTAINING_BLOCK);
}
fn repair_style(&mut self, new_style: &::ServoArc<ComputedValues>) {
diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs
index 866916b9ad5..30e43eb23c3 100644
--- a/components/layout/table_wrapper.rs
+++ b/components/layout/table_wrapper.rs
@@ -17,12 +17,11 @@ use app_units::Au;
use block::{AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput};
use block::{ISizeConstraintSolution, MarginsMayCollapseFlag};
use context::LayoutContext;
-use display_list_builder::{BlockFlowDisplayListBuilding, DisplayListBuildState};
-use display_list_builder::{NEVER_CREATES_CLIP_SCROLL_NODE, NEVER_CREATES_CONTAINING_BLOCK};
+use display_list_builder::{BlockFlowDisplayListBuilding, DisplayListBuildState, StackingContextCollectionFlags};
use display_list_builder::StackingContextCollectionState;
use euclid::Point2D;
use floats::FloatKind;
-use flow::{Flow, FlowClass, ImmutableFlowUtils, INLINE_POSITION_IS_STATIC, OpaqueFlow};
+use flow::{Flow, FlowClass, ImmutableFlowUtils, FlowFlags, OpaqueFlow};
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use gfx_traits::print_tree::PrintTree;
use model::MaybeAuto;
@@ -256,7 +255,7 @@ impl TableWrapperFlow {
return
}
- if !self.block_flow.base.flags.contains(INLINE_POSITION_IS_STATIC) {
+ if !self.block_flow.base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) {
let inline_size_computer = AbsoluteTable {
minimum_width_of_all_columns: minimum_width_of_all_columns,
preferred_width_of_all_columns: preferred_width_of_all_columns,
@@ -464,7 +463,9 @@ impl Flow for TableWrapperFlow {
fn collect_stacking_contexts(&mut self, state: &mut StackingContextCollectionState) {
self.block_flow.collect_stacking_contexts_for_block(
- state, NEVER_CREATES_CONTAINING_BLOCK | NEVER_CREATES_CLIP_SCROLL_NODE);
+ state,
+ StackingContextCollectionFlags::NEVER_CREATES_CONTAINING_BLOCK |
+ StackingContextCollectionFlags::NEVER_CREATES_CLIP_SCROLL_NODE);
}
fn repair_style(&mut self, new_style: &::ServoArc<ComputedValues>) {
diff --git a/components/layout/text.rs b/components/layout/text.rs
index bdee1c52980..6da6d094998 100644
--- a/components/layout/text.rs
+++ b/components/layout/text.rs
@@ -7,15 +7,14 @@
#![deny(unsafe_code)]
use app_units::Au;
-use fragment::{Fragment, REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES, ScannedTextFlags};
-use fragment::{SELECTED, ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
-use gfx::font::{DISABLE_KERNING_SHAPING_FLAG, FontMetrics, IGNORE_LIGATURES_SHAPING_FLAG};
-use gfx::font::{KEEP_ALL_FLAG, RTL_FLAG, RunMetrics, ShapingFlags, ShapingOptions};
+use fragment::{Fragment, ScannedTextFlags};
+use fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
+use gfx::font::{FontMetrics, RunMetrics, ShapingFlags, ShapingOptions};
use gfx::font_context::FontContext;
use gfx::text::glyph::ByteIndex;
use gfx::text::text_run::TextRun;
use gfx::text::util::{self, CompressionMode};
-use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragments, LAST_FRAGMENT_OF_ELEMENT};
+use inline::{InlineFragmentNodeFlags, InlineFragments};
use linked_list::split_off_head;
use ordered_float::NotNaN;
use range::Range;
@@ -291,15 +290,15 @@ impl TextRunScanner {
let mut flags = ShapingFlags::empty();
if let Some(v) = letter_spacing.value() {
if v.px() != 0. {
- flags.insert(IGNORE_LIGATURES_SHAPING_FLAG);
+ flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG);
}
}
if text_rendering == text_rendering::T::optimizespeed {
- flags.insert(IGNORE_LIGATURES_SHAPING_FLAG);
- flags.insert(DISABLE_KERNING_SHAPING_FLAG)
+ flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG);
+ flags.insert(ShapingFlags::DISABLE_KERNING_SHAPING_FLAG)
}
if word_break == word_break::T::keep_all {
- flags.insert(KEEP_ALL_FLAG);
+ flags.insert(ShapingFlags::KEEP_ALL_FLAG);
}
let options = ShapingOptions {
letter_spacing: letter_spacing.value().cloned().map(Au::from),
@@ -313,7 +312,7 @@ impl TextRunScanner {
let mut options = options;
options.script = run_info.script;
if run_info.bidi_level.is_rtl() {
- options.flags.insert(RTL_FLAG);
+ options.flags.insert(ShapingFlags::RTL_FLAG);
}
let mut font = fontgroup.fonts.get(run_info.font_index).unwrap().borrow_mut();
ScannedTextRun {
@@ -364,11 +363,11 @@ impl TextRunScanner {
if requires_line_break_afterward_if_wrapping_on_newlines {
byte_range.extend_by(ByteIndex(-1)); // Trim the '\n'
- flags.insert(REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES);
+ flags.insert(ScannedTextFlags::REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES);
}
if mapping.selected {
- flags.insert(SELECTED);
+ flags.insert(ScannedTextFlags::SELECTED);
}
let insertion_point = if mapping.contains_insertion_point(scanned_run.insertion_point) {
@@ -402,10 +401,10 @@ impl TextRunScanner {
if let Some(ref mut context) = new_fragment.inline_context {
for node in &mut context.nodes {
if !is_last_mapping_of_this_old_fragment {
- node.flags.remove(LAST_FRAGMENT_OF_ELEMENT);
+ node.flags.remove(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT);
}
if !is_first_mapping_of_this_old_fragment {
- node.flags.remove(FIRST_FRAGMENT_OF_ELEMENT);
+ node.flags.remove(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT);
}
}
}
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs
index 2905157db3c..c6cc07ae7df 100644
--- a/components/layout/traversal.rs
+++ b/components/layout/traversal.rs
@@ -7,14 +7,14 @@
use construct::FlowConstructor;
use context::LayoutContext;
use display_list_builder::DisplayListBuildState;
-use flow::{self, CAN_BE_FRAGMENTED, Flow, ImmutableFlowUtils};
+use flow::{self, FlowFlags, Flow, ImmutableFlowUtils};
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
use servo_config::opts;
use style::context::{SharedStyleContext, StyleContext};
use style::data::ElementData;
use style::dom::{NodeInfo, TElement, TNode};
use style::selector_parser::RestyleDamage;
-use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION};
+use style::servo::restyle_damage::ServoRestyleDamage;
use style::traversal::{DomTraversal, recalc_style_at};
use style::traversal::PerLevelTraversalData;
use wrapper::{GetRawData, LayoutNodeLayoutData};
@@ -209,7 +209,7 @@ fn construct_flows_at<N>(context: &LayoutContext, node: N)
}
}
- tnode.mutate_layout_data().unwrap().flags.insert(::data::HAS_BEEN_TRAVERSED);
+ tnode.mutate_layout_data().unwrap().flags.insert(::data::LayoutDataFlags::HAS_BEEN_TRAVERSED);
}
if let Some(el) = node.as_element() {
@@ -227,12 +227,12 @@ impl<'a> PostorderFlowTraversal for BubbleISizes<'a> {
#[inline]
fn process(&self, flow: &mut Flow) {
flow.bubble_inline_sizes();
- flow::mut_base(flow).restyle_damage.remove(BUBBLE_ISIZES);
+ flow::mut_base(flow).restyle_damage.remove(ServoRestyleDamage::BUBBLE_ISIZES);
}
#[inline]
fn should_process(&self, flow: &mut Flow) -> bool {
- flow::base(flow).restyle_damage.contains(BUBBLE_ISIZES)
+ flow::base(flow).restyle_damage.contains(ServoRestyleDamage::BUBBLE_ISIZES)
}
}
@@ -250,7 +250,7 @@ impl<'a> PreorderFlowTraversal for AssignISizes<'a> {
#[inline]
fn should_process(&self, flow: &mut Flow) -> bool {
- flow::base(flow).restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW)
+ flow::base(flow).restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW)
}
}
@@ -280,9 +280,9 @@ impl<'a> PostorderFlowTraversal for AssignBSizes<'a> {
#[inline]
fn should_process(&self, flow: &mut Flow) -> bool {
let base = flow::base(flow);
- base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) &&
+ base.restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW) &&
// The fragmentation countainer is responsible for calling Flow::fragment recursively
- !base.flags.contains(CAN_BE_FRAGMENTED)
+ !base.flags.contains(FlowFlags::CAN_BE_FRAGMENTED)
}
}
@@ -293,13 +293,13 @@ pub struct ComputeStackingRelativePositions<'a> {
impl<'a> PreorderFlowTraversal for ComputeStackingRelativePositions<'a> {
#[inline]
fn should_process_subtree(&self, flow: &mut Flow) -> bool {
- flow::base(flow).restyle_damage.contains(REPOSITION)
+ flow::base(flow).restyle_damage.contains(ServoRestyleDamage::REPOSITION)
}
#[inline]
fn process(&self, flow: &mut Flow) {
flow.compute_stacking_relative_position(self.layout_context);
- flow::mut_base(flow).restyle_damage.remove(REPOSITION)
+ flow::mut_base(flow).restyle_damage.remove(ServoRestyleDamage::REPOSITION)
}
}
@@ -317,7 +317,7 @@ impl<'a> BuildDisplayList<'a> {
self.state.current_clipping_and_scrolling = flow.clipping_and_scrolling();
flow.build_display_list(&mut self.state);
- flow::mut_base(flow).restyle_damage.remove(REPAINT);
+ flow::mut_base(flow).restyle_damage.remove(ServoRestyleDamage::REPAINT);
for kid in flow::child_iter_mut(flow) {
self.traverse(kid);
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs
index 27c9475a8b2..de1eafe26fc 100644
--- a/components/layout/wrapper.rs
+++ b/components/layout/wrapper.rs
@@ -140,7 +140,7 @@ impl<T: ThreadSafeLayoutNode> ThreadSafeLayoutNodeHelpers for T {
let damage = {
let data = node.get_raw_data().unwrap();
- if !data.layout_data.borrow().flags.contains(::data::HAS_BEEN_TRAVERSED) {
+ if !data.layout_data.borrow().flags.contains(::data::LayoutDataFlags::HAS_BEEN_TRAVERSED) {
// We're reflowing a node that was styled for the first time and
// has never been visited by layout. Return rebuild_and_reflow,
// because that's what the code expects.