diff options
| author | Grace Kloba <klobag@google.com> | 2010-05-26 12:27:41 -0700 |
|---|---|---|
| committer | Grace Kloba <klobag@google.com> | 2010-05-27 11:19:34 -0700 |
| commit | a551d0e188b3b4a05e05cc70ff0838c3165c10f6 (patch) | |
| tree | 2beaf6e70229eae75bbd9f467d7f9727aadcb807 /WebKit | |
| parent | 619aaff8ae3a2b4614393bac582ef28cf2d7939b (diff) | |
| download | external_webkit-a551d0e188b3b4a05e05cc70ff0838c3165c10f6.zip external_webkit-a551d0e188b3b4a05e05cc70ff0838c3165c10f6.tar.gz external_webkit-a551d0e188b3b4a05e05cc70ff0838c3165c10f6.tar.bz2 | |
Report correct window.innerWidth and window.innerHeight.
I agree with this article that we should have a way
to report the visible viewport to the JavaScript.
http://www.quirksmode.org/mobile/viewports2.html#link6
Fix http://b/issue?id=2717861
I will try to upstream the code to WebKit separately.
Diffstat (limited to 'WebKit')
| -rw-r--r-- | WebKit/android/jni/WebCoreViewBridge.h | 48 | ||||
| -rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 1 |
2 files changed, 33 insertions, 16 deletions
diff --git a/WebKit/android/jni/WebCoreViewBridge.h b/WebKit/android/jni/WebCoreViewBridge.h index 61990af..59e1c9a 100644 --- a/WebKit/android/jni/WebCoreViewBridge.h +++ b/WebKit/android/jni/WebCoreViewBridge.h @@ -38,20 +38,22 @@ namespace WebCore class WebCoreViewBridge : public WebCoreRefObject { public: - WebCoreViewBridge() : - mBounds(0,0,0,0), - m_windowBounds(0,0,0,0) - {} - virtual ~WebCoreViewBridge() {} + WebCoreViewBridge() { } + virtual ~WebCoreViewBridge() { } virtual void draw(WebCore::GraphicsContext* ctx, const WebCore::IntRect& rect) = 0; const WebCore::IntRect& getBounds() const { - return mBounds; + return m_bounds; } - + + const WebCore::IntRect& getVisibleBounds() const + { + return m_visibleBounds; + } + const WebCore::IntRect& getWindowBounds() const { return m_windowBounds; @@ -59,14 +61,22 @@ public: void setSize(int w, int h) { - mBounds.setWidth(w); - mBounds.setHeight(h); + m_bounds.setWidth(w); + m_bounds.setHeight(h); + } + + void setVisibleSize(int w, int h) + { + m_visibleBounds.setWidth(w); + m_visibleBounds.setHeight(h); } void setLocation(int x, int y) { - mBounds.setX(x); - mBounds.setY(y); + m_bounds.setX(x); + m_bounds.setY(y); + m_visibleBounds.setX(x); + m_visibleBounds.setY(y); } void setWindowBounds(int x, int y, int h, int v) @@ -74,17 +84,23 @@ public: m_windowBounds = WebCore::IntRect(x, y, h, v); } - int width() const { return mBounds.width(); } - int height() const { return mBounds.height(); } - int locX() const { return mBounds.x(); } - int locY() const { return mBounds.y(); } + int width() const { return m_bounds.width(); } + int height() const { return m_bounds.height(); } + int locX() const { return m_bounds.x(); } + int locY() const { return m_bounds.y(); } + + int visibleWidth() const { return m_visibleBounds.width(); } + int visibleHeight() const { return m_visibleBounds.height(); } + int visibleX() const { return m_visibleBounds.x(); } + int visibleY() const { return m_visibleBounds.y(); } virtual bool forFrameView() const { return false; } virtual bool forPluginView() const { return false; } private: - WebCore::IntRect mBounds; + WebCore::IntRect m_bounds; WebCore::IntRect m_windowBounds; + WebCore::IntRect m_visibleBounds; }; #endif // WEBCORE_VIEW_BRIDGE_H diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 89abf38..79f3a8a 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1183,6 +1183,7 @@ void WebViewCore::setSizeScreenWidthAndScale(int width, int height, int ow = window->width(); int oh = window->height(); window->setSize(width, height); + window->setVisibleSize(realScreenWidth, screenHeight); int osw = m_screenWidth; int orsw = m_screenWidth * m_screenWidthScale / m_scale; int osh = m_screenHeight; |
