2010-10-30 Dimitri Glazkov <dglazkov@chromium.org>
authordglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Oct 2010 17:32:24 +0000 (17:32 +0000)
committerdglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Oct 2010 17:32:24 +0000 (17:32 +0000)
commit64f8474422d63230d8d02b37f455b83e07a99586
treeda7c5062e2e9e152c6d4cbf28ec4f43e246c8a7e
parentf7f0c7bac822cd8c245247b31b7915b405a676dc
2010-10-30  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

        Tuned the test to better reflect its point: the event should indeed fire (it used to be swallowed),
        but its target should be a non-shadow node.

        * fast/events/shadow-boundary-crossing.html: Modified the test.
2010-10-30  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

        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.
        * 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::eventAncestors): 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.
        * inspector/InspectorDOMAgent.cpp:
        (WebCore::InspectorDOMAgent::getEventListenersForNode): Changed to use EventContexts.
        * page/EventHandler.cpp:
        (WebCore::EventHandler::updateMouseEventTargetNode): Removed code that's no longer necessary.
        * svg/SVGElement.cpp: Removed eventParentNode that's no longer needed.
        * svg/SVGElement.h: Ditto.
        * dom/WindowEventContext.cpp: Added.
        * dom/WindowEventContext.h: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70984 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/shadow-boundary-crossing.html
WebCore/Android.mk
WebCore/CMakeLists.txt
WebCore/ChangeLog
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pro
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/dom/ContainerNode.cpp
WebCore/dom/EventContext.cpp [new file with mode: 0644]
WebCore/dom/EventContext.h [new file with mode: 0644]
WebCore/dom/Node.cpp
WebCore/dom/Node.h
WebCore/dom/Text.cpp
WebCore/dom/WindowEventContext.cpp [new file with mode: 0644]
WebCore/dom/WindowEventContext.h [new file with mode: 0644]
WebCore/inspector/InspectorDOMAgent.cpp
WebCore/inspector/InspectorInstrumentation.cpp
WebCore/inspector/InspectorInstrumentation.h
WebCore/page/EventHandler.cpp
WebCore/svg/SVGElement.cpp
WebCore/svg/SVGElement.h