From 293bad18f46340f07b9f8386e748f3f7daf1c0e0 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Wed, 9 Oct 2019 22:11:19 +0000 Subject: [PATCH] Bug 1102175 Part 4 - Add BFC bits to a block if its used writing-mode is different from the parent's. r=jfkthame Without this patch, the `CHECK_BLOCK_AND_LINE_DIR` soft assertion in nsFloatManager can be triggered with wm-propagation-body-dynamic-change-002.html added in Part 3. Add the test as a crashtest because web-platform reftest doesn't seem to catch our soft assertions. Add reftests to verify that BFC bits are added to the child block if the parent and child has the same block-direction, but different sideways bit; also, add reftests to ensure that "text-orientation: sideways" doesn't add BFC bits. Differential Revision: https://phabricator.services.mozilla.com/D45912 --HG-- extra : moz-landing-system : lando --- layout/generic/crashtests/1102175-2.html | 47 ++++++++++++++++ layout/generic/crashtests/crashtests.list | 1 + layout/generic/nsBlockFrame.cpp | 12 ++-- .../slr-alongside-vlr-floats-ref.html | 50 +++++++++++++++++ .../slr-alongside-vlr-floats.html | 56 +++++++++++++++++++ .../srl-alongside-vrl-floats-ref.html | 50 +++++++++++++++++ .../srl-alongside-vrl-floats.html | 56 +++++++++++++++++++ ...ion-sideways-alongside-vlr-floats-ref.html | 42 ++++++++++++++ ...ntation-sideways-alongside-vlr-floats.html | 49 ++++++++++++++++ ...ion-sideways-alongside-vrl-floats-ref.html | 42 ++++++++++++++ ...ntation-sideways-alongside-vrl-floats.html | 49 ++++++++++++++++ 11 files changed, 450 insertions(+), 4 deletions(-) create mode 100644 layout/generic/crashtests/1102175-2.html create mode 100644 testing/web-platform/tests/css/css-writing-modes/slr-alongside-vlr-floats-ref.html create mode 100644 testing/web-platform/tests/css/css-writing-modes/slr-alongside-vlr-floats.html create mode 100644 testing/web-platform/tests/css/css-writing-modes/srl-alongside-vrl-floats-ref.html create mode 100644 testing/web-platform/tests/css/css-writing-modes/srl-alongside-vrl-floats.html create mode 100644 testing/web-platform/tests/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats-ref.html create mode 100644 testing/web-platform/tests/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats.html create mode 100644 testing/web-platform/tests/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats-ref.html create mode 100644 testing/web-platform/tests/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats.html diff --git a/layout/generic/crashtests/1102175-2.html b/layout/generic/crashtests/1102175-2.html new file mode 100644 index 000000000000..1f485f68d864 --- /dev/null +++ b/layout/generic/crashtests/1102175-2.html @@ -0,0 +1,47 @@ + + + + CSS-Writing Modes Test: propagation of the writing-mode property from body to root + + + + + + + + + + + +
+

Test passes if you see a blue square in the upper-right corner of the page

+ + diff --git a/layout/generic/crashtests/crashtests.list b/layout/generic/crashtests/crashtests.list index 556c44a5e625..8fa0e936676a 100644 --- a/layout/generic/crashtests/crashtests.list +++ b/layout/generic/crashtests/crashtests.list @@ -593,6 +593,7 @@ load 1042489.html load 1054010-1.html load 1058954-1.html skip-if(verify&&isDebugBuild&&(gtkWidget||OSX)) load 1059138-1.html +load 1102175-2.html load 1134531.html load 1134667.html load 1137723-1.html diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index d4c0b33cef4b..2adc207ff7c4 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -7110,19 +7110,23 @@ void nsBlockFrame::Init(nsIContent* aContent, nsContainerFrame* aParent, } // A display:flow-root box establishes a block formatting context. - // If a box has a different block flow direction than its containing block: + // + // If a box has a different writing-mode value than its containing block: // ... // If the box is a block container, then it establishes a new block // formatting context. - // (http://dev.w3.org/csswg/css-writing-modes/#block-flow) + // (https://drafts.csswg.org/css-writing-modes/#block-flow) // // If the box has contain: paint or contain:layout (or contain:strict), // then it should also establish a formatting context. // // Per spec, a column-span always establishes a new block formatting context. if (StyleDisplay()->mDisplay == mozilla::StyleDisplay::FlowRoot || - (GetParent() && StyleVisibility()->mWritingMode != - GetParent()->StyleVisibility()->mWritingMode) || + (GetParent() && + (GetWritingMode().GetBlockDir() != + GetParent()->GetWritingMode().GetBlockDir() || + GetWritingMode().IsVerticalSideways() != + GetParent()->GetWritingMode().IsVerticalSideways())) || StyleDisplay()->IsContainPaint() || StyleDisplay()->IsContainLayout() || (StaticPrefs::layout_css_column_span_enabled() && IsColumnSpan())) { AddStateBits(NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS); diff --git a/testing/web-platform/tests/css/css-writing-modes/slr-alongside-vlr-floats-ref.html b/testing/web-platform/tests/css/css-writing-modes/slr-alongside-vlr-floats-ref.html new file mode 100644 index 000000000000..71a4c4c284b6 --- /dev/null +++ b/testing/web-platform/tests/css/css-writing-modes/slr-alongside-vlr-floats-ref.html @@ -0,0 +1,50 @@ + + + CSS Writing Modes Test Reference: positioning of a sideways-lr block alongside vertical-lr floats + + + + + + + + +

Image download support must be enabled

+ + +
 
+
 
+
 
+ + diff --git a/testing/web-platform/tests/css/css-writing-modes/slr-alongside-vlr-floats.html b/testing/web-platform/tests/css/css-writing-modes/slr-alongside-vlr-floats.html new file mode 100644 index 000000000000..76fb454f6a17 --- /dev/null +++ b/testing/web-platform/tests/css/css-writing-modes/slr-alongside-vlr-floats.html @@ -0,0 +1,56 @@ + + + CSS Writing Modes Test: positioning of a sideways-lr block alongside vertical-lr floats + + + + + + + + + + + + + + +

Image download support must be enabled

+ + +
 
+
 
+
 
+ + diff --git a/testing/web-platform/tests/css/css-writing-modes/srl-alongside-vrl-floats-ref.html b/testing/web-platform/tests/css/css-writing-modes/srl-alongside-vrl-floats-ref.html new file mode 100644 index 000000000000..cd6ee5e91866 --- /dev/null +++ b/testing/web-platform/tests/css/css-writing-modes/srl-alongside-vrl-floats-ref.html @@ -0,0 +1,50 @@ + + + CSS Writing Modes Test Reference: positioning of a sideways-rl block alongside vertical-rl floats + + + + + + + + +

Image download support must be enabled

+ + +
 
+
 
+
 
+ + diff --git a/testing/web-platform/tests/css/css-writing-modes/srl-alongside-vrl-floats.html b/testing/web-platform/tests/css/css-writing-modes/srl-alongside-vrl-floats.html new file mode 100644 index 000000000000..7b3ee59207b5 --- /dev/null +++ b/testing/web-platform/tests/css/css-writing-modes/srl-alongside-vrl-floats.html @@ -0,0 +1,56 @@ + + + CSS Writing Modes Test: positioning of a sideways-rl block alongside vertical-rl floats + + + + + + + + + + + + + + +

Image download support must be enabled

+ + +
 
+
 
+
 
+ + diff --git a/testing/web-platform/tests/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats-ref.html b/testing/web-platform/tests/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats-ref.html new file mode 100644 index 000000000000..fc4bbee90ad9 --- /dev/null +++ b/testing/web-platform/tests/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats-ref.html @@ -0,0 +1,42 @@ + + + CSS Writing Modes Test Reference: positioning of a text-orientation:sideways block alongside vertical-lr floats + + + + + + + +
 
+
 
+
 
+ + diff --git a/testing/web-platform/tests/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats.html b/testing/web-platform/tests/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats.html new file mode 100644 index 000000000000..f605f20aa7e9 --- /dev/null +++ b/testing/web-platform/tests/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats.html @@ -0,0 +1,49 @@ + + + CSS Writing Modes Test: positioning of a text-orientation:sideways block alongside vertical-lr floats + + + + + + + + + + + + + +
 
+
 
+
 
+ + diff --git a/testing/web-platform/tests/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats-ref.html b/testing/web-platform/tests/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats-ref.html new file mode 100644 index 000000000000..218d5abdbe73 --- /dev/null +++ b/testing/web-platform/tests/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats-ref.html @@ -0,0 +1,42 @@ + + + CSS Writing Modes Test Reference: positioning of a text-orientation:sideways block alongside vertical-rl floats + + + + + + + +
 
+
 
+
 
+ + diff --git a/testing/web-platform/tests/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats.html b/testing/web-platform/tests/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats.html new file mode 100644 index 000000000000..710221031a3e --- /dev/null +++ b/testing/web-platform/tests/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats.html @@ -0,0 +1,49 @@ + + + CSS Writing Modes Test: positioning of a text-orientation:sideways block alongside vertical-rl floats + + + + + + + + + + + + + +
 
+
 
+
 
+ +