[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

brettw at chromium.org brettw at chromium.org
Wed Dec 22 13:39:08 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ad091a42da258be61ade7d113ddb239b5c480881
Author: brettw at chromium.org <brettw at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 22 15:46:22 2010 +0000

    2010-09-21  Brett Wilson  <brettw at chromium.org>
    
            Reviewed by Darin Fisher.
    
            Add caps log and num lock toggle state to WebInputEvent.
            https://bugs.webkit.org/show_bug.cgi?id=46229
    
            * public/WebInputEvent.h:
            * src/WebViewImpl.cpp:
            (WebKit::WebViewImpl::handleInputEvent):
            * src/WebViewImpl.h:
            * src/gtk/WebInputEventFactory.cpp:
            (WebKit::gdkStateToWebEventModifiers):
            * src/win/WebInputEventFactory.cpp:
            (WebKit::SetToggleKeyState):
            (WebKit::WebInputEventFactory::keyboardEvent):
            (WebKit::WebInputEventFactory::mouseEvent):
            (WebKit::WebInputEventFactory::mouseWheelEvent):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68047 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index fcdfd3c..1f001c9 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,22 @@
+2010-09-21  Brett Wilson  <brettw at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Add caps log and num lock toggle state to WebInputEvent.
+        https://bugs.webkit.org/show_bug.cgi?id=46229
+
+        * public/WebInputEvent.h:
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::handleInputEvent):
+        * src/WebViewImpl.h:
+        * src/gtk/WebInputEventFactory.cpp:
+        (WebKit::gdkStateToWebEventModifiers):
+        * src/win/WebInputEventFactory.cpp:
+        (WebKit::SetToggleKeyState):
+        (WebKit::WebInputEventFactory::keyboardEvent):
+        (WebKit::WebInputEventFactory::mouseEvent):
+        (WebKit::WebInputEventFactory::mouseWheelEvent):
+
 2010-09-21  James Robinson  <jamesr at chromium.org>
 
         Reviewed by Kenneth Russell.
diff --git a/WebKit/chromium/public/WebInputEvent.h b/WebKit/chromium/public/WebInputEvent.h
index f8b057b..26e41a4 100644
--- a/WebKit/chromium/public/WebInputEvent.h
+++ b/WebKit/chromium/public/WebInputEvent.h
@@ -122,6 +122,12 @@ public:
         LeftButtonDown   = 1 << 6,
         MiddleButtonDown = 1 << 7,
         RightButtonDown  = 1 << 8,
+
+        // Toggle modifiers for all events. Danger: these are not reflected
+        // into WebCore, so round-tripping from WebInputEvent to a WebCore
+        // event and back will not preserve these flags.
+        CapsLockOn       = 1 << 9,
+        NumLockOn        = 1 << 10,
     };
 
     unsigned size;   // The size of this structure, for serialization.
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index 103f78a..4a209f1 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -1041,8 +1041,6 @@ void WebViewImpl::composite(bool finish)
 #endif
 }
 
-// FIXME: m_currentInputEvent should be removed once ChromeClient::show() can
-// get the current-event information from WebCore.
 const WebInputEvent* WebViewImpl::m_currentInputEvent = 0;
 
 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
@@ -1057,6 +1055,8 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
     if (m_ignoreInputEvents)
         return true;
 
+    m_currentInputEvent = &inputEvent;
+
     if (m_mouseCaptureNode.get() && WebInputEvent::isMouseEventType(inputEvent.type)) {
         // Save m_mouseCaptureNode since mouseCaptureLost() will clear it.
         RefPtr<Node> node = m_mouseCaptureNode;
@@ -1086,17 +1086,10 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
         node->dispatchMouseEvent(
               PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *static_cast<const WebMouseEvent*>(&inputEvent)),
               eventType);
+        m_currentInputEvent = 0;
         return true;
     }
 
-    // FIXME: Remove m_currentInputEvent.
-    // This only exists to allow ChromeClient::show() to know which mouse button
-    // triggered a window.open event.
-    // Safari must perform a similar hack, ours is in our WebKit glue layer
-    // theirs is in the application.  This should go when WebCore can be fixed
-    // to pass more event information to ChromeClient::show()
-    m_currentInputEvent = &inputEvent;
-
     bool handled = true;
 
     // FIXME: WebKit seems to always return false on mouse events processing
diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h
index 6d81cc9..8ceffd3 100644
--- a/WebKit/chromium/src/WebViewImpl.h
+++ b/WebKit/chromium/src/WebViewImpl.h
@@ -317,9 +317,8 @@ public:
 
     void hideAutoFillPopup();
 
-    // HACK: currentInputEvent() is for ChromeClientImpl::show(), until we can
-    // fix WebKit to pass enough information up into ChromeClient::show() so we
-    // can decide if the window.open event was caused by a middle-mouse click
+    // Returns the input event we're currently processing. This is used in some
+    // cases where the WebCore DOM event doesn't have the information we need.
     static const WebInputEvent* currentInputEvent()
     {
         return m_currentInputEvent;
diff --git a/WebKit/chromium/src/gtk/WebInputEventFactory.cpp b/WebKit/chromium/src/gtk/WebInputEventFactory.cpp
index f8a1386..0d55c43 100644
--- a/WebKit/chromium/src/gtk/WebInputEventFactory.cpp
+++ b/WebKit/chromium/src/gtk/WebInputEventFactory.cpp
@@ -85,6 +85,10 @@ static int gdkStateToWebEventModifiers(guint state)
         modifiers |= WebInputEvent::MiddleButtonDown;
     if (state & GDK_BUTTON3_MASK)
         modifiers |= WebInputEvent::RightButtonDown;
+    if (state & GDK_LOCK_MASK)
+        modifiers |= WebInputEvent::CapsLockOn;
+    if (state & GDK_MOD2_MASK)
+        modifiers |= WebInputEvent::NumLockOn;
     return modifiers;
 }
 
diff --git a/WebKit/chromium/src/win/WebInputEventFactory.cpp b/WebKit/chromium/src/win/WebInputEventFactory.cpp
index d1d5869..c71a3b6 100644
--- a/WebKit/chromium/src/win/WebInputEventFactory.cpp
+++ b/WebKit/chromium/src/win/WebInputEventFactory.cpp
@@ -86,6 +86,16 @@ static bool isKeyPad(WPARAM wparam, LPARAM lparam)
     return keypad;
 }
 
+// Loads the state for toggle keys into the event.
+static void SetToggleKeyState(WebInputEvent* event)
+{
+    // Low bit set from GetKeyState indicates "toggled".
+    if (::GetKeyState(VK_NUMLOCK) & 1)
+        event->modifiers |= WebInputEvent::NumLockOn;
+    if (::GetKeyState(VK_CAPITAL) & 1)
+        event->modifiers |= WebInputEvent::CapsLockOn;
+}
+
 WebKeyboardEvent WebInputEventFactory::keyboardEvent(HWND hwnd, UINT message,
                                                      WPARAM wparam, LPARAM lparam)
 {
@@ -144,6 +154,7 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(HWND hwnd, UINT message,
     if (isKeyPad(wparam, lparam))
         result.modifiers |= WebInputEvent::IsKeyPad;
 
+    SetToggleKeyState(&result);
     return result;
 }
 
@@ -289,6 +300,7 @@ WebMouseEvent WebInputEventFactory::mouseEvent(HWND hwnd, UINT message,
     if (wparam & MK_RBUTTON)
         result.modifiers |= WebInputEvent::RightButtonDown;
 
+    SetToggleKeyState(&result);
     return result;
 }
 
@@ -386,6 +398,8 @@ WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(HWND hwnd, UINT message
     if (keyState & MK_RBUTTON)
         result.modifiers |= WebInputEvent::RightButtonDown;
 
+    SetToggleKeyState(&result);
+
     // Set coordinates by translating event coordinates from screen to client.
     POINT clientPoint = { result.globalX, result.globalY };
     MapWindowPoints(0, hwnd, &clientPoint, 1);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list