diff options
author | Anthony Ramine <nox@nox.paris> | 2019-09-20 17:00:12 +0200 |
---|---|---|
committer | Anthony Ramine <nox@nox.paris> | 2019-09-23 20:31:43 +0200 |
commit | 0c156c60c279a893fb08c72433ba98a26650607d (patch) | |
tree | d38afee9f5b5bac650247eaf70ab988d9eeee1f0 /components/layout_2020/flow/construct.rs | |
parent | 9cef3eee65cf93ff591d3638a8a402a44fba0970 (diff) | |
download | servo-0c156c60c279a893fb08c72433ba98a26650607d.tar.gz servo-0c156c60c279a893fb08c72433ba98a26650607d.zip |
Handle anonymous style in end_inline_formatting_context
Diffstat (limited to 'components/layout_2020/flow/construct.rs')
-rw-r--r-- | components/layout_2020/flow/construct.rs | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/components/layout_2020/flow/construct.rs b/components/layout_2020/flow/construct.rs index 23cc84a5f8b..6b2027a8794 100644 --- a/components/layout_2020/flow/construct.rs +++ b/components/layout_2020/flow/construct.rs @@ -16,6 +16,7 @@ use servo_arc::Arc; use std::convert::TryInto; use style::context::SharedStyleContext; use style::properties::ComputedValues; +use style::selector_parser::PseudoElement; impl BlockFormattingContext { pub fn construct<'dom>( @@ -511,22 +512,25 @@ where return; } + let context = self.context; let block_container_style = self.block_container_style; - // FIXME - // let anonymous_style = self.anonymous_style.get_or_insert_with(|| { - // // If parent_style is None, the parent is the document node, - // // in which case anonymous inline boxes should inherit their - // // styles from initial values. - // ComputedValues::anonymous_inheriting_from(Some(block_container_style)) - // }); - - // let box_ = IntermediateBlockLevelBox::SameFormattingContextBlock { - // style: anonymous_style.clone(), - // contents: IntermediateBlockContainer::InlineFormattingContext(take( - // &mut self.ongoing_inline_formatting_context, - // )), - // }; - // self.block_level_boxes.push((box_, BoxSlot::dummy())) + let anonymous_style = self.anonymous_style.get_or_insert_with(|| { + context + .stylist + .style_for_anonymous::<Node::ConcreteElement>( + &context.guards, + &PseudoElement::ServoText, + &block_container_style, + ) + }); + + let box_ = IntermediateBlockLevelBox::SameFormattingContextBlock { + style: anonymous_style.clone(), + contents: IntermediateBlockContainer::InlineFormattingContext(take( + &mut self.ongoing_inline_formatting_context, + )), + }; + self.block_level_boxes.push((box_, BoxSlot::dummy())) } fn current_inline_level_boxes(&mut self) -> &mut Vec<Arc<InlineLevelBox>> { |