Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Compute the correct overflow-x and overflow-y values for table elements
https://bugs.webkit.org/show_bug.cgi?id=252422 rdar://problem/105850323 Reviewed by Antti Koivisto. This patch is to align WebKit with Chromium / Blink and Firefox / Gecko. Inspired & Test Merge: https://src.chromium.org/viewvc/blink?view=revision&revision=199640 This patch is to align WebKit to respect web-specification[1] & [2], which tells us that display:table must treat anything other than hidden as visible and if overflow-x and overflow-y are different, how they must be resolved. This latter part is already taken care of, we're just allowing it to be applied to tables and table parts now. Additionally, it allows us to have consolidated logic and simplify our code. [1] https://drafts.csswg.org/css2/#overflow [2] https://drafts.csswg.org/css-overflow-3/#propdef-overflow-x * Source/WebCore/style/StyleAdjuster.cpp: (isOverflowClipOrVisible): New static 'bool' helper function (Adjuster::adjust): Update handling of "overflow-x" and "overflow-y" align with spec and interop with other engines and simplify code with comments * LayoutTests/fast/table/table-different-overflow-values.html: Add Test Case * LayoutTests/fast/table/table-different-overflow-values-expected.txt: Add Test Case Expectation * LayoutTests/fast/table/table-different-overflow-values-2.html: Add Test Case * LayoutTests/fast/table/table-different-overflow-values-2-expected.txt: Add Test Case Expectation * LayoutTests/fast/table/overflowScroll.html: Add Test Case * LayoutTests/fast/table/overflowScroll-expected.html: Add Test Case Expectation * LayoutTests/fast/table/overflowScroll-display-block.html: Add Test Case * LayoutTests/fast/table/overflowScroll-display-block-expected.html: Add Test Case Expectation * LayoutTests/imported/w3c/web-platform-tests/mathml/relations/css-styling/overflow/computed-value-001-expected.txt: Rebaselined Canonical link: https://commits.webkit.org/266560@main
- Loading branch information
1 parent
9809c1a
commit e6264ae
Showing
10 changed files
with
263 additions
and
29 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
LayoutTests/fast/table/overflowScroll-display-block-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<style> | ||
div | ||
{ | ||
margin-bottom: 35px; | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
</style> | ||
<div style="overflow: scroll;"> | ||
</div> | ||
<div style="overflow: scroll;"> | ||
</div> | ||
<div style="overflow: scroll;"> | ||
</div> | ||
<p> crbug.com/368699: When table elements have display: block, they should be allowed to have overflow:scroll. The exception is the table element, which doesn't permit anything other than visible per http://dev.w3.org/csswg/css2/visufx.html#overflow.</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<style> | ||
.scrollingElement | ||
{ | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
overflow: scroll; | ||
display: block; | ||
} | ||
table | ||
{ | ||
margin-bottom: 35px; | ||
} | ||
</style> | ||
<table class="scrollingElement" cellspacing=0> | ||
<tbody> | ||
<tr><td></td></tr> | ||
</tbody> | ||
</table> | ||
<table cellspacing=0> | ||
<tbody class="scrollingElement"> | ||
<tr><td></td></tr> | ||
</tbody> | ||
</table> | ||
<table cellspacing=0> | ||
<tbody> | ||
<tr class="scrollingElement"><td></td></tr> | ||
</tbody> | ||
</table> | ||
<p> crbug.com/368699: When table elements have display: block, they should be allowed to have overflow:scroll. The exception is the table element, which doesn't permit anything other than visible per http://dev.w3.org/csswg/css2/visufx.html#overflow.</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<style> | ||
.scrollingElement | ||
{ | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
table | ||
{ | ||
margin-bottom: 35px; | ||
} | ||
</style> | ||
<table class="scrollingElement" cellspacing=0> | ||
<tbody> | ||
<tr><td> text text text text</td></tr> | ||
</tbody> | ||
</table> | ||
<table cellspacing=0> | ||
<tbody class="scrollingElement"> | ||
<tr><td> text text text text</td></tr> | ||
</tbody> | ||
</table> | ||
<table cellspacing=0> | ||
<tbody> | ||
<tr class="scrollingElement"><td>text text text text</td></tr> | ||
</tbody> | ||
</table> | ||
<p> crbug.com/368699: Tables, table rows and table sections don't have scrollbars when they have overflow:scroll. </p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<style> | ||
.scrollingElement | ||
{ | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
table | ||
{ | ||
margin-bottom: 35px; | ||
} | ||
</style> | ||
<table class="scrollingElement" cellspacing=0> | ||
<tbody> | ||
<tr><td> text text text text</td></tr> | ||
</tbody> | ||
</table> | ||
<table cellspacing=0> | ||
<tbody class="scrollingElement"> | ||
<tr><td> text text text text</td></tr> | ||
</tbody> | ||
</table> | ||
<table cellspacing=0> | ||
<tbody> | ||
<tr class="scrollingElement"><td>text text text text</td></tr> | ||
</tbody> | ||
</table> | ||
<p> crbug.com/368699: Tables, table rows and table sections don't have scrollbars when they have overflow:scroll. </p> |
22 changes: 22 additions & 0 deletions
22
LayoutTests/fast/table/table-different-overflow-values-2-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
This test checks for overflow equality. If overflow-x is visible then overflow-y should be visible as well. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS table1: overflow-x is either not visible or both overflow values are visible. | ||
PASS table2: overflow-x is either not visible or both overflow values are visible. | ||
PASS table3: overflow-x is either not visible or both overflow values are visible. | ||
PASS inline_table1: overflow-x is either not visible or both overflow values are visible. | ||
PASS inline_table2: overflow-x is either not visible or both overflow values are visible. | ||
PASS inline_table3: overflow-x is either not visible or both overflow values are visible. | ||
PASS tbody1: overflow-x is either not visible or both overflow values are visible. | ||
PASS tbody2: overflow-x is either not visible or both overflow values are visible. | ||
PASS tbody3: overflow-x is either not visible or both overflow values are visible. | ||
PASS tr1: overflow-x is either not visible or both overflow values are visible. | ||
PASS tr2: overflow-x is either not visible or both overflow values are visible. | ||
PASS tr3: overflow-x is either not visible or both overflow values are visible. | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
||
|
36 changes: 36 additions & 0 deletions
36
LayoutTests/fast/table/table-different-overflow-values-2.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<script src="../../resources/js-test.js"></script> | ||
<!-- For tables. --> | ||
<table id="table1" class="test" style="overflow-y: visible; overflow-x: auto"/> | ||
<table id="table2" class="test" style="overflow-y: visible; overflow-x: scroll"/> | ||
<table id="table3" class="test" style="overflow-y: visible; overflow-x: hidden"/> | ||
<!-- For inline tables. --> | ||
<table id="inline_table1" class="test" style="overflow-y: visible; overflow-x: auto; display: inline-table;"/> | ||
<table id="inline_table2" class="test" style="overflow-y: visible; overflow-x: scroll; display: inline-table;"/> | ||
<table id="inline_table3" class="test" style="overflow-y: visible; overflow-x: hidden; display: inline-table;"/> | ||
<!-- For table row groups. --> | ||
<table> | ||
<tbody id="tbody1" class="test" style="overflow-y: visible; overflow-x: auto"/> | ||
<tbody id="tbody2" class="test" style="overflow-y: visible; overflow-x: scroll"/> | ||
<tbody id="tbody3" class="test" style="overflow-y: visible; overflow-x: hidden"/> | ||
</table> | ||
<!-- For table rows. --> | ||
<table> | ||
<tr id="tr1" class="test" style="overflow-y: visible; overflow-x: auto"/> | ||
<tr id="tr2" class="test" style="overflow-y: visible; overflow-x: scroll"/> | ||
<tr id="tr3" class="test" style="overflow-y: visible; overflow-x: hidden"/> | ||
</table> | ||
<script> | ||
description("This test checks for overflow equality. If overflow-x is visible then overflow-y should be visible as well."); | ||
var elements = document.getElementsByClassName("test"); | ||
for (i = 0; i < elements.length; ++i) | ||
{ | ||
computedStyle = getComputedStyle(elements[i]); | ||
overflowX = computedStyle.getPropertyValue('overflow-x'); | ||
overflowY = computedStyle.getPropertyValue('overflow-y'); | ||
if (overflowX == "visible" && overflowX != overflowY) | ||
testFailed(elements[i].id + ": overflow-y should be visible. Was " + overflowY + "."); | ||
else | ||
testPassed(elements[i].id + ": overflow-x is either not visible or both overflow values are visible."); | ||
} | ||
</script> |
22 changes: 22 additions & 0 deletions
22
LayoutTests/fast/table/table-different-overflow-values-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
This test checks for overflow equality. If overflow-x is visible then overflow-y should be visible as well. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS table1: overflow-x is either not visible or both overflow values are visible. | ||
PASS table2: overflow-x is either not visible or both overflow values are visible. | ||
PASS table3: overflow-x is either not visible or both overflow values are visible. | ||
PASS inline_table1: overflow-x is either not visible or both overflow values are visible. | ||
PASS inline_table2: overflow-x is either not visible or both overflow values are visible. | ||
PASS inline_table3: overflow-x is either not visible or both overflow values are visible. | ||
PASS tbody1: overflow-x is either not visible or both overflow values are visible. | ||
PASS tbody2: overflow-x is either not visible or both overflow values are visible. | ||
PASS tbody3: overflow-x is either not visible or both overflow values are visible. | ||
PASS tr1: overflow-x is either not visible or both overflow values are visible. | ||
PASS tr2: overflow-x is either not visible or both overflow values are visible. | ||
PASS tr3: overflow-x is either not visible or both overflow values are visible. | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
||
|
36 changes: 36 additions & 0 deletions
36
LayoutTests/fast/table/table-different-overflow-values.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<script src="../../resources/js-test.js"></script> | ||
<!-- For tables. --> | ||
<table id="table1" class="test" style="overflow-x: visible; overflow-y: auto"/> | ||
<table id="table2" class="test" style="overflow-x: visible; overflow-y: scroll"/> | ||
<table id="table3" class="test" style="overflow-x: visible; overflow-y: hidden"/> | ||
<!-- For inline tables. --> | ||
<table id="inline_table1" class="test" style="overflow-x: visible; overflow-y: auto; display: inline-table;"/> | ||
<table id="inline_table2" class="test" style="overflow-x: visible; overflow-y: scroll; display: inline-table;"/> | ||
<table id="inline_table3" class="test" style="overflow-x: visible; overflow-y: hidden; display: inline-table;"/> | ||
<!-- For table row groups. --> | ||
<table> | ||
<tbody id="tbody1" class="test" style="overflow-x: visible; overflow-y: auto"/> | ||
<tbody id="tbody2" class="test" style="overflow-x: visible; overflow-y: scroll"/> | ||
<tbody id="tbody3" class="test" style="overflow-x: visible; overflow-y: hidden"/> | ||
</table> | ||
<!-- For table rows. --> | ||
<table> | ||
<tr id="tr1" class="test" style="overflow-x: visible; overflow-y: auto"/> | ||
<tr id="tr2" class="test" style="overflow-x: visible; overflow-y: scroll"/> | ||
<tr id="tr3" class="test" style="overflow-x: visible; overflow-y: hidden"/> | ||
</table> | ||
<script> | ||
description("This test checks for overflow equality. If overflow-x is visible then overflow-y should be visible as well."); | ||
var elements = document.getElementsByClassName("test"); | ||
for (i = 0; i < elements.length; ++i) | ||
{ | ||
computedStyle = getComputedStyle(elements[i]); | ||
overflowX = computedStyle.getPropertyValue('overflow-x'); | ||
overflowY = computedStyle.getPropertyValue('overflow-y'); | ||
if (overflowX == "visible" && overflowX != overflowY) | ||
testFailed(elements[i].id + ": overflow-y should be visible. Was " + overflowY + "."); | ||
else | ||
testPassed(elements[i].id + ": overflow-x is either not visible or both overflow values are visible."); | ||
} | ||
</script> |
2 changes: 1 addition & 1 deletion
2
.../web-platform-tests/mathml/relations/css-styling/overflow/computed-value-001-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters