Commit c0c54ad1 authored by leviw@chromium.org's avatar leviw@chromium.org

[SVG] Use element disappears after scripted change

https://bugs.webkit.org/show_bug.cgi?id=74392

Reviewed by Eric Seidel.

Source/WebCore:

Solution uncovered by Nikolas Zimmermann. Removing an early return that caused
SVGUseElements to not update the shadow root's style, and therefor not render
correctly.

Test: svg/custom/use-disappears-after-style-update.svg

* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::didRecalcStyle):

LayoutTests:

* platform/mac-snowleopard/svg/custom/use-disappears-after-style-update-expected.png: Added.
* platform/mac-snowleopard/svg/custom/use-disappears-after-style-update-expected.txt: Added.
* svg/custom/use-disappears-after-style-update.svg: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107005 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 76f68c9e
2012-02-07 Levi Weintraub <leviw@chromium.org>
[SVG] Use element disappears after scripted change
https://bugs.webkit.org/show_bug.cgi?id=74392
Reviewed by Eric Seidel.
* platform/mac-snowleopard/svg/custom/use-disappears-after-style-update-expected.png: Added.
* platform/mac-snowleopard/svg/custom/use-disappears-after-style-update-expected.txt: Added.
* svg/custom/use-disappears-after-style-update.svg: Added.
2012-02-07 Levi Weintraub <leviw@chromium.org>
unicode-bidi:plaintext is supposed to be effective on display:inline elements too
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 300x400
RenderSVGRoot {svg} at (10,10) size 76x36
RenderSVGHiddenContainer {defs} at (0,0) size 0x0
RenderSVGResourceFilter {filter} [id="simple"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
[feOffset dx="0.00" dy="0.00"]
[SourceGraphic]
RenderSVGRect {rect} at (0,10) size 30x30 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=10.00] [width=30.00] [height=30.00]
RenderSVGContainer {g} at (10,10) size 76x36
RenderSVGContainer {use} at (10,10) size 30x30
RenderSVGContainer {g} at (10,10) size 30x30 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,0.00)}]
RenderSVGRect {rect} at (10,10) size 30x30 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=10.00] [width=30.00] [height=30.00]
RenderSVGContainer {use} at (50,10) size 36x36
[filter="simple"] RenderSVGResourceFilter {filter} at (50,10) size 36x36
RenderSVGContainer {g} at (50,10) size 30x30 [transform={m=((1.00,0.00)(0.00,1.00)) t=(50.00,0.00)}]
RenderSVGRect {rect} at (50,10) size 30x30 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=10.00] [width=30.00] [height=30.00]
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
style="width:300px;height:400px">
<!-- This tests filters failing to refresh after the initial rendering
(https://bugs.webkit.org/show_bug.cgi?id=53088).
There should be two green squares in the output. -->
<defs>
<filter id="simple" x="0" y="0">
<feOffset in="SourceGraphic" dx="0" dy="0" />
</filter>
<rect id="rect" width="30" y="10" height="30" fill="red" />
</defs>
<g>
<use xlink:href="#rect" x="10" />
<use filter="url(#simple)" xlink:href="#rect" x="50" />
</g>
<script><![CDATA[
var elements = ['rect'];
for (var i=0; i<elements.length; ++i) {
elements[i] = document.getElementById(elements[i]);
}
setTimeout(wait, 0);
function wait() {
// Single timeout doesn't seem to wait for the initial painting, wait again.
setTimeout(change, 0);
}
function change() {
for (var i=0; i<elements.length; ++i) {
elements[i].setAttribute('fill', 'green');
}
if (window.layoutTestController) {
// Let it repaint and get screenshot.
setTimeout("layoutTestController.notifyDone()", 0);
}
}
if (window.layoutTestController) {
layoutTestController.waitUntilDone();
}
]]></script>
</svg>
2012-02-07 Levi Weintraub <leviw@chromium.org>
[SVG] Use element disappears after scripted change
https://bugs.webkit.org/show_bug.cgi?id=74392
Reviewed by Eric Seidel.
Solution uncovered by Nikolas Zimmermann. Removing an early return that caused
SVGUseElements to not update the shadow root's style, and therefor not render
correctly.
Test: svg/custom/use-disappears-after-style-update.svg
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::didRecalcStyle):
2012-02-07 Kentaro Hara <haraken@chromium.org>
Rename [v8OnProto] IDL attribute to [V8OnProto] IDL attribute
......@@ -358,17 +358,12 @@ void SVGUseElement::didRecalcStyle(StyleChange change)
if (!shadowRoot)
return;
bool needsStyleUpdate = !m_needsShadowTreeRecreation;
if (m_needsShadowTreeRecreation) {
shadowRoot->markShadowTreeForRecreation();
m_needsShadowTreeRecreation = false;
}
shadowRoot->updateFromElement();
if (!needsStyleUpdate)
return;
shadowRoot->updateStyle(change);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment