Changeset 107952 in webkit


Ignore:
Timestamp:
Feb 16, 2012 9:51:27 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

WebKit does not support DOM 3 Events FocusEvent
https://bugs.webkit.org/show_bug.cgi?id=76216

Source/WebCore:

Created a new FocusEvent class (extends UIEvent) with a relatedTarget attribute. Moved
the {Focus,Blur,FocusIn,FocusOut}EventDispatchMediator classes inside FocusEvent. Now when
focusin or focusout events are dispatched, a FocusEvent is created with the relatedTarget
attribute set accordingly. No other logic changes have been made besides adding the
FocusEvent class.

Patch by Terry Anderson <tdanderson@chromium.org> on 2012-02-16
Reviewed by Eric Seidel.

Test: fast/events/related-target-focusevent.html

  • CMakeLists.txt:
  • DerivedSources.cpp:
  • DerivedSources.make:
  • DerivedSources.pri:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.gypi:
  • WebCore.xcodeproj/project.pbxproj:
  • dom/DOMAllInOne.cpp:
    • Included mention of FocusEvent / JSFocusEvent in the above files to allow the patch to build on the different platforms
  • dom/EventDispatchMediator.cpp:
  • dom/EventDispatchMediator.h:
  • dom/EventFactory.in:
  • dom/FocusEvent.cpp: Added.

(WebCore):
(WebCore::FocusEvent::FocusEvent):
(WebCore::FocusEvent::~FocusEvent):
(WebCore::FocusEvent::initFocusEvent):
(WebCore::FocusEvent::interfaceName):
(WebCore::FocusInEventDispatchMediator::create):
(WebCore::FocusInEventDispatchMediator::FocusInEventDispatchMediator):
(WebCore::FocusInEventDispatchMediator::dispatchEvent):
(WebCore::FocusInEventDispatchMediator::event):
(WebCore::FocusOutEventDispatchMediator::create):
(WebCore::FocusOutEventDispatchMediator::FocusOutEventDispatchMediator):
(WebCore::FocusOutEventDispatchMediator::dispatchEvent):
(WebCore::FocusOutEventDispatchMediator::event):
(WebCore::FocusEventDispatchMediator::create):
(WebCore::FocusEventDispatchMediator::FocusEventDispatchMediator):
(WebCore::FocusEventDispatchMediator::dispatchEvent):
(WebCore::BlurEventDispatchMediator::create):
(WebCore::BlurEventDispatchMediator::BlurEventDispatchMediator):
(WebCore::BlurEventDispatchMediator::dispatchEvent):

  • dom/FocusEvent.h: Copied from Source/WebCore/dom/EventDispatchMediator.h.

(WebCore):
(FocusEvent):
(WebCore::FocusEvent::create):
(WebCore::FocusEvent::relatedTarget):
(WebCore::FocusEvent::setRelatedTarget):
(FocusInEventDispatchMediator):
(FocusOutEventDispatchMediator):
(FocusEventDispatchMediator):
(BlurEventDispatchMediator):

  • dom/FocusEvent.idl: Added.
  • dom/Node.cpp:

(WebCore::Node::dispatchFocusInEvent):
(WebCore::Node::dispatchFocusOutEvent):

  • dom/UIEvent.cpp:
  • dom/UIEvent.h:
  • page/DOMWindow.idl:

LayoutTests:

Patch by Terry Anderson <tdanderson@chromium.org> on 2012-02-16
Reviewed by Eric Seidel.

  • fast/dom/shadow/shadow-boundary-events-expected.txt:
  • fast/dom/shadow/shadow-boundary-events.html:
    • Changed the focusin/focusout parts of this layout test to include the relatedTarget attribute, which is now set on FocusEvent objects
  • fast/events/event-creation-expected.txt:
  • fast/events/event-creation.html:
    • Added the creation of FocusEvents to this layout test
  • fast/events/related-target-focusevent-expected.txt: Added.
  • fast/events/related-target-focusevent.html: Added.
    • This is a new layout test I created specifically for this patch
Location:
trunk
Files:
4 added
22 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r107944 r107952  
     12012-02-16  Terry Anderson  <tdanderson@chromium.org>
     2
     3        WebKit does not support DOM 3 Events FocusEvent
     4        https://bugs.webkit.org/show_bug.cgi?id=76216
     5
     6        Reviewed by Eric Seidel.
     7
     8        * fast/dom/shadow/shadow-boundary-events-expected.txt:
     9        * fast/dom/shadow/shadow-boundary-events.html:
     10            - Changed the focusin/focusout parts of this layout test to include the
     11              relatedTarget attribute, which is now set on FocusEvent objects
     12        * fast/events/event-creation-expected.txt:
     13        * fast/events/event-creation.html:
     14            - Added the creation of FocusEvents to this layout test
     15        * fast/events/related-target-focusevent-expected.txt: Added.
     16        * fast/events/related-target-focusevent.html: Added.
     17            - This is a new layout test I created specifically for this patch
     18
    1192012-02-16  Philippe Normand  <pnormand@igalia.com>
    220
  • trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events-expected.txt

    r105123 r107952  
    6262Move focus from a node to its sibling node. All nodes are outside of shadow boundary.
    6363Moving focus from divB to divC
    64 PASS dispatchedEvent("focusin") is ["divC(@divC)", "divC(@divA)"]
    65 PASS dispatchedEvent("focusout") is ["divB(@divB)", "divB(@divA)"]
     64PASS dispatchedEvent("focusin") is ["divC(<-divB)(@divC)", "divC(<-divB)(@divA)"]
     65PASS dispatchedEvent("focusout") is ["divB(<-divC)(@divB)", "divB(<-divC)(@divA)"]
    6666
    6767Old focused node and new focused node exist in separated subtrees, crossing shadow boundaries. Making sure that an event is not dispatched beyond the lowest common boundary.
    6868Moving focus from shadowD/shadowF/shadowG/divH to shadowD/shadowK/divL
    69 PASS dispatchedEvent("focusin") is ["divL(@divL)", "shadowK(@shadowK)", "shadowK(@divJ)"]
    70 PASS dispatchedEvent("focusout") is ["divH(@divH)", "shadowG(@shadowG)", "shadowF(@shadowF)", "shadowF(@divE)"]
     69PASS dispatchedEvent("focusin") is ["divL(<-shadowF)(@divL)", "shadowK(<-shadowF)(@shadowK)", "shadowK(<-shadowF)(@divJ)"]
     70PASS dispatchedEvent("focusout") is ["divH(<-shadowK)(@divH)", "shadowG(<-shadowK)(@shadowG)", "shadowF(<-shadowK)(@shadowF)", "shadowF(<-shadowK)(@divE)"]
    7171
    7272Move focus from a node to its sibling node. All nodes are outside of shadow boundary.
  • trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events.html

    r105123 r107952  
    188188    moveFocus('divB', 'divC',
    189189              'Move focus from a node to its sibling node. All nodes are outside of shadow boundary.');
    190     shouldBe('dispatchedEvent("focusin")', '["divC(@divC)", "divC(@divA)"]');
    191     shouldBe('dispatchedEvent("focusout")', '["divB(@divB)", "divB(@divA)"]');
     190    shouldBe('dispatchedEvent("focusin")', '["divC(<-divB)(@divC)", "divC(<-divB)(@divA)"]');
     191    shouldBe('dispatchedEvent("focusout")', '["divB(<-divC)(@divB)", "divB(<-divC)(@divA)"]');
    192192
    193193    moveFocus('shadowD/shadowF/shadowG/divH', 'shadowD/shadowK/divL',
    194194              'Old focused node and new focused node exist in separated subtrees, crossing shadow boundaries. Making sure that an event is not dispatched beyond the lowest common boundary.');
    195     shouldBe('dispatchedEvent("focusin")', '["divL(@divL)", "shadowK(@shadowK)", "shadowK(@divJ)"]');
    196     shouldBe('dispatchedEvent("focusout")', '["divH(@divH)", "shadowG(@shadowG)", "shadowF(@shadowF)", "shadowF(@divE)"]');
     195    shouldBe('dispatchedEvent("focusin")', '["divL(<-shadowF)(@divL)", "shadowK(<-shadowF)(@shadowK)", "shadowK(<-shadowF)(@divJ)"]');
     196    shouldBe('dispatchedEvent("focusout")', '["divH(<-shadowK)(@divH)", "shadowG(<-shadowK)(@shadowG)", "shadowF(<-shadowK)(@shadowF)", "shadowF(<-shadowK)(@divE)"]');
    197197
    198198    // Omitted test cases where either a oldFocusedNode or newFocusedNode is an ancestor of the other.
  • trunk/LayoutTests/fast/events/event-creation-expected.txt

    r94506 r107952  
    2222PASS document.createEvent('ErrorEvent') instanceof window.Event is true
    2323PASS document.createEvent('ErrorEvent').constructor === window.ErrorEvent is true
     24PASS document.createEvent('FocusEvent') instanceof window.FocusEvent is true
     25PASS document.createEvent('FocusEvent') instanceof window.UIEvent is true
     26PASS document.createEvent('FocusEvent') instanceof window.Event is true
     27PASS document.createEvent('FocusEvent').constructor === window.FocusEvent is true
    2428PASS document.createEvent('HashChangeEvent') instanceof window.HashChangeEvent is true
    2529PASS document.createEvent('HashChangeEvent') instanceof window.Event is true
  • trunk/LayoutTests/fast/events/event-creation.html

    r98407 r107952  
    3737    shouldBeTrue("document.createEvent('ErrorEvent') instanceof window.Event");
    3838    shouldBeTrue("document.createEvent('ErrorEvent').constructor === window.ErrorEvent");
     39
     40    // FocusEvent
     41    shouldBeTrue("document.createEvent('FocusEvent') instanceof window.FocusEvent");
     42    shouldBeTrue("document.createEvent('FocusEvent') instanceof window.UIEvent");
     43    shouldBeTrue("document.createEvent('FocusEvent') instanceof window.Event");
     44    shouldBeTrue("document.createEvent('FocusEvent').constructor === window.FocusEvent");   
    3945
    4046    // HashChangeEvent
  • trunk/Source/WebCore/CMakeLists.txt

    r107887 r107952  
    159159    dom/EventException.idl
    160160    dom/Event.idl
     161    dom/FocusEvent.idl
    161162    dom/HashChangeEvent.idl
    162163    dom/KeyboardEvent.idl
     
    559560    dom/ExceptionBase.cpp
    560561    dom/ExceptionCodePlaceholder.cpp
     562    dom/FocusEvent.cpp
    561563    dom/GenericEventQueue.cpp
    562564    dom/IconURL.cpp
  • trunk/Source/WebCore/ChangeLog

    r107951 r107952  
     12012-02-16  Terry Anderson  <tdanderson@chromium.org>
     2
     3        WebKit does not support DOM 3 Events FocusEvent
     4        https://bugs.webkit.org/show_bug.cgi?id=76216
     5
     6        Created a new FocusEvent class (extends UIEvent) with a relatedTarget attribute.  Moved
     7        the {Focus,Blur,FocusIn,FocusOut}EventDispatchMediator classes inside FocusEvent.  Now when
     8        focusin or focusout events are dispatched, a FocusEvent is created with the relatedTarget
     9        attribute set accordingly.  No other logic changes have been made besides adding the
     10        FocusEvent class.
     11
     12        Reviewed by Eric Seidel.
     13
     14        Test: fast/events/related-target-focusevent.html
     15
     16        * CMakeLists.txt:
     17        * DerivedSources.cpp:
     18        * DerivedSources.make:
     19        * DerivedSources.pri:
     20        * GNUmakefile.list.am:
     21        * Target.pri:
     22        * WebCore.gypi:
     23        * WebCore.xcodeproj/project.pbxproj:
     24        * dom/DOMAllInOne.cpp:
     25            - Included mention of FocusEvent / JSFocusEvent in the above files to
     26              allow the patch to build on the different platforms
     27        * dom/EventDispatchMediator.cpp:
     28        * dom/EventDispatchMediator.h:
     29        * dom/EventFactory.in:
     30        * dom/FocusEvent.cpp: Added.
     31        (WebCore):
     32        (WebCore::FocusEvent::FocusEvent):
     33        (WebCore::FocusEvent::~FocusEvent):
     34        (WebCore::FocusEvent::initFocusEvent):
     35        (WebCore::FocusEvent::interfaceName):
     36        (WebCore::FocusInEventDispatchMediator::create):
     37        (WebCore::FocusInEventDispatchMediator::FocusInEventDispatchMediator):
     38        (WebCore::FocusInEventDispatchMediator::dispatchEvent):
     39        (WebCore::FocusInEventDispatchMediator::event):
     40        (WebCore::FocusOutEventDispatchMediator::create):
     41        (WebCore::FocusOutEventDispatchMediator::FocusOutEventDispatchMediator):
     42        (WebCore::FocusOutEventDispatchMediator::dispatchEvent):
     43        (WebCore::FocusOutEventDispatchMediator::event):
     44        (WebCore::FocusEventDispatchMediator::create):
     45        (WebCore::FocusEventDispatchMediator::FocusEventDispatchMediator):
     46        (WebCore::FocusEventDispatchMediator::dispatchEvent):
     47        (WebCore::BlurEventDispatchMediator::create):
     48        (WebCore::BlurEventDispatchMediator::BlurEventDispatchMediator):
     49        (WebCore::BlurEventDispatchMediator::dispatchEvent):
     50        * dom/FocusEvent.h: Copied from Source/WebCore/dom/EventDispatchMediator.h.
     51        (WebCore):
     52        (FocusEvent):
     53        (WebCore::FocusEvent::create):
     54        (WebCore::FocusEvent::relatedTarget):
     55        (WebCore::FocusEvent::setRelatedTarget):
     56        (FocusInEventDispatchMediator):
     57        (FocusOutEventDispatchMediator):
     58        (FocusEventDispatchMediator):
     59        (BlurEventDispatchMediator):
     60        * dom/FocusEvent.idl: Added.
     61        * dom/Node.cpp:
     62        (WebCore::Node::dispatchFocusInEvent):
     63        (WebCore::Node::dispatchFocusOutEvent):
     64        * dom/UIEvent.cpp:
     65        * dom/UIEvent.h:
     66        * page/DOMWindow.idl:
     67
    1682012-02-16  No'am Rosenthal  <noam.rosenthal@nokia.com>
    269
  • trunk/Source/WebCore/DerivedSources.cpp

    r106794 r107952  
    130130#include "JSFloat32Array.cpp"
    131131#include "JSFloat64Array.cpp"
     132#include "JSFocusEvent.cpp"
    132133#include "JSGeolocation.cpp"
    133134#include "JSGeoposition.cpp"
  • trunk/Source/WebCore/DerivedSources.make

    r107107 r107952  
    112112    $(WebCore)/dom/EventListener.idl \
    113113    $(WebCore)/dom/EventTarget.idl \
     114    $(WebCore)/dom/FocusEvent.idl \
    114115    $(WebCore)/dom/HashChangeEvent.idl \
    115116    $(WebCore)/dom/KeyboardEvent.idl \
  • trunk/Source/WebCore/DerivedSources.pri

    r107107 r107952  
    143143#    $$PWD/dom/EventListener.idl \
    144144#    $$PWD/dom/EventTarget.idl \
     145    $$PWD/dom/FocusEvent.idl \
    145146    $$PWD/dom/HashChangeEvent.idl \
    146147    $$PWD/dom/KeyboardEvent.idl \
  • trunk/Source/WebCore/GNUmakefile.list.am

    r107945 r107952  
    184184        DerivedSources/WebCore/JSFloat64Array.cpp \
    185185        DerivedSources/WebCore/JSFloat64Array.h \
     186        DerivedSources/WebCore/JSFocusEvent.cpp \
     187        DerivedSources/WebCore/JSFocusEvent.h \
    186188        DerivedSources/WebCore/JSGeolocation.cpp \
    187189        DerivedSources/WebCore/JSGeolocation.h \
     
    704706        $(WebCore)/dom/Event.idl \
    705707        $(WebCore)/dom/EventException.idl \
     708        $(WebCore)/dom/FocusEvent.idl \
    706709        $(WebCore)/dom/HashChangeEvent.idl \
    707710        $(WebCore)/dom/KeyboardEvent.idl \
     
    15701573        Source/WebCore/dom/ExceptionCodePlaceholder.cpp \
    15711574        Source/WebCore/dom/ExceptionCodePlaceholder.h \
     1575        Source/WebCore/dom/FocusEvent.cpp \
     1576        Source/WebCore/dom/FocusEvent.h \
    15721577        Source/WebCore/dom/FragmentScriptingPermission.h \
    15731578        Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h \
  • trunk/Source/WebCore/Target.pri

    r107945 r107952  
    522522    dom/ExceptionBase.cpp \
    523523    dom/ExceptionCodePlaceholder.cpp \
     524    dom/FocusEvent.cpp \
    524525    dom/GenericEventQueue.cpp \
    525526    dom/IconURL.cpp \
     
    16361637    dom/ExceptionBase.h \
    16371638    dom/ExceptionCode.h \
     1639    dom/FocusEvent.h \
    16381640    dom/FragmentScriptingPermission.h \
    16391641    dom/KeyboardEvent.h \
  • trunk/Source/WebCore/WebCore.gypi

    r107925 r107952  
    601601            'dom/ExceptionCode.h',
    602602            'dom/ExceptionCodePlaceholder.h',
     603            'dom/FocusEvent.h',
    603604            'dom/FragmentScriptingPermission.h',
    604605            'dom/KeyboardEvent.h',
     
    626627            'dom/TextEventInputType.h',
    627628            'dom/UIEvent.h',
     629            'dom/FocusEvent.h',
    628630            'dom/UIEventWithKeyState.h',
    629631            'dom/UserGestureIndicator.h',
     
    785787            'dom/EventListener.idl',
    786788            'dom/EventTarget.idl',
     789            'dom/FocusEvent.idl',
    787790            'dom/HashChangeEvent.idl',
    788791            'dom/KeyboardEvent.idl',
     
    817820            'dom/TreeWalker.idl',
    818821            'dom/UIEvent.idl',
     822            'dom/FocusEvent.idl',
    819823            'dom/WebKitAnimationEvent.idl',
    820824            'dom/WebKitMutationObserver.idl',
     
    50305034            'dom/ExceptionBase.h',
    50315035            'dom/ExceptionCodePlaceholder.cpp',
     5036            'dom/FocusEvent.cpp',
    50325037            'dom/GenericEventQueue.cpp',
    50335038            'dom/GenericEventQueue.h',
     
    51465151            'dom/TreeWalker.h',
    51475152            'dom/UIEvent.cpp',
     5153            'dom/FocusEvent.cpp',
    51485154            'dom/UIEventWithKeyState.cpp',
    51495155            'dom/UserGestureIndicator.cpp',
     
    71597165            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSFloat32Array.cpp',
    71607166            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSFloat32Array.h',
     7167            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSFocusEvent.cpp',
     7168            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSFocusEvent.h',
    71617169            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSGeolocation.cpp',
    71627170            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSGeolocation.h',
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r107887 r107952  
    49874987                B6566271120B1227006EA85C /* JSIDBTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B656626F120B1227006EA85C /* JSIDBTransaction.cpp */; };
    49884988                B691C1F91206D4A00025D980 /* IDBDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6A311D4FB3D004C3E4B /* IDBDatabase.cpp */; };
     4989                B6D9D23514EABD260090D75E /* FocusEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = B6D9D23314EABD260090D75E /* FocusEvent.h */; };
     4990                B6D9D23614EABD260090D75E /* FocusEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6D9D23414EABD260090D75E /* FocusEvent.cpp */; };
     4991                B6D9D27B14EAC0860090D75E /* JSFocusEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = B6D9D27914EAC0860090D75E /* JSFocusEvent.h */; };
     4992                B6D9D27C14EAC0860090D75E /* JSFocusEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6D9D27A14EAC0860090D75E /* JSFocusEvent.cpp */; };
    49894993                B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */ = {isa = PBXBuildFile; fileRef = B776D43A1104525D00BEB0EC /* PrintContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
    49904994                B734B181119B9911006587BD /* FontTranscoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B734B180119B9911006587BD /* FontTranscoder.cpp */; };
     
    1190611910                B656626E120B1227006EA85C /* JSIDBTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBTransaction.h; sourceTree = "<group>"; };
    1190711911                B656626F120B1227006EA85C /* JSIDBTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBTransaction.cpp; sourceTree = "<group>"; };
     11912                B6D9D23314EABD260090D75E /* FocusEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FocusEvent.h; sourceTree = "<group>"; };
     11913                B6D9D23414EABD260090D75E /* FocusEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FocusEvent.cpp; sourceTree = "<group>"; };
     11914                B6D9D27214EABF030090D75E /* FocusEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FocusEvent.idl; sourceTree = "<group>"; };
     11915                B6D9D27914EAC0860090D75E /* JSFocusEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFocusEvent.h; sourceTree = "<group>"; };
     11916                B6D9D27A14EAC0860090D75E /* JSFocusEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFocusEvent.cpp; sourceTree = "<group>"; };
    1190811917                B734B180119B9911006587BD /* FontTranscoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FontTranscoder.cpp; path = transcoder/FontTranscoder.cpp; sourceTree = "<group>"; };
    1190911918                B734B182119B991D006587BD /* FontTranscoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FontTranscoder.h; path = transcoder/FontTranscoder.h; sourceTree = "<group>"; };
     
    1808118090                                E1ADEDD80E76BD93004A1A5E /* JSMessagePort.h */,
    1808218091                                A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */,
     18092                                B6D9D27914EAC0860090D75E /* JSFocusEvent.h */,
     18093                                B6D9D27A14EAC0860090D75E /* JSFocusEvent.cpp */,
    1808318094                                A86629CB09DA2B47009633A5 /* JSMouseEvent.h */,
    1808418095                                65DF31E709D1CC60000BE325 /* JSMutationEvent.cpp */,
     
    2049920510                        isa = PBXGroup;
    2050020511                        children = (
     20512                                B6D9D27214EABF030090D75E /* FocusEvent.idl */,
    2050120513                                E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */,
    2050220514                                E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */,
     
    2084720859                                4123E568127B3041000FEEA7 /* WindowEventContext.cpp */,
    2084820860                                4123E567127B3041000FEEA7 /* WindowEventContext.h */,
     20861                                B6D9D23314EABD260090D75E /* FocusEvent.h */,
     20862                                B6D9D23414EABD260090D75E /* FocusEvent.cpp */,
    2084920863                        );
    2085020864                        path = dom;
     
    2427624290                                572E92FC14E540580087FFBA /* ShadowRootList.h in Headers */,
    2427724291                                97CC3AE314E8E4A200894988 /* NavigatorSupplement.h in Headers */,
     24292                                B6D9D23514EABD260090D75E /* FocusEvent.h in Headers */,
     24293                                B6D9D27B14EAC0860090D75E /* JSFocusEvent.h in Headers */,
    2427824294                                C598905714E9C28000E8D18B /* PasteboardStrategy.h in Headers */,
    2427924295                                C598905814E9C29900E8D18B /* PlatformPasteboard.h in Headers */,
     
    2722427240                                572E92FB14E540580087FFBA /* ShadowRootList.cpp in Sources */,
    2722527241                                97CC3AE214E8E4A200894988 /* NavigatorSupplement.cpp in Sources */,
     27242                                B6D9D23614EABD260090D75E /* FocusEvent.cpp in Sources */,
     27243                                B6D9D27C14EAC0860090D75E /* JSFocusEvent.cpp in Sources */,
    2722627244                                C598902E14E9B0F800E8D18B /* PlatformPasteboardMac.mm in Sources */,
    2722727245                                144FCE5A14EC79E7000D17A3 /* FractionalLayoutRect.cpp in Sources */,
  • trunk/Source/WebCore/dom/DOMAllInOne.cpp

    r107525 r107952  
    8181#include "ExceptionBase.cpp"
    8282#include "ExceptionCodePlaceholder.cpp"
     83#include "FocusEvent.cpp"
    8384#include "IconURL.cpp"
    8485#include "KeyboardEvent.cpp"
  • trunk/Source/WebCore/dom/EventDispatchMediator.cpp

    r95901 r107952  
    11/*
    2  * Copyright (C) 2011 Google Inc. All rights reserved.
     2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5252}
    5353
    54 PassRefPtr<FocusEventDispatchMediator> FocusEventDispatchMediator::create(PassRefPtr<Node> oldFocusedNode)
    55 {
    56     return adoptRef(new FocusEventDispatchMediator(oldFocusedNode));
    57 }
    58 
    59 FocusEventDispatchMediator::FocusEventDispatchMediator(PassRefPtr<Node> oldFocusedNode)
    60     : EventDispatchMediator(Event::create(eventNames().focusEvent, false, false))
    61     , m_oldFocusedNode(oldFocusedNode)
    62 {
    63 }
    64 
    65 bool FocusEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
    66 {
    67     dispatcher->adjustRelatedTarget(event(), m_oldFocusedNode);
    68     return EventDispatchMediator::dispatchEvent(dispatcher);
    69 }
    70 
    71 PassRefPtr<BlurEventDispatchMediator> BlurEventDispatchMediator::create(PassRefPtr<Node> newFocusedNode)
    72 {
    73     return adoptRef(new BlurEventDispatchMediator(newFocusedNode));
    74 }
    75 
    76 BlurEventDispatchMediator::BlurEventDispatchMediator(PassRefPtr<Node> newFocusedNode)
    77     : EventDispatchMediator(Event::create(eventNames().blurEvent, false, false))
    78     , m_newFocusedNode(newFocusedNode)
    79 {
    80 }
    81 
    82 bool BlurEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
    83 {
    84     dispatcher->adjustRelatedTarget(event(), m_newFocusedNode);
    85     return EventDispatchMediator::dispatchEvent(dispatcher);
    86 }
    87 
    8854} // namespace WebCore
  • trunk/Source/WebCore/dom/EventDispatchMediator.h

    r95901 r107952  
    11/*
    2  * Copyright (C) 2011 Google Inc. All rights reserved.
     2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5858};
    5959
    60 class FocusEventDispatchMediator : public EventDispatchMediator {
    61 public:
    62     static PassRefPtr<FocusEventDispatchMediator> create(PassRefPtr<Node> oldFocusedNode);
    63 private:
    64     explicit FocusEventDispatchMediator(PassRefPtr<Node> oldFocusedNode);
    65     virtual bool dispatchEvent(EventDispatcher*) const;
    66     RefPtr<Node> m_oldFocusedNode;
    67 };
    68 
    69 class BlurEventDispatchMediator : public EventDispatchMediator {
    70 public:
    71     static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<Node> newFocusedNode);
    72 private:
    73     explicit BlurEventDispatchMediator(PassRefPtr<Node> newFocusedNode);
    74     virtual bool dispatchEvent(EventDispatcher*) const;
    75     RefPtr<Node> m_newFocusedNode;
    76 };
    7760
    7861} // namespace WebCore
  • trunk/Source/WebCore/dom/EventFactory.in

    r106603 r107952  
    99CustomEvent
    1010ErrorEvent
     11FocusEvent
     12FocusEvents interfaceName=FocusEvent
    1113HashChangeEvent
    1214KeyboardEvent
  • trunk/Source/WebCore/dom/FocusEvent.h

    r107951 r107952  
    11/*
    2  * Copyright (C) 2011 Google Inc. All rights reserved.
     2 * Copyright (C) 2012 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929 */
    3030
    31 #ifndef EventDispatchMediator_h
    32 #define EventDispatchMediator_h
     31#ifndef FocusEvent_h
     32#define FocusEvent_h
    3333
    34 #include <wtf/PassRefPtr.h>
    35 #include <wtf/RefCounted.h>
    36 #include <wtf/RefPtr.h>
     34#include "EventDispatchMediator.h"
     35#include "UIEvent.h"
     36
    3737
    3838namespace WebCore {
    39 
    40 class Event;
    41 class EventDispatcher;
    42 class Node;
    43 
    44 class EventDispatchMediator : public RefCounted<EventDispatchMediator> {
     39   
     40class FocusEvent : public UIEvent {
    4541public:
    46     static PassRefPtr<EventDispatchMediator> create(PassRefPtr<Event>);
    47     virtual ~EventDispatchMediator() { };
     42    static PassRefPtr<FocusEvent> create()
     43    {
     44        return adoptRef(new FocusEvent);
     45    }
     46       
     47    static PassRefPtr<FocusEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, int detail, PassRefPtr<EventTarget> relatedTarget)
     48    {
     49        return adoptRef(new FocusEvent(type, canBubble, cancelable, view, detail, relatedTarget));
     50    }
     51       
     52    virtual ~FocusEvent();
     53    void initFocusEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, int detail, PassRefPtr<EventTarget> relatedTarget);
     54    EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
     55    void setRelatedTarget(PassRefPtr<EventTarget> relatedTarget) { m_relatedTarget = relatedTarget; }
     56    virtual const AtomicString& interfaceName() const;
     57   
     58private:
     59    FocusEvent();
     60    FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, int detail, PassRefPtr<EventTarget> relatedTarget);       
     61    RefPtr<EventTarget> m_relatedTarget;
     62};
     63   
     64   
     65class FocusInEventDispatchMediator : public EventDispatchMediator {
     66public:
     67    static PassRefPtr<FocusInEventDispatchMediator> create(PassRefPtr<FocusEvent>, PassRefPtr<Node> oldFocusedNode);
     68private:
     69    explicit FocusInEventDispatchMediator(PassRefPtr<FocusEvent>, PassRefPtr<Node> oldFocusedNode);
    4870    virtual bool dispatchEvent(EventDispatcher*) const;
    49     Event* event() const { return m_event.get(); };
    50 
    51 protected:
    52     explicit EventDispatchMediator(PassRefPtr<Event>);
    53     EventDispatchMediator() { };
    54     void setEvent(PassRefPtr<Event> event) { m_event = event; };
    55 
     71    FocusEvent* event() const;
     72    RefPtr<Node> m_oldFocusedNode;
     73};
     74   
     75 
     76class FocusOutEventDispatchMediator : public EventDispatchMediator {
     77public:
     78    static PassRefPtr<FocusOutEventDispatchMediator> create(PassRefPtr<FocusEvent>, PassRefPtr<Node> newFocusedNode);
    5679private:
    57     RefPtr<Event> m_event;
     80    explicit FocusOutEventDispatchMediator(PassRefPtr<FocusEvent>, PassRefPtr<Node> newFocusedNode);
     81    virtual bool dispatchEvent(EventDispatcher*) const;
     82    FocusEvent* event() const;
     83    RefPtr<Node> m_newFocusedNode;
    5884};
    59 
    60 class FocusEventDispatchMediator : public EventDispatchMediator {
     85   
     86   
     87class FocusEventDispatchMediator : public EventDispatchMediator {   
    6188public:
    6289    static PassRefPtr<FocusEventDispatchMediator> create(PassRefPtr<Node> oldFocusedNode);
     
    6592    virtual bool dispatchEvent(EventDispatcher*) const;
    6693    RefPtr<Node> m_oldFocusedNode;
    67 };
     94};
     95   
    6896
    69 class BlurEventDispatchMediator : public EventDispatchMediator {
     97class BlurEventDispatchMediator : public EventDispatchMediator {       
    7098public:
    71     static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<Node> newFocusedNode);
     99    static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<Node> newFocusedNode);       
    72100private:
    73101    explicit BlurEventDispatchMediator(PassRefPtr<Node> newFocusedNode);
    74102    virtual bool dispatchEvent(EventDispatcher*) const;
    75103    RefPtr<Node> m_newFocusedNode;
    76 };
     104};     
    77105
    78106} // namespace WebCore
    79107
    80 #endif // EventDispatchMediator_h
     108#endif // FocusEvent_h
  • trunk/Source/WebCore/dom/Node.cpp

    r107832 r107952  
    5959#include "EventNames.h"
    6060#include "ExceptionCode.h"
     61#include "FocusEvent.h"
    6162#include "Frame.h"
    6263#include "FrameView.h"
     
    28032804    ASSERT(!eventDispatchForbidden());
    28042805    ASSERT(eventType == eventNames().focusinEvent || eventType == eventNames().DOMFocusInEvent);
    2805     dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(UIEvent::create(eventType, true, false, document()->defaultView(), 0), oldFocusedNode));
     2806    dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, oldFocusedNode), oldFocusedNode));
    28062807}
    28072808
     
    28102811    ASSERT(!eventDispatchForbidden());
    28112812    ASSERT(eventType == eventNames().focusoutEvent || eventType == eventNames().DOMFocusOutEvent);
    2812     dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(UIEvent::create(eventType, true, false, document()->defaultView(), 0), newFocusedNode));
     2813    dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, newFocusedNode), newFocusedNode));
    28132814}
    28142815
  • trunk/Source/WebCore/dom/UIEvent.cpp

    r104803 r107952  
    44 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
    55 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved.
     6 * Copyright (C) 2012 Google Inc. All rights reserved.
    67 *
    78 * This library is free software; you can redistribute it and/or
     
    111112}
    112113
    113 PassRefPtr<FocusInEventDispatchMediator> FocusInEventDispatchMediator::create(PassRefPtr<Event> event, PassRefPtr<Node> oldFocusedNode)
    114 {
    115     return adoptRef(new FocusInEventDispatchMediator(event, oldFocusedNode));
    116 }
    117 
    118 FocusInEventDispatchMediator::FocusInEventDispatchMediator(PassRefPtr<Event> event, PassRefPtr<Node> oldFocusedNode)
    119     : EventDispatchMediator(event)
    120     , m_oldFocusedNode(oldFocusedNode)
    121 {
    122 }
    123 
    124 bool FocusInEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
    125 {
    126     dispatcher->adjustRelatedTarget(event(), m_oldFocusedNode);
    127     return EventDispatchMediator::dispatchEvent(dispatcher);
    128 }
    129 
    130 PassRefPtr<FocusOutEventDispatchMediator> FocusOutEventDispatchMediator::create(PassRefPtr<Event> event, PassRefPtr<Node> newFocusedNode)
    131 {
    132     return adoptRef(new FocusOutEventDispatchMediator(event, newFocusedNode));
    133 }
    134 
    135 FocusOutEventDispatchMediator::FocusOutEventDispatchMediator(PassRefPtr<Event> event, PassRefPtr<Node> newFocusedNode)
    136     : EventDispatchMediator(event)
    137     , m_newFocusedNode(newFocusedNode)
    138 {
    139 }
    140 
    141 bool FocusOutEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
    142 {
    143     dispatcher->adjustRelatedTarget(event(), m_newFocusedNode);
    144     return EventDispatchMediator::dispatchEvent(dispatcher);
    145 }
    146 
    147114} // namespace WebCore
  • trunk/Source/WebCore/dom/UIEvent.h

    r98044 r107952  
    44 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
    55 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
     6 * Copyright (C) 2012 Google Inc. All rights reserved.
    67 *
    78 * This library is free software; you can redistribute it and/or
     
    7677    };
    7778
    78     class FocusInEventDispatchMediator : public EventDispatchMediator {
    79     public:
    80         static PassRefPtr<FocusInEventDispatchMediator> create(PassRefPtr<Event>, PassRefPtr<Node> oldFocusedNode);
    81     private:
    82         explicit FocusInEventDispatchMediator(PassRefPtr<Event>, PassRefPtr<Node> oldFocusedNode);
    83         virtual bool dispatchEvent(EventDispatcher*) const;
    84         RefPtr<Node> m_oldFocusedNode;
    85     };
    86 
    87     class FocusOutEventDispatchMediator : public EventDispatchMediator {
    88     public:
    89         static PassRefPtr<FocusOutEventDispatchMediator> create(PassRefPtr<Event>, PassRefPtr<Node> newFocusedNode);
    90     private:
    91         explicit FocusOutEventDispatchMediator(PassRefPtr<Event>, PassRefPtr<Node> newFocusedNode);
    92         virtual bool dispatchEvent(EventDispatcher*) const;
    93         RefPtr<Node> m_newFocusedNode;
    94     };
    95 
    9679} // namespace WebCore
    9780
  • trunk/Source/WebCore/page/DOMWindow.idl

    r107869 r107952  
    11/*
    22 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
    3  * Copyright (C) 2011 Google Inc. All rights reserved.
     3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
    44 *
    55 * Redistribution and use in source and binary forms, with or without
     
    512512        attribute CustomEventConstructor CustomEvent;
    513513        attribute ErrorEventConstructor ErrorEvent;
     514        attribute FocusEventConstructor FocusEvent;
    514515        attribute HashChangeEventConstructor HashChangeEvent;
    515516        attribute KeyboardEventConstructor KeyboardEvent;
Note: See TracChangeset for help on using the changeset viewer.