Bug 378923 - Make non-root outer-<svg> respect |overflow:visible| (overflow="visible"). r=roc

This commit is contained in:
Jonathan Watt 2013-05-24 17:56:26 +01:00
parent be5a9d6aef
commit dcc3e40184
12 changed files with 172 additions and 1 deletions

View File

@ -0,0 +1,7 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<svg xmlns="http://www.w3.org/2000/svg">
<rect width="100" height="100" fill="blue"/>
</svg>

After

Width:  |  Height:  |  Size: 213 B

View File

@ -0,0 +1,11 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<svg xmlns="http://www.w3.org/2000/svg"
style="overflow:visible;"
width="100" height="100">
<title>Test that we always clip root-&lt;svg&gt; regardless of 'overflow'</title>
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=378923 -->
<rect width="100%" height="100%" fill="blue"/>
</svg>

After

Width:  |  Height:  |  Size: 428 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<div style="background-color: blue; width: 100px; height: 100px;"></div>
</body>
</html>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test that non-root outer-&lt;svg&gt; clips for overflow="auto"</title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"
overflow="auto">
<rect x="-50" y="-50" width="200" height="200" fill="blue"/>
</svg>
</body>
</html>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test that non-root outer-&lt;svg&gt; clips for overflow="scroll"</title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"
overflow="scroll">
<rect x="-50" y="-50" width="200" height="200" fill="blue"/>
</svg>
</body>
</html>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test that non-root outer-&lt;svg&gt; clips for overflow="hidden"</title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"
overflow="hidden">
<rect x="-50" y="-50" width="200" height="200" fill="blue"/>
</svg>
</body>
</html>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html xmlns="http://www.w3.org/1999/xhtml"
class="reftest-wait">
<head>
<title>Test that non-root outer-&lt;svg&gt; repaints correctly changing to overflow="hidden"</title>
<script>
function doTest() {
document.getElementById("svg").setAttribute("overflow", "hidden");
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest, false);
setTimeout(doTest, 4000); // fallback for running outside reftest
</script>
</head>
<body>
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="100" height="100"
overflow="visible">
<rect x="-50" y="-50" width="200" height="200" fill="blue"/>
</svg>
</body>
</html>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<div style="background-color: blue; transform: translate(-50px, -50px); width: 200px; height: 200px;"></div>
</body>
</html>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test that non-root outer-&lt;svg&gt; clips for overflow="auto"</title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"
overflow="visible">
<rect x="-50" y="-50" width="200" height="200" fill="blue"/>
</svg>
</body>
</html>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html xmlns="http://www.w3.org/1999/xhtml"
class="reftest-wait">
<head>
<title>Test that non-root outer-&lt;svg&gt; repaints correctly changing to overflow="visible"</title>
<script>
function doTest() {
document.getElementById("svg").setAttribute("overflow", "visible");
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest, false);
setTimeout(doTest, 4000); // fallback for running outside reftest
</script>
</head>
<body>
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="100" height="100"
overflow="hidden">
<rect x="-50" y="-50" width="200" height="200" fill="blue"/>
</svg>
</body>
</html>

View File

@ -216,6 +216,13 @@ skip-if(d2d) == opacity-and-gradient-02.svg opacity-and-gradient-02-ref.svg
== opacity-and-pattern-01.svg pass.svg
== opacity-and-transform-01.svg opacity-and-transform-01-ref.svg
== outer-svg-border-and-padding-01.svg outer-svg-border-and-padding-01-ref.svg
== overflow-on-outer-svg-01.svg overflow-on-outer-svg-01-ref.svg
== overflow-on-outer-svg-02a.xhtml overflow-on-outer-svg-02-ref.xhtml
== overflow-on-outer-svg-02b.xhtml overflow-on-outer-svg-02-ref.xhtml
== overflow-on-outer-svg-02c.xhtml overflow-on-outer-svg-02-ref.xhtml
== overflow-on-outer-svg-02d.xhtml overflow-on-outer-svg-02-ref.xhtml
== overflow-on-outer-svg-03a.xhtml overflow-on-outer-svg-03-ref.xhtml
== overflow-on-outer-svg-03b.xhtml overflow-on-outer-svg-03-ref.xhtml
pref(svg.paint-order.enabled,true) == paint-order-01.svg paint-order-01-ref.svg
pref(svg.paint-order.enabled,true) == paint-order-02.svg paint-order-02-ref.svg
pref(svg.paint-order.enabled,true) == paint-order-03.svg paint-order-03-ref.svg

View File

@ -765,7 +765,13 @@ nsSVGOuterSVGFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
DisplayBorderBackgroundOutline(aBuilder, aLists);
DisplayListClipState::AutoClipContainingBlockDescendantsToContentBox clip(aBuilder, this);
// Per-spec, we always clip root-<svg> even when 'overflow' has its initial
// value of 'visible'. See also the "visual overflow" comments in Reflow.
DisplayListClipState::AutoSaveRestore autoSR(aBuilder);
if (mIsRootContent ||
StyleDisplay()->IsScrollableOverflow()) {
autoSR.ClipContainingBlockDescendantsToContentBox(aBuilder, this);
}
if ((aBuilder->IsForEventDelivery() &&
NS_SVGDisplayListHitTestingEnabled()) ||