From 299511d537b620ede57a2bff60a8f27d3c935815 Mon Sep 17 00:00:00 2001 From: Grace Kloba Date: Mon, 24 May 2010 22:27:34 -0700 Subject: Refix http://b/issue?id=2509597. Instead of changing the screenRect for the Screen object, change createWindow() logic to depend on the WebCoreViewBridge width/height instead of Screen as Screen is supposed to be in device pixel and it is not proper to be used here. Update the comment for the screenRect so that we won't mistakenly modify it. Fix http://b/issue?id=2690479 --- WebCore/platform/android/ScreenAndroid.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'WebCore/platform') diff --git a/WebCore/platform/android/ScreenAndroid.cpp b/WebCore/platform/android/ScreenAndroid.cpp index 70cf794..1912a98 100644 --- a/WebCore/platform/android/ScreenAndroid.cpp +++ b/WebCore/platform/android/ScreenAndroid.cpp @@ -62,28 +62,22 @@ bool screenIsMonochrome(Widget* page) return false; } -// The only place I have seen these values used is -// positioning popup windows. If we support multiple windows -// they will be most likely full screen. Therefore, -// the accuracy of these number are not too important. +// This is used by JavaScript Screen object and media query for device info. We +// should return the value in the device pixel. FloatRect screenRect(Widget* page) { - if (!page) - return FloatRect(); - - IntRect rect = page->root()->platformWidget()->getBounds(); - return FloatRect(0.0, 0.0, rect.width(), rect.height()); + android::DisplayInfo info; + android::SurfaceComposerClient::getDisplayInfo(android::DisplayID(0), &info); + return FloatRect(0.0, 0.0, info.w, info.h); } -// Similar screenRect, this function is commonly used by javascripts -// to position and resize windows (usually to full screen). +// Similar as screenRect, this is used by JavaScript Screen object. This is also +// used by JavaScript Window to position and resize (usually to full screen). FloatRect screenAvailableRect(Widget* page) { - if (!page) - return FloatRect(); - - IntRect rect = page->root()->platformWidget()->getBounds(); - return FloatRect(0.0, 0.0, rect.width(), rect.height()); + android::DisplayInfo info; + android::SurfaceComposerClient::getDisplayInfo(android::DisplayID(0), &info); + return FloatRect(0.0, 0.0, info.w, info.h); } } // namespace WebCore -- cgit v1.1