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) |