[chromium] Simplify computation of screenRect/windowRect.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2013 20:49:18 +0000 (20:49 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2013 20:49:18 +0000 (20:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110456

Patch by John Mellor <johnme@chromium.org> on 2013-02-21
Reviewed by Adam Barth.

This patch removes applyDeviceScaleFactorInCompositor checks
added by http://trac.webkit.org/changeset/139356 because
Chrome for Android now sizes its screen and window in DIP
units (like other platforms), so they are no longer necessary.

Source/WebCore:

No new tests, since this is just removing an unused codepath.

* platform/chromium/PlatformScreenChromium.cpp:
(WebCore::screenRect):
(WebCore::screenAvailableRect):
* rendering/TextAutosizer.cpp:
(WebCore::TextAutosizer::processSubtree):

Source/WebKit/chromium:

* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::windowRect):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/chromium/PlatformScreenChromium.cpp
Source/WebCore/rendering/TextAutosizer.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/ChromeClientImpl.cpp

index d059700917af716299f3cdf98fe1dce8d0e19ec0..ba4734f39bc595c8ae55d6d9580f6742813bf584 100644 (file)
@@ -1,3 +1,23 @@
+2013-02-21  John Mellor  <johnme@chromium.org>
+
+        [chromium] Simplify computation of screenRect/windowRect.
+        https://bugs.webkit.org/show_bug.cgi?id=110456
+
+        Reviewed by Adam Barth.
+
+        This patch removes applyDeviceScaleFactorInCompositor checks
+        added by http://trac.webkit.org/changeset/139356 because
+        Chrome for Android now sizes its screen and window in DIP
+        units (like other platforms), so they are no longer necessary.
+
+        No new tests, since this is just removing an unused codepath.
+
+        * platform/chromium/PlatformScreenChromium.cpp:
+        (WebCore::screenRect):
+        (WebCore::screenAvailableRect):
+        * rendering/TextAutosizer.cpp:
+        (WebCore::TextAutosizer::processSubtree):
+
 2013-02-21  Beth Dakin  <bdakin@apple.com>
 
         Out-of-view fixed position check should not be affected by page scale at all on Mac
index a298ec93e59e9eebe3c833f0b323531fed746429..4fb6915a469a6877db65b6bc168951c05a6bf0e7 100644 (file)
 #include "PlatformScreen.h"
 
 #include "FloatRect.h"
-#include "Frame.h"
-#include "FrameView.h"
 #include "HostWindow.h"
-#include "Page.h"
 #include "ScrollView.h"
-#include "Settings.h"
 #include "Widget.h"
 #include <public/Platform.h>
 #include <public/WebScreenInfo.h>
@@ -81,24 +77,12 @@ bool screenIsMonochrome(Widget* widget)
     return client->screenInfo().isMonochrome;
 }
 
-// On Chrome for Android, the screenInfo rects are in physical screen pixels
-// instead of density independent (UI) pixels, and must be scaled down.
-static FloatRect toUserSpace(FloatRect rect, Widget* widget)
-{
-    if (widget->isFrameView()) {
-        Page* page = static_cast<FrameView*>(widget)->frame()->page();
-        if (page && !page->settings()->applyDeviceScaleFactorInCompositor())
-            rect.scale(1 / page->deviceScaleFactor());
-    }
-    return rect;
-}
-
 FloatRect screenRect(Widget* widget)
 {
     PlatformPageClient client = toPlatformPageClient(widget);
     if (!client)
         return FloatRect();
-    return toUserSpace(IntRect(client->screenInfo().rect), widget);
+    return IntRect(client->screenInfo().rect);
 }
 
 FloatRect screenAvailableRect(Widget* widget)
@@ -106,7 +90,7 @@ FloatRect screenAvailableRect(Widget* widget)
     PlatformPageClient client = toPlatformPageClient(widget);
     if (!client)
         return FloatRect();
-    return toUserSpace(IntRect(client->screenInfo().availableRect), widget);
+    return IntRect(client->screenInfo().availableRect);
 }
 
 void screenColorProfile(ColorProfile& toProfile)
index 6c926b804cd0cf189d4eafc0f83da81f365838f8..70d074f758429d10a60266c99cfea161ebedc8bd 100644 (file)
@@ -117,8 +117,6 @@ bool TextAutosizer::processSubtree(RenderObject* layoutRoot)
     if (windowInfo.windowSize.isEmpty()) {
         bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenWidthOverride(mainFrame);
         windowInfo.windowSize = mainFrame->view()->unscaledVisibleContentSize(includeScrollbars ? ScrollableArea::IncludeScrollbars : ScrollableArea::ExcludeScrollbars);
-        if (!m_document->settings()->applyDeviceScaleFactorInCompositor())
-            windowInfo.windowSize.scale(1 / m_document->page()->deviceScaleFactor());
     }
 
     // Largest area of block that can be visible at once (assuming the main
index ca1ad9752bd896f5b01da21e8c220428ca2c2047..8895240881e79ae6fb8fa2b466b32862732c7e51 100644 (file)
@@ -1,3 +1,18 @@
+2013-02-21  John Mellor  <johnme@chromium.org>
+
+        [chromium] Simplify computation of screenRect/windowRect.
+        https://bugs.webkit.org/show_bug.cgi?id=110456
+
+        Reviewed by Adam Barth.
+
+        This patch removes applyDeviceScaleFactorInCompositor checks
+        added by http://trac.webkit.org/changeset/139356 because
+        Chrome for Android now sizes its screen and window in DIP
+        units (like other platforms), so they are no longer necessary.
+
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::windowRect):
+
 2013-02-21  Vsevolod Vlasov  <vsevik@chromium.org>
 
         Web Inspector: Get rid of parsedURL in uiSourceCode, use name and path for displayName instead.
index cb67f799f897fe70be0267d7c34c93184fd51674..495768a056d271ce4b0a066c8b5162133e34db86 100644 (file)
@@ -189,19 +189,17 @@ void ChromeClientImpl::setWindowRect(const FloatRect& r)
 
 FloatRect ChromeClientImpl::windowRect()
 {
-    if (m_webView->client()) {
-        // On Chrome for Android, rootWindowRect is in physical screen pixels
-        // instead of density independent (UI) pixels, and must be scaled down.
-        FloatRect rect = FloatRect(m_webView->client()->rootWindowRect());
-        if (!m_webView->page()->settings()->applyDeviceScaleFactorInCompositor())
-            rect.scale(1 / m_webView->client()->screenInfo().deviceScaleFactor);
-        return rect;
+    WebRect rect;
+    if (m_webView->client())
+        rect = m_webView->client()->rootWindowRect();
+    else {
+        // These numbers will be fairly wrong. The window's x/y coordinates will
+        // be the top left corner of the screen and the size will be the content
+        // size instead of the window size.
+        rect.width = m_webView->size().width;
+        rect.height = m_webView->size().height;
     }
-
-    // These numbers will be fairly wrong. The window's x/y coordinates will
-    // be the top left corner of the screen and the size will be the content
-    // size instead of the window size.
-    return FloatRect(0, 0, m_webView->size().width, m_webView->size().height);
+    return FloatRect(rect);
 }
 
 FloatRect ChromeClientImpl::pageRect()