Title: [144581] trunk
Revision
144581
Author
[email protected]
Date
2013-03-03 14:15:46 -0800 (Sun, 03 Mar 2013)

Log Message

[chromium] Remove WebLayerTreeView::setViewportSize call
https://bugs.webkit.org/show_bug.cgi?id=110727

Reviewed by James Robinson.

After https://codereview.chromium.org/12328080 lands,
setViewportSize is called from the Chromium side. The multiplication
by deviceScaleFactor here was prone to off-by-one errors.
The layoutSize() function was only used here so delete it as well.

DumpRenderTree WebViewHost must now call this method as well.

Source/WebKit/chromium:

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::updateLayerTreeViewport):
* src/WebViewImpl.h:
(WebViewImpl):

Tools:

* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::initializeLayerTreeView):
(WebViewHost::setWindowRect):
(WebViewHost::setDeviceScaleFactor):
(WebViewHost::updateViewportSize):
* DumpRenderTree/chromium/WebViewHost.h:
(WebViewHost):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (144580 => 144581)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-03-03 22:15:00 UTC (rev 144580)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-03-03 22:15:46 UTC (rev 144581)
@@ -1,3 +1,22 @@
+2013-03-03  Alexandre Elias  <[email protected]>
+
+        [chromium] Remove WebLayerTreeView::setViewportSize call
+        https://bugs.webkit.org/show_bug.cgi?id=110727
+
+        Reviewed by James Robinson.
+
+        After https://codereview.chromium.org/12328080 lands,
+        setViewportSize is called from the Chromium side. The multiplication
+        by deviceScaleFactor here was prone to off-by-one errors.
+        The layoutSize() function was only used here so delete it as well.
+
+        DumpRenderTree WebViewHost must now call this method as well.
+
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::updateLayerTreeViewport):
+        * src/WebViewImpl.h:
+        (WebViewImpl):
+
 2013-03-03  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r144567.

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (144580 => 144581)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2013-03-03 22:15:00 UTC (rev 144580)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2013-03-03 22:15:46 UTC (rev 144581)
@@ -3148,20 +3148,6 @@
     return root->documentRect().size();
 }
 
-IntSize WebViewImpl::layoutSize() const
-{
-    if (!isFixedLayoutModeEnabled())
-        return m_size;
-
-    IntSize contentSize = contentsSize();
-
-    if (fixedLayoutSize().width >= contentSize.width())
-        return fixedLayoutSize();
-
-    float aspectRatio = static_cast<float>(m_size.height) / m_size.width;
-    return IntSize(contentSize.width(), contentSize.width() * aspectRatio);
-}
-
 void WebViewImpl::computePageScaleFactorLimits()
 {
     if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()->view())
@@ -4292,15 +4278,7 @@
         return;
 
     FrameView* view = page()->mainFrame()->view();
-
-    IntSize layoutViewportSize = layoutSize();
-    IntSize deviceViewportSize = m_size;
-    if (m_webSettings->applyDeviceScaleFactorInCompositor())
-        deviceViewportSize.scale(deviceScaleFactor());
-
-    m_nonCompositedContentHost->setViewport(deviceViewportSize, view->contentsSize(), view->scrollPosition(), view->scrollOrigin());
-
-    m_layerTreeView->setViewportSize(layoutViewportSize, deviceViewportSize);
+    m_nonCompositedContentHost->setViewport(m_size, view->contentsSize(), view->scrollPosition(), view->scrollOrigin());
     m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
 }
 

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (144580 => 144581)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.h	2013-03-03 22:15:00 UTC (rev 144580)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h	2013-03-03 22:15:46 UTC (rev 144581)
@@ -454,7 +454,6 @@
     }
 
     WebCore::IntSize dipSize() const;
-    WebCore::IntSize layoutSize() const;
     WebCore::IntSize scaledSize(float) const;
 
     // Set the disposition for how this webview is to be initially shown.

Modified: trunk/Tools/ChangeLog (144580 => 144581)


--- trunk/Tools/ChangeLog	2013-03-03 22:15:00 UTC (rev 144580)
+++ trunk/Tools/ChangeLog	2013-03-03 22:15:46 UTC (rev 144581)
@@ -1,3 +1,25 @@
+2013-03-03  Alexandre Elias  <[email protected]>
+
+        [chromium] Remove WebLayerTreeView::setViewportSize call
+        https://bugs.webkit.org/show_bug.cgi?id=110727
+
+        Reviewed by James Robinson.
+
+        After https://codereview.chromium.org/12328080 lands,
+        setViewportSize is called from the Chromium side. The multiplication
+        by deviceScaleFactor here was prone to off-by-one errors.
+        The layoutSize() function was only used here so delete it as well.
+
+        DumpRenderTree WebViewHost must now call this method as well.
+
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::initializeLayerTreeView):
+        (WebViewHost::setWindowRect):
+        (WebViewHost::setDeviceScaleFactor):
+        (WebViewHost::updateViewportSize):
+        * DumpRenderTree/chromium/WebViewHost.h:
+        (WebViewHost):
+
 2013-02-27  Darin Adler  <[email protected]>
 
         StringHasher functions require alignment that call sites do not all guarantee

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (144580 => 144581)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-03-03 22:15:00 UTC (rev 144580)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-03-03 22:15:46 UTC (rev 144581)
@@ -284,6 +284,7 @@
         m_layerTreeView = adoptPtr(webkit_support::CreateLayerTreeView3d(m_layerTreeViewClient.get()));
 
     ASSERT(m_layerTreeView);
+    updateViewportSize();
     m_layerTreeView->setRootLayer(rootLayer);
     m_layerTreeView->setSurfaceReady();
 }
@@ -366,6 +367,7 @@
     int width = m_windowRect.width - border2;
     int height = m_windowRect.height - border2;
     webWidget()->resize(WebSize(width, height));
+    updateViewportSize();
 }
 
 WebRect WebViewHost::rootWindowRect()
@@ -617,6 +619,7 @@
 void WebViewHost::setDeviceScaleFactor(float deviceScaleFactor)
 {
     webView()->setDeviceScaleFactor(deviceScaleFactor);
+    updateViewportSize();
 }
 
 void WebViewHost::setFocus(bool focused)
@@ -941,6 +944,16 @@
     entry->setContentState(historyItem);
 }
 
+void WebViewHost::updateViewportSize()
+{
+    if (!m_layerTreeView)
+        return;
+
+    WebSize deviceViewportSize(webWidget()->size().width * webView()->deviceScaleFactor(),
+        webWidget()->size().height * webView()->deviceScaleFactor());
+    m_layerTreeView->setViewportSize(webWidget()->size(), deviceViewportSize);
+}
+
 void WebViewHost::printFrameDescription(WebFrame* webframe)
 {
     string name8 = webframe->uniqueName().utf8();

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.h (144580 => 144581)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-03-03 22:15:00 UTC (rev 144580)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-03-03 22:15:46 UTC (rev 144581)
@@ -234,6 +234,8 @@
 
     bool hasWindow() const { return m_hasWindow; }
 
+    void updateViewportSize();
+
 #if ENABLE(MEDIA_STREAM)
     webkit_support::TestMediaStreamClient* testMediaStreamClient();
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to