Title: [160833] trunk/Source/WebKit2
Revision
160833
Author
[email protected]
Date
2013-12-19 08:30:51 -0800 (Thu, 19 Dec 2013)

Log Message

[CoordinatedGraphics] Regressions in WebView's contentScaleFactor/contentPosition
https://bugs.webkit.org/show_bug.cgi?id=125943

Patch by Nick Diego Yamane <[email protected]> on 2013-12-19
Reviewed by Noam Rosenthal.

When WebView::pageDidRequestScroll is called it is scaling position requested
to scroll before store it as contentPosition, that is not necessary since WebView
already stores the requested contentScaleFactor so it's able to do that internally
when needed, what simplifies the API and improves the readability of webview's code.
This patch reverts changes from https://bugs.webkit.org/show_bug.cgi?id=118548, which
was causing some regressions in contentScaleFactor/contentPosition related stuff.
Besides that WebView::pageDidRequestScroll calls viewClient callback with the wrong
position (different from the position stored in WebView).

* UIProcess/API/efl/EwkView.cpp:
(EwkView::scrollBy):
* UIProcess/CoordinatedGraphics/WebView.cpp:
(WebKit::WebView::transformToScene):
(WebKit::WebView::updateViewportSize):
(WebKit::WebView::pageDidRequestScroll):
* UIProcess/efl/PageViewportControllerClientEfl.cpp:
(WebKit::PageViewportControllerClientEfl::setViewportPosition):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (160832 => 160833)


--- trunk/Source/WebKit2/ChangeLog	2013-12-19 16:21:47 UTC (rev 160832)
+++ trunk/Source/WebKit2/ChangeLog	2013-12-19 16:30:51 UTC (rev 160833)
@@ -1,3 +1,27 @@
+2013-12-19  Nick Diego Yamane  <[email protected]>
+
+        [CoordinatedGraphics] Regressions in WebView's contentScaleFactor/contentPosition
+        https://bugs.webkit.org/show_bug.cgi?id=125943
+
+        Reviewed by Noam Rosenthal.
+
+        When WebView::pageDidRequestScroll is called it is scaling position requested
+        to scroll before store it as contentPosition, that is not necessary since WebView
+        already stores the requested contentScaleFactor so it's able to do that internally
+        when needed, what simplifies the API and improves the readability of webview's code.
+        This patch reverts changes from https://bugs.webkit.org/show_bug.cgi?id=118548, which
+        was causing some regressions in contentScaleFactor/contentPosition related stuff.
+        Besides that WebView::pageDidRequestScroll calls viewClient callback with the wrong
+        position (different from the position stored in WebView).
+
+        * UIProcess/API/efl/EwkView.cpp:
+        (EwkView::scrollBy):
+        * UIProcess/CoordinatedGraphics/WebView.cpp:
+        (WebKit::WebView::transformToScene):
+        (WebKit::WebView::updateViewportSize):
+        (WebKit::WebView::pageDidRequestScroll):
+        * UIProcess/efl/PageViewportControllerClientEfl.cpp:
+        (WebKit::PageViewportControllerClientEfl::setViewportPosition):
 2013-12-18  Tim Horton  <[email protected]>
 
         WebKit2 View Gestures: Move WebProcess-side geometry collection into its own class

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp (160832 => 160833)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp	2013-12-19 16:21:47 UTC (rev 160832)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp	2013-12-19 16:30:51 UTC (rev 160833)
@@ -1396,16 +1396,16 @@
 bool EwkView::scrollBy(const IntSize& offset)
 {
     WKPoint oldPosition = WKViewGetContentPosition(wkView());
-    FloatPoint newPosition(oldPosition.x + offset.width(), oldPosition.y + offset.height());
+    float contentScale = WKViewGetContentScaleFactor(wkView());
 
+    FloatPoint newPosition(oldPosition.x + offset.width() / contentScale, oldPosition.y + offset.height() / contentScale);
+
     // Update new position to the PageViewportController.
-    float contentScale = WKViewGetContentScaleFactor(wkView());
-    newPosition.scale(1 / contentScale, 1 / contentScale);
     newPosition = m_pageViewportController.boundContentsPositionAtScale(newPosition, contentScale);
     m_pageViewportController.didChangeContentsVisibility(newPosition, contentScale);
 
     // Update new position to the WKView.
-    WKPoint position = WKPointMake(newPosition.x() * contentScale, newPosition.y() * contentScale);
+    WKPoint position = WKPointMake(newPosition.x(), newPosition.y());
     WKViewSetContentPosition(wkView(), position);
 
     // If the page position has not changed, notify the caller using the return value.

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp (160832 => 160833)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp	2013-12-19 16:21:47 UTC (rev 160832)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp	2013-12-19 16:30:51 UTC (rev 160833)
@@ -239,7 +239,7 @@
 {
     FloatPoint position = -m_contentPosition;
     float effectiveScale = m_contentScaleFactor * m_page->deviceScaleFactor();
-    position.scale(m_page->deviceScaleFactor(), m_page->deviceScaleFactor());
+    position.scale(effectiveScale, effectiveScale);
 
     TransformationMatrix transform = m_userViewportTransform;
     transform.translate(position.x(), position.y());
@@ -261,9 +261,7 @@
     if (CoordinatedDrawingAreaProxy* drawingArea = static_cast<CoordinatedDrawingAreaProxy*>(page()->drawingArea())) {
         // Web Process expects sizes in UI units, and not raw device units.
         drawingArea->setSize(roundedIntSize(dipSize()), IntSize(), IntSize());
-        FloatPoint position = contentPosition();
-        position.scale(1 / m_contentScaleFactor, 1 / m_contentScaleFactor);
-        FloatRect visibleContentsRect(position, visibleContentsSize());
+        FloatRect visibleContentsRect(contentPosition(), visibleContentsSize());
         visibleContentsRect.intersect(FloatRect(FloatPoint(), contentsSize()));
         drawingArea->setVisibleContentsRect(visibleContentsRect, FloatPoint());
     }
@@ -515,7 +513,6 @@
 void WebView::pageDidRequestScroll(const IntPoint& position)
 {
     FloatPoint uiPosition(position);
-    uiPosition.scale(contentScaleFactor(), contentScaleFactor());
     setContentPosition(uiPosition);
 
     m_client.didChangeContentsPosition(this, position);

Modified: trunk/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp (160832 => 160833)


--- trunk/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp	2013-12-19 16:21:47 UTC (rev 160832)
+++ trunk/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp	2013-12-19 16:30:51 UTC (rev 160833)
@@ -53,10 +53,8 @@
 {
     m_contentPosition = contentsPoint;
 
-    FloatPoint pos(contentsPoint);
     float scaleFactor = WKViewGetContentScaleFactor(m_view->wkView());
-    pos.scale(scaleFactor, scaleFactor);
-    WKViewSetContentPosition(m_view->wkView(), WKPointMake(pos.x(), pos.y()));
+    WKViewSetContentPosition(m_view->wkView(), WKPointMake(contentsPoint.x(), contentsPoint.y()));
 
     m_controller->didChangeContentsVisibility(m_contentPosition, scaleFactor);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to