2011-05-17 Yufeng Shen <miletus@chromium.org>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 May 2011 20:04:41 +0000 (20:04 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 May 2011 20:04:41 +0000 (20:04 +0000)
        Reviewed by Darin Fisher.

        Make WebKit expose extra touch information
        https://bugs.webkit.org/show_bug.cgi?id=59030

        * fast/events/touch/document-create-touch-expected.txt:
        * fast/events/touch/script-tests/document-create-touch.js:
2011-05-17  Yufeng Shen  <miletus@chromium.org>

        Reviewed by Darin Fisher.

        Make WebKit expose extra touch information
        https://bugs.webkit.org/show_bug.cgi?id=59030

        * dom/Document.cpp:
        (WebCore::Document::createTouch):
        * dom/Document.h:
        * dom/Document.idl:
        * dom/Touch.cpp:
        (WebCore::Touch::Touch):
        * dom/Touch.h:
        (WebCore::Touch::create):
        (WebCore::Touch::webkitRadiusX):
        (WebCore::Touch::webkitRadiusY):
        (WebCore::Touch::webkitRotationAngle):
        * dom/Touch.idl:
        * page/EventHandler.cpp:
        (WebCore::EventHandler::handleTouchEvent):
        * platform/PlatformTouchPoint.h:
        (WebCore::PlatformTouchPoint::radiusX):
        (WebCore::PlatformTouchPoint::radiusY):
        (WebCore::PlatformTouchPoint::rotationAngle):
2011-05-17  Yufeng Shen  <miletus@chromium.org>

        Reviewed by Darin Fisher.

        Make WebKit expose extra touch information
        https://bugs.webkit.org/show_bug.cgi?id=59030

        * public/WebTouchPoint.h:
        (WebKit::WebTouchPoint::WebTouchPoint):
        * src/WebInputEventConversion.cpp:
        (WebKit::PlatformTouchPointBuilder::PlatformTouchPointBuilder):

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

15 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/touch/document-create-touch-expected.txt
LayoutTests/fast/events/touch/script-tests/document-create-touch.js
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Document.idl
Source/WebCore/dom/Touch.cpp
Source/WebCore/dom/Touch.h
Source/WebCore/dom/Touch.idl
Source/WebCore/page/EventHandler.cpp
Source/WebCore/platform/PlatformTouchPoint.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebTouchPoint.h
Source/WebKit/chromium/src/WebInputEventConversion.cpp

index 868512c..870832e 100644 (file)
@@ -1,3 +1,13 @@
+2011-05-17  Yufeng Shen  <miletus@chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Make WebKit expose extra touch information
+        https://bugs.webkit.org/show_bug.cgi?id=59030
+
+        * fast/events/touch/document-create-touch-expected.txt:
+        * fast/events/touch/script-tests/document-create-touch.js:
+
 2011-05-17  Andreas Kling  <kling@webkit.org>
 
         Reviewed by Kenneth Rohde Christiansen.
index 2bf33cb..3e9c518 100644 (file)
@@ -11,6 +11,9 @@ PASS touch.pageX is 100
 PASS touch.pageY is 101
 PASS touch.screenX is 102
 PASS touch.screenY is 103
+PASS touch.webkitRadiusX is 5
+PASS touch.webkitRadiusY is 3
+PASS touch.webkitRotationAngle is 10
 PASS emptyTouch is non-null.
 PASS emptyTouch.target is null
 PASS emptyTouch.identifier is 0
@@ -18,6 +21,9 @@ PASS emptyTouch.pageX is 0
 PASS emptyTouch.pageY is 0
 PASS emptyTouch.screenX is 0
 PASS emptyTouch.screenY is 0
+PASS emptyTouch.webkitRadiusX is 0
+PASS emptyTouch.webkitRadiusY is 0
+PASS emptyTouch.webkitRotationAngle is NaN
 PASS badParamsTouch is non-null.
 PASS badParamsTouch.target is null
 PASS badParamsTouch.identifier is 0
@@ -25,6 +31,9 @@ PASS badParamsTouch.pageX is 0
 PASS badParamsTouch.pageY is 0
 PASS badParamsTouch.screenX is 0
 PASS badParamsTouch.screenY is 104
+PASS badParamsTouch.webkitRadiusX is 0
+PASS badParamsTouch.webkitRadiusY is 0
+PASS badParamsTouch.webkitRotationAngle is NaN
 PASS successfullyParsed is true
 
 TEST COMPLETE
index c51c7e3..3c405b2 100644 (file)
@@ -9,7 +9,7 @@ box.style.height = "100px";
 document.body.appendChild(box);
 
 var target = document.getElementById("box");
-var touch = document.createTouch(window, target, 1, 100, 101, 102, 103);
+var touch = document.createTouch(window, target, 1, 100, 101, 102, 103, 5, 3, 10);
 shouldBeNonNull("touch");
 shouldBe("touch.target", "box");
 shouldBe("touch.identifier", "1");
@@ -17,6 +17,9 @@ shouldBe("touch.pageX", "100");
 shouldBe("touch.pageY", "101");
 shouldBe("touch.screenX", "102");
 shouldBe("touch.screenY", "103");
+shouldBe("touch.webkitRadiusX", "5");
+shouldBe("touch.webkitRadiusY", "3");
+shouldBe("touch.webkitRotationAngle", "10");
 
 var emptyTouch = document.createTouch();
 shouldBeNonNull("emptyTouch");
@@ -26,9 +29,12 @@ shouldBe("emptyTouch.pageX", "0");
 shouldBe("emptyTouch.pageY", "0");
 shouldBe("emptyTouch.screenX", "0");
 shouldBe("emptyTouch.screenY", "0");
+shouldBe("emptyTouch.webkitRadiusX", "0");
+shouldBe("emptyTouch.webkitRadiusY", "0");
+shouldBeNaN("emptyTouch.webkitRotationAngle");
 
 // Try invoking with incorrect parameter types.
-var badParamsTouch = document.createTouch(function(x) { return x; }, 12, 'a', 'b', 'c', function(x) { return x; }, 104);
+var badParamsTouch = document.createTouch(function(x) { return x; }, 12, 'a', 'b', 'c', function(x) { return x; }, 104, 'a', 'b', 'c');
 shouldBeNonNull("badParamsTouch");
 shouldBeNull("badParamsTouch.target");
 shouldBe("badParamsTouch.identifier", "0");
@@ -36,6 +42,9 @@ shouldBe("badParamsTouch.pageX", "0");
 shouldBe("badParamsTouch.pageY", "0");
 shouldBe("badParamsTouch.screenX", "0");
 shouldBe("badParamsTouch.screenY", "104");
+shouldBe("badParamsTouch.webkitRadiusX", "0");
+shouldBe("badParamsTouch.webkitRadiusY", "0");
+shouldBeNaN("badParamsTouch.webkitRotationAngle");
 
 successfullyParsed = true;
 isSuccessfullyParsed();
index a7e7f5b..6837a27 100644 (file)
@@ -1,3 +1,29 @@
+2011-05-17  Yufeng Shen  <miletus@chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Make WebKit expose extra touch information
+        https://bugs.webkit.org/show_bug.cgi?id=59030
+
+        * dom/Document.cpp:
+        (WebCore::Document::createTouch):
+        * dom/Document.h:
+        * dom/Document.idl:
+        * dom/Touch.cpp:
+        (WebCore::Touch::Touch):
+        * dom/Touch.h:
+        (WebCore::Touch::create):
+        (WebCore::Touch::webkitRadiusX):
+        (WebCore::Touch::webkitRadiusY):
+        (WebCore::Touch::webkitRotationAngle):
+        * dom/Touch.idl:
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleTouchEvent):
+        * platform/PlatformTouchPoint.h:
+        (WebCore::PlatformTouchPoint::radiusX):
+        (WebCore::PlatformTouchPoint::radiusY):
+        (WebCore::PlatformTouchPoint::rotationAngle):
+
 2011-05-17  Eric Seidel  <eric@webkit.org>
 
         Reviewed by Ryosuke Niwa.
index 8c157a7..13c7cb6 100644 (file)
@@ -5065,7 +5065,7 @@ void Document::serviceScriptedAnimations(DOMTimeStamp time)
 #endif
 
 #if ENABLE(TOUCH_EVENTS)
-PassRefPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, ExceptionCode&) const
+PassRefPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, ExceptionCode&) const
 {
     // FIXME: It's not clear from the documentation at
     // http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html
@@ -5073,7 +5073,7 @@ PassRefPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target,
     // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=47819
     // Ditto for the createTouchList method below.
     Frame* frame = window ? window->frame() : this->frame();
-    return Touch::create(frame, target, identifier, screenX, screenY, pageX, pageY);
+    return Touch::create(frame, target, identifier, screenX, screenY, pageX, pageY, radiusX, radiusY, rotationAngle);
 }
 
 PassRefPtr<TouchList> Document::createTouchList(ExceptionCode&) const
index 4b86835..d263c9f 100644 (file)
@@ -1081,7 +1081,7 @@ public:
     bool isDelayingLoadEvent() const { return m_loadEventDelayCount; }
 
 #if ENABLE(TOUCH_EVENTS)
-    PassRefPtr<Touch> createTouch(DOMWindow*, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, ExceptionCode&) const;
+    PassRefPtr<Touch> createTouch(DOMWindow*, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, ExceptionCode&) const;
     PassRefPtr<TouchList> createTouchList(ExceptionCode&) const;
 #endif
 
index 89ae65e..fc055d9 100644 (file)
@@ -322,8 +322,11 @@ module core {
                                                          in long identifier,
                                                          in long pageX,
                                                          in long pageY,
-                                                         in long ScreenX,
-                                                         in long screenY)
+                                                         in long screenX,
+                                                         in long screenY,
+                                                         in long webkitRadiusX,
+                                                         in long webkitRadiusY,
+                                                         in float webkitRotationAngle)
             raises (DOMException);
         [ReturnsNew, EnabledAtRuntime, Custom] TouchList createTouchList()
             raises (DOMException);
index e0681f2..376b6bd 100644 (file)
@@ -54,7 +54,7 @@ static int contentsY(Frame* frame)
     return frameView->scrollY() / frame->pageZoomFactor();
 }
 
-Touch::Touch(Frame* frame, EventTarget* target, unsigned identifier, int screenX, int screenY, int pageX, int pageY)
+Touch::Touch(Frame* frame, EventTarget* target, unsigned identifier, int screenX, int screenY, int pageX, int pageY, int radiusX, int radiusY, float rotationAngle)
     : m_target(target)
     , m_identifier(identifier)
     , m_clientX(pageX - contentsX(frame))
@@ -63,6 +63,9 @@ Touch::Touch(Frame* frame, EventTarget* target, unsigned identifier, int screenX
     , m_screenY(screenY)
     , m_pageX(pageX)
     , m_pageY(pageY)
+    , m_radiusX(radiusX)
+    , m_radiusY(radiusY)
+    , m_rotationAngle(rotationAngle)
 {
 }
 
index 0ffd473..cc51218 100644 (file)
@@ -40,10 +40,11 @@ class Frame;
 class Touch : public RefCounted<Touch> {
 public:
     static PassRefPtr<Touch> create(Frame* frame, EventTarget* target,
-            unsigned identifier, int screenX, int screenY, int pageX, int pageY)
+            unsigned identifier, int screenX, int screenY, int pageX, int pageY,
+            int radiusX, int radiusY, float rotationAngle)
     {
         return adoptRef(new Touch(frame, target, identifier, screenX, 
-                screenY, pageX, pageY));
+                screenY, pageX, pageY, radiusX, radiusY, rotationAngle));
     }
 
     EventTarget* target() const { return m_target.get(); }
@@ -54,10 +55,14 @@ public:
     int screenY() const { return m_screenY; }
     int pageX() const { return m_pageX; }
     int pageY() const { return m_pageY; }
+    int webkitRadiusX() const { return m_radiusX; }
+    int webkitRadiusY() const { return m_radiusY; }
+    float webkitRotationAngle() const { return m_rotationAngle; }
 
 private:
     Touch(Frame* frame, EventTarget* target, unsigned identifier,
-            int screenX, int screenY, int pageX, int pageY);
+            int screenX, int screenY, int pageX, int pageY,
+            int radiusX, int radiusY, float rotationAngle);
 
     RefPtr<EventTarget> m_target;
     unsigned m_identifier;
@@ -67,6 +72,9 @@ private:
     int m_screenY;
     int m_pageX;
     int m_pageY;
+    int m_radiusX;
+    int m_radiusY;
+    float m_rotationAngle;
 };
 
 } // namespace WebCore
index 1afc63a..3c62042 100644 (file)
@@ -36,5 +36,8 @@ module events {
         readonly attribute long             pageY;
         readonly attribute EventTarget      target;
         readonly attribute unsigned long    identifier;
+        readonly attribute int              webkitRadiusX;
+        readonly attribute int              webkitRadiusY;
+        readonly attribute float            webkitRotationAngle;
     };
 }
index 146222a..393d7cb 100644 (file)
@@ -3159,7 +3159,8 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
 
         RefPtr<Touch> touch = Touch::create(doc->frame(), touchTarget.get(), point.id(),
                                             point.screenPos().x(), point.screenPos().y(),
-                                            adjustedPageX, adjustedPageY);
+                                            adjustedPageX, adjustedPageY,
+                                            point.radiusX(), point.radiusY(), point.rotationAngle());
 
         // Ensure this target's touch list exists, even if it ends up empty, so it can always be passed to TouchEvent::Create below.
         TargetTouchesMap::iterator targetTouchesIterator = touchesByTarget.find(touchTarget.get());
index bc19f80..9d9b4fc 100644 (file)
@@ -59,12 +59,18 @@ public:
     State state() const { return m_state; }
     IntPoint screenPos() const { return m_screenPos; }
     IntPoint pos() const { return m_pos; }
-    
+    int radiusX() const { return m_radiusX; }
+    int radiusY() const { return m_radiusY; }
+    float rotationAngle() const { return m_rotationAngle; }
+
 protected:
     unsigned m_id;
     State m_state;
     IntPoint m_screenPos;
     IntPoint m_pos;
+    int m_radiusY;
+    int m_radiusX;
+    float m_rotationAngle;
 };
 
 }
index 904e9a3..14f172c 100644 (file)
@@ -1,3 +1,15 @@
+2011-05-17  Yufeng Shen  <miletus@chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Make WebKit expose extra touch information
+        https://bugs.webkit.org/show_bug.cgi?id=59030
+
+        * public/WebTouchPoint.h:
+        (WebKit::WebTouchPoint::WebTouchPoint):
+        * src/WebInputEventConversion.cpp:
+        (WebKit::PlatformTouchPointBuilder::PlatformTouchPointBuilder):
+
 2011-05-16  James Robinson  <jamesr@chromium.org>
 
         Reviewed by Kenneth Russell.
 
         * src/gtk/WebInputEventFactory.cpp: set click count for mouse up events.
         * tests/WebInputEventFactoryTestGtk.cpp: added test case MouseUpClickCount.
+
 2011-04-20  Evan Martin  <evan@chromium.org>
 
         Reviewed by Tony Chang.
index 3d60744..62e5769 100644 (file)
@@ -46,7 +46,12 @@ public:
 
     WebTouchPoint()
         : id(FingerFirst)
-        , state(StateUndefined) { }
+        , state(StateUndefined)
+        , radiusX(0)
+        , radiusY(0)
+        , rotationAngle(0)
+    {
+    }
 
     enum State {
         StateUndefined,
@@ -61,6 +66,10 @@ public:
     State state;
     WebPoint screenPosition;
     WebPoint position;
+
+    int radiusX;
+    int radiusY;
+    float rotationAngle;
 };
 
 } // namespace WebKit
index 56d0dbd..d3db9cf 100644 (file)
@@ -212,6 +212,9 @@ PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTo
     m_state = toPlatformTouchPointState(point.state);
     m_pos = widget->convertFromContainingWindow(point.position);
     m_screenPos = point.screenPosition;
+    m_radiusY = point.radiusY;
+    m_radiusX = point.radiusX;
+    m_rotationAngle = point.rotationAngle;
 }
 
 PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTouchEvent& event)