diff options
-rw-r--r-- | WebCore/platform/android/ScreenAndroid.cpp | 26 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp | 7 |
2 files changed, 13 insertions, 20 deletions
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 diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp index ead81e0..c8d9d4b 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp @@ -40,7 +40,6 @@ #include "GraphicsLayerAndroid.h" #include "Icon.h" #include "Page.h" -#include "Screen.h" #include "ScriptController.h" #include "WebCoreFrameBridge.h" #include "WebCoreViewBridge.h" @@ -171,10 +170,10 @@ Page* ChromeClientAndroid::createWindow(Frame* frame, const FrameLoadRequest&, return frame->page(); #endif - WTF::PassRefPtr<WebCore::Screen> screen = WebCore::Screen::create(frame); + const WebCoreViewBridge* bridge = frame->view()->platformWidget(); bool dialog = features.dialog || !features.resizable - || (features.heightSet && features.height < screen.get()->height() - && features.widthSet && features.width < screen.get()->width()) + || (features.heightSet && features.height < bridge->height() + && features.widthSet && features.width < bridge->width()) || (!features.menuBarVisible && !features.statusBarVisible && !features.toolBarVisible && !features.locationBarVisible && !features.scrollbarsVisible); |