mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Bug 1298588 part 8. Pass a SharedStyleContext, not a Stylist, to Legalizer methods. r=bholley
This commit is contained in:
parent
d3e34db508
commit
09c74190b9
1 changed files with 19 additions and 20 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue