Store an OpaqueNode in boxes and fragments

This commit is contained in:
Anthony Ramine 2019-12-13 01:46:46 +01:00
parent 47944a39fc
commit abc2c15c28
8 changed files with 67 additions and 25 deletions

View file

@ -13,12 +13,14 @@ use crate::style_ext::DisplayInside;
use crate::ContainingBlock;
use servo_arc::Arc;
use std::convert::TryInto;
use style::dom::OpaqueNode;
use style::properties::ComputedValues;
use style::values::computed::Length;
/// https://drafts.csswg.org/css-display/#independent-formatting-context
#[derive(Debug)]
pub(crate) struct IndependentFormattingContext {
pub tag: OpaqueNode,
pub style: Arc<ComputedValues>,
/// If it was requested during construction
@ -71,6 +73,7 @@ impl IndependentFormattingContext {
content_sizes,
);
Self {
tag: node.as_opaque(),
style,
content_sizes,
contents: IndependentFormattingContextContents::Flow(bfc),
@ -80,6 +83,7 @@ impl IndependentFormattingContext {
Err(replaced) => {
let content_sizes = content_sizes.compute(|| replaced.inline_content_sizes(&style));
Self {
tag: node.as_opaque(),
style,
content_sizes,
contents: IndependentFormattingContextContents::Replaced(replaced),