Title: [170622] trunk/Source/WebKit2
Revision
170622
Author
[email protected]
Date
2014-06-30 17:42:49 -0700 (Mon, 30 Jun 2014)

Log Message

[iOS][WK2] Improve double-tap-to-scroll on image documents
https://bugs.webkit.org/show_bug.cgi?id=134474
<rdar://problem/17496778>

Reviewed by Enrica Casucci.

On image document, we were always rendering the center of the image as the origin, which broke
double tap to scroll.

This patch improves on this in two ways:
1) If the hit testing already got the image, only change the type to replaced (to get the right
   scaling behavior for images since the type is block on iOS's image document).
2) If the hit testing is outside the image, only center the axis that is not in the image.
   This way, we "fix" the component that is not valid, and keep the vali component.
   This works great for viewing comics on iPad.

* WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
(WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (170621 => 170622)


--- trunk/Source/WebKit2/ChangeLog	2014-07-01 00:38:12 UTC (rev 170621)
+++ trunk/Source/WebKit2/ChangeLog	2014-07-01 00:42:49 UTC (rev 170622)
@@ -1,3 +1,24 @@
+2014-06-30  Benjamin Poulain  <[email protected]>
+
+        [iOS][WK2] Improve double-tap-to-scroll on image documents
+        https://bugs.webkit.org/show_bug.cgi?id=134474
+        <rdar://problem/17496778>
+
+        Reviewed by Enrica Casucci.
+
+        On image document, we were always rendering the center of the image as the origin, which broke
+        double tap to scroll.
+
+        This patch improves on this in two ways:
+        1) If the hit testing already got the image, only change the type to replaced (to get the right
+           scaling behavior for images since the type is block on iOS's image document).
+        2) If the hit testing is outside the image, only center the axis that is not in the image.
+           This way, we "fix" the component that is not valid, and keep the vali component.
+           This works great for viewing comics on iPad.
+
+        * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
+        (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
+
 2014-06-30  Enrica Casucci  <[email protected]>
 
         REGRESSION (WK2): Weird selection behavior on autos.yahoo.com, en.wikipedia.org.

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.cpp (170621 => 170622)


--- trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.cpp	2014-07-01 00:38:12 UTC (rev 170621)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.cpp	2014-07-01 00:42:49 UTC (rev 170622)
@@ -94,8 +94,15 @@
 
         if (node->document().isImageDocument()) {
             if (HTMLImageElement* imageElement = static_cast<ImageDocument&>(node->document()).imageElement()) {
-                renderRect = imageElement->renderRect(&isReplaced);
-                origin = renderRect.center();
+                if (node != imageElement) {
+                    renderRect = imageElement->renderRect(&isReplaced);
+                    FloatPoint newOrigin = origin;
+                    if (origin.x() < renderRect.x() || origin.x() > renderRect.maxX())
+                        newOrigin.setX(renderRect.x() + renderRect.width() / 2);
+                    if (origin.y() < renderRect.y() || origin.y() > renderRect.maxY())
+                        newOrigin.setY(renderRect.y() + renderRect.height() / 2);
+                    origin = newOrigin;
+                }
                 isReplaced = true;
             }
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to