Bug 1077993 - make changes to clip-rule work. r=jwatt

This commit is contained in:
Robert Longson 2014-10-06 14:19:14 +01:00
Родитель a735b7135f
Коммит 45c6ebc582
3 изменённых файлов: 48 добавлений и 6 удалений

Просмотреть файл

@ -0,0 +1,32 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" class="reftest-wait">
<title>Testcase for dynamic changes to clip-rule</title>
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=1077993 -->
<script>
function doTest() {
document.getElementById("p2").setAttribute("style", "clip-rule: winding;");
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest, false);
window.setTimeout(doTest, 4000); // fallback for running outside reftest
</script>
<defs>
<clipPath id="p2" style="clip-rule:evenodd">
<path
d="M100,50 l0,150 50,0 0,-100 -100,0 0,50 150,0 0,-50 -50,0 0,-50 z"/>
</clipPath>
</defs>
<rect width="100%" height="100%" fill="lime"/>
<path fill-rule="winding" fill="red"
d="M100,50 l0,150 50,0 0,-100 -100,0 0,50 150,0 0,-50 -50,0 0,-50 z"/>
<rect width="100%" height="100%" fill="lime" clip-path="url(#p2)"/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

@ -60,6 +60,9 @@ fuzzy-if(/^Windows\x20NT\x206\.[12]/.test(http.oscpu),1,5) fuzzy-if(azureQuartz,
== dynamic-attr-removal-2.svg pass.svg
== dynamic-attr-change-1.svg pass.svg
== dynamic-class-01.svg pass.svg
fuzzy-if(Android,4,87) == dynamic-clipPath-01.svg pass.svg
== dynamic-clipPath-02.svg pass.svg
== dynamic-clipPath-clip-rule-01.svg pass.svg
== dynamic-conditions-01.svg pass.svg
== dynamic-conditions-02.svg about:blank
== dynamic-conditions-03.svg pass.svg
@ -73,8 +76,6 @@ fuzzy-if(/^Windows\x20NT\x206\.[12]/.test(http.oscpu),1,5) fuzzy-if(azureQuartz,
== dynamic-conditions-11.svg pass.svg
== dynamic-conditions-12.svg pass.svg
== dynamic-conditions-13.svg about:blank
fuzzy-if(Android,4,87) == dynamic-clipPath-01.svg pass.svg
== dynamic-clipPath-02.svg pass.svg
== dynamic-feFlood-01.svg pass.svg
asserts(0-1) == dynamic-feImage-01.svg pass.svg # intermittent assertions (bug 886080)
== dynamic-fill-01.svg dynamic-fill-01-ref.svg

Просмотреть файл

@ -171,10 +171,19 @@ nsSVGPathGeometryFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
// decides whether or not to insert little lines into the path for zero
// length subpaths base on that property.
element->ClearAnyCachedPath();
} else if (StyleSVG()->mFillRule !=
aOldStyleContext->PeekStyleSVG()->mFillRule) {
// Moz2D Path objects are fill-rule specific.
element->ClearAnyCachedPath();
} else if (GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) {
if (StyleSVG()->mClipRule !=
aOldStyleContext->PeekStyleSVG()->mClipRule) {
// Moz2D Path objects are fill-rule specific.
// For clipPath we use clip-rule as the path's fill-rule.
element->ClearAnyCachedPath();
}
} else {
if (StyleSVG()->mFillRule !=
aOldStyleContext->PeekStyleSVG()->mFillRule) {
// Moz2D Path objects are fill-rule specific.
element->ClearAnyCachedPath();
}
}
}
}