From e840c7aaa09627979c2cec69277a04f884489e6b Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 15 Apr 2016 17:25:24 -0700 Subject: [PATCH] layout: Make absolutely-positioned blocks not generate {ib} splits. Improves YouTube. Closes #10642. --- components/layout/construct.rs | 27 ++++++++++--------- tests/wpt/mozilla/meta/MANIFEST.json | 24 +++++++++++++++++ .../tests/css/absolute_ib_split_a.html | 5 ++++ .../tests/css/absolute_ib_split_ref.html | 4 +++ 4 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 tests/wpt/mozilla/tests/css/absolute_ib_split_a.html create mode 100644 tests/wpt/mozilla/tests/css/absolute_ib_split_ref.html diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 8ba85710ae3..4099e1f9af5 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -512,19 +512,20 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode> } else if flow.need_anonymous_flow(&*kid_flow) { consecutive_siblings.push(kid_flow) } else { - // Flush any inline fragments that we were gathering up. This allows us to - // handle {ib} splits. - debug!("flushing {} inline box(es) to flow A", - inline_fragment_accumulator.fragments.fragments.len()); - let old_inline_fragment_accumulator = - mem::replace(inline_fragment_accumulator, - InlineFragmentsAccumulator::new()); - self.flush_inline_fragments_to_flow_or_list( - old_inline_fragment_accumulator, - flow, - consecutive_siblings, - abs_descendants, - node); + if !flow::base(&*kid_flow).flags.contains(IS_ABSOLUTELY_POSITIONED) { + // Flush any inline fragments that we were gathering up. This allows us to + // handle {ib} splits. + let old_inline_fragment_accumulator = + mem::replace(inline_fragment_accumulator, + InlineFragmentsAccumulator::new()); + self.flush_inline_fragments_to_flow_or_list( + old_inline_fragment_accumulator, + flow, + consecutive_siblings, + abs_descendants, + node); + } + if !consecutive_siblings.is_empty() { let consecutive_siblings = mem::replace(consecutive_siblings, vec!()); self.generate_anonymous_missing_child(consecutive_siblings, flow, node); diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 121842c43ff..010e2d1e8b3 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -94,6 +94,18 @@ "url": "/_mozilla/css/absolute_hypothetical_with_intervening_inline_block_a.html" } ], + "css/absolute_ib_split_a.html": [ + { + "path": "css/absolute_ib_split_a.html", + "references": [ + [ + "/_mozilla/css/absolute_ib_split_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/absolute_ib_split_a.html" + } + ], "css/absolute_inline_containing_block_a.html": [ { "path": "css/absolute_inline_containing_block_a.html", @@ -6720,6 +6732,18 @@ "url": "/_mozilla/css/absolute_hypothetical_with_intervening_inline_block_a.html" } ], + "css/absolute_ib_split_a.html": [ + { + "path": "css/absolute_ib_split_a.html", + "references": [ + [ + "/_mozilla/css/absolute_ib_split_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/absolute_ib_split_a.html" + } + ], "css/absolute_inline_containing_block_a.html": [ { "path": "css/absolute_inline_containing_block_a.html", diff --git a/tests/wpt/mozilla/tests/css/absolute_ib_split_a.html b/tests/wpt/mozilla/tests/css/absolute_ib_split_a.html new file mode 100644 index 00000000000..43b8fb09e9e --- /dev/null +++ b/tests/wpt/mozilla/tests/css/absolute_ib_split_a.html @@ -0,0 +1,5 @@ + + + +Ser
vo + diff --git a/tests/wpt/mozilla/tests/css/absolute_ib_split_ref.html b/tests/wpt/mozilla/tests/css/absolute_ib_split_ref.html new file mode 100644 index 00000000000..6acc697b869 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/absolute_ib_split_ref.html @@ -0,0 +1,4 @@ + + +Servo +