Remove unnecessary #includes from WebEvent.h
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Oct 2010 16:27:05 +0000 (16:27 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Oct 2010 16:27:05 +0000 (16:27 +0000)
Fixes <http://webkit.org/b/48609> WebEvent.h #includes things it
doesn't need

Reviewed by Sam Weinig.

* Scripts/webkit2/messages.py:
(MessageReceiver.iterparameters): Merged iterreplyparameters into this
function. All callers to iterparameters are really interested in the
reply parameters, too. This will cause us to, e.g., add
forward-declarations for types used in sync replies.
(headers_for_type): Added a special case for WebCore::KeypressCommand.

* Scripts/webkit2/messages_unittest.py: Added a test to cover the
failing case that inspired the above changes.

* Shared/WebEvent.h: Replaced #includes with forward-declarations.

* Shared/API/c/WKSharedAPICast.h:
* Shared/NativeWebKeyboardEvent.h:
* Shared/WebEvent.cpp:
* Shared/WebKeyboardEvent.cpp:
* Shared/WebMouseEvent.cpp:
* Shared/WebPlatformTouchPoint.cpp:
* Shared/WebTouchEvent.cpp:
* Shared/WebWheelEvent.cpp:
* UIProcess/LayerBackedDrawingAreaProxy.cpp:
* UIProcess/WebUIClient.cpp:
* UIProcess/WebUIClient.h:
* WebProcess/WebPage/FindController.cpp:
* WebProcess/WebPage/mac/WebPageMac.mm:
Added now-needed #includes and declarations.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70885 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
WebKit2/ChangeLog
WebKit2/Scripts/webkit2/messages.py
WebKit2/Scripts/webkit2/messages_unittest.py
WebKit2/Shared/API/c/WKSharedAPICast.h
WebKit2/Shared/NativeWebKeyboardEvent.h
WebKit2/Shared/WebEvent.cpp
WebKit2/Shared/WebEvent.h
WebKit2/Shared/WebKeyboardEvent.cpp
WebKit2/Shared/WebMouseEvent.cpp
WebKit2/Shared/WebPlatformTouchPoint.cpp
WebKit2/Shared/WebTouchEvent.cpp
WebKit2/Shared/WebWheelEvent.cpp
WebKit2/Shared/qt/WebEventFactoryQt.cpp
WebKit2/Shared/win/WebEventFactory.cpp
WebKit2/UIProcess/API/qt/qwkpage.cpp
WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp
WebKit2/UIProcess/WebUIClient.cpp
WebKit2/UIProcess/WebUIClient.h
WebKit2/UIProcess/win/WebView.cpp
WebKit2/WebProcess/WebPage/FindController.cpp
WebKit2/WebProcess/WebPage/mac/WebPageMac.mm

index ab0a941..32d3c59 100644 (file)
@@ -1,3 +1,43 @@
+2010-10-28  Adam Roben  <aroben@apple.com>
+
+        Remove unnecessary #includes from WebEvent.h
+
+        Fixes <http://webkit.org/b/48609> WebEvent.h #includes things it
+        doesn't need
+
+        Reviewed by Sam Weinig.
+
+        * Scripts/webkit2/messages.py:
+        (MessageReceiver.iterparameters): Merged iterreplyparameters into this
+        function. All callers to iterparameters are really interested in the
+        reply parameters, too. This will cause us to, e.g., add
+        forward-declarations for types used in sync replies.
+        (headers_for_type): Added a special case for WebCore::KeypressCommand.
+
+        * Scripts/webkit2/messages_unittest.py: Added a test to cover the
+        failing case that inspired the above changes.
+
+        * Shared/WebEvent.h: Replaced #includes with forward-declarations.
+
+        * Shared/API/c/WKSharedAPICast.h:
+        * Shared/NativeWebKeyboardEvent.h:
+        * Shared/WebEvent.cpp:
+        * Shared/WebKeyboardEvent.cpp:
+        * Shared/WebMouseEvent.cpp:
+        * Shared/WebPlatformTouchPoint.cpp:
+        * Shared/WebTouchEvent.cpp:
+        * Shared/WebWheelEvent.cpp:
+        * Shared/qt/WebEventFactoryQt.cpp:
+        * Shared/win/WebEventFactory.cpp:
+        * UIProcess/API/qt/qwkpage.cpp:
+        * UIProcess/LayerBackedDrawingAreaProxy.cpp:
+        * UIProcess/WebUIClient.cpp:
+        * UIProcess/WebUIClient.h:
+        * UIProcess/win/WebView.cpp:
+        * WebProcess/WebPage/FindController.cpp:
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        Added now-needed #includes and declarations.
+
 2010-10-29  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         Reviewed by Adam Roben and David Kilzer.
index b36ef72..05b6332 100644 (file)
@@ -21,6 +21,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import collections
+import itertools
 import re
 
 
@@ -56,10 +57,8 @@ class MessageReceiver(object):
         self.condition = condition
 
     def iterparameters(self):
-        return (parameter for message in self.messages for parameter in message.parameters)
-
-    def iterreplyparameters(self):
-        return (reply_parameter for message in self.messages for reply_parameter in message.reply_parameters)
+        return itertools.chain((parameter for message in self.messages for parameter in message.parameters),
+            (reply_parameter for message in self.messages if message.reply_parameters for reply_parameter in message.reply_parameters))
 
     @classmethod
     def parse(cls, file):
@@ -381,6 +380,7 @@ def headers_for_type(type):
 
     special_cases = {
         'WTF::String': '<wtf/text/WTFString.h>',
+        'WebCore::KeypressCommand': '<WebCore/KeyboardEvent.h>',
         'WebKit::WebKeyboardEvent': '"WebEvent.h"',
         'WebKit::WebMouseEvent': '"WebEvent.h"',
         'WebKit::WebWheelEvent': '"WebEvent.h"',
index 12f0699..8cf7edd 100644 (file)
@@ -67,6 +67,11 @@ messages -> WebPage {
     GetPluginProcessConnection(WTF::String pluginPath) -> (CoreIPC::Connection::Handle connectionHandle) delayed
 
     DidCreateWebProcessConnection(CoreIPC::MachPort connectionIdentifier)
+
+#if PLATFORM(MAC)
+    # Keyboard support
+    InterpretKeyEvent(uint32_t type) -> (Vector<WebCore::KeypressCommand> commandName)
+#endif
 }
 
 #endif
@@ -174,6 +179,16 @@ _expected_results = {
             ),
             'condition': None,
         },
+        {
+            'name': 'InterpretKeyEvent',
+            'parameters': (
+                ('uint32_t', 'type'),
+            ),
+            'reply_parameters': (
+                ('Vector<WebCore::KeypressCommand>', 'commandName'),
+            ),
+            'condition': 'PLATFORM(MAC)',
+        },
     ),
 }
 
@@ -236,8 +251,11 @@ _expected_header = """/*
 #if ENABLE(WEBKIT2)
 
 #include "Arguments.h"
+#include "Connection.h"
 #include "MessageID.h"
 #include "Plugin.h"
+#include <WebCore/KeyboardEvent.h>
+#include <WebCore/PluginInfo.h>
 #include <wtf/Vector.h>
 
 namespace CoreIPC {
@@ -272,6 +290,9 @@ enum Kind {
     GetPluginsID,
     GetPluginProcessConnectionID,
     DidCreateWebProcessConnectionID,
+#if PLATFORM(MAC)
+    InterpretKeyEventID,
+#endif
 };
 
 struct LoadURL : CoreIPC::Arguments1<const WTF::String&> {
@@ -384,6 +405,18 @@ struct DidCreateWebProcessConnection : CoreIPC::Arguments1<const CoreIPC::MachPo
     }
 };
 
+#if PLATFORM(MAC)
+struct InterpretKeyEvent : CoreIPC::Arguments1<uint32_t> {
+    static const Kind messageID = InterpretKeyEventID;
+    typedef CoreIPC::Arguments1<Vector<WebCore::KeypressCommand>&> Reply;
+    typedef CoreIPC::Arguments1<uint32_t> DecodeType;
+    explicit InterpretKeyEvent(uint32_t type)
+        : CoreIPC::Arguments1<uint32_t>(type)
+    {
+    }
+};
+#endif
+
 } // namespace WebPage
 
 } // namespace Messages
@@ -493,6 +526,11 @@ CoreIPC::SyncReplyMode WebPage::didReceiveSyncWebPageMessage(CoreIPC::Connection
     case Messages::WebPage::GetPluginProcessConnectionID:
         CoreIPC::handleMessage<Messages::WebPage::GetPluginProcessConnection>(arguments, reply, this, &WebPage::getPluginProcessConnection);
         return CoreIPC::AutomaticReply;
+#if PLATFORM(MAC)
+    case Messages::WebPage::InterpretKeyEventID:
+        CoreIPC::handleMessage<Messages::WebPage::InterpretKeyEvent>(arguments, reply, this, &WebPage::interpretKeyEvent);
+        return CoreIPC::AutomaticReply;
+#endif
     default:
         break;
     }
index 1e5d6de..2daa96b 100644 (file)
@@ -34,6 +34,7 @@
 #include "WebNumber.h"
 #include "WebString.h"
 #include "WebURL.h"
+#include <WebCore/IntRect.h>
 #include <WebCore/FloatRect.h>
 #include <wtf/TypeTraits.h>
 
index b9598d9..9c4e480 100644 (file)
@@ -29,6 +29,7 @@
 #include "WebEvent.h"
 
 #if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
 #ifdef __OBJC__
 @class NSView;
 #else
index 1086126..00f38f2 100644 (file)
@@ -25,6 +25,9 @@
 
 #include "WebEvent.h"
 
+#include "ArgumentDecoder.h"
+#include "ArgumentEncoder.h"
+
 namespace WebKit {
 
 WebEvent::WebEvent(Type type, Modifiers modifiers, double timestamp)
index 76f262a..67120da 100644 (file)
 // FIXME: We should probably move to makeing the WebCore/PlatformFooEvents trivial classes so that
 // we can use them as the event type.
 
-#include "ArgumentDecoder.h"
-#include "ArgumentEncoder.h"
-#include "WebCoreArgumentCoders.h"
 #include <wtf/text/WTFString.h>
 
+namespace CoreIPC {
+    class ArgumentDecoder;
+    class ArgumentEncoder;
+}
+
 namespace WebKit {
 
 class WebEvent {
index c711a5b..0859cdd 100644 (file)
@@ -25,6 +25,8 @@
 
 #include "WebEvent.h"
 
+#include "WebCoreArgumentCoders.h"
+
 namespace WebKit {
 
 WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp)
index 7c6cff1..97b9d13 100644 (file)
@@ -25,6 +25,9 @@
 
 #include "WebEvent.h"
 
+#include "ArgumentDecoder.h"
+#include "ArgumentEncoder.h"
+
 namespace WebKit {
 
 WebMouseEvent::WebMouseEvent(Type type, Button button, int x, int y, int globalX, int globalY, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, double timestamp)
index cfc285c..85eaca4 100644 (file)
@@ -27,6 +27,9 @@
 
 #include "WebEvent.h"
 
+#include "ArgumentDecoder.h"
+#include "ArgumentEncoder.h"
+
 namespace WebKit {
 
 WebPlatformTouchPoint::WebPlatformTouchPoint(unsigned id, TouchPointState state, int screenPosX, int screenPosY, int posX, int posY)
index 344b038..f705ca0 100644 (file)
@@ -27,6 +27,8 @@
 
 #include "WebEvent.h"
 
+#include "ArgumentCoders.h"
+
 namespace WebKit {
 
 WebTouchEvent::WebTouchEvent(WebEvent::Type type, Vector<WebPlatformTouchPoint> touchPoints, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, Modifiers modifiers, double timestamp)
index 7b46fca..bb9b2ad 100644 (file)
@@ -25,6 +25,9 @@
 
 #include "WebEvent.h"
 
+#include "ArgumentDecoder.h"
+#include "ArgumentEncoder.h"
+
 namespace WebKit {    
 
 WebWheelEvent::WebWheelEvent(Type type, int x, int y, int globalX, int globalY, float deltaX, float deltaY, float wheelTicksX, float wheelTicksY, Granularity granularity, Modifiers modifiers, double timestamp)
index 009a470..aaeb33b 100644 (file)
@@ -28,6 +28,8 @@
 #include <qgraphicssceneevent.h>
 #include <QApplication>
 #include <QKeyEvent>
+#include <WebCore/IntPoint.h>
+#include <WebCore/FloatPoint.h>
 #include <WebCore/PlatformKeyboardEvent.h>
 #include <wtf/ASCIICType.h>
 #include <wtf/CurrentTime.h>
index 3104f18..22e5f1b 100644 (file)
@@ -29,8 +29,6 @@
 #include <windowsx.h>
 #include <wtf/ASCIICType.h>
 
-using namespace WebCore;
-
 namespace WebKit {
 
 static const unsigned short HIGH_BIT_MASK_SHORT = 0x8000;
index cf122d6..edb9699 100644 (file)
@@ -42,6 +42,7 @@
 #include <QStyle>
 #include <QTouchEvent>
 #include <QtDebug>
+#include <WebCore/Cursor.h>
 #include <WebCore/FloatRect.h>
 #include <WebKit2/WKFrame.h>
 #include <WebKit2/WKRetainPtr.h>
index 4e162b3..4c57cd9 100644 (file)
@@ -30,6 +30,7 @@
 #include "DrawingAreaMessageKinds.h"
 #include "DrawingAreaProxyMessageKinds.h"
 #include "MessageID.h"
+#include "WebCoreArgumentCoders.h"
 #include "WebPageProxy.h"
 #include "WebProcessProxy.h"
 
index 140e5ff..fe1bd91 100644 (file)
@@ -32,6 +32,7 @@
 #include "WebPageProxy.h"
 #include <WebCore/FloatRect.h>
 #include <WebCore/IntSize.h>
+#include <WebCore/WindowFeatures.h>
 #include <string.h>
 #include <wtf/text/WTFString.h>
 
index 9e6630e..51c193c 100644 (file)
@@ -32,8 +32,9 @@
 #include <wtf/PassRefPtr.h>
 
 namespace WebCore {
-class IntSize;
-struct WindowFeatures;
+    class FloatRect;
+    class IntSize;
+    struct WindowFeatures;
 }
 
 namespace WebKit {
index 47145a3..dfee2aa 100644 (file)
@@ -35,6 +35,7 @@
 #include "WebPageProxy.h"
 #include "WebPopupMenuProxyWin.h"
 #include <Commctrl.h>
+#include <WebCore/Cursor.h>
 #include <WebCore/FloatRect.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/WebCoreInstanceHandle.h>
index 4792e33..bdf9ba9 100644 (file)
@@ -28,6 +28,7 @@
 #include "BackingStore.h"
 #include "FindPageOverlay.h"
 #include "WKPage.h"
+#include "WebCoreArgumentCoders.h"
 #include "WebPage.h"
 #include "WebPageProxyMessages.h"
 #include "WebProcess.h"
index fb07f26..556dc31 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "WebPage.h"
 
+#include "WebCoreArgumentCoders.h"
 #include "WebEvent.h"
 #include "WebPageProxyMessages.h"
 #include "WebProcess.h"