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
Percent width/height SVG not always scaled on window resize
https://bugs.webkit.org/show_bug.cgi?id=79490 Patch by Florin Malita <fmalita@google.com> on 2012-02-28 Reviewed by Nikolas Zimmermann. Source/WebCore: Tests: fast/repaint/percent-minheight-resize-expected.html fast/repaint/percent-minheight-resize.html svg/custom/svg-percent-scale-expected.html svg/custom/svg-percent-scale-vonly-expected.html svg/custom/svg-percent-scale-vonly.html svg/custom/svg-percent-scale.html Fix a couple of problems preventing correct SVG scaling on window resize: - RenderReplaced::computePreferredLogicalWidths is not SVG attribute aware and computes a non-zero m_minPreferredLogicalWidth even when the SVG widh/height are percentages. - RenderBlock::layoutInlineChildren is also not SVG attribute aware and does not trigger percent height child layouts on vertical-only resizes. * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlock::layoutInlineChildren): Use hasRelativeDimensions() instead of direct width/height->isPercent tests. This also fixes an HTML issue where percent {min,max}Height inline elements are not updated on vertical-only resizes. * rendering/RenderBox.cpp: (WebCore::RenderBox::hasRelativeDimensions): (WebCore): * rendering/RenderBox.h: (RenderBox): Add virtual hasRelativeDimensions() method. * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::computePreferredLogicalWidths): Use hasRelativeDimensions() instead of direct width/height->isPercent tests. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::computeReplacedLogicalHeight): (WebCore::RenderSVGRoot::willBeDestroyed): Register percent-height SVG elements with the gPercentHeightDescendantsMap, and clean-up on destruction or height unit change. (WebCore::RenderSVGRoot::hasRelativeDimensions): (WebCore): * rendering/svg/RenderSVGRoot.h: (RenderSVGRoot): SVG-aware hasRelativeDimensions() override. LayoutTests: * fast/repaint/percent-minheight-resize-expected.html: Added. * fast/repaint/percent-minheight-resize.html: Added. * svg/custom/svg-percent-scale-expected.html: Added. * svg/custom/svg-percent-scale-vonly-expected.html: Added. * svg/custom/svg-percent-scale-vonly.html: Added. * svg/custom/svg-percent-scale.html: Added. Canonical link: https://commits.webkit.org/96865@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@109104 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
19a9f05
commit 32f5e81
Showing
14 changed files
with
229 additions
and
6 deletions.
There are no files selected for viewing
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
16 changes: 16 additions & 0 deletions
16
LayoutTests/fast/repaint/percent-minheight-resize-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,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="resources/repaint.js"></script> | ||
</head> | ||
|
||
<body style="margin: 0; padding: 0; overflow: hidden;" onload="runRepaintTest()"> | ||
<div style="width: 100px; height: 100px; background-color: green; position: absolute;"></div> | ||
|
||
<script> | ||
function repaintTest() { | ||
window.resizeBy(0, -window.innerHeight / 2); | ||
} | ||
</script> | ||
</body> | ||
</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,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="resources/repaint.js"></script> | ||
</head> | ||
|
||
<body style="margin: 0; padding: 0; overflow: hidden;" onload="runRepaintTest()"> | ||
<div style="width: 100%; height: 100%; position: absolute;"> | ||
<!-- After window resizing, this DIV element should not be visible --> | ||
<div style="width: 100px; min-height: 33%; background-color: red; display: inline-block;"></div> | ||
</div> | ||
|
||
<div style="width: 100px; height: 100px; background-color: green; position: absolute;"></div> | ||
|
||
<script> | ||
function repaintTest() { | ||
window.resizeBy(0, -window.innerHeight / 2); | ||
} | ||
</script> | ||
</body> | ||
</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,20 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../fast/repaint/resources/repaint.js"></script> | ||
</head> | ||
|
||
<body style="margin: 0; padding: 0; overflow: hidden;" onload="runRepaintTest()"> | ||
<div style="width: 100%; height: 100%; position: absolute;"> | ||
<svg width="200" height="150" xmlns="http://www.w3.org/2000/svg"> | ||
<rect fill="green" width="100%" height="100%"/> | ||
</svg> | ||
</div> | ||
|
||
<script> | ||
function repaintTest() { | ||
window.resizeTo(window.innerWidth / 2, window.innerHeight / 2); | ||
} | ||
</script> | ||
</body> | ||
</html> |
16 changes: 16 additions & 0 deletions
16
LayoutTests/svg/custom/svg-percent-scale-vonly-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,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../fast/repaint/resources/repaint.js"></script> | ||
</head> | ||
|
||
<body style="margin: 0; padding: 0; overflow: hidden;" onload="runRepaintTest()"> | ||
<div style="width: 100px; height: 100px; position: absolute; background-color: green;"></div> | ||
|
||
<script> | ||
function repaintTest() { | ||
window.resizeBy(0, -window.innerHeight / 2); | ||
} | ||
</script> | ||
</body> | ||
</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,27 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../fast/repaint/resources/repaint.js"></script> | ||
</head> | ||
|
||
<body style="margin: 0; padding: 0; overflow: hidden;" onload="runRepaintTest()"> | ||
|
||
<div style="width: 100%; height: 100%; position: absolute; align: left;"> | ||
<!-- After vertical window resizing, this SVG element should not be visible --> | ||
<svg width="50%" height="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600"> | ||
<rect fill="red" width="200" height="200"></rect> | ||
</svg> | ||
|
||
<!-- force an anonymous block creation to exercise the percent-height descendants map --> | ||
<div></div> | ||
</div> | ||
|
||
<div style="width: 100px; height: 100px; position: absolute; background-color: green;"></div> | ||
|
||
<script> | ||
function repaintTest() { | ||
window.resizeBy(0, -window.innerHeight / 2); | ||
} | ||
</script> | ||
</body> | ||
</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,28 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../fast/repaint/resources/repaint.js"></script> | ||
</head> | ||
|
||
<body style="margin: 0; padding: 0; overflow: hidden;" onload="runRepaintTest()"> | ||
|
||
<div style="width: 100%; height: 100%; position: absolute;"> | ||
<!-- After window resizing, this SVG element should not be visible --> | ||
<svg width="50%" height="50%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600"> | ||
<rect fill="red" width="800" height="600"></rect> | ||
</svg> | ||
</div> | ||
|
||
<div style="width: 100%; height: 100%; position: absolute;"> | ||
<svg width="200" height="150" xmlns="http://www.w3.org/2000/svg"> | ||
<rect fill="green" width="100%" height="100%"/> | ||
</svg> | ||
</div> | ||
|
||
<script> | ||
function repaintTest() { | ||
window.resizeTo(window.innerWidth / 2, window.innerHeight / 2); | ||
} | ||
</script> | ||
</body> | ||
</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
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
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