Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: Source/WebCore/platform/chromium/PlatformScreenChromium.cpp

Issue 11862015: Merge 139356 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/page/Settings.in ('k') | Source/WebCore/rendering/TextAutosizer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/platform/chromium/PlatformScreenChromium.cpp
===================================================================
--- Source/WebCore/platform/chromium/PlatformScreenChromium.cpp (revision 139470)
+++ Source/WebCore/platform/chromium/PlatformScreenChromium.cpp (working copy)
@@ -32,8 +32,12 @@
#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>
@@ -77,12 +81,24 @@
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 IntRect(client->screenInfo().rect);
+ return toUserSpace(IntRect(client->screenInfo().rect), widget);
}
FloatRect screenAvailableRect(Widget* widget)
@@ -90,7 +106,7 @@
PlatformPageClient client = toPlatformPageClient(widget);
if (!client)
return FloatRect();
- return IntRect(client->screenInfo().availableRect);
+ return toUserSpace(IntRect(client->screenInfo().availableRect), widget);
}
void screenColorProfile(ColorProfile& toProfile)
« no previous file with comments | « Source/WebCore/page/Settings.in ('k') | Source/WebCore/rendering/TextAutosizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698