Handle anonymous style in end_inline_formatting_context

This commit is contained in:
Anthony Ramine 2019-09-20 17:00:12 +02:00
parent 9cef3eee65
commit 0c156c60c2
2 changed files with 20 additions and 16 deletions

View file

@ -274,7 +274,7 @@ impl Drop for BoxSlot<'_> {
} }
} }
pub(crate) trait NodeExt<'dom>: 'dom + Copy + Send + Sync { pub(crate) trait NodeExt<'dom>: 'dom + Copy + LayoutNode + Send + Sync {
fn is_element(self) -> bool; fn is_element(self) -> bool;
fn as_text(self) -> Option<String>; fn as_text(self) -> Option<String>;
fn first_child(self) -> Option<Self>; fn first_child(self) -> Option<Self>;
@ -291,7 +291,7 @@ pub(crate) trait NodeExt<'dom>: 'dom + Copy + Send + Sync {
impl<'dom, T> NodeExt<'dom> for T impl<'dom, T> NodeExt<'dom> for T
where where
T: 'dom + LayoutNode + Send + Sync, T: 'dom + Copy + LayoutNode + Send + Sync,
{ {
fn is_element(self) -> bool { fn is_element(self) -> bool {
self.to_threadsafe().as_element().is_some() self.to_threadsafe().as_element().is_some()

View file

@ -16,6 +16,7 @@ use servo_arc::Arc;
use std::convert::TryInto; use std::convert::TryInto;
use style::context::SharedStyleContext; use style::context::SharedStyleContext;
use style::properties::ComputedValues; use style::properties::ComputedValues;
use style::selector_parser::PseudoElement;
impl BlockFormattingContext { impl BlockFormattingContext {
pub fn construct<'dom>( pub fn construct<'dom>(
@ -511,22 +512,25 @@ where
return; return;
} }
let context = self.context;
let block_container_style = self.block_container_style; let block_container_style = self.block_container_style;
// FIXME let anonymous_style = self.anonymous_style.get_or_insert_with(|| {
// let anonymous_style = self.anonymous_style.get_or_insert_with(|| { context
// // If parent_style is None, the parent is the document node, .stylist
// // in which case anonymous inline boxes should inherit their .style_for_anonymous::<Node::ConcreteElement>(
// // styles from initial values. &context.guards,
// ComputedValues::anonymous_inheriting_from(Some(block_container_style)) &PseudoElement::ServoText,
// }); &block_container_style,
)
});
// let box_ = IntermediateBlockLevelBox::SameFormattingContextBlock { let box_ = IntermediateBlockLevelBox::SameFormattingContextBlock {
// style: anonymous_style.clone(), style: anonymous_style.clone(),
// contents: IntermediateBlockContainer::InlineFormattingContext(take( contents: IntermediateBlockContainer::InlineFormattingContext(take(
// &mut self.ongoing_inline_formatting_context, &mut self.ongoing_inline_formatting_context,
// )), )),
// }; };
// self.block_level_boxes.push((box_, BoxSlot::dummy())) self.block_level_boxes.push((box_, BoxSlot::dummy()))
} }
fn current_inline_level_boxes(&mut self) -> &mut Vec<Arc<InlineLevelBox>> { fn current_inline_level_boxes(&mut self) -> &mut Vec<Arc<InlineLevelBox>> {