Title: [93385] trunk/Source/WebCore
Revision
93385
Author
[email protected]
Date
2011-08-18 21:46:33 -0700 (Thu, 18 Aug 2011)

Log Message

Isolate EventDispatchMediator into a separate file.
https://bugs.webkit.org/show_bug.cgi?id=66458

Reviewed by Ryosuke Niwa.

Extracted EventDispatchMediator.h and EventDispatchMediator.cpp
out of Event.h and Event.cpp Also moved FocusEventDispatchMediator
and BlurEventDispatchMediator from Event.{h|cpp} to
EventDispatchMediator.{h|cpp}.

No new tests since this is just refactoring.

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* dom/Event.cpp:
* dom/Event.h:
* dom/EventDispatchMediator.cpp: Added.
(WebCore::EventDispatchMediator::create):
(WebCore::EventDispatchMediator::EventDispatchMediator):
(WebCore::EventDispatchMediator::dispatchEvent):
(WebCore::FocusEventDispatchMediator::create):
(WebCore::FocusEventDispatchMediator::FocusEventDispatchMediator):
(WebCore::FocusEventDispatchMediator::dispatchEvent):
(WebCore::BlurEventDispatchMediator::create):
(WebCore::BlurEventDispatchMediator::BlurEventDispatchMediator):
(WebCore::BlurEventDispatchMediator::dispatchEvent):
* dom/EventDispatchMediator.h: Added.
(WebCore::EventDispatchMediator::~EventDispatchMediator):
(WebCore::EventDispatchMediator::event):
(WebCore::EventDispatchMediator::EventDispatchMediator):
(WebCore::EventDispatchMediator::setEvent):
* dom/EventDispatcher.cpp:
* dom/KeyboardEvent.h:
* dom/MouseEvent.h:
* dom/Node.cpp:
* dom/ScopedEventQueue.cpp:
* dom/UIEvent.h:
* dom/WheelEvent.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (93384 => 93385)


--- trunk/Source/WebCore/CMakeLists.txt	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/CMakeLists.txt	2011-08-19 04:46:33 UTC (rev 93385)
@@ -524,6 +524,7 @@
     dom/ErrorEvent.cpp
     dom/Event.cpp
     dom/EventContext.cpp
+    dom/EventDispatchMediator.cpp
     dom/EventDispatcher.cpp
     dom/EventNames.cpp
     dom/EventTarget.cpp

Modified: trunk/Source/WebCore/ChangeLog (93384 => 93385)


--- trunk/Source/WebCore/ChangeLog	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/ChangeLog	2011-08-19 04:46:33 UTC (rev 93385)
@@ -1,3 +1,48 @@
+2011-08-18  Hayato Ito  <[email protected]>
+
+        Isolate EventDispatchMediator into a separate file.
+        https://bugs.webkit.org/show_bug.cgi?id=66458
+
+        Reviewed by Ryosuke Niwa.
+
+        Extracted EventDispatchMediator.h and EventDispatchMediator.cpp
+        out of Event.h and Event.cpp Also moved FocusEventDispatchMediator
+        and BlurEventDispatchMediator from Event.{h|cpp} to
+        EventDispatchMediator.{h|cpp}.
+
+        No new tests since this is just refactoring.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/Event.cpp:
+        * dom/Event.h:
+        * dom/EventDispatchMediator.cpp: Added.
+        (WebCore::EventDispatchMediator::create):
+        (WebCore::EventDispatchMediator::EventDispatchMediator):
+        (WebCore::EventDispatchMediator::dispatchEvent):
+        (WebCore::FocusEventDispatchMediator::create):
+        (WebCore::FocusEventDispatchMediator::FocusEventDispatchMediator):
+        (WebCore::FocusEventDispatchMediator::dispatchEvent):
+        (WebCore::BlurEventDispatchMediator::create):
+        (WebCore::BlurEventDispatchMediator::BlurEventDispatchMediator):
+        (WebCore::BlurEventDispatchMediator::dispatchEvent):
+        * dom/EventDispatchMediator.h: Added.
+        (WebCore::EventDispatchMediator::~EventDispatchMediator):
+        (WebCore::EventDispatchMediator::event):
+        (WebCore::EventDispatchMediator::EventDispatchMediator):
+        (WebCore::EventDispatchMediator::setEvent):
+        * dom/EventDispatcher.cpp:
+        * dom/KeyboardEvent.h:
+        * dom/MouseEvent.h:
+        * dom/Node.cpp:
+        * dom/ScopedEventQueue.cpp:
+        * dom/UIEvent.h:
+        * dom/WheelEvent.h:
+
 2011-08-18  Dan Bernstein  <[email protected]>
 
         Mid-word break can occur between a character and a combining mark

Modified: trunk/Source/WebCore/GNUmakefile.list.am (93384 => 93385)


--- trunk/Source/WebCore/GNUmakefile.list.am	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2011-08-19 04:46:33 UTC (rev 93385)
@@ -1169,6 +1169,8 @@
 	Source/WebCore/dom/Event.h \
 	Source/WebCore/dom/EventContext.cpp \
 	Source/WebCore/dom/EventContext.h \
+	Source/WebCore/dom/EventDispatchMediator.cpp \
+	Source/WebCore/dom/EventDispatchMediator.h \
 	Source/WebCore/dom/EventDispatcher.cpp \
 	Source/WebCore/dom/EventDispatcher.h \
 	Source/WebCore/dom/EventException.h \

Modified: trunk/Source/WebCore/WebCore.gypi (93384 => 93385)


--- trunk/Source/WebCore/WebCore.gypi	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/WebCore.gypi	2011-08-19 04:46:33 UTC (rev 93385)
@@ -5298,6 +5298,8 @@
             'dom/Event.cpp',
             'dom/EventContext.cpp',
             'dom/EventContext.h',
+            'dom/EventDispatchMediator.cpp',
+            'dom/EventDispatchMediator.h',
             'dom/EventDispatcher.cpp',
             'dom/EventDispatcher.h',
             'dom/EventException.h',

Modified: trunk/Source/WebCore/WebCore.pro (93384 => 93385)


--- trunk/Source/WebCore/WebCore.pro	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/WebCore.pro	2011-08-19 04:46:33 UTC (rev 93385)
@@ -495,6 +495,7 @@
     dom/ErrorEvent.cpp \
     dom/Event.cpp \
     dom/EventContext.cpp \
+    dom/EventDispatchMediator.cpp \
     dom/EventDispatcher.cpp \
     dom/EventNames.cpp \
     dom/EventTarget.cpp \
@@ -1495,6 +1496,7 @@
     dom/Entity.h \
     dom/EntityReference.h \
     dom/Event.h \
+    dom/EventDispatchMediator.h \
     dom/EventNames.h \
     dom/EventTarget.h \
     dom/ExceptionBase.h \

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (93384 => 93385)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-08-19 04:46:33 UTC (rev 93385)
@@ -45650,6 +45650,62 @@
 				>
 			</File>
 			<File
+				RelativePath="..\dom\EventDispatcMediator.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug_Cairo_CFLite|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release_Cairo_CFLite|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug_All|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Production|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\dom\EventDispatchMediator.h"
+				>
+			</File>
+			<File
 				RelativePath="..\dom\EventDispatcher.cpp"
 				>
 				<FileConfiguration

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (93384 => 93385)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-08-19 04:46:33 UTC (rev 93385)
@@ -1292,6 +1292,8 @@
 		4AD01009127E642A0015035F /* HTMLOutputElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AD01006127E642A0015035F /* HTMLOutputElement.h */; };
 		4AD0173C127E82860015035F /* JSHTMLOutputElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AD0173A127E82860015035F /* JSHTMLOutputElement.cpp */; };
 		4AD0173D127E82860015035F /* JSHTMLOutputElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AD0173B127E82860015035F /* JSHTMLOutputElement.h */; };
+		4AF1AD3E13FD23A400AA9590 /* EventDispatchMediator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AF1AD3C13FD23A400AA9590 /* EventDispatchMediator.cpp */; };
+		4AF1AD3F13FD23A400AA9590 /* EventDispatchMediator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AF1AD3D13FD23A400AA9590 /* EventDispatchMediator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		4B2708C70AF19EE40065127F /* Pasteboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B2708C50AF19EE40065127F /* Pasteboard.h */; };
 		4B2709830AF2E5E00065127F /* PasteboardMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2709810AF2E5E00065127F /* PasteboardMac.mm */; };
 		4B3043C70AE0370300A82647 /* Sound.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3043C60AE0370300A82647 /* Sound.h */; };
@@ -7902,6 +7904,8 @@
 		4AD01007127E642A0015035F /* HTMLOutputElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLOutputElement.idl; sourceTree = "<group>"; };
 		4AD0173A127E82860015035F /* JSHTMLOutputElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLOutputElement.cpp; sourceTree = "<group>"; };
 		4AD0173B127E82860015035F /* JSHTMLOutputElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLOutputElement.h; sourceTree = "<group>"; };
+		4AF1AD3C13FD23A400AA9590 /* EventDispatchMediator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventDispatchMediator.cpp; sourceTree = "<group>"; };
+		4AF1AD3D13FD23A400AA9590 /* EventDispatchMediator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventDispatchMediator.h; sourceTree = "<group>"; };
 		4B2708C50AF19EE40065127F /* Pasteboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pasteboard.h; sourceTree = "<group>"; };
 		4B2709810AF2E5E00065127F /* PasteboardMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PasteboardMac.mm; sourceTree = "<group>"; };
 		4B3043C60AE0370300A82647 /* Sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Sound.h; sourceTree = "<group>"; };
@@ -19872,6 +19876,8 @@
 				14E836D209F8512000B85AE4 /* Event.idl */,
 				4138D3341244054800323D33 /* EventContext.cpp */,
 				4138D3331244054800323D33 /* EventContext.h */,
+				4AF1AD3C13FD23A400AA9590 /* EventDispatchMediator.cpp */,
+				4AF1AD3D13FD23A400AA9590 /* EventDispatchMediator.h */,
 				418A06CF133C04D500CD379C /* EventDispatcher.cpp */,
 				418A06CE133C04D500CD379C /* EventDispatcher.h */,
 				BC60D9090D2A17CE00B9918F /* EventException.h */,
@@ -21390,6 +21396,7 @@
 				2ECF7AE210162B5800427DE7 /* ErrorEvent.h in Headers */,
 				85031B420A44EFC700F992E0 /* Event.h in Headers */,
 				4138D3351244054800323D33 /* EventContext.h in Headers */,
+				4AF1AD3F13FD23A400AA9590 /* EventDispatchMediator.h in Headers */,
 				418A06D0133C04D500CD379C /* EventDispatcher.h in Headers */,
 				BC60D90C0D2A17CE00B9918F /* EventException.h in Headers */,
 				93C09A530B064DB3005ABD4D /* EventHandler.h in Headers */,
@@ -24347,6 +24354,7 @@
 				2ECF7AE110162B5800427DE7 /* ErrorEvent.cpp in Sources */,
 				85031B410A44EFC700F992E0 /* Event.cpp in Sources */,
 				4138D3361244054800323D33 /* EventContext.cpp in Sources */,
+				4AF1AD3E13FD23A400AA9590 /* EventDispatchMediator.cpp in Sources */,
 				418A06D1133C04D500CD379C /* EventDispatcher.cpp in Sources */,
 				93C09A810B064F00005ABD4D /* EventHandler.cpp in Sources */,
 				93C09A7F0B064EEF005ABD4D /* EventHandlerMac.mm in Sources */,

Modified: trunk/Source/WebCore/dom/Event.cpp (93384 => 93385)


--- trunk/Source/WebCore/dom/Event.cpp	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/dom/Event.cpp	2011-08-19 04:46:33 UTC (rev 93385)
@@ -289,58 +289,4 @@
     m_underlyingEvent = ue;
 }
 
-PassRefPtr<EventDispatchMediator> EventDispatchMediator::create(PassRefPtr<Event> event)
-{
-    return adoptRef(new EventDispatchMediator(event));
-}
-
-EventDispatchMediator::EventDispatchMediator(PassRefPtr<Event> event)
-    : m_event(event)
-{
-}
-
-EventDispatchMediator::~EventDispatchMediator()
-{
-}
-
-bool EventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
-{
-    return dispatcher->dispatchEvent(m_event.get());
-}
-
-PassRefPtr<FocusEventDispatchMediator> FocusEventDispatchMediator::create(PassRefPtr<Node> oldFocusedNode)
-{
-    return adoptRef(new FocusEventDispatchMediator(oldFocusedNode));
-}
-
-FocusEventDispatchMediator::FocusEventDispatchMediator(PassRefPtr<Node> oldFocusedNode)
-    : EventDispatchMediator(Event::create(eventNames().focusEvent, false, false))
-    , m_oldFocusedNode(oldFocusedNode)
-{
-}
-
-bool FocusEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
-{
-    dispatcher->adjustRelatedTarget(event(), m_oldFocusedNode);
-    return EventDispatchMediator::dispatchEvent(dispatcher);
-}
-
-PassRefPtr<BlurEventDispatchMediator> BlurEventDispatchMediator::create(PassRefPtr<Node> newFocusedNode)
-{
-    return adoptRef(new BlurEventDispatchMediator(newFocusedNode));
-}
-
-BlurEventDispatchMediator::BlurEventDispatchMediator(PassRefPtr<Node> newFocusedNode)
-    : EventDispatchMediator(Event::create(eventNames().blurEvent, false, false))
-    , m_newFocusedNode(newFocusedNode)
-{
-}
-
-bool BlurEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
-{
-    dispatcher->adjustRelatedTarget(event(), m_newFocusedNode);
-    return EventDispatchMediator::dispatchEvent(dispatcher);
-}
-
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/Event.h (93384 => 93385)


--- trunk/Source/WebCore/dom/Event.h	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/dom/Event.h	2011-08-19 04:46:33 UTC (rev 93385)
@@ -199,55 +199,6 @@
         RefPtr<Event> m_underlyingEvent;
     };
 
-class EventDispatchMediator : public RefCounted<EventDispatchMediator> {
-public:
-    static PassRefPtr<EventDispatchMediator> create(PassRefPtr<Event>);
-    virtual ~EventDispatchMediator();
-
-    virtual bool dispatchEvent(EventDispatcher*) const;
-    Event* event() const;
-
-protected:
-    explicit EventDispatchMediator(PassRefPtr<Event>);
-    EventDispatchMediator();
-    void setEvent(PassRefPtr<Event>);
-
-private:
-    RefPtr<Event> m_event;
-};
-
-inline EventDispatchMediator::EventDispatchMediator()
-{
-}
-
-inline Event* EventDispatchMediator::event() const
-{
-    return m_event.get();
-}
-
-inline void EventDispatchMediator::setEvent(PassRefPtr<Event> event)
-{
-    m_event = event;
-}
-
-class FocusEventDispatchMediator : public EventDispatchMediator {
-public:
-    static PassRefPtr<FocusEventDispatchMediator> create(PassRefPtr<Node> oldFocusedNode);
-private:
-    explicit FocusEventDispatchMediator(PassRefPtr<Node> oldFocusedNode);
-    virtual bool dispatchEvent(EventDispatcher*) const;
-    RefPtr<Node> m_oldFocusedNode;
-};
-
-class BlurEventDispatchMediator : public EventDispatchMediator {
-public:
-    static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<Node> newFocusedNode);
-private:
-    explicit BlurEventDispatchMediator(PassRefPtr<Node> newFocusedNode);
-    virtual bool dispatchEvent(EventDispatcher*) const;
-    RefPtr<Node> m_newFocusedNode;
-};
-
 } // namespace WebCore
 
 #endif // Event_h

Added: trunk/Source/WebCore/dom/EventDispatchMediator.cpp (0 => 93385)


--- trunk/Source/WebCore/dom/EventDispatchMediator.cpp	                        (rev 0)
+++ trunk/Source/WebCore/dom/EventDispatchMediator.cpp	2011-08-19 04:46:33 UTC (rev 93385)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "EventDispatchMediator.h"
+
+#include "Event.h"
+#include "EventDispatcher.h"
+
+namespace WebCore {
+
+PassRefPtr<EventDispatchMediator> EventDispatchMediator::create(PassRefPtr<Event> event)
+{
+    return adoptRef(new EventDispatchMediator(event));
+}
+
+EventDispatchMediator::EventDispatchMediator(PassRefPtr<Event> event)
+    : m_event(event)
+{
+}
+
+bool EventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
+{
+    return dispatcher->dispatchEvent(m_event.get());
+}
+
+PassRefPtr<FocusEventDispatchMediator> FocusEventDispatchMediator::create(PassRefPtr<Node> oldFocusedNode)
+{
+    return adoptRef(new FocusEventDispatchMediator(oldFocusedNode));
+}
+
+FocusEventDispatchMediator::FocusEventDispatchMediator(PassRefPtr<Node> oldFocusedNode)
+    : EventDispatchMediator(Event::create(eventNames().focusEvent, false, false))
+    , m_oldFocusedNode(oldFocusedNode)
+{
+}
+
+bool FocusEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
+{
+    dispatcher->adjustRelatedTarget(event(), m_oldFocusedNode);
+    return EventDispatchMediator::dispatchEvent(dispatcher);
+}
+
+PassRefPtr<BlurEventDispatchMediator> BlurEventDispatchMediator::create(PassRefPtr<Node> newFocusedNode)
+{
+    return adoptRef(new BlurEventDispatchMediator(newFocusedNode));
+}
+
+BlurEventDispatchMediator::BlurEventDispatchMediator(PassRefPtr<Node> newFocusedNode)
+    : EventDispatchMediator(Event::create(eventNames().blurEvent, false, false))
+    , m_newFocusedNode(newFocusedNode)
+{
+}
+
+bool BlurEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
+{
+    dispatcher->adjustRelatedTarget(event(), m_newFocusedNode);
+    return EventDispatchMediator::dispatchEvent(dispatcher);
+}
+
+} // namespace WebCore
Property changes on: trunk/Source/WebCore/dom/EventDispatchMediator.cpp
___________________________________________________________________

Added: svn:eol-style

Added: trunk/Source/WebCore/dom/EventDispatchMediator.h (0 => 93385)


--- trunk/Source/WebCore/dom/EventDispatchMediator.h	                        (rev 0)
+++ trunk/Source/WebCore/dom/EventDispatchMediator.h	2011-08-19 04:46:33 UTC (rev 93385)
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EventDispatchMediator_h
+#define EventDispatchMediator_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class Event;
+class EventDispatcher;
+class Node;
+
+class EventDispatchMediator : public RefCounted<EventDispatchMediator> {
+public:
+    static PassRefPtr<EventDispatchMediator> create(PassRefPtr<Event>);
+    virtual ~EventDispatchMediator() { };
+    virtual bool dispatchEvent(EventDispatcher*) const;
+    Event* event() const { return m_event.get(); };
+
+protected:
+    explicit EventDispatchMediator(PassRefPtr<Event>);
+    EventDispatchMediator() { };
+    void setEvent(PassRefPtr<Event> event) { m_event = event; };
+
+private:
+    RefPtr<Event> m_event;
+};
+
+class FocusEventDispatchMediator : public EventDispatchMediator {
+public:
+    static PassRefPtr<FocusEventDispatchMediator> create(PassRefPtr<Node> oldFocusedNode);
+private:
+    explicit FocusEventDispatchMediator(PassRefPtr<Node> oldFocusedNode);
+    virtual bool dispatchEvent(EventDispatcher*) const;
+    RefPtr<Node> m_oldFocusedNode;
+};
+
+class BlurEventDispatchMediator : public EventDispatchMediator {
+public:
+    static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<Node> newFocusedNode);
+private:
+    explicit BlurEventDispatchMediator(PassRefPtr<Node> newFocusedNode);
+    virtual bool dispatchEvent(EventDispatcher*) const;
+    RefPtr<Node> m_newFocusedNode;
+};
+
+} // namespace WebCore
+
+#endif // EventDispatchMediator_h
Property changes on: trunk/Source/WebCore/dom/EventDispatchMediator.h
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (93384 => 93385)


--- trunk/Source/WebCore/dom/EventDispatcher.cpp	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp	2011-08-19 04:46:33 UTC (rev 93385)
@@ -27,6 +27,7 @@
 #include "EventDispatcher.h"
 
 #include "EventContext.h"
+#include "EventDispatchMediator.h"
 #include "FrameView.h"
 #include "HTMLMediaElement.h"
 #include "InspectorInstrumentation.h"

Modified: trunk/Source/WebCore/dom/KeyboardEvent.h (93384 => 93385)


--- trunk/Source/WebCore/dom/KeyboardEvent.h	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/dom/KeyboardEvent.h	2011-08-19 04:46:33 UTC (rev 93385)
@@ -24,6 +24,7 @@
 #ifndef KeyboardEvent_h
 #define KeyboardEvent_h
 
+#include "EventDispatchMediator.h"
 #include "UIEventWithKeyState.h"
 #include <wtf/Vector.h>
 

Modified: trunk/Source/WebCore/dom/MouseEvent.h (93384 => 93385)


--- trunk/Source/WebCore/dom/MouseEvent.h	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/dom/MouseEvent.h	2011-08-19 04:46:33 UTC (rev 93385)
@@ -25,6 +25,7 @@
 #define MouseEvent_h
 
 #include "Clipboard.h"
+#include "EventDispatchMediator.h"
 #include "MouseRelatedEvent.h"
 
 namespace WebCore {

Modified: trunk/Source/WebCore/dom/Node.cpp (93384 => 93385)


--- trunk/Source/WebCore/dom/Node.cpp	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/dom/Node.cpp	2011-08-19 04:46:33 UTC (rev 93385)
@@ -48,6 +48,7 @@
 #include "Element.h"
 #include "Event.h"
 #include "EventContext.h"
+#include "EventDispatchMediator.h"
 #include "EventDispatcher.h"
 #include "EventException.h"
 #include "EventHandler.h"

Modified: trunk/Source/WebCore/dom/ScopedEventQueue.cpp (93384 => 93385)


--- trunk/Source/WebCore/dom/ScopedEventQueue.cpp	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/dom/ScopedEventQueue.cpp	2011-08-19 04:46:33 UTC (rev 93385)
@@ -32,6 +32,7 @@
 #include "ScopedEventQueue.h"
 
 #include "Event.h"
+#include "EventDispatchMediator.h"
 #include "EventDispatcher.h"
 #include "EventTarget.h"
 #include <wtf/OwnPtr.h>

Modified: trunk/Source/WebCore/dom/UIEvent.h (93384 => 93385)


--- trunk/Source/WebCore/dom/UIEvent.h	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/dom/UIEvent.h	2011-08-19 04:46:33 UTC (rev 93385)
@@ -26,6 +26,7 @@
 
 #include "DOMWindow.h"
 #include "Event.h"
+#include "EventDispatchMediator.h"
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/dom/WheelEvent.h (93384 => 93385)


--- trunk/Source/WebCore/dom/WheelEvent.h	2011-08-19 03:34:36 UTC (rev 93384)
+++ trunk/Source/WebCore/dom/WheelEvent.h	2011-08-19 04:46:33 UTC (rev 93385)
@@ -24,6 +24,7 @@
 #ifndef WheelEvent_h
 #define WheelEvent_h
 
+#include "EventDispatchMediator.h"
 #include "FloatPoint.h"
 #include "MouseRelatedEvent.h"
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to