haikuwebkit/LayoutTests/svg/filters/feImage-target-add-to-docum...

25 lines
1000 B
XML
Raw Permalink Normal View History

<feImage> DOM mutation problems https://bugs.webkit.org/show_bug.cgi?id=77198 Reviewed by Antti Koivisto. Source/WebCore: Consider <feImage xlink:href="#rect"/>, where <rect> gets dynamically added to the tree. Currently <feImage> doesn't notice this, as it doesn't register itself pending on "#rect". Integrate <feImage> properly within the pending resources concept, fixing the bug. Tests: svg/filters/feImage-target-add-to-document.svg svg/filters/feImage-target-changes-id.svg svg/filters/feImage-target-id-change.svg svg/filters/feImage-target-reappend-to-document.svg svg/filters/feImage-target-remove-from-document.svg * svg/SVGFEImageElement.cpp: Rename invalidateImageResource to clearResourceReferences. (WebCore::SVGFEImageElement::~SVGFEImageElement): Call clearResourceReferences. (WebCore::SVGFEImageElement::clearResourceReferences): Remove any occurence of m_targetImage, it's no longer used. (WebCore::SVGFEImageElement::requestImageResource): requestImageResource is now called by buildPendingResource. (WebCore::SVGFEImageElement::buildPendingResource): Called whenever any element that we depend on gets resolved - now invalidates the <filter>. (WebCore::SVGFEImageElement::parseMappedAttribute): Don't start loading from parseMappedAttribute. (WebCore::SVGFEImageElement::svgAttributeChanged): Start loading from here, for consistency with SVGImageElement. (WebCore::SVGFEImageElement::insertedIntoDocument): Invoke buildPendingResource(), if we enter the tree. (WebCore::SVGFEImageElement::removedFromDocument): Clear m_cachedImage as soon as we get removed from the tree. (WebCore::SVGFEImageElement::build): Clean up this function, m_targetImage is no longer exist. * svg/SVGFEImageElement.h: Remove OwnPtr<ImageBuffer> m_targetImage, which is no longer used. LayoutTests: Add new test cases covering <feImage> + DOM mutations. * platform/chromium/test_expectations.txt: Updated expectations. * svg/filters/feImage-target-add-to-document-expected.png: Added. * svg/filters/feImage-target-add-to-document-expected.txt: Added. * svg/filters/feImage-target-add-to-document.svg: Added. * svg/filters/feImage-target-changes-id-expected.png: Added. * svg/filters/feImage-target-changes-id-expected.txt: Added. * svg/filters/feImage-target-changes-id.svg: Added. * svg/filters/feImage-target-id-change-expected.png: Added. * svg/filters/feImage-target-id-change-expected.txt: Added. * svg/filters/feImage-target-id-change.svg: Added. * svg/filters/feImage-target-reappend-to-document-expected.png: Added. * svg/filters/feImage-target-reappend-to-document-expected.txt: Added. * svg/filters/feImage-target-reappend-to-document.svg: Added. * svg/filters/feImage-target-remove-from-document-expected.png: Added. * svg/filters/feImage-target-remove-from-document-expected.txt: Added. * svg/filters/feImage-target-remove-from-document.svg: Added. Canonical link: https://commits.webkit.org/94088@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106110 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-01-27 12:56:21 +00:00
<?xml version="1.0" encoding="UTF-8"?>
SVGLoad event fires too early https://bugs.webkit.org/show_bug.cgi?id=78084 Reviewed by Hajime Morita. Source/WebCore: SVGLoad event fires too early, making it impossible to use the vanilla repaint.js harness (runRepaintTest). We're using a hack called runSVGRepaintTest() at the moment in trunk, which runs runRepaintTest() from a 0ms timer, which is not reliable. The main difference between HTML onload and SVG onload is that HTMLs event is a "window event", thus dispatched through DOMWindow (eg. <body onload="alert(event.target)" will yield Document, <svg onload="alert(evt.target)"> will say SVGSVGElement). Consider: <svg onload="alert('1')> <g onload="alert('2)"> <rect onload="alert('3')"/> </svg> As soon as the <rect> finishes parsing (SVGElement::finishedParsingChildren), it's SVGLoad event is fired. So first you'll see '3', then '2', then '1'. Using: <svg onload="alert('1')> <g onload="alert('2)"> <image xlink:href="someExternal.jpg" onload="alert('3')"/> </svg> will yield the same SVGLoad order. When using <image externalREsourcesRequired="true", first the '1' will fire, then '3', then '2', all as expected and specified in SVG. http://www.w3.org/TR/SVG/interact.html#LoadEvent says: "The event is triggered at the point at which the user agent has fully parsed the element and its descendants and is ready to act appropriately upon that element, such as being ready to render the element to the target device. Referenced external resources that are required must be loaded, parsed and ready to render before the event is triggered. Optional external resources are not required to be ready for the event to be triggered." What we don't implement correctly is the second part of the first sentence: "and is ready to act appropriately upon that element, such as being ready to render the element to the target device". We currently fire the SVGLoad event, right after </svg> is seen, if no externalResourceRequired="true" attributes are set anywhere. This is not wrong, but not correct for WebKit, as we're not yet "ready to render". HTML fires its window onload event from Document::implicitClose(), where it calls Document::dispatchWindowLoadEvent. At this point we're ready to render. So I'm now aligning the timing of the outermost <svg> elements SVGLoad event, to be equal to HTML. This lets use use the repaint.js harness w/o any special SVG tricks. Covered by existing tests. * dom/Document.cpp: (WebCore::Document::implicitClose): Dispatch SVGLoad event for outermost <svg> elements from here, as HTML does for its window onload event. * svg/SVGDocumentExtensions.cpp: (WebCore::SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements): Sends a SVGLoad event to all outermost <svg> elements in a document, if possible. There can be multiple ones, if using <svg><foreignObject><svg>... - the <svg> in the <fO> also acts as outermost <svg> element. * svg/SVGDocumentExtensions.h: Add new dispatchSVGLoadEventToOutermostSVGElements() helper. * svg/SVGElement.cpp: (WebCore::SVGElement::isOutermostSVGSVGElement): Moved from SVGSVGElement into SVGElement, and renamed from isOutermostSVG(). (WebCore::SVGElement::sendSVGLoadEventIfPossible): Don't dispatch load events to outermost <svg> elements, if Document::implicitClose() wasn't called yet. (WebCore::SVGElement::finishParsingChildren): Stop using the default SVGLoad dispatching logic for outermost <svg> elements. * svg/SVGElement.h: Add isOutermostSVGSVGElement(). * svg/SVGSVGElement.cpp: Rename isOutermostSVG to isOutermostSVGSVGElement. (WebCore::SVGSVGElement::currentScale): (WebCore::SVGSVGElement::setCurrentScale): (WebCore::SVGSVGElement::localCoordinateSpaceTransform): (WebCore::SVGSVGElement::createRenderer): * svg/SVGSVGElement.h: Move isOutermostSVG() to SVGElement. * svg/SVGStyledElement.cpp: (WebCore::SVGStyledElement::title): Rename isOutermostSVG to isOutermostSVGSVGElement. LayoutTests: Remove runSVGRepaintTest() from repaint.js again, and convert all *.svg tests to use runRepaintTest() directly. This is now possible as the outermost <svg> elements load event timing as aligned with HTML. * fast/repaint/resources/repaint.js: Remove runSVGRepaintTest(), it's no longer needed. (runRepaintTest): s/document.rootElement/document.documentElement/ to make it work for all HTML/XHTML and SVG documents (XHTML was broken). * platform/chromium/test_expectations.txt: * platform/mac/svg/custom/SVGPoint-matrixTransform-expected.png: * platform/mac/svg/custom/SVGPoint-matrixTransform-expected.txt: * platform/mac/svg/custom/getTransformToElement-expected.png: * platform/mac/svg/custom/getTransformToElement-expected.txt: * platform/mac/svg/custom/polyline-setattribute-points-null-expected.png: * platform/mac/svg/custom/polyline-setattribute-points-null-expected.txt: * platform/mac/svg/custom/text-ctm-expected.png: * platform/mac/svg/custom/text-ctm-expected.txt: * platform/mac/svg/custom/text-hit-test-expected.png: * platform/mac/svg/custom/text-hit-test-expected.txt: * platform/mac/svg/filters/filter-refresh-expected.png: * svg/carto.net/tabgroup.svg: * svg/carto.net/window.svg: * svg/css/shadow-changes.svg: * svg/custom/loadevents-externalresourcesrequired.svg: * svg/dom/SVGPathSegList-segment-modification.svg: * svg/dom/SVGPathSegList-xml-dom-synchronization2.xhtml: * svg/dom/SVGRectElement/rect-modify-rx.svg: * svg/filters/animate-fill.svg: * svg/filters/feImage-reference-invalidation.svg: * svg/filters/feImage-target-add-to-document.svg: * svg/filters/feImage-target-changes-id.svg: * svg/filters/feImage-target-id-change.svg: * svg/filters/feImage-target-reappend-to-document.svg: * svg/filters/feImage-target-remove-from-document.svg: * svg/filters/filter-refresh.svg: * svg/filters/filter-width-update.svg: * svg/filters/invalidate-on-child-layout.svg: * svg/hixie/perf/001.xml: * svg/hixie/perf/002.xml: * svg/hixie/perf/003.xml: * svg/hixie/perf/004.xml: * svg/hixie/perf/005.xml: * svg/hixie/perf/006.xml: * svg/hixie/perf/007.xml: * svg/repaint/container-repaint.svg: * svg/repaint/filter-child-repaint.svg: * svg/repaint/image-href-change.svg: * svg/repaint/image-with-clip-path.svg: * svg/text/text-text-05-t.svg: * svg/zoom/page/absolute-sized-document-no-scrollbars.svg: * svg/zoom/page/absolute-sized-document-scrollbars.svg: * svg/zoom/page/relative-sized-document-scrollbars.svg: * svg/zoom/page/zoom-coords-viewattr-01-b.svg: * svg/zoom/page/zoom-foreignObject.svg: * svg/zoom/page/zoom-mask-with-percentages.svg: * svg/zoom/resources/testPageZoom.js: (repaintTest): * svg/zoom/text/absolute-sized-document-no-scrollbars.svg: * svg/zoom/text/absolute-sized-document-scrollbars.svg: * svg/zoom/text/relative-sized-document-scrollbars.svg: * svg/zoom/text/zoom-coords-viewattr-01-b.svg: * svg/zoom/text/zoom-foreignObject.svg: Canonical link: https://commits.webkit.org/94969@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107057 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-08 10:21:49 +00:00
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
Rewrite SVG tests to make extensive use of display() in repaint tests https://bugs.webkit.org/show_bug.cgi?id=77736 Reviewed by Andreas Kling. Convert all tests in svg/ (except svg/custom & svg/dynamic-updates) that exercise repainting to use the fast/repaint/resources/repaint.js harness, which forces a layout, and calls layoutTestController.display() before executing the actual repaint test, so that repaint rectangles are properly tracked and shown (white areas that are redrawn, on top of the gray background, painted over the web view after the initial painting). Previously SVG tests used to work like this: (using an HTML example, but it doesn't matter) <html><body><svg><rect/><script>function change() { rect.setAttribute(...); layoutTestController.notifyDone(); } setTimeout(change, 0); </script></svg></body></html> We expected that the initial painting was done, before change() as called. This is unreliable for various reasons: - the timeout is not guaranteed to fire after the document loaded, it may happen inbetween on eg. a slow connection. - nor is it guaranteed that the document has painted initially before we enter change(). This leads to the current regressions -- if we break repainting, we can't see it in the current layout tests, as the initial painting always happens after change() executed in trunk, at least on a fast machine. In order to make repaint testing reliable we have to use following scheme: <html><body onload="runRepaintTest()"><svg><rect/><script>function repaintTest() { rect.setAttribute(...); }</script></svg></body></html> runRepaintTest() is provided by the repaint.js harness and does: if (window.layoutTestController) { document.body.offsetTop; layoutTestController.display(); repaintTest(); } else { setTimeout(repaintTest, 100); } Using this harness outside of DRT allows to test SVG repainting tests in the browser as well, as the repainting changes aren't immediately fired (0ms timer) but instead delayed by 100ms, so a visual "flash" is visible, if something changes. For DRT it does two things. First it forces Document::updateLayout() to be called, and then forces the web view to paint immediately, and then it starts tracking any repaint rects, that are fired _after_ the initial painting, which are then highlighted in the pixel test dump later on. Using display() is the only way to get reliable painting results across DRT/WebKitTestRunner, and to get rid of the flakiness. All *.xml/*.html/*.htm/*.xhtml tests which excersise repainting can be moved to use runRepaintTest() from repaint.js. <body> needs to be changed to <body onload="runRepaintTest()">, and the timeouts & waitUntilDone/notifyDone calls can be removed from the tests, leading to much nicer testcases, removing lots of boilerplate. Pure *.svg tests unfortunately can't use <svg onload="runRepaintTest()"> at the moment, due timing differences between the HTML load and the SVGLoad event, that's out of scope for this bug report. To remove any hacks from the testcases themselves, I centralized following work-around in a new function in repaint.js, and let all *.svg tests use it. function runSVGRepaintTest() { if (window.layoutTestController) { layoutTestController.waitUntilDone(); setTimeout(runRepaintTest, 0); } else runRepaintTest(); } runRepaintTest() has to be called from a timer at the moment, as the SVGLoad event fires earlier as HTML load event. Before that is fixed, we have to use <svg onload="runSVGRepaintTest()"> instead of <svg onload="runRepaintTest()"> and append: layoutTestController.notifyDone() to the repaintTest() functions in the testcases. That should explain the testcase differences between pure-SVG and non-pure-SVG tests, and why I treated them differently. This approach is unfortunately as flakey as the old, so to make pure *.svg tests test repainting reliable, the bug needs to be fixed. Note that svg/custom, and svg/dynamic-updates will be fixed in another chunk, as they also require large amounts of rebaselines. * fast/repaint/resources/repaint.js: (runRepaintTest): (runSVGRepaintTest): * platform/chromium/test_expectations.txt: * platform/mac/svg/as-background-image/animated-svg-as-background-expected.png: * platform/mac/svg/as-image/animated-svg-as-image-expected.png: * platform/mac/svg/as-image/animated-svg-as-image-no-fixed-intrinsic-size-expected.png: * platform/mac/svg/as-image/animated-svg-as-image-same-image-expected.png: * platform/mac/svg/as-image/svg-image-change-content-size-expected.png: * platform/mac/svg/as-object/deep-nested-embedded-svg-size-changes-no-layout-triggers-1-expected.png: * platform/mac/svg/as-object/deep-nested-embedded-svg-size-changes-no-layout-triggers-1-expected.txt: * platform/mac/svg/as-object/deep-nested-embedded-svg-size-changes-no-layout-triggers-2-expected.png: * platform/mac/svg/as-object/deep-nested-embedded-svg-size-changes-no-layout-triggers-2-expected.txt: * platform/mac/svg/as-object/embedded-svg-immediate-offsetWidth-query-expected.png: * platform/mac/svg/as-object/embedded-svg-size-changes-expected.png: * platform/mac/svg/as-object/embedded-svg-size-changes-no-layout-triggers-expected.png: * platform/mac/svg/as-object/embedded-svg-size-changes-no-layout-triggers-expected.txt: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-expected.png: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-1-expected.png: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-1-expected.txt: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-2-expected.png: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-2-expected.txt: * platform/mac/svg/carto.net/tabgroup-expected.png: * platform/mac/svg/carto.net/tabgroup-expected.txt: * platform/mac/svg/carto.net/window-expected.png: * platform/mac/svg/carto.net/window-expected.txt: * platform/mac/svg/css/shadow-changes-expected.png: * platform/mac/svg/dom/SVGPathSegList-segment-modification-expected.png: * platform/mac/svg/dom/SVGPathSegList-segment-modification-expected.txt: * platform/mac/svg/dom/SVGPathSegList-xml-dom-synchronization-expected.png: * platform/mac/svg/dom/SVGPathSegList-xml-dom-synchronization2-expected.png: * platform/mac/svg/dom/SVGRectElement/rect-modify-rx-expected.png: * platform/mac/svg/filters/filter-refresh-expected.png: * platform/mac/svg/filters/filter-width-update-expected.png: * platform/mac/svg/filters/filter-width-update-expected.txt: * platform/mac/svg/filters/invalidate-on-child-layout-expected.png: * platform/mac/svg/hixie/perf/001-expected.png: * platform/mac/svg/hixie/perf/002-expected.png: * platform/mac/svg/hixie/perf/003-expected.png: * platform/mac/svg/hixie/perf/003-expected.txt: * platform/mac/svg/hixie/perf/004-expected.png: * platform/mac/svg/hixie/perf/004-expected.txt: * platform/mac/svg/hixie/perf/005-expected.png: * platform/mac/svg/hixie/perf/005-expected.txt: * platform/mac/svg/hixie/perf/006-expected.png: * platform/mac/svg/hixie/perf/006-expected.txt: * platform/mac/svg/hixie/perf/007-expected.png: * platform/mac/svg/hixie/perf/007-expected.txt: * platform/mac/svg/repaint/filter-child-repaint-expected.png: * platform/mac/svg/repaint/image-href-change-expected.png: * platform/mac/svg/repaint/image-with-clip-path-expected.png: * platform/mac/svg/text/append-text-node-to-tspan-expected.png: * platform/mac/svg/text/modify-text-node-in-tspan-expected.png: * platform/mac/svg/text/remove-text-node-from-tspan-expected.png: * platform/mac/svg/text/remove-tspan-from-text-expected.png: * platform/mac/svg/text/text-text-05-t-expected.png: * platform/mac/svg/text/text-text-05-t-expected.txt: * platform/mac/svg/transforms/animated-path-inside-transformed-html-expected.png: * platform/mac/svg/zoom/page/absolute-sized-document-no-scrollbars-expected.png: * platform/mac/svg/zoom/page/relative-sized-document-scrollbars-expected.png: * platform/mac/svg/zoom/page/zoom-background-images-expected.txt: * platform/mac/svg/zoom/page/zoom-foreignObject-expected.png: * platform/mac/svg/zoom/page/zoom-hixie-mixed-008-expected.txt: * platform/mac/svg/zoom/page/zoom-hixie-rendering-model-004-expected.png: * platform/mac/svg/zoom/page/zoom-hixie-rendering-model-004-expected.txt: * platform/mac/svg/zoom/page/zoom-mask-with-percentages-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-background-with-relative-size-and-viewBox-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-background-with-relative-size-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-image-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-object-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-relative-image-expected.png: * platform/mac/svg/zoom/page/zoom-svg-through-object-with-auto-size-expected.txt: * platform/mac/svg/zoom/page/zoom-svg-through-object-with-override-size-expected.txt: * platform/mac/svg/zoom/text/absolute-sized-document-no-scrollbars-expected.png: * platform/mac/svg/zoom/text/absolute-sized-document-scrollbars-expected.png: * platform/mac/svg/zoom/text/relative-sized-document-scrollbars-expected.png: * platform/mac/svg/zoom/text/zoom-foreignObject-expected.png: * platform/mac/svg/zoom/text/zoom-hixie-mixed-008-expected.png: * platform/mac/svg/zoom/text/zoom-hixie-mixed-008-expected.txt: * platform/mac/svg/zoom/text/zoom-hixie-mixed-009-expected.png: * platform/mac/svg/zoom/text/zoom-hixie-rendering-model-004-expected.png: * platform/mac/svg/zoom/text/zoom-hixie-rendering-model-004-expected.txt: * svg/as-background-image/animated-svg-as-background.html: * svg/as-background-image/resources/animated-rect-relative-size.svg: * svg/as-background-image/svg-as-background-5.html: * svg/as-background-image/svg-background-partial-redraw.html: * svg/as-image/animated-svg-as-image-no-fixed-intrinsic-size.html: * svg/as-image/animated-svg-as-image-same-image.html: * svg/as-image/animated-svg-as-image.html: * svg/as-image/resources/animated-rect-fixed-size-2.svg: Copied from LayoutTests/svg/as-image/resources/animated-rect-same-image.svg. * svg/as-image/resources/animated-rect-fixed-size.svg: * svg/as-image/resources/animated-rect-relative-size.svg: * svg/as-image/resources/animated-rect-same-image.svg: * svg/as-image/svg-image-change-content-size.xhtml: * svg/as-object/embedded-svg-immediate-offsetWidth-query.html: * svg/as-object/embedded-svg-size-changes-no-layout-triggers.html: * svg/as-object/embedded-svg-size-changes.html: * svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-1.html: * svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-2.html: * svg/as-object/nested-embedded-svg-size-changes.html: * svg/as-object/resources/embedded-svg-size-changes-no-layout-triggers.svg: * svg/as-object/resources/nested-embedded-svg-size-changes-target-no-layout-triggers-1.html: * svg/carto.net/tabgroup.svg: * svg/carto.net/window.svg: * svg/css/shadow-changes.svg: * svg/dom/SVGPathSegList-segment-modification.svg: * svg/dom/SVGPathSegList-xml-dom-synchronization.xhtml: * svg/dom/SVGPathSegList-xml-dom-synchronization2.xhtml: * svg/dom/SVGRectElement/rect-modify-rx.svg: * svg/filters/animate-fill-expected.png: * svg/filters/animate-fill.svg: * svg/filters/feImage-reference-invalidation-expected.png: * svg/filters/feImage-reference-invalidation.svg: * svg/filters/feImage-target-add-to-document-expected.png: * svg/filters/feImage-target-add-to-document.svg: * svg/filters/feImage-target-changes-id-expected.png: * svg/filters/feImage-target-changes-id.svg: * svg/filters/feImage-target-id-change-expected.png: * svg/filters/feImage-target-id-change.svg: * svg/filters/feImage-target-reappend-to-document-expected.png: * svg/filters/feImage-target-reappend-to-document.svg: * svg/filters/feImage-target-remove-from-document-expected.png: * svg/filters/feImage-target-remove-from-document.svg: * svg/filters/filter-refresh.svg: * svg/filters/filter-width-update.svg: * svg/filters/invalidate-on-child-layout.svg: * svg/hixie/perf/001.xml: * svg/hixie/perf/002.xml: * svg/hixie/perf/003.xml: * svg/hixie/perf/004.xml: * svg/hixie/perf/005.xml: * svg/hixie/perf/006.xml: * svg/hixie/perf/007.xml: * svg/hixie/perf/resources/smallcats.gif: Added. * svg/repaint/container-repaint-expected.png: * svg/repaint/container-repaint.svg: * svg/repaint/filter-child-repaint.svg: * svg/repaint/image-href-change.svg: * svg/repaint/image-with-clip-path.svg: * svg/text/append-text-node-to-tspan.html: * svg/text/modify-text-node-in-tspan.html: * svg/text/remove-text-node-from-tspan.html: * svg/text/remove-tspan-from-text.html: * svg/text/text-text-05-t.svg: * svg/transforms/animated-path-inside-transformed-html.xhtml: * svg/zoom/page/absolute-sized-document-no-scrollbars.svg: * svg/zoom/page/absolute-sized-document-scrollbars.svg: * svg/zoom/page/relative-sized-document-scrollbars.svg: * svg/zoom/page/zoom-background-image-tiled.html: * svg/zoom/page/zoom-background-images.html: * svg/zoom/page/zoom-coords-viewattr-01-b.svg: * svg/zoom/page/zoom-foreignObject.svg: * svg/zoom/page/zoom-getBoundingClientRect.xhtml: * svg/zoom/page/zoom-hixie-mixed-008.xml: * svg/zoom/page/zoom-hixie-mixed-009.xml: * svg/zoom/page/zoom-hixie-rendering-model-004.xhtml: * svg/zoom/page/zoom-img-preserveAspectRatio-support-1.html: * svg/zoom/page/zoom-mask-with-percentages.svg: * svg/zoom/page/zoom-replaced-intrinsic-ratio-001.htm: * svg/zoom/page/zoom-svg-as-background-with-relative-size-and-viewBox.html: * svg/zoom/page/zoom-svg-as-background-with-relative-size.html: * svg/zoom/page/zoom-svg-as-image.html: * svg/zoom/page/zoom-svg-as-object.html: * svg/zoom/page/zoom-svg-as-relative-image.html: * svg/zoom/page/zoom-svg-float-border-padding.xml: * svg/zoom/page/zoom-svg-through-object-with-absolute-size-2.xhtml: * svg/zoom/page/zoom-svg-through-object-with-absolute-size.xhtml: * svg/zoom/page/zoom-svg-through-object-with-auto-size.html: * svg/zoom/page/zoom-svg-through-object-with-huge-size.xhtml: * svg/zoom/page/zoom-svg-through-object-with-override-size.html: * svg/zoom/page/zoom-svg-through-object-with-percentage-size.xhtml: * svg/zoom/page/zoom-svg-through-object-with-text.xhtml-disabled: * svg/zoom/page/zoom-zoom-coords.xhtml: * svg/zoom/resources/testPageZoom.js: (repaintTest): * svg/zoom/resources/testTextZoom.js: (repaintTest): * svg/zoom/text/absolute-sized-document-no-scrollbars.svg: * svg/zoom/text/absolute-sized-document-scrollbars.svg: * svg/zoom/text/relative-sized-document-scrollbars.svg: * svg/zoom/text/zoom-coords-viewattr-01-b.svg: * svg/zoom/text/zoom-foreignObject.svg: * svg/zoom/text/zoom-hixie-mixed-008.xml: * svg/zoom/text/zoom-hixie-mixed-009.xml: * svg/zoom/text/zoom-hixie-rendering-model-004.xhtml: * svg/zoom/text/zoom-svg-float-border-padding.xml: Canonical link: https://commits.webkit.org/94836@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106918 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-07 11:19:19 +00:00
<script xlink:href="../../fast/repaint/resources/repaint.js"></script>
<feImage> DOM mutation problems https://bugs.webkit.org/show_bug.cgi?id=77198 Reviewed by Antti Koivisto. Source/WebCore: Consider <feImage xlink:href="#rect"/>, where <rect> gets dynamically added to the tree. Currently <feImage> doesn't notice this, as it doesn't register itself pending on "#rect". Integrate <feImage> properly within the pending resources concept, fixing the bug. Tests: svg/filters/feImage-target-add-to-document.svg svg/filters/feImage-target-changes-id.svg svg/filters/feImage-target-id-change.svg svg/filters/feImage-target-reappend-to-document.svg svg/filters/feImage-target-remove-from-document.svg * svg/SVGFEImageElement.cpp: Rename invalidateImageResource to clearResourceReferences. (WebCore::SVGFEImageElement::~SVGFEImageElement): Call clearResourceReferences. (WebCore::SVGFEImageElement::clearResourceReferences): Remove any occurence of m_targetImage, it's no longer used. (WebCore::SVGFEImageElement::requestImageResource): requestImageResource is now called by buildPendingResource. (WebCore::SVGFEImageElement::buildPendingResource): Called whenever any element that we depend on gets resolved - now invalidates the <filter>. (WebCore::SVGFEImageElement::parseMappedAttribute): Don't start loading from parseMappedAttribute. (WebCore::SVGFEImageElement::svgAttributeChanged): Start loading from here, for consistency with SVGImageElement. (WebCore::SVGFEImageElement::insertedIntoDocument): Invoke buildPendingResource(), if we enter the tree. (WebCore::SVGFEImageElement::removedFromDocument): Clear m_cachedImage as soon as we get removed from the tree. (WebCore::SVGFEImageElement::build): Clean up this function, m_targetImage is no longer exist. * svg/SVGFEImageElement.h: Remove OwnPtr<ImageBuffer> m_targetImage, which is no longer used. LayoutTests: Add new test cases covering <feImage> + DOM mutations. * platform/chromium/test_expectations.txt: Updated expectations. * svg/filters/feImage-target-add-to-document-expected.png: Added. * svg/filters/feImage-target-add-to-document-expected.txt: Added. * svg/filters/feImage-target-add-to-document.svg: Added. * svg/filters/feImage-target-changes-id-expected.png: Added. * svg/filters/feImage-target-changes-id-expected.txt: Added. * svg/filters/feImage-target-changes-id.svg: Added. * svg/filters/feImage-target-id-change-expected.png: Added. * svg/filters/feImage-target-id-change-expected.txt: Added. * svg/filters/feImage-target-id-change.svg: Added. * svg/filters/feImage-target-reappend-to-document-expected.png: Added. * svg/filters/feImage-target-reappend-to-document-expected.txt: Added. * svg/filters/feImage-target-reappend-to-document.svg: Added. * svg/filters/feImage-target-remove-from-document-expected.png: Added. * svg/filters/feImage-target-remove-from-document-expected.txt: Added. * svg/filters/feImage-target-remove-from-document.svg: Added. Canonical link: https://commits.webkit.org/94088@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106110 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-01-27 12:56:21 +00:00
<title>There should be a single green 100x100 square.</title>
<defs>
<rect id="red-rect" width="100" height="100" fill="red"/>
<rect id="green-rect" width="100" height="100" fill="green"/>
<filter id="filter">
<feImage id="feimage-red" xlink:href="#red-rect"/>
</filter>
</defs>
<rect x="0" y="0" width="100" height="100" filter="url(#filter)" />
<script>
<![CDATA[
Rewrite SVG tests to make extensive use of display() in repaint tests https://bugs.webkit.org/show_bug.cgi?id=77736 Reviewed by Andreas Kling. Convert all tests in svg/ (except svg/custom & svg/dynamic-updates) that exercise repainting to use the fast/repaint/resources/repaint.js harness, which forces a layout, and calls layoutTestController.display() before executing the actual repaint test, so that repaint rectangles are properly tracked and shown (white areas that are redrawn, on top of the gray background, painted over the web view after the initial painting). Previously SVG tests used to work like this: (using an HTML example, but it doesn't matter) <html><body><svg><rect/><script>function change() { rect.setAttribute(...); layoutTestController.notifyDone(); } setTimeout(change, 0); </script></svg></body></html> We expected that the initial painting was done, before change() as called. This is unreliable for various reasons: - the timeout is not guaranteed to fire after the document loaded, it may happen inbetween on eg. a slow connection. - nor is it guaranteed that the document has painted initially before we enter change(). This leads to the current regressions -- if we break repainting, we can't see it in the current layout tests, as the initial painting always happens after change() executed in trunk, at least on a fast machine. In order to make repaint testing reliable we have to use following scheme: <html><body onload="runRepaintTest()"><svg><rect/><script>function repaintTest() { rect.setAttribute(...); }</script></svg></body></html> runRepaintTest() is provided by the repaint.js harness and does: if (window.layoutTestController) { document.body.offsetTop; layoutTestController.display(); repaintTest(); } else { setTimeout(repaintTest, 100); } Using this harness outside of DRT allows to test SVG repainting tests in the browser as well, as the repainting changes aren't immediately fired (0ms timer) but instead delayed by 100ms, so a visual "flash" is visible, if something changes. For DRT it does two things. First it forces Document::updateLayout() to be called, and then forces the web view to paint immediately, and then it starts tracking any repaint rects, that are fired _after_ the initial painting, which are then highlighted in the pixel test dump later on. Using display() is the only way to get reliable painting results across DRT/WebKitTestRunner, and to get rid of the flakiness. All *.xml/*.html/*.htm/*.xhtml tests which excersise repainting can be moved to use runRepaintTest() from repaint.js. <body> needs to be changed to <body onload="runRepaintTest()">, and the timeouts & waitUntilDone/notifyDone calls can be removed from the tests, leading to much nicer testcases, removing lots of boilerplate. Pure *.svg tests unfortunately can't use <svg onload="runRepaintTest()"> at the moment, due timing differences between the HTML load and the SVGLoad event, that's out of scope for this bug report. To remove any hacks from the testcases themselves, I centralized following work-around in a new function in repaint.js, and let all *.svg tests use it. function runSVGRepaintTest() { if (window.layoutTestController) { layoutTestController.waitUntilDone(); setTimeout(runRepaintTest, 0); } else runRepaintTest(); } runRepaintTest() has to be called from a timer at the moment, as the SVGLoad event fires earlier as HTML load event. Before that is fixed, we have to use <svg onload="runSVGRepaintTest()"> instead of <svg onload="runRepaintTest()"> and append: layoutTestController.notifyDone() to the repaintTest() functions in the testcases. That should explain the testcase differences between pure-SVG and non-pure-SVG tests, and why I treated them differently. This approach is unfortunately as flakey as the old, so to make pure *.svg tests test repainting reliable, the bug needs to be fixed. Note that svg/custom, and svg/dynamic-updates will be fixed in another chunk, as they also require large amounts of rebaselines. * fast/repaint/resources/repaint.js: (runRepaintTest): (runSVGRepaintTest): * platform/chromium/test_expectations.txt: * platform/mac/svg/as-background-image/animated-svg-as-background-expected.png: * platform/mac/svg/as-image/animated-svg-as-image-expected.png: * platform/mac/svg/as-image/animated-svg-as-image-no-fixed-intrinsic-size-expected.png: * platform/mac/svg/as-image/animated-svg-as-image-same-image-expected.png: * platform/mac/svg/as-image/svg-image-change-content-size-expected.png: * platform/mac/svg/as-object/deep-nested-embedded-svg-size-changes-no-layout-triggers-1-expected.png: * platform/mac/svg/as-object/deep-nested-embedded-svg-size-changes-no-layout-triggers-1-expected.txt: * platform/mac/svg/as-object/deep-nested-embedded-svg-size-changes-no-layout-triggers-2-expected.png: * platform/mac/svg/as-object/deep-nested-embedded-svg-size-changes-no-layout-triggers-2-expected.txt: * platform/mac/svg/as-object/embedded-svg-immediate-offsetWidth-query-expected.png: * platform/mac/svg/as-object/embedded-svg-size-changes-expected.png: * platform/mac/svg/as-object/embedded-svg-size-changes-no-layout-triggers-expected.png: * platform/mac/svg/as-object/embedded-svg-size-changes-no-layout-triggers-expected.txt: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-expected.png: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-1-expected.png: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-1-expected.txt: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-2-expected.png: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-2-expected.txt: * platform/mac/svg/carto.net/tabgroup-expected.png: * platform/mac/svg/carto.net/tabgroup-expected.txt: * platform/mac/svg/carto.net/window-expected.png: * platform/mac/svg/carto.net/window-expected.txt: * platform/mac/svg/css/shadow-changes-expected.png: * platform/mac/svg/dom/SVGPathSegList-segment-modification-expected.png: * platform/mac/svg/dom/SVGPathSegList-segment-modification-expected.txt: * platform/mac/svg/dom/SVGPathSegList-xml-dom-synchronization-expected.png: * platform/mac/svg/dom/SVGPathSegList-xml-dom-synchronization2-expected.png: * platform/mac/svg/dom/SVGRectElement/rect-modify-rx-expected.png: * platform/mac/svg/filters/filter-refresh-expected.png: * platform/mac/svg/filters/filter-width-update-expected.png: * platform/mac/svg/filters/filter-width-update-expected.txt: * platform/mac/svg/filters/invalidate-on-child-layout-expected.png: * platform/mac/svg/hixie/perf/001-expected.png: * platform/mac/svg/hixie/perf/002-expected.png: * platform/mac/svg/hixie/perf/003-expected.png: * platform/mac/svg/hixie/perf/003-expected.txt: * platform/mac/svg/hixie/perf/004-expected.png: * platform/mac/svg/hixie/perf/004-expected.txt: * platform/mac/svg/hixie/perf/005-expected.png: * platform/mac/svg/hixie/perf/005-expected.txt: * platform/mac/svg/hixie/perf/006-expected.png: * platform/mac/svg/hixie/perf/006-expected.txt: * platform/mac/svg/hixie/perf/007-expected.png: * platform/mac/svg/hixie/perf/007-expected.txt: * platform/mac/svg/repaint/filter-child-repaint-expected.png: * platform/mac/svg/repaint/image-href-change-expected.png: * platform/mac/svg/repaint/image-with-clip-path-expected.png: * platform/mac/svg/text/append-text-node-to-tspan-expected.png: * platform/mac/svg/text/modify-text-node-in-tspan-expected.png: * platform/mac/svg/text/remove-text-node-from-tspan-expected.png: * platform/mac/svg/text/remove-tspan-from-text-expected.png: * platform/mac/svg/text/text-text-05-t-expected.png: * platform/mac/svg/text/text-text-05-t-expected.txt: * platform/mac/svg/transforms/animated-path-inside-transformed-html-expected.png: * platform/mac/svg/zoom/page/absolute-sized-document-no-scrollbars-expected.png: * platform/mac/svg/zoom/page/relative-sized-document-scrollbars-expected.png: * platform/mac/svg/zoom/page/zoom-background-images-expected.txt: * platform/mac/svg/zoom/page/zoom-foreignObject-expected.png: * platform/mac/svg/zoom/page/zoom-hixie-mixed-008-expected.txt: * platform/mac/svg/zoom/page/zoom-hixie-rendering-model-004-expected.png: * platform/mac/svg/zoom/page/zoom-hixie-rendering-model-004-expected.txt: * platform/mac/svg/zoom/page/zoom-mask-with-percentages-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-background-with-relative-size-and-viewBox-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-background-with-relative-size-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-image-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-object-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-relative-image-expected.png: * platform/mac/svg/zoom/page/zoom-svg-through-object-with-auto-size-expected.txt: * platform/mac/svg/zoom/page/zoom-svg-through-object-with-override-size-expected.txt: * platform/mac/svg/zoom/text/absolute-sized-document-no-scrollbars-expected.png: * platform/mac/svg/zoom/text/absolute-sized-document-scrollbars-expected.png: * platform/mac/svg/zoom/text/relative-sized-document-scrollbars-expected.png: * platform/mac/svg/zoom/text/zoom-foreignObject-expected.png: * platform/mac/svg/zoom/text/zoom-hixie-mixed-008-expected.png: * platform/mac/svg/zoom/text/zoom-hixie-mixed-008-expected.txt: * platform/mac/svg/zoom/text/zoom-hixie-mixed-009-expected.png: * platform/mac/svg/zoom/text/zoom-hixie-rendering-model-004-expected.png: * platform/mac/svg/zoom/text/zoom-hixie-rendering-model-004-expected.txt: * svg/as-background-image/animated-svg-as-background.html: * svg/as-background-image/resources/animated-rect-relative-size.svg: * svg/as-background-image/svg-as-background-5.html: * svg/as-background-image/svg-background-partial-redraw.html: * svg/as-image/animated-svg-as-image-no-fixed-intrinsic-size.html: * svg/as-image/animated-svg-as-image-same-image.html: * svg/as-image/animated-svg-as-image.html: * svg/as-image/resources/animated-rect-fixed-size-2.svg: Copied from LayoutTests/svg/as-image/resources/animated-rect-same-image.svg. * svg/as-image/resources/animated-rect-fixed-size.svg: * svg/as-image/resources/animated-rect-relative-size.svg: * svg/as-image/resources/animated-rect-same-image.svg: * svg/as-image/svg-image-change-content-size.xhtml: * svg/as-object/embedded-svg-immediate-offsetWidth-query.html: * svg/as-object/embedded-svg-size-changes-no-layout-triggers.html: * svg/as-object/embedded-svg-size-changes.html: * svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-1.html: * svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-2.html: * svg/as-object/nested-embedded-svg-size-changes.html: * svg/as-object/resources/embedded-svg-size-changes-no-layout-triggers.svg: * svg/as-object/resources/nested-embedded-svg-size-changes-target-no-layout-triggers-1.html: * svg/carto.net/tabgroup.svg: * svg/carto.net/window.svg: * svg/css/shadow-changes.svg: * svg/dom/SVGPathSegList-segment-modification.svg: * svg/dom/SVGPathSegList-xml-dom-synchronization.xhtml: * svg/dom/SVGPathSegList-xml-dom-synchronization2.xhtml: * svg/dom/SVGRectElement/rect-modify-rx.svg: * svg/filters/animate-fill-expected.png: * svg/filters/animate-fill.svg: * svg/filters/feImage-reference-invalidation-expected.png: * svg/filters/feImage-reference-invalidation.svg: * svg/filters/feImage-target-add-to-document-expected.png: * svg/filters/feImage-target-add-to-document.svg: * svg/filters/feImage-target-changes-id-expected.png: * svg/filters/feImage-target-changes-id.svg: * svg/filters/feImage-target-id-change-expected.png: * svg/filters/feImage-target-id-change.svg: * svg/filters/feImage-target-reappend-to-document-expected.png: * svg/filters/feImage-target-reappend-to-document.svg: * svg/filters/feImage-target-remove-from-document-expected.png: * svg/filters/feImage-target-remove-from-document.svg: * svg/filters/filter-refresh.svg: * svg/filters/filter-width-update.svg: * svg/filters/invalidate-on-child-layout.svg: * svg/hixie/perf/001.xml: * svg/hixie/perf/002.xml: * svg/hixie/perf/003.xml: * svg/hixie/perf/004.xml: * svg/hixie/perf/005.xml: * svg/hixie/perf/006.xml: * svg/hixie/perf/007.xml: * svg/hixie/perf/resources/smallcats.gif: Added. * svg/repaint/container-repaint-expected.png: * svg/repaint/container-repaint.svg: * svg/repaint/filter-child-repaint.svg: * svg/repaint/image-href-change.svg: * svg/repaint/image-with-clip-path.svg: * svg/text/append-text-node-to-tspan.html: * svg/text/modify-text-node-in-tspan.html: * svg/text/remove-text-node-from-tspan.html: * svg/text/remove-tspan-from-text.html: * svg/text/text-text-05-t.svg: * svg/transforms/animated-path-inside-transformed-html.xhtml: * svg/zoom/page/absolute-sized-document-no-scrollbars.svg: * svg/zoom/page/absolute-sized-document-scrollbars.svg: * svg/zoom/page/relative-sized-document-scrollbars.svg: * svg/zoom/page/zoom-background-image-tiled.html: * svg/zoom/page/zoom-background-images.html: * svg/zoom/page/zoom-coords-viewattr-01-b.svg: * svg/zoom/page/zoom-foreignObject.svg: * svg/zoom/page/zoom-getBoundingClientRect.xhtml: * svg/zoom/page/zoom-hixie-mixed-008.xml: * svg/zoom/page/zoom-hixie-mixed-009.xml: * svg/zoom/page/zoom-hixie-rendering-model-004.xhtml: * svg/zoom/page/zoom-img-preserveAspectRatio-support-1.html: * svg/zoom/page/zoom-mask-with-percentages.svg: * svg/zoom/page/zoom-replaced-intrinsic-ratio-001.htm: * svg/zoom/page/zoom-svg-as-background-with-relative-size-and-viewBox.html: * svg/zoom/page/zoom-svg-as-background-with-relative-size.html: * svg/zoom/page/zoom-svg-as-image.html: * svg/zoom/page/zoom-svg-as-object.html: * svg/zoom/page/zoom-svg-as-relative-image.html: * svg/zoom/page/zoom-svg-float-border-padding.xml: * svg/zoom/page/zoom-svg-through-object-with-absolute-size-2.xhtml: * svg/zoom/page/zoom-svg-through-object-with-absolute-size.xhtml: * svg/zoom/page/zoom-svg-through-object-with-auto-size.html: * svg/zoom/page/zoom-svg-through-object-with-huge-size.xhtml: * svg/zoom/page/zoom-svg-through-object-with-override-size.html: * svg/zoom/page/zoom-svg-through-object-with-percentage-size.xhtml: * svg/zoom/page/zoom-svg-through-object-with-text.xhtml-disabled: * svg/zoom/page/zoom-zoom-coords.xhtml: * svg/zoom/resources/testPageZoom.js: (repaintTest): * svg/zoom/resources/testTextZoom.js: (repaintTest): * svg/zoom/text/absolute-sized-document-no-scrollbars.svg: * svg/zoom/text/absolute-sized-document-scrollbars.svg: * svg/zoom/text/relative-sized-document-scrollbars.svg: * svg/zoom/text/zoom-coords-viewattr-01-b.svg: * svg/zoom/text/zoom-foreignObject.svg: * svg/zoom/text/zoom-hixie-mixed-008.xml: * svg/zoom/text/zoom-hixie-mixed-009.xml: * svg/zoom/text/zoom-hixie-rendering-model-004.xhtml: * svg/zoom/text/zoom-svg-float-border-padding.xml: Canonical link: https://commits.webkit.org/94836@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106918 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-07 11:19:19 +00:00
function repaintTest()
<feImage> DOM mutation problems https://bugs.webkit.org/show_bug.cgi?id=77198 Reviewed by Antti Koivisto. Source/WebCore: Consider <feImage xlink:href="#rect"/>, where <rect> gets dynamically added to the tree. Currently <feImage> doesn't notice this, as it doesn't register itself pending on "#rect". Integrate <feImage> properly within the pending resources concept, fixing the bug. Tests: svg/filters/feImage-target-add-to-document.svg svg/filters/feImage-target-changes-id.svg svg/filters/feImage-target-id-change.svg svg/filters/feImage-target-reappend-to-document.svg svg/filters/feImage-target-remove-from-document.svg * svg/SVGFEImageElement.cpp: Rename invalidateImageResource to clearResourceReferences. (WebCore::SVGFEImageElement::~SVGFEImageElement): Call clearResourceReferences. (WebCore::SVGFEImageElement::clearResourceReferences): Remove any occurence of m_targetImage, it's no longer used. (WebCore::SVGFEImageElement::requestImageResource): requestImageResource is now called by buildPendingResource. (WebCore::SVGFEImageElement::buildPendingResource): Called whenever any element that we depend on gets resolved - now invalidates the <filter>. (WebCore::SVGFEImageElement::parseMappedAttribute): Don't start loading from parseMappedAttribute. (WebCore::SVGFEImageElement::svgAttributeChanged): Start loading from here, for consistency with SVGImageElement. (WebCore::SVGFEImageElement::insertedIntoDocument): Invoke buildPendingResource(), if we enter the tree. (WebCore::SVGFEImageElement::removedFromDocument): Clear m_cachedImage as soon as we get removed from the tree. (WebCore::SVGFEImageElement::build): Clean up this function, m_targetImage is no longer exist. * svg/SVGFEImageElement.h: Remove OwnPtr<ImageBuffer> m_targetImage, which is no longer used. LayoutTests: Add new test cases covering <feImage> + DOM mutations. * platform/chromium/test_expectations.txt: Updated expectations. * svg/filters/feImage-target-add-to-document-expected.png: Added. * svg/filters/feImage-target-add-to-document-expected.txt: Added. * svg/filters/feImage-target-add-to-document.svg: Added. * svg/filters/feImage-target-changes-id-expected.png: Added. * svg/filters/feImage-target-changes-id-expected.txt: Added. * svg/filters/feImage-target-changes-id.svg: Added. * svg/filters/feImage-target-id-change-expected.png: Added. * svg/filters/feImage-target-id-change-expected.txt: Added. * svg/filters/feImage-target-id-change.svg: Added. * svg/filters/feImage-target-reappend-to-document-expected.png: Added. * svg/filters/feImage-target-reappend-to-document-expected.txt: Added. * svg/filters/feImage-target-reappend-to-document.svg: Added. * svg/filters/feImage-target-remove-from-document-expected.png: Added. * svg/filters/feImage-target-remove-from-document-expected.txt: Added. * svg/filters/feImage-target-remove-from-document.svg: Added. Canonical link: https://commits.webkit.org/94088@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106110 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-01-27 12:56:21 +00:00
{
Rewrite SVG tests to make extensive use of display() in repaint tests https://bugs.webkit.org/show_bug.cgi?id=77736 Reviewed by Andreas Kling. Convert all tests in svg/ (except svg/custom & svg/dynamic-updates) that exercise repainting to use the fast/repaint/resources/repaint.js harness, which forces a layout, and calls layoutTestController.display() before executing the actual repaint test, so that repaint rectangles are properly tracked and shown (white areas that are redrawn, on top of the gray background, painted over the web view after the initial painting). Previously SVG tests used to work like this: (using an HTML example, but it doesn't matter) <html><body><svg><rect/><script>function change() { rect.setAttribute(...); layoutTestController.notifyDone(); } setTimeout(change, 0); </script></svg></body></html> We expected that the initial painting was done, before change() as called. This is unreliable for various reasons: - the timeout is not guaranteed to fire after the document loaded, it may happen inbetween on eg. a slow connection. - nor is it guaranteed that the document has painted initially before we enter change(). This leads to the current regressions -- if we break repainting, we can't see it in the current layout tests, as the initial painting always happens after change() executed in trunk, at least on a fast machine. In order to make repaint testing reliable we have to use following scheme: <html><body onload="runRepaintTest()"><svg><rect/><script>function repaintTest() { rect.setAttribute(...); }</script></svg></body></html> runRepaintTest() is provided by the repaint.js harness and does: if (window.layoutTestController) { document.body.offsetTop; layoutTestController.display(); repaintTest(); } else { setTimeout(repaintTest, 100); } Using this harness outside of DRT allows to test SVG repainting tests in the browser as well, as the repainting changes aren't immediately fired (0ms timer) but instead delayed by 100ms, so a visual "flash" is visible, if something changes. For DRT it does two things. First it forces Document::updateLayout() to be called, and then forces the web view to paint immediately, and then it starts tracking any repaint rects, that are fired _after_ the initial painting, which are then highlighted in the pixel test dump later on. Using display() is the only way to get reliable painting results across DRT/WebKitTestRunner, and to get rid of the flakiness. All *.xml/*.html/*.htm/*.xhtml tests which excersise repainting can be moved to use runRepaintTest() from repaint.js. <body> needs to be changed to <body onload="runRepaintTest()">, and the timeouts & waitUntilDone/notifyDone calls can be removed from the tests, leading to much nicer testcases, removing lots of boilerplate. Pure *.svg tests unfortunately can't use <svg onload="runRepaintTest()"> at the moment, due timing differences between the HTML load and the SVGLoad event, that's out of scope for this bug report. To remove any hacks from the testcases themselves, I centralized following work-around in a new function in repaint.js, and let all *.svg tests use it. function runSVGRepaintTest() { if (window.layoutTestController) { layoutTestController.waitUntilDone(); setTimeout(runRepaintTest, 0); } else runRepaintTest(); } runRepaintTest() has to be called from a timer at the moment, as the SVGLoad event fires earlier as HTML load event. Before that is fixed, we have to use <svg onload="runSVGRepaintTest()"> instead of <svg onload="runRepaintTest()"> and append: layoutTestController.notifyDone() to the repaintTest() functions in the testcases. That should explain the testcase differences between pure-SVG and non-pure-SVG tests, and why I treated them differently. This approach is unfortunately as flakey as the old, so to make pure *.svg tests test repainting reliable, the bug needs to be fixed. Note that svg/custom, and svg/dynamic-updates will be fixed in another chunk, as they also require large amounts of rebaselines. * fast/repaint/resources/repaint.js: (runRepaintTest): (runSVGRepaintTest): * platform/chromium/test_expectations.txt: * platform/mac/svg/as-background-image/animated-svg-as-background-expected.png: * platform/mac/svg/as-image/animated-svg-as-image-expected.png: * platform/mac/svg/as-image/animated-svg-as-image-no-fixed-intrinsic-size-expected.png: * platform/mac/svg/as-image/animated-svg-as-image-same-image-expected.png: * platform/mac/svg/as-image/svg-image-change-content-size-expected.png: * platform/mac/svg/as-object/deep-nested-embedded-svg-size-changes-no-layout-triggers-1-expected.png: * platform/mac/svg/as-object/deep-nested-embedded-svg-size-changes-no-layout-triggers-1-expected.txt: * platform/mac/svg/as-object/deep-nested-embedded-svg-size-changes-no-layout-triggers-2-expected.png: * platform/mac/svg/as-object/deep-nested-embedded-svg-size-changes-no-layout-triggers-2-expected.txt: * platform/mac/svg/as-object/embedded-svg-immediate-offsetWidth-query-expected.png: * platform/mac/svg/as-object/embedded-svg-size-changes-expected.png: * platform/mac/svg/as-object/embedded-svg-size-changes-no-layout-triggers-expected.png: * platform/mac/svg/as-object/embedded-svg-size-changes-no-layout-triggers-expected.txt: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-expected.png: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-1-expected.png: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-1-expected.txt: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-2-expected.png: * platform/mac/svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-2-expected.txt: * platform/mac/svg/carto.net/tabgroup-expected.png: * platform/mac/svg/carto.net/tabgroup-expected.txt: * platform/mac/svg/carto.net/window-expected.png: * platform/mac/svg/carto.net/window-expected.txt: * platform/mac/svg/css/shadow-changes-expected.png: * platform/mac/svg/dom/SVGPathSegList-segment-modification-expected.png: * platform/mac/svg/dom/SVGPathSegList-segment-modification-expected.txt: * platform/mac/svg/dom/SVGPathSegList-xml-dom-synchronization-expected.png: * platform/mac/svg/dom/SVGPathSegList-xml-dom-synchronization2-expected.png: * platform/mac/svg/dom/SVGRectElement/rect-modify-rx-expected.png: * platform/mac/svg/filters/filter-refresh-expected.png: * platform/mac/svg/filters/filter-width-update-expected.png: * platform/mac/svg/filters/filter-width-update-expected.txt: * platform/mac/svg/filters/invalidate-on-child-layout-expected.png: * platform/mac/svg/hixie/perf/001-expected.png: * platform/mac/svg/hixie/perf/002-expected.png: * platform/mac/svg/hixie/perf/003-expected.png: * platform/mac/svg/hixie/perf/003-expected.txt: * platform/mac/svg/hixie/perf/004-expected.png: * platform/mac/svg/hixie/perf/004-expected.txt: * platform/mac/svg/hixie/perf/005-expected.png: * platform/mac/svg/hixie/perf/005-expected.txt: * platform/mac/svg/hixie/perf/006-expected.png: * platform/mac/svg/hixie/perf/006-expected.txt: * platform/mac/svg/hixie/perf/007-expected.png: * platform/mac/svg/hixie/perf/007-expected.txt: * platform/mac/svg/repaint/filter-child-repaint-expected.png: * platform/mac/svg/repaint/image-href-change-expected.png: * platform/mac/svg/repaint/image-with-clip-path-expected.png: * platform/mac/svg/text/append-text-node-to-tspan-expected.png: * platform/mac/svg/text/modify-text-node-in-tspan-expected.png: * platform/mac/svg/text/remove-text-node-from-tspan-expected.png: * platform/mac/svg/text/remove-tspan-from-text-expected.png: * platform/mac/svg/text/text-text-05-t-expected.png: * platform/mac/svg/text/text-text-05-t-expected.txt: * platform/mac/svg/transforms/animated-path-inside-transformed-html-expected.png: * platform/mac/svg/zoom/page/absolute-sized-document-no-scrollbars-expected.png: * platform/mac/svg/zoom/page/relative-sized-document-scrollbars-expected.png: * platform/mac/svg/zoom/page/zoom-background-images-expected.txt: * platform/mac/svg/zoom/page/zoom-foreignObject-expected.png: * platform/mac/svg/zoom/page/zoom-hixie-mixed-008-expected.txt: * platform/mac/svg/zoom/page/zoom-hixie-rendering-model-004-expected.png: * platform/mac/svg/zoom/page/zoom-hixie-rendering-model-004-expected.txt: * platform/mac/svg/zoom/page/zoom-mask-with-percentages-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-background-with-relative-size-and-viewBox-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-background-with-relative-size-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-image-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-object-expected.png: * platform/mac/svg/zoom/page/zoom-svg-as-relative-image-expected.png: * platform/mac/svg/zoom/page/zoom-svg-through-object-with-auto-size-expected.txt: * platform/mac/svg/zoom/page/zoom-svg-through-object-with-override-size-expected.txt: * platform/mac/svg/zoom/text/absolute-sized-document-no-scrollbars-expected.png: * platform/mac/svg/zoom/text/absolute-sized-document-scrollbars-expected.png: * platform/mac/svg/zoom/text/relative-sized-document-scrollbars-expected.png: * platform/mac/svg/zoom/text/zoom-foreignObject-expected.png: * platform/mac/svg/zoom/text/zoom-hixie-mixed-008-expected.png: * platform/mac/svg/zoom/text/zoom-hixie-mixed-008-expected.txt: * platform/mac/svg/zoom/text/zoom-hixie-mixed-009-expected.png: * platform/mac/svg/zoom/text/zoom-hixie-rendering-model-004-expected.png: * platform/mac/svg/zoom/text/zoom-hixie-rendering-model-004-expected.txt: * svg/as-background-image/animated-svg-as-background.html: * svg/as-background-image/resources/animated-rect-relative-size.svg: * svg/as-background-image/svg-as-background-5.html: * svg/as-background-image/svg-background-partial-redraw.html: * svg/as-image/animated-svg-as-image-no-fixed-intrinsic-size.html: * svg/as-image/animated-svg-as-image-same-image.html: * svg/as-image/animated-svg-as-image.html: * svg/as-image/resources/animated-rect-fixed-size-2.svg: Copied from LayoutTests/svg/as-image/resources/animated-rect-same-image.svg. * svg/as-image/resources/animated-rect-fixed-size.svg: * svg/as-image/resources/animated-rect-relative-size.svg: * svg/as-image/resources/animated-rect-same-image.svg: * svg/as-image/svg-image-change-content-size.xhtml: * svg/as-object/embedded-svg-immediate-offsetWidth-query.html: * svg/as-object/embedded-svg-size-changes-no-layout-triggers.html: * svg/as-object/embedded-svg-size-changes.html: * svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-1.html: * svg/as-object/nested-embedded-svg-size-changes-no-layout-triggers-2.html: * svg/as-object/nested-embedded-svg-size-changes.html: * svg/as-object/resources/embedded-svg-size-changes-no-layout-triggers.svg: * svg/as-object/resources/nested-embedded-svg-size-changes-target-no-layout-triggers-1.html: * svg/carto.net/tabgroup.svg: * svg/carto.net/window.svg: * svg/css/shadow-changes.svg: * svg/dom/SVGPathSegList-segment-modification.svg: * svg/dom/SVGPathSegList-xml-dom-synchronization.xhtml: * svg/dom/SVGPathSegList-xml-dom-synchronization2.xhtml: * svg/dom/SVGRectElement/rect-modify-rx.svg: * svg/filters/animate-fill-expected.png: * svg/filters/animate-fill.svg: * svg/filters/feImage-reference-invalidation-expected.png: * svg/filters/feImage-reference-invalidation.svg: * svg/filters/feImage-target-add-to-document-expected.png: * svg/filters/feImage-target-add-to-document.svg: * svg/filters/feImage-target-changes-id-expected.png: * svg/filters/feImage-target-changes-id.svg: * svg/filters/feImage-target-id-change-expected.png: * svg/filters/feImage-target-id-change.svg: * svg/filters/feImage-target-reappend-to-document-expected.png: * svg/filters/feImage-target-reappend-to-document.svg: * svg/filters/feImage-target-remove-from-document-expected.png: * svg/filters/feImage-target-remove-from-document.svg: * svg/filters/filter-refresh.svg: * svg/filters/filter-width-update.svg: * svg/filters/invalidate-on-child-layout.svg: * svg/hixie/perf/001.xml: * svg/hixie/perf/002.xml: * svg/hixie/perf/003.xml: * svg/hixie/perf/004.xml: * svg/hixie/perf/005.xml: * svg/hixie/perf/006.xml: * svg/hixie/perf/007.xml: * svg/hixie/perf/resources/smallcats.gif: Added. * svg/repaint/container-repaint-expected.png: * svg/repaint/container-repaint.svg: * svg/repaint/filter-child-repaint.svg: * svg/repaint/image-href-change.svg: * svg/repaint/image-with-clip-path.svg: * svg/text/append-text-node-to-tspan.html: * svg/text/modify-text-node-in-tspan.html: * svg/text/remove-text-node-from-tspan.html: * svg/text/remove-tspan-from-text.html: * svg/text/text-text-05-t.svg: * svg/transforms/animated-path-inside-transformed-html.xhtml: * svg/zoom/page/absolute-sized-document-no-scrollbars.svg: * svg/zoom/page/absolute-sized-document-scrollbars.svg: * svg/zoom/page/relative-sized-document-scrollbars.svg: * svg/zoom/page/zoom-background-image-tiled.html: * svg/zoom/page/zoom-background-images.html: * svg/zoom/page/zoom-coords-viewattr-01-b.svg: * svg/zoom/page/zoom-foreignObject.svg: * svg/zoom/page/zoom-getBoundingClientRect.xhtml: * svg/zoom/page/zoom-hixie-mixed-008.xml: * svg/zoom/page/zoom-hixie-mixed-009.xml: * svg/zoom/page/zoom-hixie-rendering-model-004.xhtml: * svg/zoom/page/zoom-img-preserveAspectRatio-support-1.html: * svg/zoom/page/zoom-mask-with-percentages.svg: * svg/zoom/page/zoom-replaced-intrinsic-ratio-001.htm: * svg/zoom/page/zoom-svg-as-background-with-relative-size-and-viewBox.html: * svg/zoom/page/zoom-svg-as-background-with-relative-size.html: * svg/zoom/page/zoom-svg-as-image.html: * svg/zoom/page/zoom-svg-as-object.html: * svg/zoom/page/zoom-svg-as-relative-image.html: * svg/zoom/page/zoom-svg-float-border-padding.xml: * svg/zoom/page/zoom-svg-through-object-with-absolute-size-2.xhtml: * svg/zoom/page/zoom-svg-through-object-with-absolute-size.xhtml: * svg/zoom/page/zoom-svg-through-object-with-auto-size.html: * svg/zoom/page/zoom-svg-through-object-with-huge-size.xhtml: * svg/zoom/page/zoom-svg-through-object-with-override-size.html: * svg/zoom/page/zoom-svg-through-object-with-percentage-size.xhtml: * svg/zoom/page/zoom-svg-through-object-with-text.xhtml-disabled: * svg/zoom/page/zoom-zoom-coords.xhtml: * svg/zoom/resources/testPageZoom.js: (repaintTest): * svg/zoom/resources/testTextZoom.js: (repaintTest): * svg/zoom/text/absolute-sized-document-no-scrollbars.svg: * svg/zoom/text/absolute-sized-document-scrollbars.svg: * svg/zoom/text/relative-sized-document-scrollbars.svg: * svg/zoom/text/zoom-coords-viewattr-01-b.svg: * svg/zoom/text/zoom-foreignObject.svg: * svg/zoom/text/zoom-hixie-mixed-008.xml: * svg/zoom/text/zoom-hixie-mixed-009.xml: * svg/zoom/text/zoom-hixie-rendering-model-004.xhtml: * svg/zoom/text/zoom-svg-float-border-padding.xml: Canonical link: https://commits.webkit.org/94836@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106918 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-07 11:19:19 +00:00
var newFEImage = document.createElementNS("http://www.w3.org/2000/svg", "feImage");
newFEImage.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#green-rect");
document.getElementById("filter").appendChild(newFEImage);
<feImage> DOM mutation problems https://bugs.webkit.org/show_bug.cgi?id=77198 Reviewed by Antti Koivisto. Source/WebCore: Consider <feImage xlink:href="#rect"/>, where <rect> gets dynamically added to the tree. Currently <feImage> doesn't notice this, as it doesn't register itself pending on "#rect". Integrate <feImage> properly within the pending resources concept, fixing the bug. Tests: svg/filters/feImage-target-add-to-document.svg svg/filters/feImage-target-changes-id.svg svg/filters/feImage-target-id-change.svg svg/filters/feImage-target-reappend-to-document.svg svg/filters/feImage-target-remove-from-document.svg * svg/SVGFEImageElement.cpp: Rename invalidateImageResource to clearResourceReferences. (WebCore::SVGFEImageElement::~SVGFEImageElement): Call clearResourceReferences. (WebCore::SVGFEImageElement::clearResourceReferences): Remove any occurence of m_targetImage, it's no longer used. (WebCore::SVGFEImageElement::requestImageResource): requestImageResource is now called by buildPendingResource. (WebCore::SVGFEImageElement::buildPendingResource): Called whenever any element that we depend on gets resolved - now invalidates the <filter>. (WebCore::SVGFEImageElement::parseMappedAttribute): Don't start loading from parseMappedAttribute. (WebCore::SVGFEImageElement::svgAttributeChanged): Start loading from here, for consistency with SVGImageElement. (WebCore::SVGFEImageElement::insertedIntoDocument): Invoke buildPendingResource(), if we enter the tree. (WebCore::SVGFEImageElement::removedFromDocument): Clear m_cachedImage as soon as we get removed from the tree. (WebCore::SVGFEImageElement::build): Clean up this function, m_targetImage is no longer exist. * svg/SVGFEImageElement.h: Remove OwnPtr<ImageBuffer> m_targetImage, which is no longer used. LayoutTests: Add new test cases covering <feImage> + DOM mutations. * platform/chromium/test_expectations.txt: Updated expectations. * svg/filters/feImage-target-add-to-document-expected.png: Added. * svg/filters/feImage-target-add-to-document-expected.txt: Added. * svg/filters/feImage-target-add-to-document.svg: Added. * svg/filters/feImage-target-changes-id-expected.png: Added. * svg/filters/feImage-target-changes-id-expected.txt: Added. * svg/filters/feImage-target-changes-id.svg: Added. * svg/filters/feImage-target-id-change-expected.png: Added. * svg/filters/feImage-target-id-change-expected.txt: Added. * svg/filters/feImage-target-id-change.svg: Added. * svg/filters/feImage-target-reappend-to-document-expected.png: Added. * svg/filters/feImage-target-reappend-to-document-expected.txt: Added. * svg/filters/feImage-target-reappend-to-document.svg: Added. * svg/filters/feImage-target-remove-from-document-expected.png: Added. * svg/filters/feImage-target-remove-from-document-expected.txt: Added. * svg/filters/feImage-target-remove-from-document.svg: Added. Canonical link: https://commits.webkit.org/94088@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106110 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-01-27 12:56:21 +00:00
}
]]>
</script>
</svg>