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
Display property as specified on svg elements
https://bugs.webkit.org/show_bug.cgi?id=257267 Reviewed by Tim Nguyen. This patch aligns WebKit with Blink / Chromium and Gecko / Firefox. Merge: https://src.chromium.org/viewvc/blink?view=revision&revision=177649 The computed display of svg elements should be as for other elements. For svg:svg elements, they should behave as other replaced elements when styled with inline-block, table-cell, etc. For svg elements inside the root svg element, they still get a computed value for display as other elements, although the rendering is the same for all display values different from 'none'. Also, this change makes it possible to remove the custom style building for display. NOTE: We still need to add special handling of '<g>' etc., for display type content and have FIXME in 'StyleAdjuster.cpp'. * Source/WebCore/css/CSSProperties.json: * Source/WebCore/style/StyleBuilderCustom.h: Remove 'isValidDisplayValue' (BuilderCustom::isValidDisplayValue): Removed (BuilderCustom::applyInheritDisplay): Removed (BuilderCustom::applyValueDisplay): Removed * LayoutTests/svg/css/display-computed.html: Add Test Case * LayoutTests/svg/css/display-computed-expected.txt: Add Test Case Expectation * LayoutTests/svg/css/display.html: Add Test Case * LayoutTests/svg/css/display-expected.html: Add Test Case Expectation * LayoutTests/imported/w3c/web-platform-tests/css/css-display/display-contents-svg-anchor-child-expected.txt: Rebaselined * LayoutTests/platform/glib/imported/w3c/web-platform-tests/svg/import/masking-path-12-f-manual-expected.txt: Rebaselined * LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/svg/imp…/masking-path-12-f-manual-expected.txt: Rebaselined * LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/masking-path-12-f-manual-expected.txt: Rebaselined Canonical link: https://commits.webkit.org/264627@main
- Loading branch information
1 parent
b7a6d9a
commit 86a5ffe
Showing
10 changed files
with
112 additions
and
28 deletions.
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1
...ted/w3c/web-platform-tests/css/css-display/display-contents-svg-anchor-child-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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
Text | ||
|
||
PASS Loading this page should not cause a crash. | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
|
||
PASS svg:svg display inline | ||
PASS svg:g display inline | ||
PASS svg:svg display block | ||
PASS svg:g display block | ||
PASS svg:svg display inline-block | ||
PASS svg:g display inline-block | ||
PASS svg:svg display inline-table | ||
PASS svg:g display inline-table | ||
PASS svg:svg display table | ||
PASS svg:g display table | ||
PASS svg:svg display table-cell | ||
PASS svg:g display table-cell | ||
PASS svg:svg display contents computes to none | ||
FAIL svg:g display contents computes to contents assert_equals: expected "contents" but got "none" | ||
|
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/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<style> | ||
svg { width: 0; height: 0; } | ||
#t1, #t1 g { display: inline } | ||
#t2, #t2 g { display: block; } | ||
#t3, #t3 g { display: inline-block; } | ||
#t4, #t4 g { display: inline-table; } | ||
#t5, #t5 g { display: table; } | ||
#t6, #t6 g { display: table-cell; } | ||
#t7, #t7 g { display: contents; } | ||
</style> | ||
<svg id="t1"><g/></svg> | ||
<svg id="t2"><g/></svg> | ||
<svg id="t3"><g/></svg> | ||
<svg id="t4"><g/></svg> | ||
<svg id="t5"><g/></svg> | ||
<svg id="t6"><g/></svg> | ||
<svg id="t7"><g/></svg> | ||
<script> | ||
test(function(){ assert_equals(getComputedStyle(document.querySelector("#t1")).display, "inline"); }, "svg:svg display inline"); | ||
test(function(){ assert_equals(getComputedStyle(document.querySelector("#t1 g")).display, "inline"); }, "svg:g display inline"); | ||
test(function(){ assert_equals(getComputedStyle(document.querySelector("#t2")).display, "block"); }, "svg:svg display block"); | ||
test(function(){ assert_equals(getComputedStyle(document.querySelector("#t2 g")).display, "block"); }, "svg:g display block"); | ||
test(function(){ assert_equals(getComputedStyle(document.querySelector("#t3")).display, "inline-block"); }, "svg:svg display inline-block"); | ||
test(function(){ assert_equals(getComputedStyle(document.querySelector("#t3 g")).display, "inline-block"); }, "svg:g display inline-block"); | ||
test(function(){ assert_equals(getComputedStyle(document.querySelector("#t4")).display, "inline-table"); }, "svg:svg display inline-table"); | ||
test(function(){ assert_equals(getComputedStyle(document.querySelector("#t4 g")).display, "inline-table"); }, "svg:g display inline-table"); | ||
test(function(){ assert_equals(getComputedStyle(document.querySelector("#t5")).display, "table"); }, "svg:svg display table"); | ||
test(function(){ assert_equals(getComputedStyle(document.querySelector("#t5 g")).display, "table"); }, "svg:g display table"); | ||
test(function(){ assert_equals(getComputedStyle(document.querySelector("#t6")).display, "table-cell"); }, "svg:svg display table-cell"); | ||
test(function(){ assert_equals(getComputedStyle(document.querySelector("#t6 g")).display, "table-cell"); }, "svg:g display table-cell"); | ||
test(function(){ assert_equals(getComputedStyle(document.querySelector("#t7")).display, "none"); }, "svg:svg display contents computes to none"); | ||
test(function(){ assert_equals(getComputedStyle(document.querySelector("#t7 g")).display, "contents"); }, "svg:g display contents computes to contents"); | ||
</script> |
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> | ||
img { | ||
width: 20px; | ||
height: 20px; | ||
background: green; | ||
} | ||
|
||
.table { display: table } | ||
|
||
#t1 { display: inline } | ||
#t2 { display: block; } | ||
#t3 { display: inline-block; } | ||
#t4 { display: inline-table; } | ||
#t5 { display: table; } | ||
#t6 { display: table-cell; } | ||
#t7, #t8 { display: none; } | ||
</style> | ||
<img id="t1" src="../../css2.1/support/1x1-transparent.png"> | ||
<img id="t2" src="../../css2.1/support/1x1-transparent.png"> | ||
<img id="t3" src="../../css2.1/support/1x1-transparent.png"> | ||
<img id="t4" src="../../css2.1/support/1x1-transparent.png"> | ||
<img id="t5" src="../../css2.1/support/1x1-transparent.png"> | ||
<div class="table"> | ||
| ||
<img id="t6" src="../../css2.1/support/1x1-transparent.png"> | ||
</div> | ||
<img id="t7" src="../../css2.1/support/1x1-transparent.png"> | ||
Inline content <img id="t8" src="../../css2.1/support/1x1-transparent.png"> |
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> | ||
svg { | ||
width: 20px; | ||
height: 20px; | ||
background: green; | ||
} | ||
|
||
.table { display: table } | ||
|
||
#t1 { display: inline } | ||
#t2 { display: block; } | ||
#t3 { display: inline-block; } | ||
#t4 { display: inline-table; } | ||
#t5 { display: table; } | ||
#t6 { display: table-cell; } | ||
#t7, #t8 { display: contents; } | ||
</style> | ||
<svg id="t1"></svg> | ||
<svg id="t2"></svg> | ||
<svg id="t3"></svg> | ||
<svg id="t4"></svg> | ||
<svg id="t5"></svg> | ||
<div class="table"> | ||
| ||
<svg id="t6"></svg> | ||
</div> | ||
<svg id="t7"></svg> | ||
Inline content <svg id="t8"></svg> |
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