Fix usage of layout types in platform code
authoreae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 May 2012 20:29:39 +0000 (20:29 +0000)
committereae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 May 2012 20:29:39 +0000 (20:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=85392

Reviewed by Eric Seidel.

Source/WebCore:

No new tests, no change in functionality.

* page/EventHandler.cpp:
(WebCore::EventHandler::handleGestureTap):
Use rounded point for gestures as event handling is still mostly int based.

Source/WebKit/chromium:

* src/WebHitTestResult.cpp:
(WebKit::WebHitTestResult::localPoint):
* src/WebSurroundingText.cpp:
(WebKit::WebSurroundingText::initialize):
Explicitly cast WebPoint to IntPoint to avoid ambiguous conversion error.

Source/WebKit/efl:

* ewk/ewk_frame.cpp:
(ewk_frame_focused_element_geometry_get):
* ewk/ewk_view.cpp:
(_Ewk_View_Private_Data):
(ewk_view_scale_set):

Source/WebKit2:

* WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
(WebCore::WebGraphicsLayer::tiledBackingStoreVisibleRect):
Use enclosingIntRect to convert visible rect for transform results to
line up with device pixels.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState):
Use pixelSnapped rect for editor rect calculation as it represents a
device coordinate.

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

Source/WebCore/ChangeLog
Source/WebCore/page/EventHandler.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebHitTestResult.cpp
Source/WebKit/chromium/src/WebSurroundingText.cpp
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/ewk/ewk_frame.cpp
Source/WebKit/efl/ewk/ewk_view.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 6d19423..7babeca 100644 (file)
@@ -1,3 +1,16 @@
+2012-05-02  Emil A Eklund  <eae@chromium.org>
+
+        Fix usage of layout types in platform code
+        https://bugs.webkit.org/show_bug.cgi?id=85392
+
+        Reviewed by Eric Seidel.
+
+        No new tests, no change in functionality.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleGestureTap):
+        Use rounded point for gestures as event handling is still mostly int based.
+
 2012-05-02  Kenneth Russell  <kbr@google.com>
 
         Don't allocate stencil buffer if stencil flag is false in context creation attributes
index dd0bc14..290e58f 100644 (file)
@@ -2443,7 +2443,7 @@ bool EventHandler::handleGestureTap(const PlatformGestureEvent& gestureEvent, No
 #endif
     // FIXME: Refactor to avoid hit testing multiple times (this is only an interim step).
     if (preTargetedNode)
-        adjustedPoint = preTargetedNode->getRect().center();
+        adjustedPoint = preTargetedNode->getPixelSnappedRect().center();
 
     bool defaultPrevented = false;
     PlatformMouseEvent fakeMouseMove(adjustedPoint, gestureEvent.globalPosition(), NoButton, PlatformEvent::MouseMoved, /* clickCount */ 1, gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp());
index 124fb08..34f32b8 100644 (file)
@@ -1,3 +1,16 @@
+2012-05-02  Emil A Eklund  <eae@chromium.org>
+
+        Fix usage of layout types in platform code
+        https://bugs.webkit.org/show_bug.cgi?id=85392
+
+        Reviewed by Eric Seidel.
+
+        * src/WebHitTestResult.cpp:
+        (WebKit::WebHitTestResult::localPoint):
+        * src/WebSurroundingText.cpp:
+        (WebKit::WebSurroundingText::initialize):
+        Explicitly cast WebPoint to IntPoint to avoid ambiguous conversion error.       
+
 2012-05-02  Yury Semikhatsky  <yurys@chromium.org>
 
         Web Inspector: TypeError: Cannot call method 'createLiveLocation' of undefined
index a827e25..5f806b8 100644 (file)
@@ -47,7 +47,7 @@ WebNode WebHitTestResult::node() const
 
 WebPoint WebHitTestResult::localPoint() const
 {
-    return WebPoint(m_private->localPoint());
+    return roundedIntPoint(m_private->localPoint());
 }
 
 WebHitTestResult::WebHitTestResult(const HitTestResult& result)
index 30fe09d..26bb392 100644 (file)
@@ -46,7 +46,7 @@ void WebSurroundingText::initialize(const WebHitTestResult& hitTestInfo, size_t
     if (!node || !node->renderer())
         return;
 
-    VisiblePosition visiblePosition(node->renderer()->positionForPoint(hitTestInfo.localPoint()));
+    VisiblePosition visiblePosition(node->renderer()->positionForPoint(static_cast<IntPoint>(hitTestInfo.localPoint())));
     if (visiblePosition.isNull())
         return;
 
index efb589f..b51a5d3 100644 (file)
@@ -1,3 +1,16 @@
+2012-05-02  Emil A Eklund  <eae@chromium.org>
+
+        Fix usage of layout types in platform code
+        https://bugs.webkit.org/show_bug.cgi?id=85392
+
+        Reviewed by Eric Seidel.
+
+        * ewk/ewk_frame.cpp:
+        (ewk_frame_focused_element_geometry_get):
+        * ewk/ewk_view.cpp:
+        (_Ewk_View_Private_Data):
+        (ewk_view_scale_set):
+
 2012-05-02  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
 
         [EFL] Hyperlink auditing ewk_view setting
index 606f068..4af00b3 100644 (file)
@@ -861,7 +861,7 @@ Eina_Bool ewk_frame_focused_element_geometry_get(const Evas_Object *ewkFrame, in
     WebCore::Node* focusedNode = document->focusedNode();
     if (!focusedNode)
         return false;
-    WebCore::IntRect nodeRect = focusedNode->getRect();
+    WebCore::IntRect nodeRect = focusedNode->getPixelSnappedRect();
     if (x)
         *x = nodeRect.x();
     if (y)
index ea40370..7952bbc 100644 (file)
@@ -1689,7 +1689,7 @@ Eina_Bool ewk_view_scale_set(Evas_Object* ewkView, float scaleFactor, Evas_Coord
     if (currentScaleFactor == -1)
         return false;
 
-    priv->page->setPageScaleFactor(scaleFactor, WebCore::LayoutPoint(scrollX, scrollY));
+    priv->page->setPageScaleFactor(scaleFactor, WebCore::IntPoint(scrollX, scrollY));
     return true;
 }
 
index 7a1ad15..7033673 100644 (file)
@@ -1,3 +1,20 @@
+2012-05-02  Emil A Eklund  <eae@chromium.org>
+
+        Fix usage of layout types in platform code
+        https://bugs.webkit.org/show_bug.cgi?id=85392
+
+        Reviewed by Eric Seidel.
+
+        * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+        (WebCore::WebGraphicsLayer::tiledBackingStoreVisibleRect):
+        Use enclosingIntRect to convert visible rect for transform results to
+        line up with device pixels.
+        
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::editorState):
+        Use pixelSnapped rect for editor rect calculation as it represents a
+        device coordinate.
+
 2012-05-02  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
 
         Revert r115191 - "Make the web view's url property follow the active url"
index 73edf24..80e8b61 100644 (file)
@@ -582,7 +582,7 @@ IntRect WebGraphicsLayer::tiledBackingStoreVisibleRect()
     // Return a projection of the visible rect (surface coordinates) onto the layer's plane (layer coordinates).
     // The resulting quad might be squewed and the visible rect is the bounding box of this quad,
     // so it might spread further than the real visible area (and then even more amplified by the cover rect multiplier).
-    return m_layerTransform.combined().inverse().clampedBoundsOfProjectedQuad(FloatQuad(FloatRect(m_webGraphicsLayerClient->visibleContentsRect())));
+    return enclosingIntRect(m_layerTransform.combined().inverse().clampedBoundsOfProjectedQuad(FloatQuad(FloatRect(m_webGraphicsLayerClient->visibleContentsRect()))));
 }
 
 Color WebGraphicsLayer::tiledBackingStoreBackgroundColor() const
index 7f4d6db..eef0dce 100644 (file)
@@ -459,7 +459,7 @@ EditorState WebPage::editorState() const
     }
 
     if (selectionRoot)
-        result.editorRect = frame->view()->contentsToWindow(selectionRoot->getRect());
+        result.editorRect = frame->view()->contentsToWindow(selectionRoot->getPixelSnappedRect());
 
     RefPtr<Range> range;
     if (result.hasComposition && (range = frame->editor()->compositionRange())) {