Diff
Modified: trunk/LayoutTests/ChangeLog (277320 => 277321)
--- trunk/LayoutTests/ChangeLog 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/LayoutTests/ChangeLog 2021-05-11 12:49:46 UTC (rev 277321)
@@ -1,3 +1,15 @@
+2021-05-11 Cathie Chen <[email protected]>
+
+ [CSS contain] Support contain:size
+ https://bugs.webkit.org/show_bug.cgi?id=223570
+
+ Reviewed by Alan Bujtas.
+
+ Update the test result for size containment. Added explanations for size containment tests
+ that depended on other features.
+
+ * TestExpectations:
+
2021-05-11 Antti Koivisto <[email protected]>
Don't allow :visited link style in subtrees that use mix-blend-mode
Modified: trunk/LayoutTests/TestExpectations (277320 => 277321)
--- trunk/LayoutTests/TestExpectations 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/LayoutTests/TestExpectations 2021-05-11 12:49:46 UTC (rev 277321)
@@ -4646,7 +4646,6 @@
webanimations/translate-property-and-translate-animation-with-delay-on-forced-layer.html [ Skip ]
# CSS containment tests that fail
-imported/w3c/web-platform-tests/css/css-contain/contain-animation-001.html [ ImageOnlyFailure ]
# webkit-ruby-text
imported/w3c/web-platform-tests/css/css-contain/contain-layout-017.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-001.html [ ImageOnlyFailure ]
@@ -4663,7 +4662,6 @@
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-020.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-021.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-022.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-layout-size-003.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/contain-paint-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/contain-paint-004.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/contain-paint-005.html [ ImageOnlyFailure ]
@@ -4705,68 +4703,8 @@
imported/w3c/web-platform-tests/css/css-contain/contain-paint-stacking-context-001b.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/contain-paint-table-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/contain-paint-table-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-011.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-013.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-021.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-023.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-025.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-027.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-041.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-042.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-056.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-061.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-062.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-063.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-064.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-block-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-block-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-block-003.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-block-004.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-borders.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-breaks-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-button-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-button-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-fieldset-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-fieldset-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-fieldset-003.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-fieldset-004.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-flex-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-flexbox-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-005.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-inline-block-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-inline-block-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-inline-block-003.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-inline-block-004.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-inline-flex-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-monolithic-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-monolithic-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-multicol-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-multicol-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-multicol-003.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-003a.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-003b.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-003c.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-004.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-005.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-006.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-scrollbars-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-scrollbars-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-scrollbars-003.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-select-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-select-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-select-elem-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-select-elem-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-select-elem-003.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-select-elem-004.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-select-elem-005.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-size-table-caption-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/contain-strict-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/contain-strict-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-strict-003.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/contain-strict-011.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-002.html [ ImageOnlyFailure ]
@@ -4802,6 +4740,31 @@
# Flaky css-contain test
imported/w3c/web-platform-tests/css/css-contain/content-visibility/animation-display-lock.html [ Failure Pass ]
+# Canvas doesn't get default aspect-ratio for width and height attributes.
+webkit.org/b/217529 imported/w3c/web-platform-tests/css/css-flexbox/canvas-contain-size.html [ ImageOnlyFailure ]
+
+# Content is painted on svg's padding area.
+webkit.org/b/425868 imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-002.html [ ImageOnlyFailure ]
+
+# Multicolumn does not paint the horizontal overflow area of a relative child.
+webkit.org/b/41796 imported/w3c/web-platform-tests/css/css-contain/contain-size-monolithic-002.html [ ImageOnlyFailure ]
+
+# Buttons with auto width and height has extra margins.
+imported/w3c/web-platform-tests/css/css-contain/contain-size-button-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-contain/contain-size-button-002.html [ ImageOnlyFailure ]
+
+# Scrollbar displays are different.
+imported/w3c/web-platform-tests/css/css-contain/contain-size-block-003.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-contain/contain-size-inline-block-003.html [ ImageOnlyFailure ]
+
+# Select with empty content always has root linebox, so the heights are different.
+imported/w3c/web-platform-tests/css/css-contain/contain-size-select-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-contain/contain-size-select-002.html [ ImageOnlyFailure ]
+
+# CSS property color is not working in select elements.
+imported/w3c/web-platform-tests/css/css-contain/contain-size-select-elem-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-contain/contain-size-select-elem-002.html [ ImageOnlyFailure ]
+
# Tests that fail because they assume a vertical scrollbar in `writing-mode: vertical-rl` elements will be on the right-hand side
webkit.org/b/224357 imported/w3c/web-platform-tests/css/css-writing-modes/sizing-orthog-vrl-in-htb-013.xht [ ImageOnlyFailure ]
webkit.org/b/224357 imported/w3c/web-platform-tests/css/cssom-view/cssom-getBoundingClientRect-vertical-rl.html [ ImageOnlyFailure ]
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (277320 => 277321)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-05-11 12:49:46 UTC (rev 277321)
@@ -1,3 +1,20 @@
+2021-05-11 Cathie Chen <[email protected]>
+
+ [CSS contain] Support contain:size
+ https://bugs.webkit.org/show_bug.cgi?id=223570
+
+ Reviewed by Alan Bujtas.
+
+ <canvas> and <video> don't support computing aspect ratio from width and height attributes yet,
+ so the heights are zero when they are with "contain: size".
+
+ * web-platform-tests/css/css-contain/contain-size-grid-003-expected.txt:
+ * web-platform-tests/css/css-contain/contain-size-grid-004-expected.txt:
+ * web-platform-tests/css/css-contain/contain-size-multicol-as-flex-item-expected.txt:
+ * web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt:
+ * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt:
+ * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt:
+
2021-05-10 Rob Buis <[email protected]>
Implement <form>.requestSubmit()
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-003-expected.txt (277320 => 277321)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-003-expected.txt 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-003-expected.txt 2021-05-11 12:49:46 UTC (rev 277321)
@@ -36,19 +36,8 @@
PASS .grid 35
PASS .grid 36
PASS .grid 37
-FAIL .grid 38 assert_equals:
-<div class="grid" style="grid: repeat(auto-fit, 75px) / repeat(auto-fit, 100px);" data-expected-width="0" data-expected-height="0">
- <div></div>
- </div>
-width expected 0 but got 100
-FAIL .grid 39 assert_equals:
-<div class="grid" style="grid: auto 50px / 100px auto;" data-expected-width="100" data-expected-height="50">
- <div data-expected-width="100" data-expected-height="10" data-offset-x="0" data-offset-y="0">X</div>
- <div data-expected-width="40" data-expected-height="10" data-offset-x="100" data-offset-y="0">XX</div>
- <div data-expected-width="100" data-expected-height="50" data-offset-x="0" data-offset-y="10">XXX</div>
- <div data-expected-width="40" data-expected-height="50" data-offset-x="100" data-offset-y="10">XXXX</div>
-</div>
-width expected 100 but got 140
+PASS .grid 38
+PASS .grid 39
X
XX
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-004-expected.txt (277320 => 277321)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-004-expected.txt 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-004-expected.txt 2021-05-11 12:49:46 UTC (rev 277321)
@@ -1,38 +1,18 @@
PASS .grid 1
-FAIL .grid 2 assert_equals:
-<div class="grid percent min-content" data-expected-height="0" data-expected-width="0">
- <div data-expected-height="0" data-expected-width="0">XXXX</div>
-</div>
-width expected 0 but got 300
+PASS .grid 2
PASS .grid 3
-FAIL .grid 4 assert_equals:
-<div class="grid percent max-content" data-expected-height="0" data-expected-width="0">
- <div data-expected-height="0" data-expected-width="0">XXXX</div>
-</div>
-width expected 0 but got 300
+PASS .grid 4
PASS .grid 5
PASS .grid 6
PASS .grid 7
-FAIL .grid 8 assert_equals:
-<div class="grid calc min-content" data-expected-height="0" data-expected-width="0">
- <div data-expected-height="100" data-expected-width="100">XXXX</div>
-</div>
-width expected 0 but got 300
+PASS .grid 8
PASS .grid 9
-FAIL .grid 10 assert_equals:
-<div class="grid calc max-content" data-expected-height="0" data-expected-width="0">
- <div data-expected-height="100" data-expected-width="100">XXXX</div>
-</div>
-width expected 0 but got 300
+PASS .grid 10
PASS .grid 11
PASS .grid 12
PASS .grid 13
-FAIL .grid 14 assert_equals:
-<div class="grid minmax-percent-fixed min-content" data-expected-height="100" data-expected-width="0">
- <div data-expected-height="100" data-expected-width="0">XXXX</div>
-</div>
-width expected 0 but got 100
+PASS .grid 14
PASS .grid 15
PASS .grid 16
PASS .grid 17
@@ -40,67 +20,31 @@
PASS .grid 19
PASS .grid 20
PASS .grid 21
-FAIL .grid 22 assert_equals:
-<div class="grid minmax-fixed-percent max-content" data-expected-height="100" data-expected-width="100">
- <div data-expected-height="100" data-expected-width="100">XXXX</div>
-</div>
-width expected 100 but got 300
+PASS .grid 22
PASS .grid 23
PASS .grid 24
PASS .grid 25
-FAIL .grid 26 assert_equals:
-<div class="grid minmax-percent-flex min-content" data-expected-height="0" data-expected-width="0">
- <div data-expected-height="0" data-expected-width="0">XXXX</div>
-</div>
-width expected 0 but got 300
+PASS .grid 26
PASS .grid 27
-FAIL .grid 28 assert_equals:
-<div class="grid minmax-percent-flex max-content" data-expected-height="0" data-expected-width="0">
- <div data-expected-height="0" data-expected-width="0">XXXX</div>
-</div>
-width expected 0 but got 300
+PASS .grid 28
PASS .grid 29
PASS .grid 30
PASS .grid 31
-FAIL .grid 32 assert_equals:
-<div class="grid minmax-intrinsic-percent min-content" data-expected-height="0" data-expected-width="0">
- <div data-expected-height="75" data-expected-width="300">XXXX</div>
-</div>
-width expected 0 but got 300
+PASS .grid 32
PASS .grid 33
-FAIL .grid 34 assert_equals:
-<div class="grid minmax-intrinsic-percent max-content" data-expected-height="0" data-expected-width="0">
- <div data-expected-height="75" data-expected-width="300">XXXX</div>
-</div>
-width expected 0 but got 300
+PASS .grid 34
PASS .grid 35
PASS .grid 36
PASS .grid 37
-FAIL .grid 38 assert_equals:
-<div class="grid minmax-percent-intrinsic min-content" data-expected-height="0" data-expected-width="0">
- <div data-expected-height="0" data-expected-width="0">XXXX</div>
-</div>
-width expected 0 but got 300
+PASS .grid 38
PASS .grid 39
-FAIL .grid 40 assert_equals:
-<div class="grid minmax-percent-intrinsic max-content" data-expected-height="0" data-expected-width="0">
- <div data-expected-height="0" data-expected-width="0">XXXX</div>
-</div>
-width expected 0 but got 300
+PASS .grid 40
PASS .grid 41
PASS .grid 42
PASS .grid 43
-FAIL .grid 44 assert_equals:
-<div class="grid fit-content min-content" data-expected-height="0" data-expected-width="0">
- <div data-expected-height="75" data-expected-width="300">XXXX</div>
-</div>
-width expected 0 but got 300
+PASS .grid 44
PASS .grid 45
-FAIL .grid 46 assert_equals:
-<div class="grid fit-content max-content" data-expected-height="0" data-expected-width="0">
- <div data-expected-height="75" data-expected-width="300">XXXX</div>
-</div>
-width expected 0 but got 300
+PASS .grid 46
PASS .grid 47
PASS .grid 48
XXXX
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-multicol-as-flex-item-expected.txt (277320 => 277321)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-multicol-as-flex-item-expected.txt 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-multicol-as-flex-item-expected.txt 2021-05-11 12:49:46 UTC (rev 277321)
@@ -1,11 +1,5 @@
There should be a green square below.
-FAIL #flex 1 assert_equals:
-<div id="flex">
- <div id="multicol" data-expected-width="100" data-expected-height="100">
- <div style="width:1000px; height:1px;"></div>
- </div>
-</div>
-width expected 100 but got 784
+PASS #flex 1
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt (277320 => 277321)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt 2021-05-11 12:49:46 UTC (rev 277321)
@@ -17,28 +17,12 @@
Row
-FAIL .inline-flex 1 assert_equals:
-<div class="inline-flex" style="display: inline-flex; flex-direction: column;" data-expected-width="0" data-expected-height="0">
- <div style="contain: strict;" data-expected-width="0" data-expected-height="0">Column</div>
-</div>
-width expected 0 but got 52
-FAIL .inline-flex 2 assert_equals:
-<div class="inline-flex" data-expected-width="0" data-expected-height="0">
- <div style="contain: strict;" data-expected-width="0" data-expected-height="0">Row</div>
-</div>
-width expected 0 but got 30
+PASS .inline-flex 1
+PASS .inline-flex 2
PASS .inline-flex 3
PASS .inline-flex 4
-FAIL .inline-flex 5 assert_equals:
-<div class="inline-flex" style="flex-direction: column; align-items: flex-start;" data-expected-width="0" data-expected-height="0">
- <div style="contain: strict;" data-expected-width="0" data-expected-height="0">Column</div>
-</div>
-width expected 0 but got 52
-FAIL .inline-flex 6 assert_equals:
-<div class="inline-flex" style="align-items: flex-start;" data-expected-width="0" data-expected-height="0">
- <div style="contain: strict;" data-expected-width="0" data-expected-height="0">Row</div>
-</div>
-width expected 0 but got 30
+PASS .inline-flex 5
+PASS .inline-flex 6
PASS .inline-flex 7
PASS .inline-flex 8
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt (277320 => 277321)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt 2021-05-11 12:49:46 UTC (rev 277321)
@@ -1,6 +1,6 @@
-PASS Canvas width and height attributes are used as the surface size with contain:size
+FAIL Canvas width and height attributes are used as the surface size with contain:size assert_approx_equals: expected 2.5 +/- 0.001 but got Infinity
PASS Canvas width and height attributes are used as the surface size
FAIL Computed style test: canvas with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
PASS Computed style test: canvas with {"width":"0","height":"1"}
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt (277320 => 277321)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt 2021-05-11 12:49:46 UTC (rev 277321)
@@ -1,6 +1,6 @@
-FAIL Video width and height attributes are not used to infer aspect-ratio assert_approx_equals: expected 2.5 +/- 0.001 but got 2
+FAIL Video width and height attributes are not used to infer aspect-ratio assert_approx_equals: expected 2.5 +/- 0.001 but got Infinity
FAIL Computed style test: video with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
FAIL Computed style test: video with {"width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto"
PASS Computed style test: video with {"width":"0","height":"1"}
Modified: trunk/Source/WebCore/ChangeLog (277320 => 277321)
--- trunk/Source/WebCore/ChangeLog 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/ChangeLog 2021-05-11 12:49:46 UTC (rev 277321)
@@ -1,3 +1,100 @@
+2021-05-11 Cathie Chen <[email protected]>
+
+ [CSS contain] Support contain:size
+ https://bugs.webkit.org/show_bug.cgi?id=223570
+
+ Reviewed by Alan Bujtas.
+
+ This patch brings initial support of CSS contain:size according to [1].
+ It adds shouldApplySizeContainment() to indicate whether the object is a size containment box.
+ The intrinsic sizes of size containment box are determined as if it had no content.
+ So the implementation need to cooperate with the layout steps:
+ - Computing logical width: Size containment boxes skip handling children while computing minLogicalWidth
+ and maxLogicalWidth in computeIntrinsicLogicalWidths. So the logical width is not affected by children.
+ - Layout children: The logical height is changed after layout all children.
+ - Computing logical height: At the beginning, size containment boxes need to reset logical height to the empty content height
+ if it is not renderGrid. So the logical height is not affected by children.
+ We also need to calculate the sizes according to the layout algorithms.
+ - Grid layout:
+ To calculate the minLogicalWidth and maxLogicalWidth for indefinite size RenderGrid.
+ The widths are calculated by GridTrackSizingAlgorithm: m_minContentSize and m_maxContentSize which are the sum of
+ m_baseSize/m_growthLimit of all GridTracks. The size containment RenderGrid skips handling content in resolveIntrinsicTrackSizes
+ and the m_maxContentSize will be the sum of m_baseSize. The logical height is same to width, but after calculating
+ RenderGrid's logical height, it needs to calculate the track sizes again, to make sure that they are distributed properly.
+ We use computeTrackSizesForDefiniteSize(ForRows, trackBasedLogicalHeight) to recalculate it.
+ - MultiColumn layout:
+ According to the specification, size containment boxes should be monolithic, so we need to extend column height
+ for overflow and positioned size containment boxes. m_spaceShortageForSizeContainment is added to indicate the shortage space
+ that need to balance the column heights. adjustSizeContainmentChildForPagination() will calculate the shortage.
+
+ [1] https://www.w3.org/TR/css-contain-1/#containment-size
+
+ * rendering/GridTrackSizingAlgorithm.cpp: Add isComputingSizeContainment to indicate if it is calculating sizes
+ for indefinite size RenderGrid which is size containment.
+ (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild const):
+ (WebCore::GridTrackSizingAlgorithm::computeGridContainerIntrinsicSizes):
+ It skips resolveIntrinsicTrackSizes if isComputingSizeContainment, so growthLimit might be undefined,
+ if so, use track.baseSize() instead.
+ (WebCore::GridTrackSizingAlgorithm::resolveIntrinsicTrackSizes): Skip resolve the content if isComputingSizeContainment().
+ (WebCore::GridTrackSizingAlgorithm::advanceNextState): Added RowSizingExtraIterationForSizeContainment.
+ (WebCore::GridTrackSizingAlgorithm::isValidTransition const):
+ (WebCore::GridTrackSizingAlgorithm::run): Do not stretch the track sizes if isComputingSizeContainment().
+ * rendering/GridTrackSizingAlgorithm.h:
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::layoutPositionedObject): Calculate m_spaceShortageForSizeContainment for positioned size containment.
+ (WebCore::RenderBlock::computeIntrinsicLogicalWidths const): Skip computeBlockPreferredLogicalWidths if shouldApplySizeContainment.
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths const): Skip handling the children for size containment box.
+ (WebCore::RenderBlockFlow::adjustBlockChildForPagination): Calculate m_spaceShortageForSizeContainment for child.
+ (WebCore::RenderBlockFlow::adjustSizeContainmentChildForPagination): m_spaceShortageForSizeContainment = childOverflowHeight - remainingLogicalHeight.
+ * rendering/RenderBlockFlow.h:
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::updateLogicalHeight): Reset the logical height to empty content height for size containment box.
+ (WebCore::RenderBox::isUnsplittableForPagination const): Size containment box is unsplittable.
+ * rendering/RenderDeprecatedFlexibleBox.cpp:
+ (WebCore::RenderDeprecatedFlexibleBox::computeIntrinsicLogicalWidths const): Ditto.
+ * rendering/RenderFileUploadControl.cpp:
+ (WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths const): Ditto.
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths const): Ditto.
+ * rendering/RenderFragmentedFlow.h:
+ * rendering/RenderGrid.cpp:
+ (WebCore::RenderGrid::layoutBlock): If it is size containment with infiniteSize, using trackBasedLogicalHeight
+ to compute track sizes again to make sure the height is distributed properly.
+ (WebCore::RenderGrid::computeEmptyTracksForAutoRepeat const): Collapse if shouldApplySizeContainment.
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::computeIntrinsicRatioInformation const): This is handled in RenderReplaced::computeIntrinsicRatioInformation instead.
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::computeIntrinsicLogicalWidths const): The widths of size containment boxes are optionsSpacingHorizontal.
+ * rendering/RenderMenuList.cpp:
+ (RenderMenuList::computeIntrinsicLogicalWidths const): The widths of size containment box are theme.minimumMenuListSize.
+ * rendering/RenderMultiColumnFlow.cpp:
+ (WebCore::RenderMultiColumnFlow::updateSpaceShortageForSizeContainment): Set m_spaceShortageForSizeContainment.
+ * rendering/RenderMultiColumnFlow.h:
+ * rendering/RenderMultiColumnSet.cpp:
+ (WebCore::RenderMultiColumnSet::RenderMultiColumnSet):
+ (WebCore::RenderMultiColumnSet::calculateBalancedHeight const): Add m_spaceShortageForSizeContainment to the column height.
+ (WebCore::RenderMultiColumnSet::prepareForLayout): Reset m_spaceShortageForSizeContainment.
+ * rendering/RenderMultiColumnSet.h:
+ * rendering/RenderObject.cpp:
+ (WebCore::shouldApplySizeContainment): Check if the object is a size containment box.
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::isAtomicInlineLevelBox const):
+ * rendering/RenderReplaced.cpp:
+ (WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox const):
+ (WebCore::RenderReplaced::computeIntrinsicRatioInformation const): Use the empty intrinsicSize.
+ * rendering/RenderReplaced.h: The intrinsicSize of size containment is (0, 0).
+ * rendering/RenderSlider.cpp:
+ (WebCore::RenderSlider::computeIntrinsicLogicalWidths const): Ditto.
+ * rendering/RenderTextControl.cpp:
+ (WebCore::RenderTextControl::computeIntrinsicLogicalWidths const): Ditto.
+ * rendering/RenderVideo.cpp:
+ (WebCore::RenderVideo::calculateIntrinsicSize): Ditto.
+ * rendering/style/RenderStyle.h:
+ (WebCore::RenderStyle::containsSize const):
+ * rendering/svg/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::computeIntrinsicRatioInformation const): Handled in RenderReplaced::computeIntrinsicRatioInformation instead.
+
2021-05-11 Antti Koivisto <[email protected]>
Don't allow :visited link style in subtrees that use mix-blend-mode
Modified: trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -580,7 +580,7 @@
Optional<LayoutUnit> GridTrackSizingAlgorithm::gridAreaBreadthForChild(const RenderBox& child, GridTrackSizingDirection direction) const
{
bool addContentAlignmentOffset =
- direction == ForColumns && m_sizingState == RowSizingFirstIteration;
+ direction == ForColumns && (m_sizingState == RowSizingFirstIteration || m_sizingState == RowSizingExtraIterationForSizeContainment);
// To determine the column track's size based on an orthogonal grid item we need it's logical
// height, which may depend on the row track's size. It's possible that the row tracks sizing
// logic has not been performed yet, so we will need to do an estimation.
@@ -736,9 +736,9 @@
Vector<GridTrack>& allTracks = tracks(m_direction);
for (auto& track : allTracks) {
- ASSERT(!track.infiniteGrowthPotential());
+ ASSERT(m_strategy->isComputingSizeContainment() || !track.infiniteGrowthPotential());
m_minContentSize += track.baseSize();
- m_maxContentSize += track.growthLimit();
+ m_maxContentSize += track.growthLimitIsInfinite() ? track.baseSize() : track.growthLimit();
// The growth limit caps must be cleared now in order to properly sort
// tracks by growth potential on an eventual "Maximize Tracks".
track.setGrowthLimitCap(WTF::nullopt);
@@ -932,6 +932,7 @@
double findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection, Optional<LayoutUnit> freeSpace) const override;
bool recomputeUsedFlexFractionIfNeeded(double& flexFraction, LayoutUnit& totalGrowth) const override;
LayoutUnit freeSpaceForStretchAutoTracksStep() const override;
+ bool isComputingSizeContainment() const override { return shouldApplySizeContainment(*renderGrid()); }
};
void IndefiniteSizeStrategy::layoutGridItemForMinSizeComputation(RenderBox& child, bool overrideSizeHasChanged) const
@@ -1030,6 +1031,7 @@
LayoutUnit freeSpaceForStretchAutoTracksStep() const override;
LayoutUnit minContentForChild(RenderBox&) const override;
LayoutUnit minLogicalSizeForChild(RenderBox&, const Length& childMinSize, Optional<LayoutUnit> availableSize) const override;
+ bool isComputingSizeContainment() const override { return false; }
};
LayoutUnit IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep() const
@@ -1146,9 +1148,22 @@
void GridTrackSizingAlgorithm::resolveIntrinsicTrackSizes()
{
+ Vector<GridTrack>& allTracks = tracks(m_direction);
+ auto handleInfinityGrowthLimit = [&]() {
+ for (auto trackIndex : m_contentSizedTracksIndex) {
+ GridTrack& track = allTracks[trackIndex];
+ if (track.growthLimit() == infinity)
+ track.setGrowthLimit(track.baseSize());
+ }
+ };
+
+ if (m_strategy->isComputingSizeContainment()) {
+ handleInfinityGrowthLimit();
+ return;
+ }
+
Vector<GridItemWithSpan> itemsSortedByIncreasingSpan;
HashSet<RenderBox*> itemsSet;
- Vector<GridTrack>& allTracks = tracks(m_direction);
if (m_grid.hasGridItems()) {
for (auto trackIndex : m_contentSizedTracksIndex) {
GridIterator iterator(m_grid, m_direction, trackIndex);
@@ -1178,12 +1193,7 @@
increaseSizesToAccommodateSpanningItems<ResolveMaxContentMaximums>(spanGroupRange);
it = spanGroupRange.rangeEnd;
}
-
- for (auto trackIndex : m_contentSizedTracksIndex) {
- GridTrack& track = allTracks[trackIndex];
- if (track.growthLimit() == infinity)
- track.setGrowthLimit(track.baseSize());
- }
+ handleInfinityGrowthLimit();
}
void GridTrackSizingAlgorithm::stretchFlexibleTracks(Optional<LayoutUnit> freeSpace)
@@ -1239,6 +1249,9 @@
m_sizingState = RowSizingFirstIteration;
return;
case RowSizingFirstIteration:
+ m_sizingState = m_strategy->isComputingSizeContainment() ? RowSizingExtraIterationForSizeContainment : ColumnSizingSecondIteration;
+ return;
+ case RowSizingExtraIterationForSizeContainment:
m_sizingState = ColumnSizingSecondIteration;
return;
case ColumnSizingSecondIteration:
@@ -1259,6 +1272,7 @@
case ColumnSizingSecondIteration:
return m_direction == ForColumns;
case RowSizingFirstIteration:
+ case RowSizingExtraIterationForSizeContainment:
case RowSizingSecondIteration:
return m_direction == ForRows;
}
@@ -1346,6 +1360,8 @@
// Step 3.
m_strategy->maximizeTracks(tracks(m_direction), m_direction == ForColumns ? m_freeSpaceColumns : m_freeSpaceRows);
+ if (m_strategy->isComputingSizeContainment())
+ return;
// Step 4.
stretchFlexibleTracks(initialFreeSpace);
Modified: trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.h (277320 => 277321)
--- trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.h 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.h 2021-05-11 12:49:46 UTC (rev 277321)
@@ -224,6 +224,7 @@
enum SizingState {
ColumnSizingFirstIteration,
RowSizingFirstIteration,
+ RowSizingExtraIterationForSizeContainment,
ColumnSizingSecondIteration,
RowSizingSecondIteration
};
@@ -261,6 +262,7 @@
virtual double findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection, Optional<LayoutUnit> initialFreeSpace) const = 0;
virtual bool recomputeUsedFlexFractionIfNeeded(double& flexFraction, LayoutUnit& totalGrowth) const = 0;
virtual LayoutUnit freeSpaceForStretchAutoTracksStep() const = 0;
+ virtual bool isComputingSizeContainment() const = 0;
protected:
GridTrackSizingAlgorithmStrategy(GridTrackSizingAlgorithm& algorithm)
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -1073,6 +1073,9 @@
r.setNeedsLayout(MarkOnlyThis);
r.layoutIfNeeded();
}
+
+ if (view().frameView().layoutContext().layoutState()->isPaginated() && is<RenderBlockFlow>(*this))
+ downcast<RenderBlockFlow>(*this).adjustSizeContainmentChildForPagination(r, r.logicalTop());
}
void RenderBlock::layoutPositionedObjects(bool relayoutChildren, bool fixedPositionObjectsOnly)
@@ -2282,8 +2285,8 @@
void RenderBlock::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
ASSERT(!childrenInline());
-
- computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth);
+ if (!shouldApplySizeContainment(*this))
+ computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth);
maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth);
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -339,10 +339,12 @@
void RenderBlockFlow::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
- if (childrenInline())
- computeInlinePreferredLogicalWidths(minLogicalWidth, maxLogicalWidth);
- else
- computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth);
+ if (!shouldApplySizeContainment(*this)) {
+ if (childrenInline())
+ computeInlinePreferredLogicalWidths(minLogicalWidth, maxLogicalWidth);
+ else
+ computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth);
+ }
maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth);
@@ -1662,6 +1664,9 @@
}
}
+ if (shouldApplySizeContainment(child))
+ adjustSizeContainmentChildForPagination(child, result);
+
// For replaced elements and scrolled elements, we want to shift them to the next page if they don't fit on the current one.
LayoutUnit logicalTopBeforeUnsplittableAdjustment = result;
LayoutUnit logicalTopAfterUnsplittableAdjustment = adjustForUnsplittableChild(child, result);
@@ -2047,6 +2052,24 @@
return logicalHeightForChild(child);
}
+void RenderBlockFlow::adjustSizeContainmentChildForPagination(RenderBox& child, LayoutUnit offset)
+{
+ if (!shouldApplySizeContainment(child))
+ return;
+
+ LayoutUnit childOverflowHeight = child.isHorizontalWritingMode() ? child.layoutOverflowRect().maxY() : child.layoutOverflowRect().maxX();
+ LayoutUnit childLogicalHeight = std::max(child.logicalHeight(), childOverflowHeight);
+
+ LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(offset, ExcludePageBoundary);
+
+ LayoutUnit spaceShortage = childLogicalHeight - remainingLogicalHeight;
+ if (spaceShortage <= 0)
+ return;
+
+ if (RenderFragmentedFlow* fragmentedFlow = enclosingFragmentedFlow())
+ fragmentedFlow->updateSpaceShortageForSizeContainment(this, offsetFromLogicalTopOfFirstPage() + offset, spaceShortage);
+}
+
void RenderBlockFlow::layoutLineGridBox()
{
if (style().lineGrid() == RenderStyle::initialLineGrid()) {
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.h 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h 2021-05-11 12:49:46 UTC (rev 277321)
@@ -398,6 +398,8 @@
// column balancer to help set a good minimum column height.
void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight);
+ void adjustSizeContainmentChildForPagination(RenderBox& child, LayoutUnit offset);
+
void addFloatsToNewParent(RenderBlockFlow& toBlockFlow) const;
LayoutUnit endPaddingWidthForCaret() const;
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -2860,6 +2860,14 @@
void RenderBox::updateLogicalHeight()
{
+ if (shouldApplySizeContainment(*this) && !isRenderGrid()) {
+ // We need the exact width of border and padding here, yet we can't use borderAndPadding* interfaces.
+ // Because these interfaces evetually call borderAfter/Before, and RenderBlock::borderBefore
+ // adds extra border to fieldset by adding intrinsicBorderForFieldset which is not needed here.
+ auto borderAndPadding = RenderBox::borderBefore() + RenderBox::paddingBefore() + RenderBox::borderAfter() + RenderBox::paddingAfter();
+ setLogicalHeight(borderAndPadding + scrollbarLogicalHeight());
+ }
+
cacheIntrinsicContentLogicalHeightForFlexItem(contentLogicalHeight());
auto computedValues = computeLogicalHeight(logicalHeight(), logicalTop());
setLogicalHeight(computedValues.m_extent);
@@ -4857,7 +4865,8 @@
return isReplaced()
|| hasUnsplittableScrollingOverflow()
|| (parent() && isWritingModeRoot())
- || (isFloating() && style().styleType() == PseudoId::FirstLetter && style().initialLetterDrop() > 0);
+ || (isFloating() && style().styleType() == PseudoId::FirstLetter && style().initialLetterDrop() > 0)
+ || shouldApplySizeContainment(*this);
}
LayoutUnit RenderBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const
Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -187,6 +187,17 @@
void RenderDeprecatedFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
+ auto addScrollbarWidth = [&]() {
+ LayoutUnit scrollbarWidth = intrinsicScrollbarLogicalWidth();
+ maxLogicalWidth += scrollbarWidth;
+ minLogicalWidth += scrollbarWidth;
+ };
+
+ if (shouldApplySizeContainment(*this)) {
+ addScrollbarWidth();
+ return;
+ }
+
if (hasMultipleLines() || isVertical()) {
for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
if (childDoesNotAffectWidthOrFlexing(child))
@@ -211,10 +222,7 @@
}
maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth);
-
- LayoutUnit scrollbarWidth = intrinsicScrollbarLogicalWidth();
- maxLogicalWidth += scrollbarWidth;
- minLogicalWidth += scrollbarWidth;
+ addScrollbarWidth();
}
void RenderDeprecatedFlexibleBox::computePreferredLogicalWidths()
Modified: trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -197,6 +197,8 @@
void RenderFileUploadControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
+ if (shouldApplySizeContainment(*this))
+ return;
// Figure out how big the filename space needs to be for a given number of characters
// (using "0" as the nominal character).
const UChar character = '0';
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -83,6 +83,17 @@
void RenderFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
+ auto addScrollbarWidth = [&]() {
+ LayoutUnit scrollbarWidth(scrollbarLogicalWidth());
+ maxLogicalWidth += scrollbarWidth;
+ minLogicalWidth += scrollbarWidth;
+ };
+
+ if (shouldApplySizeContainment(*this)) {
+ addScrollbarWidth();
+ return;
+ }
+
LayoutUnit childMinWidth;
LayoutUnit childMaxWidth;
bool hadExcludedChildren = computePreferredWidthsForExcludedChildren(childMinWidth, childMaxWidth);
@@ -98,11 +109,11 @@
++numItemsWithNormalLayout;
LayoutUnit margin = marginIntrinsicLogicalWidthForChild(*child);
-
+
LayoutUnit minPreferredLogicalWidth;
LayoutUnit maxPreferredLogicalWidth;
computeChildPreferredLogicalWidths(*child, minPreferredLogicalWidth, maxPreferredLogicalWidth);
-
+
minPreferredLogicalWidth += margin;
maxPreferredLogicalWidth += margin;
@@ -139,9 +150,7 @@
maxLogicalWidth = std::max(maxLogicalWidth, childMaxWidth);
}
- LayoutUnit scrollbarWidth(scrollbarLogicalWidth());
- maxLogicalWidth += scrollbarWidth;
- minLogicalWidth += scrollbarWidth;
+ addScrollbarWidth();
}
LayoutUnit RenderFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode direction, LinePositionMode) const
Modified: trunk/Source/WebCore/rendering/RenderFragmentedFlow.h (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderFragmentedFlow.h 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderFragmentedFlow.h 2021-05-11 12:49:46 UTC (rev 277321)
@@ -102,6 +102,8 @@
virtual void setPageBreak(const RenderBlock*, LayoutUnit /*offset*/, LayoutUnit /*spaceShortage*/) { }
virtual void updateMinimumPageHeight(const RenderBlock*, LayoutUnit /*offset*/, LayoutUnit /*minHeight*/) { }
+ virtual void updateSpaceShortageForSizeContainment(const RenderBlock*, LayoutUnit /*offset*/, LayoutUnit /*shortage*/) { }
+
virtual RenderFragmentContainer* fragmentAtBlockOffset(const RenderBox*, LayoutUnit, bool extendLastFragment = false) const;
bool fragmentsHaveUniformLogicalWidth() const { return m_fragmentsHaveUniformLogicalWidth; }
Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderGrid.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -250,11 +250,17 @@
// 2- Next, the track sizing algorithm resolves the sizes of the grid rows,
// using the grid column sizes calculated in the previous step.
- if (!hasDefiniteLogicalHeight)
+ bool shouldRecomputeHeight = false;
+ if (!hasDefiniteLogicalHeight) {
computeTrackSizesForIndefiniteSize(m_trackSizingAlgorithm, ForRows);
- else
+ if (shouldApplySizeContainment(*this))
+ shouldRecomputeHeight = true;
+ } else
computeTrackSizesForDefiniteSize(ForRows, availableLogicalHeight(ExcludeMarginBorderPadding));
LayoutUnit trackBasedLogicalHeight = m_trackSizingAlgorithm.computeTrackBasedSize() + borderAndPaddingLogicalHeight() + scrollbarLogicalHeight();
+ if (shouldRecomputeHeight)
+ computeTrackSizesForDefiniteSize(ForRows, trackBasedLogicalHeight);
+
setLogicalHeight(trackBasedLogicalHeight);
LayoutUnit oldClientAfterEdge = clientLogicalBottom();
@@ -548,7 +554,7 @@
unsigned firstAutoRepeatTrack = insertionPoint + grid.explicitGridStart(direction);
unsigned lastAutoRepeatTrack = firstAutoRepeatTrack + grid.autoRepeatTracks(direction);
- if (!grid.hasGridItems()) {
+ if (!grid.hasGridItems() || shouldApplySizeContainment(*this)) {
emptyTrackIndexes = makeUnique<OrderedTrackIndexSet>();
for (unsigned trackIndex = firstAutoRepeatTrack; trackIndex < lastAutoRepeatTrack; ++trackIndex)
emptyTrackIndexes->add(trackIndex);
Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderImage.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -850,6 +850,7 @@
void RenderImage::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const
{
+ ASSERT(!shouldApplySizeContainment(*this));
RenderReplaced::computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio);
// Our intrinsicSize is empty if we're rendering generated images with relative width/height. Figure out the right intrinsic size to use.
Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderListBox.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -211,7 +211,7 @@
void RenderListBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
- maxLogicalWidth = m_optionsWidth + 2 * optionsSpacingHorizontal;
+ maxLogicalWidth = shouldApplySizeContainment(*this) ? 2 * optionsSpacingHorizontal : m_optionsWidth + 2 * optionsSpacingHorizontal;
if (m_vBar)
maxLogicalWidth += m_vBar->width();
if (!style().width().isPercentOrCalculated())
Modified: trunk/Source/WebCore/rendering/RenderMenuList.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderMenuList.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderMenuList.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -315,7 +315,8 @@
void RenderMenuList::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
- maxLogicalWidth = std::max(m_optionsWidth, theme().minimumMenuListSize(style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight();
+ maxLogicalWidth = shouldApplySizeContainment(*this) ? theme().minimumMenuListSize(style()) : std::max(m_optionsWidth, theme().minimumMenuListSize(style()));
+ maxLogicalWidth += m_innerBlock->paddingLeft() + m_innerBlock->paddingRight();
if (!style().width().isPercentOrCalculated())
minLogicalWidth = maxLogicalWidth;
}
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -203,6 +203,12 @@
multicolSet->updateMinimumColumnHeight(minHeight);
}
+void RenderMultiColumnFlow::updateSpaceShortageForSizeContainment(const RenderBlock* block, LayoutUnit offset, LayoutUnit shortage)
+{
+ if (auto* multicolSet = downcast<RenderMultiColumnSet>(fragmentAtBlockOffset(block, offset)))
+ multicolSet->updateSpaceShortageForSizeContainment(shortage);
+}
+
RenderFragmentContainer* RenderMultiColumnFlow::fragmentAtBlockOffset(const RenderBox* box, LayoutUnit offset, bool extendLastFragment) const
{
if (!m_inLayout)
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlow.h (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderMultiColumnFlow.h 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlow.h 2021-05-11 12:49:46 UTC (rev 277321)
@@ -108,6 +108,7 @@
LayoutUnit initialLogicalWidth() const override;
void setPageBreak(const RenderBlock*, LayoutUnit offset, LayoutUnit spaceShortage) override;
void updateMinimumPageHeight(const RenderBlock*, LayoutUnit offset, LayoutUnit minHeight) override;
+ void updateSpaceShortageForSizeContainment(const RenderBlock*, LayoutUnit offset, LayoutUnit shortage) override;
RenderFragmentContainer* fragmentAtBlockOffset(const RenderBox*, LayoutUnit, bool extendLastFragment = false) const override;
void setFragmentRangeForBox(const RenderBox&, RenderFragmentContainer*, RenderFragmentContainer*) override;
bool addForcedFragmentBreak(const RenderBlock*, LayoutUnit, RenderBox* breakChild, bool isBefore, LayoutUnit* offsetBreakAdjustment = 0) override;
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -50,6 +50,7 @@
, m_maxColumnHeight(RenderFragmentedFlow::maxLogicalHeight())
, m_minSpaceShortage(RenderFragmentedFlow::maxLogicalHeight())
, m_minimumColumnHeight(0)
+ , m_spaceShortageForSizeContainment(0)
{
}
@@ -235,15 +236,16 @@
return std::max<LayoutUnit>(m_contentRuns[index].columnLogicalHeight(startOffset), m_minimumColumnHeight);
}
+ LayoutUnit sizeContainmentShortage = std::max<LayoutUnit>(LayoutUnit(), m_spaceShortageForSizeContainment);
if (columnCount() <= computedColumnCount()) {
// With the current column height, the content fits without creating overflowing columns. We're done.
- return m_computedColumnHeight;
+ return m_computedColumnHeight + sizeContainmentShortage;
}
if (forcedBreaksCount() >= computedColumnCount()) {
// Too many forced breaks to allow any implicit breaks. Initial balancing should already
// have set a good height. There's nothing more we should do.
- return m_computedColumnHeight;
+ return m_computedColumnHeight + sizeContainmentShortage;
}
// If the initial guessed column height wasn't enough, stretch it now. Stretch by the lowest
@@ -252,9 +254,10 @@
ASSERT(m_minSpaceShortage > 0); // We should never _shrink_ the height!
// ASSERT(m_minSpaceShortage != RenderFragmentedFlow::maxLogicalHeight()); // If this happens, we probably have a bug.
if (m_minSpaceShortage == RenderFragmentedFlow::maxLogicalHeight())
- return m_computedColumnHeight; // So bail out rather than looping infinitely.
+ return m_computedColumnHeight + sizeContainmentShortage; // So bail out rather than looping infinitely.
- return m_computedColumnHeight + m_minSpaceShortage;
+ auto toAdd = std::max<LayoutUnit>(sizeContainmentShortage, m_minSpaceShortage);
+ return m_computedColumnHeight + toAdd;
}
void RenderMultiColumnSet::clearForcedBreaks()
@@ -365,6 +368,8 @@
// Nuke previously stored minimum column height. Contents may have changed for all we know.
m_minimumColumnHeight = 0;
+ m_spaceShortageForSizeContainment = 0;
+
// Start with "infinite" flow thread portion height until height is known.
setLogicalBottomInFragmentedFlow(RenderFragmentedFlow::maxLogicalHeight());
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.h (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.h 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.h 2021-05-11 12:49:46 UTC (rev 277321)
@@ -83,6 +83,15 @@
void updateMinimumColumnHeight(LayoutUnit height) { m_minimumColumnHeight = std::max(height, m_minimumColumnHeight); }
LayoutUnit minimumColumnHeight() const { return m_minimumColumnHeight; }
+ void updateSpaceShortageForSizeContainment(LayoutUnit shortage)
+ {
+ if (m_spaceShortageForSizeContainment <= 0) {
+ m_spaceShortageForSizeContainment = shortage;
+ return;
+ }
+ m_spaceShortageForSizeContainment = std::min(shortage, m_spaceShortageForSizeContainment);
+ }
+
unsigned forcedBreaksCount() const { return m_contentRuns.size(); }
void clearForcedBreaks();
void addForcedBreak(LayoutUnit offsetFromFirstPage);
@@ -198,6 +207,7 @@
LayoutUnit m_maxColumnHeight; // Maximum column height allowed.
LayoutUnit m_minSpaceShortage; // The smallest amout of space shortage that caused a column break.
LayoutUnit m_minimumColumnHeight;
+ LayoutUnit m_spaceShortageForSizeContainment; // The shortage space that keeps size containment monolithic.
// A run of content without explicit (forced) breaks; i.e. a flow thread portion between two
// explicit breaks, between flow thread start and an explicit break, between an explicit break
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -2498,3 +2498,8 @@
{
return renderer.style().containsLayout() && (!renderer.isInline() || renderer.isAtomicInlineLevelBox()) && !renderer.isRubyText() && (!renderer.isTablePart() || renderer.isRenderBlockFlow());
}
+
+bool WebCore::shouldApplySizeContainment(const WebCore::RenderObject& renderer)
+{
+ return renderer.style().containsSize() && (!renderer.isInline() || renderer.isAtomicInlineLevelBox()) && !renderer.isRubyText() && (!renderer.isTablePart() || renderer.isTableCaption()) && !renderer.isTable();
+}
Modified: trunk/Source/WebCore/rendering/RenderObject.h (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderObject.h 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2021-05-11 12:49:46 UTC (rev 277321)
@@ -201,7 +201,7 @@
bool isRenderInline() const;
bool isRenderLayerModelObject() const;
- inline bool isAtomicInlineLevelBox() const;
+ bool isAtomicInlineLevelBox() const;
virtual bool isCounter() const { return false; }
virtual bool isQuote() const { return false; }
@@ -1173,7 +1173,7 @@
return nextSibling;
}
-bool RenderObject::isAtomicInlineLevelBox() const
+inline bool RenderObject::isAtomicInlineLevelBox() const
{
return style().isDisplayInlineType() && !(style().display() == DisplayType::Inline && !isReplaced());
}
@@ -1187,6 +1187,7 @@
#endif
bool shouldApplyLayoutContainment(const RenderObject&);
+bool shouldApplySizeContainment(const RenderObject&);
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderReplaced.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -391,7 +391,9 @@
void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* contentRenderer, FloatSize& constrainedSize, double& intrinsicRatio) const
{
FloatSize intrinsicSize;
- if (contentRenderer) {
+ if (shouldApplySizeContainment(*this))
+ RenderReplaced::computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio);
+ else if (contentRenderer) {
contentRenderer->computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio);
if (style().aspectRatioType() == AspectRatioType::Ratio || (style().aspectRatioType() == AspectRatioType::AutoAndRatio && !intrinsicRatio))
@@ -496,7 +498,7 @@
void RenderReplaced::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const
{
// If there's an embeddedContentBox() of a remote, referenced document available, this code-path should never be used.
- ASSERT(!embeddedContentBox());
+ ASSERT(!embeddedContentBox() || shouldApplySizeContainment(*this));
intrinsicSize = FloatSize(intrinsicLogicalWidth(), intrinsicLogicalHeight());
if (style().hasAspectRatio()) {
Modified: trunk/Source/WebCore/rendering/RenderReplaced.h (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderReplaced.h 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderReplaced.h 2021-05-11 12:49:46 UTC (rev 277321)
@@ -40,7 +40,12 @@
bool hasReplacedLogicalHeight() const;
bool setNeedsLayoutIfNeededAfterIntrinsicSizeChange();
- LayoutSize intrinsicSize() const final { return m_intrinsicSize; }
+ LayoutSize intrinsicSize() const final
+ {
+ if (shouldApplySizeContainment(*this))
+ return LayoutSize();
+ return m_intrinsicSize;
+ }
RoundedRect roundedContentBoxRect() const;
Modified: trunk/Source/WebCore/rendering/RenderSlider.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderSlider.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderSlider.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -69,6 +69,8 @@
void RenderSlider::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
+ if (shouldApplySizeContainment(*this))
+ return;
maxLogicalWidth = defaultTrackLength * style().effectiveZoom();
if (!style().width().isPercentOrCalculated())
minLogicalWidth = maxLogicalWidth;
Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderTextControl.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -156,6 +156,8 @@
void RenderTextControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
+ if (shouldApplySizeContainment(*this))
+ return;
// Use average character width. Matches IE.
maxLogicalWidth = preferredContentLogicalWidth(const_cast<RenderTextControl*>(this)->getAverageCharWidth());
if (RenderBox* innerTextRenderBox = innerTextElement()->renderBox())
Modified: trunk/Source/WebCore/rendering/RenderVideo.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/RenderVideo.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/RenderVideo.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -123,6 +123,9 @@
LayoutSize RenderVideo::calculateIntrinsicSize()
{
+ if (shouldApplySizeContainment(*this))
+ return LayoutSize();
+
// Spec text from 4.8.6
//
// The intrinsic width of a video element's playback area is the intrinsic width
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (277320 => 277321)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2021-05-11 12:49:46 UTC (rev 277321)
@@ -527,6 +527,7 @@
bool hasAspectRatio() const { return aspectRatioType() == AspectRatioType::Ratio || aspectRatioType() == AspectRatioType::AutoAndRatio; }
OptionSet<Containment> contain() const { return m_rareNonInheritedData->contain; }
bool containsLayout() const { return m_rareNonInheritedData->contain.contains(Containment::Layout); }
+ bool containsSize() const { return m_rareNonInheritedData->contain.contains(Containment::Size); }
BoxAlignment boxAlign() const { return static_cast<BoxAlignment>(m_rareNonInheritedData->deprecatedFlexibleBox->align); }
BoxDirection boxDirection() const { return static_cast<BoxDirection>(m_inheritedFlags.boxDirection); }
float boxFlex() const { return m_rareNonInheritedData->deprecatedFlexibleBox->flex; }
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (277320 => 277321)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2021-05-11 12:24:00 UTC (rev 277320)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2021-05-11 12:49:46 UTC (rev 277321)
@@ -70,6 +70,8 @@
void RenderSVGRoot::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const
{
+ ASSERT(!shouldApplySizeContainment(*this));
+
// Spec: http://www.w3.org/TR/SVG/coords.html#IntrinsicSizing
// SVG needs to specify how to calculate some intrinsic sizing properties to enable inclusion within other languages.