Changeset 107952 in webkit
- Timestamp:
- Feb 16, 2012 9:51:27 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 22 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r107944 r107952 1 2012-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 1 19 2012-02-16 Philippe Normand <pnormand@igalia.com> 2 20 -
trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events-expected.txt
r105123 r107952 62 62 Move focus from a node to its sibling node. All nodes are outside of shadow boundary. 63 63 Moving focus from divB to divC 64 PASS dispatchedEvent("focusin") is ["divC( @divC)", "divC(@divA)"]65 PASS dispatchedEvent("focusout") is ["divB( @divB)", "divB(@divA)"]64 PASS dispatchedEvent("focusin") is ["divC(<-divB)(@divC)", "divC(<-divB)(@divA)"] 65 PASS dispatchedEvent("focusout") is ["divB(<-divC)(@divB)", "divB(<-divC)(@divA)"] 66 66 67 67 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. 68 68 Moving 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)"]69 PASS dispatchedEvent("focusin") is ["divL(<-shadowF)(@divL)", "shadowK(<-shadowF)(@shadowK)", "shadowK(<-shadowF)(@divJ)"] 70 PASS dispatchedEvent("focusout") is ["divH(<-shadowK)(@divH)", "shadowG(<-shadowK)(@shadowG)", "shadowF(<-shadowK)(@shadowF)", "shadowF(<-shadowK)(@divE)"] 71 71 72 72 Move 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 188 188 moveFocus('divB', 'divC', 189 189 '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)"]'); 192 192 193 193 moveFocus('shadowD/shadowF/shadowG/divH', 'shadowD/shadowK/divL', 194 194 '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)"]'); 197 197 198 198 // 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 22 22 PASS document.createEvent('ErrorEvent') instanceof window.Event is true 23 23 PASS document.createEvent('ErrorEvent').constructor === window.ErrorEvent is true 24 PASS document.createEvent('FocusEvent') instanceof window.FocusEvent is true 25 PASS document.createEvent('FocusEvent') instanceof window.UIEvent is true 26 PASS document.createEvent('FocusEvent') instanceof window.Event is true 27 PASS document.createEvent('FocusEvent').constructor === window.FocusEvent is true 24 28 PASS document.createEvent('HashChangeEvent') instanceof window.HashChangeEvent is true 25 29 PASS document.createEvent('HashChangeEvent') instanceof window.Event is true -
trunk/LayoutTests/fast/events/event-creation.html
r98407 r107952 37 37 shouldBeTrue("document.createEvent('ErrorEvent') instanceof window.Event"); 38 38 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"); 39 45 40 46 // HashChangeEvent -
trunk/Source/WebCore/CMakeLists.txt
r107887 r107952 159 159 dom/EventException.idl 160 160 dom/Event.idl 161 dom/FocusEvent.idl 161 162 dom/HashChangeEvent.idl 162 163 dom/KeyboardEvent.idl … … 559 560 dom/ExceptionBase.cpp 560 561 dom/ExceptionCodePlaceholder.cpp 562 dom/FocusEvent.cpp 561 563 dom/GenericEventQueue.cpp 562 564 dom/IconURL.cpp -
trunk/Source/WebCore/ChangeLog
r107951 r107952 1 2012-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 1 68 2012-02-16 No'am Rosenthal <noam.rosenthal@nokia.com> 2 69 -
trunk/Source/WebCore/DerivedSources.cpp
r106794 r107952 130 130 #include "JSFloat32Array.cpp" 131 131 #include "JSFloat64Array.cpp" 132 #include "JSFocusEvent.cpp" 132 133 #include "JSGeolocation.cpp" 133 134 #include "JSGeoposition.cpp" -
trunk/Source/WebCore/DerivedSources.make
r107107 r107952 112 112 $(WebCore)/dom/EventListener.idl \ 113 113 $(WebCore)/dom/EventTarget.idl \ 114 $(WebCore)/dom/FocusEvent.idl \ 114 115 $(WebCore)/dom/HashChangeEvent.idl \ 115 116 $(WebCore)/dom/KeyboardEvent.idl \ -
trunk/Source/WebCore/DerivedSources.pri
r107107 r107952 143 143 # $$PWD/dom/EventListener.idl \ 144 144 # $$PWD/dom/EventTarget.idl \ 145 $$PWD/dom/FocusEvent.idl \ 145 146 $$PWD/dom/HashChangeEvent.idl \ 146 147 $$PWD/dom/KeyboardEvent.idl \ -
trunk/Source/WebCore/GNUmakefile.list.am
r107945 r107952 184 184 DerivedSources/WebCore/JSFloat64Array.cpp \ 185 185 DerivedSources/WebCore/JSFloat64Array.h \ 186 DerivedSources/WebCore/JSFocusEvent.cpp \ 187 DerivedSources/WebCore/JSFocusEvent.h \ 186 188 DerivedSources/WebCore/JSGeolocation.cpp \ 187 189 DerivedSources/WebCore/JSGeolocation.h \ … … 704 706 $(WebCore)/dom/Event.idl \ 705 707 $(WebCore)/dom/EventException.idl \ 708 $(WebCore)/dom/FocusEvent.idl \ 706 709 $(WebCore)/dom/HashChangeEvent.idl \ 707 710 $(WebCore)/dom/KeyboardEvent.idl \ … … 1570 1573 Source/WebCore/dom/ExceptionCodePlaceholder.cpp \ 1571 1574 Source/WebCore/dom/ExceptionCodePlaceholder.h \ 1575 Source/WebCore/dom/FocusEvent.cpp \ 1576 Source/WebCore/dom/FocusEvent.h \ 1572 1577 Source/WebCore/dom/FragmentScriptingPermission.h \ 1573 1578 Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h \ -
trunk/Source/WebCore/Target.pri
r107945 r107952 522 522 dom/ExceptionBase.cpp \ 523 523 dom/ExceptionCodePlaceholder.cpp \ 524 dom/FocusEvent.cpp \ 524 525 dom/GenericEventQueue.cpp \ 525 526 dom/IconURL.cpp \ … … 1636 1637 dom/ExceptionBase.h \ 1637 1638 dom/ExceptionCode.h \ 1639 dom/FocusEvent.h \ 1638 1640 dom/FragmentScriptingPermission.h \ 1639 1641 dom/KeyboardEvent.h \ -
trunk/Source/WebCore/WebCore.gypi
r107925 r107952 601 601 'dom/ExceptionCode.h', 602 602 'dom/ExceptionCodePlaceholder.h', 603 'dom/FocusEvent.h', 603 604 'dom/FragmentScriptingPermission.h', 604 605 'dom/KeyboardEvent.h', … … 626 627 'dom/TextEventInputType.h', 627 628 'dom/UIEvent.h', 629 'dom/FocusEvent.h', 628 630 'dom/UIEventWithKeyState.h', 629 631 'dom/UserGestureIndicator.h', … … 785 787 'dom/EventListener.idl', 786 788 'dom/EventTarget.idl', 789 'dom/FocusEvent.idl', 787 790 'dom/HashChangeEvent.idl', 788 791 'dom/KeyboardEvent.idl', … … 817 820 'dom/TreeWalker.idl', 818 821 'dom/UIEvent.idl', 822 'dom/FocusEvent.idl', 819 823 'dom/WebKitAnimationEvent.idl', 820 824 'dom/WebKitMutationObserver.idl', … … 5030 5034 'dom/ExceptionBase.h', 5031 5035 'dom/ExceptionCodePlaceholder.cpp', 5036 'dom/FocusEvent.cpp', 5032 5037 'dom/GenericEventQueue.cpp', 5033 5038 'dom/GenericEventQueue.h', … … 5146 5151 'dom/TreeWalker.h', 5147 5152 'dom/UIEvent.cpp', 5153 'dom/FocusEvent.cpp', 5148 5154 'dom/UIEventWithKeyState.cpp', 5149 5155 'dom/UserGestureIndicator.cpp', … … 7159 7165 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSFloat32Array.cpp', 7160 7166 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSFloat32Array.h', 7167 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSFocusEvent.cpp', 7168 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSFocusEvent.h', 7161 7169 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSGeolocation.cpp', 7162 7170 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSGeolocation.h', -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r107887 r107952 4987 4987 B6566271120B1227006EA85C /* JSIDBTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B656626F120B1227006EA85C /* JSIDBTransaction.cpp */; }; 4988 4988 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 */; }; 4989 4993 B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */ = {isa = PBXBuildFile; fileRef = B776D43A1104525D00BEB0EC /* PrintContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4990 4994 B734B181119B9911006587BD /* FontTranscoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B734B180119B9911006587BD /* FontTranscoder.cpp */; }; … … 11906 11910 B656626E120B1227006EA85C /* JSIDBTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBTransaction.h; sourceTree = "<group>"; }; 11907 11911 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>"; }; 11908 11917 B734B180119B9911006587BD /* FontTranscoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FontTranscoder.cpp; path = transcoder/FontTranscoder.cpp; sourceTree = "<group>"; }; 11909 11918 B734B182119B991D006587BD /* FontTranscoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FontTranscoder.h; path = transcoder/FontTranscoder.h; sourceTree = "<group>"; }; … … 18081 18090 E1ADEDD80E76BD93004A1A5E /* JSMessagePort.h */, 18082 18091 A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */, 18092 B6D9D27914EAC0860090D75E /* JSFocusEvent.h */, 18093 B6D9D27A14EAC0860090D75E /* JSFocusEvent.cpp */, 18083 18094 A86629CB09DA2B47009633A5 /* JSMouseEvent.h */, 18084 18095 65DF31E709D1CC60000BE325 /* JSMutationEvent.cpp */, … … 20499 20510 isa = PBXGroup; 20500 20511 children = ( 20512 B6D9D27214EABF030090D75E /* FocusEvent.idl */, 20501 20513 E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */, 20502 20514 E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */, … … 20847 20859 4123E568127B3041000FEEA7 /* WindowEventContext.cpp */, 20848 20860 4123E567127B3041000FEEA7 /* WindowEventContext.h */, 20861 B6D9D23314EABD260090D75E /* FocusEvent.h */, 20862 B6D9D23414EABD260090D75E /* FocusEvent.cpp */, 20849 20863 ); 20850 20864 path = dom; … … 24276 24290 572E92FC14E540580087FFBA /* ShadowRootList.h in Headers */, 24277 24291 97CC3AE314E8E4A200894988 /* NavigatorSupplement.h in Headers */, 24292 B6D9D23514EABD260090D75E /* FocusEvent.h in Headers */, 24293 B6D9D27B14EAC0860090D75E /* JSFocusEvent.h in Headers */, 24278 24294 C598905714E9C28000E8D18B /* PasteboardStrategy.h in Headers */, 24279 24295 C598905814E9C29900E8D18B /* PlatformPasteboard.h in Headers */, … … 27224 27240 572E92FB14E540580087FFBA /* ShadowRootList.cpp in Sources */, 27225 27241 97CC3AE214E8E4A200894988 /* NavigatorSupplement.cpp in Sources */, 27242 B6D9D23614EABD260090D75E /* FocusEvent.cpp in Sources */, 27243 B6D9D27C14EAC0860090D75E /* JSFocusEvent.cpp in Sources */, 27226 27244 C598902E14E9B0F800E8D18B /* PlatformPasteboardMac.mm in Sources */, 27227 27245 144FCE5A14EC79E7000D17A3 /* FractionalLayoutRect.cpp in Sources */, -
trunk/Source/WebCore/dom/DOMAllInOne.cpp
r107525 r107952 81 81 #include "ExceptionBase.cpp" 82 82 #include "ExceptionCodePlaceholder.cpp" 83 #include "FocusEvent.cpp" 83 84 #include "IconURL.cpp" 84 85 #include "KeyboardEvent.cpp" -
trunk/Source/WebCore/dom/EventDispatchMediator.cpp
r95901 r107952 1 1 /* 2 * Copyright (C) 2011 Google Inc. All rights reserved.2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 52 52 } 53 53 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) const66 {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) const83 {84 dispatcher->adjustRelatedTarget(event(), m_newFocusedNode);85 return EventDispatchMediator::dispatchEvent(dispatcher);86 }87 88 54 } // namespace WebCore -
trunk/Source/WebCore/dom/EventDispatchMediator.h
r95901 r107952 1 1 /* 2 * Copyright (C) 2011 Google Inc. All rights reserved.2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 58 58 }; 59 59 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 };77 60 78 61 } // namespace WebCore -
trunk/Source/WebCore/dom/EventFactory.in
r106603 r107952 9 9 CustomEvent 10 10 ErrorEvent 11 FocusEvent 12 FocusEvents interfaceName=FocusEvent 11 13 HashChangeEvent 12 14 KeyboardEvent -
trunk/Source/WebCore/dom/FocusEvent.h
r107951 r107952 1 1 /* 2 * Copyright (C) 201 1Google Inc. All rights reserved.2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 */ 30 30 31 #ifndef EventDispatchMediator_h32 #define EventDispatchMediator_h31 #ifndef FocusEvent_h 32 #define FocusEvent_h 33 33 34 #include <wtf/PassRefPtr.h>35 #include <wtf/RefCounted.h>36 #include <wtf/RefPtr.h> 34 #include "EventDispatchMediator.h" 35 #include "UIEvent.h" 36 37 37 38 38 namespace WebCore { 39 40 class Event; 41 class EventDispatcher; 42 class Node; 43 44 class EventDispatchMediator : public RefCounted<EventDispatchMediator> { 39 40 class FocusEvent : public UIEvent { 45 41 public: 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 58 private: 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 65 class FocusInEventDispatchMediator : public EventDispatchMediator { 66 public: 67 static PassRefPtr<FocusInEventDispatchMediator> create(PassRefPtr<FocusEvent>, PassRefPtr<Node> oldFocusedNode); 68 private: 69 explicit FocusInEventDispatchMediator(PassRefPtr<FocusEvent>, PassRefPtr<Node> oldFocusedNode); 48 70 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 76 class FocusOutEventDispatchMediator : public EventDispatchMediator { 77 public: 78 static PassRefPtr<FocusOutEventDispatchMediator> create(PassRefPtr<FocusEvent>, PassRefPtr<Node> newFocusedNode); 56 79 private: 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; 58 84 }; 59 60 class FocusEventDispatchMediator : public EventDispatchMediator { 85 86 87 class FocusEventDispatchMediator : public EventDispatchMediator { 61 88 public: 62 89 static PassRefPtr<FocusEventDispatchMediator> create(PassRefPtr<Node> oldFocusedNode); … … 65 92 virtual bool dispatchEvent(EventDispatcher*) const; 66 93 RefPtr<Node> m_oldFocusedNode; 67 }; 94 }; 95 68 96 69 class BlurEventDispatchMediator : public EventDispatchMediator { 97 class BlurEventDispatchMediator : public EventDispatchMediator { 70 98 public: 71 static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<Node> newFocusedNode); 99 static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<Node> newFocusedNode); 72 100 private: 73 101 explicit BlurEventDispatchMediator(PassRefPtr<Node> newFocusedNode); 74 102 virtual bool dispatchEvent(EventDispatcher*) const; 75 103 RefPtr<Node> m_newFocusedNode; 76 }; 104 }; 77 105 78 106 } // namespace WebCore 79 107 80 #endif // EventDispatchMediator_h108 #endif // FocusEvent_h -
trunk/Source/WebCore/dom/Node.cpp
r107832 r107952 59 59 #include "EventNames.h" 60 60 #include "ExceptionCode.h" 61 #include "FocusEvent.h" 61 62 #include "Frame.h" 62 63 #include "FrameView.h" … … 2803 2804 ASSERT(!eventDispatchForbidden()); 2804 2805 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)); 2806 2807 } 2807 2808 … … 2810 2811 ASSERT(!eventDispatchForbidden()); 2811 2812 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)); 2813 2814 } 2814 2815 -
trunk/Source/WebCore/dom/UIEvent.cpp
r104803 r107952 4 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2012 Google Inc. All rights reserved. 6 7 * 7 8 * This library is free software; you can redistribute it and/or … … 111 112 } 112 113 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) const125 {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) const142 {143 dispatcher->adjustRelatedTarget(event(), m_newFocusedNode);144 return EventDispatchMediator::dispatchEvent(dispatcher);145 }146 147 114 } // namespace WebCore -
trunk/Source/WebCore/dom/UIEvent.h
r98044 r107952 4 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2012 Google Inc. All rights reserved. 6 7 * 7 8 * This library is free software; you can redistribute it and/or … … 76 77 }; 77 78 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 96 79 } // namespace WebCore 97 80 -
trunk/Source/WebCore/page/DOMWindow.idl
r107869 r107952 1 1 /* 2 2 * 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. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 512 512 attribute CustomEventConstructor CustomEvent; 513 513 attribute ErrorEventConstructor ErrorEvent; 514 attribute FocusEventConstructor FocusEvent; 514 515 attribute HashChangeEventConstructor HashChangeEvent; 515 516 attribute KeyboardEventConstructor KeyboardEvent;
Note: See TracChangeset
for help on using the changeset viewer.