RESOLVED FIXED 81423
getIntersectionList always returns empty NodeList until layout is complete
https://bugs.webkit.org/show_bug.cgi?id=81423
Summary getIntersectionList always returns empty NodeList until layout is complete
Oscar Kozlowski
Reported 2012-03-16 15:43:01 PDT
Created attachment 132406 [details] Repro case Steps to reproduce: 1. Open attached mininmal repro (svg_getIntersectionList_CTM.html). This repro sets up a simple scene (rectangle at origin) and calls getIntersectionList multiple times, resulting in an empty NodeList (expected behavoir is to return the rectangle element). Calling getScreenCTM() (note: this can be called on either the root SVGSVGElement or the SVGRect) and calling getIntersectionList now returns the correct result. Correct behaviour under IE9 and Opera.
Attachments
Repro case (2.10 KB, text/html)
2012-03-16 15:43 PDT, Oscar Kozlowski
no flags
reduced test case (570 bytes, text/html)
2017-02-08 12:55 PST, Said Abou-Hallawa
no flags
Patch (3.38 KB, patch)
2017-02-08 13:00 PST, Said Abou-Hallawa
no flags
Nikolas Zimmermann
Comment 1 2012-03-19 08:05:16 PDT
Bug confirmed. I see following on debug builds: ASSERTION FAILED: !fixed /Users/nzimmermann/Coding/WebKit/Source/WebCore/rendering/svg/RenderSVGRoot.cpp(370) : virtual void WebCore::RenderSVGRoot::mapLocalToContainer(WebCore::RenderBoxModelObject *, bool, bool, WebCore::TransformState &, bool *) const 1 0x11050393e WebCore::RenderSVGRoot::mapLocalToContainer(WebCore::RenderBoxModelObject*, bool, bool, WebCore::TransformState&, bool*) const 2 0x1104b22cc WebCore::RenderObject::localToAbsolute(WebCore::FloatPoint const&, bool, bool) const 3 0x11044f37b WebCore::RenderLayer::convertToLayerCoords(WebCore::RenderLayer const*, WebCore::IntPoint&) const 4 0x11044fa9d WebCore::RenderLayer::updateLayerPositions(WebCore::IntPoint*, unsigned int) 5 0x11044fee9 WebCore::RenderLayer::updateLayerPositions(WebCore::IntPoint*, unsigned int) 6 0x11044fee9 WebCore::RenderLayer::updateLayerPositions(WebCore::IntPoint*, unsigned int) 7 0x10f85d074 WebCore::FrameView::layout(bool) 8 0x10f555f96 WebCore::Document::updateLayout() 9 0x10f5560c5 WebCore::Document::updateLayoutIgnorePendingStylesheets() 10 0x11081c1f2 WebCore::SVGLocatable::computeCTM(WebCore::SVGElement*, WebCore::SVGLocatable::CTMScope, WebCore::SVGLocatable::StyleUpdateStrategy) 11 0x11087ccdf WebCore::SVGStyledLocatableElement::getScreenCTM(WebCore::SVGLocatable::StyleUpdateStrategy) 12 0x11009302f WebCore::jsSVGSVGElementPrototypeFunctionGetScreenCTM(JSC::ExecState*) 13 0x4f42d3a01258 14 0x10e6ec7b9 JSC::JITCode::execute(JSC::RegisterFile*, JSC::ExecState*, JSC::JSGlobalData*) 15 0x10e6e9278 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) 16 0x10e5a3f0b JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) 17 0x10fc17f63 WebCore::JSMainThreadExecState::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) 18 0x10fd5a5af WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) 19 0x10f799459 WebCore::EventTarget::fireEventListeners(WebCore::Event*, WebCore::EventTargetData*, WTF::Vector<WebCore::RegisteredEventListener, 1ul>&) 20 0x10f79929b WebCore::EventTarget::fireEventListeners(WebCore::Event*) 21 0x1102750bb WebCore::Node::handleLocalEvents(WebCore::Event*) 22 0x10f76b9d9 WebCore::EventDispatcher::dispatchEvent(WTF::PassRefPtr<WebCore::Event>) 23 0x10f76f3ac WebCore::EventDispatchMediator::dispatchEvent(WebCore::EventDispatcher*) const 24 0x10f76ac1a WebCore::EventDispatcher::dispatchEvent(WebCore::Node*, WTF::PassRefPtr<WebCore::EventDispatchMediator>) 25 0x1102751b6 WebCore::Node::dispatchEvent(WTF::PassRefPtr<WebCore::Event>) 26 0x10f5617de WebCore::Document::finishedParsing() 27 0x10fa25ea4 WebCore::HTMLTreeBuilder::finished() 28 0x10f94f8d3 WebCore::HTMLDocumentParser::end() 29 0x10f94e7f6 WebCore::HTMLDocumentParser::attemptToRunDeferredScriptsAndEnd() 30 0x10f94e5cc WebCore::HTMLDocumentParser::prepareToStopParsing() 31 0x10f94f081 WebCore::HTMLDocumentParser::endIfDelayed()
Nikolas Zimmermann
Comment 2 2012-03-19 08:18:32 PDT
CC'ing Max who might be interested in this bug.
Max Vujovic
Comment 3 2012-04-05 13:32:14 PDT
(In reply to comment #2) > CC'ing Max who might be interested in this bug. Hi Niko, It does look like an interesting bug :). Unfortunately, I don't think I'll get to it anytime soon. I've been completely wrapped up in CSS shaders work recently, so anybody is welcome to pick it up as far as I'm concerned.
Said Abou-Hallawa
Comment 4 2017-02-08 12:55:03 PST
Created attachment 300941 [details] reduced test case
Said Abou-Hallawa
Comment 5 2017-02-08 13:00:27 PST
Said Abou-Hallawa
Comment 6 2017-02-08 13:04:58 PST
First of all the assertion is not related to this bug. And it is covered by https://bugs.webkit.org/show_bug.cgi?id=31278. I attached a reduced test case which does not hit the assertion and still can show the bug. The bug happens because getIntersectionList() is called before running the layout. getScreenCTM() happens to force layout. Other calls like root.getBoundingClientRect() or document.body.offsetWidth can do the same thing. The fix can be simply done by calling document().updateLayoutIgnorePendingStylesheets() from SVGSVGElement::getIntersectionList(). We call the same API from the DOM API Element::getBoundingClientRect().
WebKit Commit Bot
Comment 7 2017-02-08 15:17:31 PST
Comment on attachment 300942 [details] Patch Clearing flags on attachment: 300942 Committed r211905: <http://trac.webkit.org/changeset/211905>
WebKit Commit Bot
Comment 8 2017-02-08 15:17:37 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.