Skip to content

Commit 3dd3f19

Browse files
fantasaiyulunwu2
authored andcommitted
Block container inline-axis overflow includes padding + block-level child margins
https://bugs.webkit.org/show_bug.cgi?id=286753 rdar://144312078 Reviewed by Alan Baradlay. The CSS specs recently expanded the scrollable overflow area of block containers in the inline axis to include the padding edge as appended to the outer (margin) edge of child block-level boxes. See discussion in w3c/csswg-drafts#129 and w3c/csswg-drafts#8660 This patch updates our implementation by - Adding some options to ComputeOverflowOptions to enable this behavior. - Passing in those options when calling computeOverflow from RenderBlockFlow. - Adding/rearranging some helper functions to calculate it. - Renaming some methods for clarity. * LayoutTests/compositing/overflow/rtl-scrollbar-layer-positioning-expected.txt: * LayoutTests/compositing/tiling/perspective-on-scroller-tile-coverage-expected.txt: * LayoutTests/css2.1/20110323/abspos-containing-block-initial-001-expected.txt: * LayoutTests/css3/scroll-snap/scroll-snap-offsets-expected.txt: * LayoutTests/css3/scroll-snap/scroll-snap-offsets-rtl-expected.txt: * LayoutTests/fast/scrolling/mac/negative-z-index-overflow-scroll-expected.txt: * LayoutTests/http/tests/misc/ftp-eplf-directory-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/scrollable-overflow-transform-005.tentative-expected.txt: Rebaseline. * LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/scrollable-overflow-zero-one-axis-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollWidthHeight-expected.txt: Pass more tests. * LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/scrollable-overflow-zero-one-axis-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollWidthHeight-expected.txt: * LayoutTests/interaction-region/text-input-expected.txt: * LayoutTests/overflow/overflow-transform-perspective-expected.txt: * LayoutTests/platform/glib/compositing/overflow/ancestor-overflow-expected.txt: * LayoutTests/platform/glib/compositing/tiling/visiblerect-accumulated-offset-expected.txt: * LayoutTests/platform/glib/overflow/overflow-transform-perspective-expected.txt: * LayoutTests/platform/gtk/tables/mozilla/bugs/bug44505-expected.txt: * LayoutTests/platform/gtk/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt: * LayoutTests/platform/ios/compositing/overflow/ancestor-overflow-expected.txt: * LayoutTests/platform/ios/compositing/tiling/perspective-on-scroller-tile-coverage-expected.txt: * LayoutTests/platform/ios/compositing/tiling/visiblerect-accumulated-offset-expected.txt: * LayoutTests/platform/ios/css2.1/20110323/abspos-containing-block-initial-001-expected.txt: * LayoutTests/platform/ios/http/tests/misc/ftp-eplf-directory-expected.txt: * LayoutTests/platform/ios/overflow/overflow-transform-perspective-expected.txt: * LayoutTests/platform/ios/tables/mozilla/bugs/bug44505-expected.txt: * LayoutTests/platform/ios/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt: * LayoutTests/platform/mac-sequoia-wk2/tables/mozilla/bugs/bug44505-expected.txt: * LayoutTests/platform/mac-sequoia-wk2/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt: * LayoutTests/platform/mac-wk2/tables/mozilla/bugs/bug44505-expected.txt: Removed. * LayoutTests/platform/mac-wk2/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt: Removed. * LayoutTests/platform/mac/compositing/overflow/ancestor-overflow-expected.txt: * LayoutTests/platform/mac/compositing/tiling/visiblerect-accumulated-offset-expected.txt: * LayoutTests/platform/mac/tables/mozilla/bugs/bug44505-expected.txt: * LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt: * LayoutTests/platform/win/compositing/tiling/visiblerect-accumulated-offset-expected.txt: * LayoutTests/platform/win/overflow/overflow-transform-perspective-expected.txt: * LayoutTests/platform/wpe/tables/mozilla/bugs/bug44505-expected.txt: * LayoutTests/platform/wpe/tables/mozilla_expected_failures/bugs/bug2479-5-expected.png: * LayoutTests/platform/wpe/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt: Rebaseline. * Source/WebCore/platform/graphics/LayoutRect.cpp: (WebCore::LayoutRect::uniteXEvenIfEmpty): (WebCore::LayoutRect::uniteYEvenIfEmpty): * Source/WebCore/platform/graphics/LayoutRect.h: (WebCore::LayoutRect::containsX const): (WebCore::LayoutRect::containsY const): Add utility functions. * Source/WebCore/rendering/RenderBlock.cpp: (WebCore::RenderBlock::computeOverflow): * Source/WebCore/rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::layoutBlock): Make RenderBlockFlow add inline-axis child margins and self padding to overflow. * Source/WebCore/rendering/RenderBox.cpp: (WebCore::RenderBox::addOverflowWithRendererOffset): (WebCore::RenderBox::clampToAllowedLayoutOverflow): (WebCore::RenderBox::addLayoutOverflow): (WebCore::RenderBox::addMarginBoxOverflow): * Source/WebCore/rendering/RenderBox.h: * Source/WebCore/rendering/RenderBoxInlines.h: (WebCore::RenderBox::scrollableContentAreaOverflowRect const): (WebCore::RenderBox::scrollablePaddingAreaOverflowRect const): Extract some logic into helper methods and add per-axis arguments for computeOverflow() methods. * Source/WebCore/rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::layoutBlock): * Source/WebCore/rendering/RenderGrid.cpp: (WebCore::RenderGrid::layoutMasonry): Update call site to new argument format. * Source/WebCore/rendering/RenderOverflow.h: (WebCore::RenderOverflow::addContentOverflowX): (WebCore::RenderOverflow::addContentOverflowY): Provide per-axis variants of addContentOverflow methods. Canonical link: https://commits.webkit.org/307212@main
1 parent 9c8ea0e commit 3dd3f19

File tree

48 files changed

+260
-582
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+260
-582
lines changed

LayoutTests/compositing/overflow/rtl-scrollbar-layer-positioning-expected.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
(GraphicsLayer
1616
(offsetFromRenderer width=13 height=13)
1717
(position 23.00 23.00)
18-
(bounds origin 292.00 0.00)
18+
(bounds origin 300.00 0.00)
1919
(bounds 316.00 316.00)
2020
(children 1
2121
(GraphicsLayer
2222
(offsetFromRenderer width=13 height=13)
23-
(scrollOffset (292,0))
23+
(scrollOffset (300,0))
2424
(anchor 0.00 0.00)
25-
(bounds 608.00 616.00)
25+
(bounds 616.00 616.00)
2626
)
2727
)
2828
)

LayoutTests/compositing/tiling/perspective-on-scroller-tile-coverage-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
(GraphicsLayer
4141
(scrollOffset (0,900))
4242
(anchor 0.00 0.00)
43-
(bounds 585.00 3240.00)
43+
(bounds 625.00 3240.00)
4444
(preserves3D 1)
4545
(visible rect 0.00, 900.00 585.00 x 500.00)
4646
(coverage rect 0.00, 900.00 585.00 x 500.00)

LayoutTests/css2.1/20110323/abspos-containing-block-initial-001-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
layer at (0,0) size 785x10110
1+
layer at (0,0) size 785x10120
22
RenderView at (0,0) size 785x600
33
layer at (10,10) size 765x10100
44
RenderBlock {HTML} at (10,10) size 765x10100 [border: (20px solid #000000)]

LayoutTests/css3/scroll-snap/scroll-snap-offsets-expected.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ Tests that the scroll-snap feature works properly in overflow regions.
33
Scroll-snap offsets for verticalTarget: vertical = { 0, 30, 60, 90, 120, 150 }
44
Scroll-snap offsets for horizontalBorderedTarget: horizontal = { 0, 30, 60, 90, 120, 150 }
55
Scroll-snap offsets for verticalBorderedTarget: vertical = { 0, 30, 60, 90, 120, 150 }
6-
Scroll-snap offsets for horizontalPaddedTarget: horizontal = { 20, 50, 80, 110, 140 }
6+
Scroll-snap offsets for horizontalPaddedTarget: horizontal = { 20, 50, 80, 110, 140, 150 }
77
Scroll-snap offsets for verticalPaddedTarget: vertical = { 15, 45, 75, 105, 135, 150 }
8-
Scroll-snap offsets for horizontalBorderedPaddedTarget: horizontal = { 20, 50, 80, 110, 140 }
8+
Scroll-snap offsets for horizontalBorderedPaddedTarget: horizontal = { 20, 50, 80, 110, 140, 150 }
99
Scroll-snap offsets for verticalBorderedPaddedTarget: vertical = { 15, 45, 75, 105, 135, 150 }
10-
Scroll-snap offsets for horizontalRotatedTarget: horizontal = { 20, 50, 80, 110, 140 }
10+
Scroll-snap offsets for horizontalRotatedTarget: horizontal = { 20, 50, 80, 110, 140, 150 }
1111
Scroll-snap offsets for verticalRotatedTarget: vertical = { 15, 45, 75, 105, 135, 150 }
1212
PASS successfullyParsed is true
1313

LayoutTests/css3/scroll-snap/scroll-snap-offsets-rtl-expected.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Tests that the scroll-snap feature works properly in overflow regions.
22
Scroll-snap offsets for horizontalTarget: horizontal = { 0, 100, 200, 300, 400, 500 }
33
Scroll-snap offsets for horizontalBorderedTarget: horizontal = { 0, 100, 200, 300, 400, 500 }
4-
Scroll-snap offsets for horizontalPaddedTarget: horizontal = { 0, 70, 170, 270, 370, 470 }
5-
Scroll-snap offsets for horizontalBorderedPaddedTarget: horizontal = { 0, 70, 170, 270, 370, 470 }
6-
Scroll-snap offsets for horizontalRotatedTarget: horizontal = { 0, 70, 170, 270, 370, 470 }
4+
Scroll-snap offsets for horizontalPaddedTarget: horizontal = { 0, 90, 190, 290, 390, 490 }
5+
Scroll-snap offsets for horizontalBorderedPaddedTarget: horizontal = { 0, 90, 190, 290, 390, 490 }
6+
Scroll-snap offsets for horizontalRotatedTarget: horizontal = { 0, 90, 190, 290, 390, 490 }
77
PASS successfullyParsed is true
88

99
TEST COMPLETE

LayoutTests/fast/scrolling/mac/negative-z-index-overflow-scroll-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
(GraphicsLayer
4343
(offsetFromRenderer width=30 height=30)
4444
(anchor 0.00 0.00)
45-
(bounds 425.00 10040.00)
45+
(bounds 440.00 10040.00)
4646
(drawsContent 1)
4747
(event region
48-
(rect (0,0) width=425 height=10040)
48+
(rect (0,0) width=440 height=10040)
4949
)
5050
)
5151
)

LayoutTests/http/tests/misc/ftp-eplf-directory-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
layer at (0,0) size 785x1184
1+
layer at (0,0) size 785x1192
22
RenderView at (0,0) size 785x600
33
RenderBlock {HTML} at (0,600) size 785x584
44
RenderBody {BODY} at (8,0) size 769x584

LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/scrollable-overflow-transform-005.tentative-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ FAIL .container 1 assert_equals:
44
<div style="transform: translate(-200px, -200px);" class="element">
55
</div>
66
</div>
7-
scrollHeight expected 100 but got 200
7+
scrollWidth expected 100 but got 200
88
FAIL .container 2 assert_equals:
99
<div class="container" data-expected-scroll-width="150" data-expected-scroll-height="150">
1010
<div style="transform: translate(-25%, -25%);" class="element">
1111
</div>
1212
</div>
13-
scrollHeight expected 150 but got 200
13+
scrollWidth expected 150 but got 200
1414
PASS .container 3
1515
PASS .container 4
1616
PASS .container 5

LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/scrollable-overflow-zero-one-axis-expected.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11

22
PASS .scroll 1
3-
FAIL .scroll 2 assert_equals:
4-
<div class="scroll zero-w" data-expected-scroll-width="100">
5-
<div class="zero-h"></div>
6-
</div>
7-
scrollWidth expected 100 but got -15
3+
PASS .scroll 2
84
PASS .scroll 3
95
PASS .scroll 4
106
PASS .scroll 5

LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollWidthHeight-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PASS elemSimple.scrollWidth is its clientWidth
66
PASS elemOverflow.clientHeight is the height of the padding edge
77
PASS elemOverflow.scrollHeight is the height of its scrolled contents (including padding)
88
PASS elemOverflow.clientWidth is the width of the padding edge
9-
FAIL elemOverflow.scrollHeight is the width of its scrolled contents (including padding) assert_equals: expected 290 but got 250
9+
PASS elemOverflow.scrollHeight is the width of its scrolled contents (including padding)
1010
PASS elemNestedOverflow.clientHeight is the height of the padding edge
1111
PASS elemNestedOverflow.scrollHeight is the height of its scrolled contents (ignoring padding)
1212
PASS elemNestedOverflow.clientWidth is the height of the padding edge

0 commit comments

Comments
 (0)