Title: [161087] trunk/Source/WebKit2
Revision
161087
Author
[email protected]
Date
2013-12-26 07:04:22 -0800 (Thu, 26 Dec 2013)

Log Message

[WK2][CoordinatedGraphics] Removing duplicate scale information from WebVIew.cpp
https://bugs.webkit.org/show_bug.cgi?id=126243

Reviewed by Benjamin Poulain.

The scale factor of the WebView must reflect the same information present in
WebPageProxy.
Previously, in WebView.cpp, there was a m_contentScaleFactor member, which adds
information duplication and needs to be synchronizing with pageScaleFactor in
WebPageProxy. We can avoid this by just making WebView access and set WebPageProxy's
pageScaleFactor directly.

* UIProcess/CoordinatedGraphics/WebView.cpp:
(WebKit::WebView::WebView):
(WebKit::WebView::setContentScaleFactor):
(WebKit::WebView::transformToScene):
(WebKit::WebView::visibleContentsSize):
* UIProcess/CoordinatedGraphics/WebView.h:
(WebKit::WebView::contentScaleFactor):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (161086 => 161087)


--- trunk/Source/WebKit2/ChangeLog	2013-12-26 09:24:36 UTC (rev 161086)
+++ trunk/Source/WebKit2/ChangeLog	2013-12-26 15:04:22 UTC (rev 161087)
@@ -1,3 +1,25 @@
+2013-12-26  Thiago de Barros Lacerda  <[email protected]>
+
+        [WK2][CoordinatedGraphics] Removing duplicate scale information from WebVIew.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=126243
+
+        Reviewed by Benjamin Poulain.
+
+        The scale factor of the WebView must reflect the same information present in
+        WebPageProxy.
+        Previously, in WebView.cpp, there was a m_contentScaleFactor member, which adds
+        information duplication and needs to be synchronizing with pageScaleFactor in
+        WebPageProxy. We can avoid this by just making WebView access and set WebPageProxy's
+        pageScaleFactor directly.
+
+        * UIProcess/CoordinatedGraphics/WebView.cpp:
+        (WebKit::WebView::WebView):
+        (WebKit::WebView::setContentScaleFactor):
+        (WebKit::WebView::transformToScene):
+        (WebKit::WebView::visibleContentsSize):
+        * UIProcess/CoordinatedGraphics/WebView.h:
+        (WebKit::WebView::contentScaleFactor):
+
 2013-12-25  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r161033 and r161074.

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp (161086 => 161087)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp	2013-12-26 09:24:36 UTC (rev 161086)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp	2013-12-26 15:04:22 UTC (rev 161087)
@@ -48,7 +48,6 @@
 WebView::WebView(WebContext* context, WebPageGroup* pageGroup)
     : m_focused(false)
     , m_visible(false)
-    , m_contentScaleFactor(1.0)
     , m_opacity(1.0)
 {
     // Need to call createWebPage after other data members, specifically m_visible, are initialized.
@@ -77,6 +76,12 @@
     setActive(true);
 }
 
+void WebView::setContentScaleFactor(float scaleFactor)
+{
+    m_page->scalePage(scaleFactor, roundedIntPoint(contentPosition()));
+    updateViewportSize();
+}
+
 void WebView::setActive(bool active)
 {
     CoordinatedGraphicsScene* scene = coordinatedGraphicsScene();
@@ -238,7 +243,7 @@
 AffineTransform WebView::transformToScene() const
 {
     FloatPoint position = -m_contentPosition;
-    float effectiveScale = m_contentScaleFactor * m_page->deviceScaleFactor();
+    float effectiveScale = contentScaleFactor() * m_page->deviceScaleFactor();
     position.scale(effectiveScale, effectiveScale);
 
     TransformationMatrix transform = m_userViewportTransform;
@@ -278,7 +283,7 @@
 WebCore::FloatSize WebView::visibleContentsSize() const
 {
     FloatSize visibleContentsSize(dipSize());
-    visibleContentsSize.scale(1 / m_contentScaleFactor);
+    visibleContentsSize.scale(1 / contentScaleFactor());
 
     return visibleContentsSize;
 }

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h (161086 => 161087)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h	2013-12-26 09:24:36 UTC (rev 161086)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h	2013-12-26 15:04:22 UTC (rev 161087)
@@ -70,8 +70,8 @@
     bool isVisible() const { return m_visible; }
     void setVisible(bool);
 
-    void setContentScaleFactor(float scaleFactor) { m_contentScaleFactor = scaleFactor; }
-    float contentScaleFactor() const { return m_contentScaleFactor; }
+    void setContentScaleFactor(float);
+    float contentScaleFactor() const { return m_page->pageScaleFactor(); }
 
     void setContentPosition(const WebCore::FloatPoint& position) { m_contentPosition = position; }
     const WebCore::FloatPoint& contentPosition() const { return m_contentPosition; }
@@ -213,7 +213,6 @@
     WebCore::IntSize m_size; // Size in device units.
     bool m_focused;
     bool m_visible;
-    float m_contentScaleFactor;
     double m_opacity;
     WebCore::FloatPoint m_contentPosition; // Position in UI units.
     WebCore::IntSize m_contentsSize;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to