aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/construct.rs
diff options
context:
space:
mode:
authorBoris Zbarsky <bzbarsky@mit.edu>2017-01-04 13:46:41 -0500
committerBoris Zbarsky <bzbarsky@mit.edu>2017-01-04 23:13:45 -0500
commit09c74190b99ccd20091aaa1c64ef9b199b7e6ecb (patch)
treec179c514ed201457dcbcd8f9f52e8429e00eec87 /components/layout/construct.rs
parentd3e34db50895116ef1f77a32b9dde81dc6a90ee6 (diff)
downloadservo-09c74190b99ccd20091aaa1c64ef9b199b7e6ecb.tar.gz
servo-09c74190b99ccd20091aaa1c64ef9b199b7e6ecb.zip
Bug 1298588 part 8. Pass a SharedStyleContext, not a Stylist, to Legalizer methods. r=bholley
Diffstat (limited to 'components/layout/construct.rs')
-rw-r--r--components/layout/construct.rs39
1 files changed, 19 insertions, 20 deletions
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index 660d4f64834..1d9c1212ad6 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -54,7 +54,6 @@ use style::logical_geometry::Direction;
use style::properties::{self, ServoComputedValues};
use style::selector_parser::{PseudoElement, RestyleDamage};
use style::servo::restyle_damage::{BUBBLE_ISIZES, RECONSTRUCT_FLOW};
-use style::stylist::Stylist;
use style::values::Either;
use table::TableFlow;
use table_caption::TableCaptionFlow;
@@ -470,7 +469,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
}
inline_flow_ref.finish();
- legalizer.add_child(&self.style_context().stylist, flow, inline_flow_ref)
+ legalizer.add_child(self.style_context(), flow, inline_flow_ref)
}
fn build_block_flow_using_construction_result_of_child(
@@ -503,7 +502,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
legalizer,
node);
}
- legalizer.add_child(&self.style_context().stylist, flow, kid_flow)
+ legalizer.add_child(self.style_context(), flow, kid_flow)
}
abs_descendants.push_descendants(kid_abs_descendants);
}
@@ -537,7 +536,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
node);
// Push the flow generated by the {ib} split onto our list of flows.
- legalizer.add_child(&self.style_context().stylist, flow, kid_flow)
+ legalizer.add_child(self.style_context(), flow, kid_flow)
}
// Add the fragments to the list we're maintaining.
@@ -1123,7 +1122,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
caption_side::T::top);
if let ConstructionResult::Flow(table_flow, table_abs_descendants) = construction_result {
- legalizer.add_child(&self.style_context().stylist, &mut wrapper_flow, table_flow);
+ legalizer.add_child(self.style_context(), &mut wrapper_flow, table_flow);
abs_descendants.push_descendants(table_abs_descendants);
}
@@ -1889,16 +1888,16 @@ impl Legalizer {
/// Makes the `child` flow a new child of `parent`. Anonymous flows are automatically inserted
/// to keep the tree legal.
- fn add_child(&mut self, stylist: &Stylist, parent: &mut FlowRef, mut child: FlowRef) {
+ fn add_child(&mut self, context: &SharedStyleContext, parent: &mut FlowRef, mut child: FlowRef) {
while !self.stack.is_empty() {
- if self.try_to_add_child(stylist, parent, &mut child) {
+ if self.try_to_add_child(context, parent, &mut child) {
return
}
self.flush_top_of_stack(parent)
}
- while !self.try_to_add_child(stylist, parent, &mut child) {
- self.push_next_anonymous_flow(stylist, parent)
+ while !self.try_to_add_child(context, parent, &mut child) {
+ self.push_next_anonymous_flow(context, parent)
}
}
@@ -1915,7 +1914,7 @@ impl Legalizer {
/// This method attempts to create anonymous blocks in between `parent` and `child` if and only
/// if those blocks will only ever have `child` as their sole child. At present, this is only
/// true for anonymous block children of flex flows.
- fn try_to_add_child(&mut self, stylist: &Stylist, parent: &mut FlowRef, child: &mut FlowRef)
+ fn try_to_add_child(&mut self, context: &SharedStyleContext, parent: &mut FlowRef, child: &mut FlowRef)
-> bool {
let mut parent = self.stack.last_mut().unwrap_or(parent);
let (parent_class, child_class) = (parent.class(), child.class());
@@ -1947,7 +1946,7 @@ impl Legalizer {
(FlowClass::Flex, FlowClass::Inline) => {
flow::mut_base(FlowRef::deref_mut(child)).flags.insert(MARGINS_CANNOT_COLLAPSE);
let mut block_wrapper =
- Legalizer::create_anonymous_flow(stylist,
+ Legalizer::create_anonymous_flow(context,
parent,
&[PseudoElement::ServoAnonymousBlock],
SpecificFragmentInfo::Generic,
@@ -1999,32 +1998,32 @@ impl Legalizer {
/// Adds the anonymous flow that would be necessary to make an illegal child of `parent` legal
/// to the stack.
- fn push_next_anonymous_flow(&mut self, stylist: &Stylist, parent: &FlowRef) {
+ fn push_next_anonymous_flow(&mut self, context: &SharedStyleContext, parent: &FlowRef) {
let parent_class = self.stack.last().unwrap_or(parent).class();
match parent_class {
FlowClass::TableRow => {
- self.push_new_anonymous_flow(stylist,
+ self.push_new_anonymous_flow(context,
parent,
&[PseudoElement::ServoAnonymousTableCell],
SpecificFragmentInfo::TableCell,
TableCellFlow::from_fragment)
}
FlowClass::Table | FlowClass::TableRowGroup => {
- self.push_new_anonymous_flow(stylist,
+ self.push_new_anonymous_flow(context,
parent,
&[PseudoElement::ServoAnonymousTableRow],
SpecificFragmentInfo::TableRow,
TableRowFlow::from_fragment)
}
FlowClass::TableWrapper => {
- self.push_new_anonymous_flow(stylist,
+ self.push_new_anonymous_flow(context,
parent,
&[PseudoElement::ServoAnonymousTable],
SpecificFragmentInfo::Table,
TableFlow::from_fragment)
}
_ => {
- self.push_new_anonymous_flow(stylist,
+ self.push_new_anonymous_flow(context,
parent,
&[PseudoElement::ServoTableWrapper,
PseudoElement::ServoAnonymousTableWrapper],
@@ -2036,13 +2035,13 @@ impl Legalizer {
/// Creates an anonymous flow and pushes it onto the stack.
fn push_new_anonymous_flow<F>(&mut self,
- stylist: &Stylist,
+ context: &SharedStyleContext,
reference: &FlowRef,
pseudos: &[PseudoElement],
specific_fragment_info: SpecificFragmentInfo,
constructor: extern "Rust" fn(Fragment) -> F)
where F: Flow {
- let new_flow = Legalizer::create_anonymous_flow(stylist,
+ let new_flow = Legalizer::create_anonymous_flow(context,
reference,
pseudos,
specific_fragment_info,
@@ -2055,7 +2054,7 @@ impl Legalizer {
///
/// This method invokes the supplied constructor function on the given specific fragment info
/// in order to actually generate the flow.
- fn create_anonymous_flow<F>(stylist: &Stylist,
+ fn create_anonymous_flow<F>(context: &SharedStyleContext,
reference: &FlowRef,
pseudos: &[PseudoElement],
specific_fragment_info: SpecificFragmentInfo,
@@ -2065,7 +2064,7 @@ impl Legalizer {
let reference_block = reference.as_block();
let mut new_style = reference_block.fragment.style.clone();
for pseudo in pseudos {
- new_style = stylist.style_for_anonymous_box(pseudo, &new_style)
+ new_style = context.stylist.style_for_anonymous_box(pseudo, &new_style)
}
let fragment = reference_block.fragment
.create_similar_anonymous_fragment(new_style,