• dglazkov@chromium.org's avatar
    2010-11-05 Dimitri Glazkov <dglazkov@chromium.org> · 22000f6d
    dglazkov@chromium.org authored
            Reviewed by Darin Adler.
    
            Implement shadow DOM-aware event targeting and introduce EventContext to track the context of each event dispatch.
            https://bugs.webkit.org/show_bug.cgi?id=46015
    
            Added more test coverage around events crossing shadow DOM boundaries and tweaked existing tests.
    
            * fast/events/shadow-boundary-crossing-2-expected.txt: Added.
            * fast/events/shadow-boundary-crossing-2.html: Added.
            * fast/events/shadow-boundary-crossing.html: Tuned to better reflect its point:
                the event should indeed fire (it used to be swallowed), but its target
                should be a non-shadow node.
            * media/audio-delete-while-slider-thumb-clicked.html :  Tweaked to actually click on
                the scrubber thumb (it was off by 2 pixels).
    2010-11-05  Dimitri Glazkov  <dglazkov@chromium.org>
    
            Reviewed by Darin Adler.
    
            Implement shadow DOM-aware event targeting and introduce EventContext to track the context of each event dispatch.
            https://bugs.webkit.org/show_bug.cgi?id=46015
    
            Test: fast/events/shadow-boundary-crossing-2.html
    
            This patch adds the notion of EventContext (and a very similar-acting WindowEventContext, specifically
            for DOMWindow), an abstraction that carries information around dispatching an event for any given Node.
    
            This abstraction is necessary to ensure that events, fired from shadow DOM nodes are properly retargeted to
            appear as if they are coming from their host, thus never exposing the shadow DOM nodes to the world outside.
    
            * Android.mk: Added EventContext, WindowEventContext files.
            * CMakeLists.txt: Ditto.
            * GNUmakefile.am: Ditto.
            * WebCore.gypi: Ditto.
            * WebCore.pro: Ditto.
            * WebCore.xcodeproj/project.pbxproj: Ditto.
            * WebCore.vcproj/WebCore.vcproj: Ditto.
            * dom/ContainerNode.cpp:
            (WebCore::notifyChildInserted): Changed to be shadow DOM-aware.
            * dom/EventContext.cpp: Added.
            * dom/EventContext.h: Added.
            * dom/Node.cpp:
            (WebCore::Node::markAncestorsWithChildNeedsStyleRecalc): Changed to be shadow DOM-aware.
            (WebCore::Node::createRendererIfNeeded): Ditto.
            (WebCore::Node::parentOrHostNode): Added new helper method.
            (WebCore::Node::enclosingLinkEventParentOrSelf): Changed to be shadow DOM-aware.
            (WebCore::eventTargetRespectingSVGTargetRules): Collapsed two helper methods into one.
            (WebCore::Node::getEventAncestors): Renamed and refactored to collect a vector of EventContexts.
            (WebCore::Node::topEventContext): Added.
            (WebCore::eventHasListeners): Changed to use EventContexts.
            (WebCore::Node::dispatchGenericEvent): Ditto.
            * dom/Node.h: Removed eventParentNode that's no longer needed, added parentOrHostNode decl,
                and changed signature of eventAncestors to use EventContexts.
            * dom/Text.cpp:
            (WebCore::Text::createRenderer): Changed to be shadow DOM-aware.
            * dom/WindowEventContext.cpp: Added.
            * dom/WindowEventContext.h: Added.
            * inspector/InspectorDOMAgent.cpp:
            (WebCore::InspectorDOMAgent::getEventListenersForNode): Changed to use EventContexts.
            * page/EventHandler.cpp:
            (WebCore::EventHandler::updateMouseEventTargetNode): Removed code that's no longer necessary.
            * rendering/RenderTextControlMultiLine.cpp:
            (WebCore::RenderTextControlMultiLine::subtreeHasChanged): Removed event invocation that's
                no longer necessary.
            * rendering/ShadowElement.h: Made m_shadowParent a RefPtr to avoid stale references when parent
            is deleted.
            * rendering/TextControlInnerElements.cpp:
            (WebCore::TextControlInnerTextElement::defaultEventHandler): Flipped the condition back
                from where it was prior to r60418.
            * svg/SVGElement.cpp: Removed eventParentNode that's no longer needed.
            * svg/SVGElement.h: Ditto.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71934 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    22000f6d
CMakeLists.txt 68.4 KB