diff options
-rw-r--r-- | WebCore/platform/android/PlatformBridge.h | 3 | ||||
-rw-r--r-- | WebCore/rendering/RenderBox.cpp | 15 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/PlatformBridge.cpp | 13 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 2 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 9 | ||||
-rw-r--r-- | WebKit/android/nav/WebView.cpp | 4 |
6 files changed, 46 insertions, 0 deletions
diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h index 7d54ae5..3f559d5 100644 --- a/WebCore/platform/android/PlatformBridge.h +++ b/WebCore/platform/android/PlatformBridge.h @@ -148,6 +148,9 @@ public: static int highUsageDeltaMB(); static int memoryUsageMB(); static int actualMemoryUsageMB(); + + static int visibleScreenWidth(const FrameView*); + static int visibleScreenHeight(const FrameView*); }; } diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index 772879c..fe78fd5 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -39,6 +39,7 @@ #include "FloatQuad.h" #include "Frame.h" #include "Page.h" +#include "PlatformBridge.h" #include "RenderArena.h" #include "RenderFlexibleBox.h" #include "RenderInline.h" @@ -2077,6 +2078,13 @@ void RenderBox::computeBlockDirectionMargins(RenderBlock* containingBlock) int RenderBox::containingBlockWidthForPositioned(const RenderBoxModelObject* containingBlock) const { + // Fixed element's position should be decided by the visible screen size. + // That is in the doc coordindate. + if (style()->position() == FixedPosition && containingBlock->isRenderView()) { + const RenderView* view = toRenderView(containingBlock); + return PlatformBridge::visibleScreenWidth(view->frameView()); + } + if (containingBlock->isBox()) { const RenderBox* containingBlockBox = toRenderBox(containingBlock); return containingBlockBox->width() - containingBlockBox->borderLeft() - containingBlockBox->borderRight() - containingBlockBox->verticalScrollbarWidth(); @@ -2107,6 +2115,13 @@ int RenderBox::containingBlockWidthForPositioned(const RenderBoxModelObject* con int RenderBox::containingBlockHeightForPositioned(const RenderBoxModelObject* containingBlock) const { + // Fixed element's position should be decided by the visible screen size. + // That is in the doc coordindate. + if (style()->position() == FixedPosition && containingBlock->isRenderView()) { + const RenderView* view = toRenderView(containingBlock); + return PlatformBridge::visibleScreenHeight(view->frameView()); + } + int heightResult = 0; if (containingBlock->isBox()) heightResult = toRenderBox(containingBlock)->height(); diff --git a/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/WebKit/android/WebCoreSupport/PlatformBridge.cpp index 0bc2e3c..b34ff8c 100644 --- a/WebKit/android/WebCoreSupport/PlatformBridge.cpp +++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp @@ -159,6 +159,19 @@ FloatRect PlatformBridge::screenRect() return FloatRect(0.0, 0.0, info.w, info.h); } +// The visible size on screen in document coordinate +int PlatformBridge::visibleScreenWidth(const WebCore::FrameView* frameView) +{ + android::WebViewCore* webViewCore = android::WebViewCore::getWebViewCore(frameView); + return webViewCore->visibleScreenWidth(); +} + +int PlatformBridge::visibleScreenHeight(const WebCore::FrameView* frameView) +{ + android::WebViewCore* webViewCore = android::WebViewCore::getWebViewCore(frameView); + return webViewCore->visibleScreenHeight(); +} + String PlatformBridge::computeDefaultLanguage() { #if USE(CHROME_NETWORK_STACK) diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 6ba8276..ef4cf66 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -486,6 +486,8 @@ void WebViewCore::reset(bool fromConstructor) m_scrollOffsetY = 0; m_screenWidth = 0; m_screenHeight = 0; + m_visibleScreenWidth = 0; + m_visibleScreenHeight = 0; m_groupForVisitedLinks = NULL; m_currentNodeDomNavigationAxis = 0; } diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index 4357165..a32ce49 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -581,6 +581,10 @@ namespace android { bool isPaused() const { return m_isPaused; } void setIsPaused(bool isPaused) { m_isPaused = isPaused; } bool drawIsPaused() const; + int visibleScreenWidth() const { return m_visibleScreenWidth; } + int visibleScreenHeight() const { return m_visibleScreenHeight; } + void setVisibleScreenWidth(int w) { m_visibleScreenWidth = w; } + void setVisibleScreenHeight(int h) { m_visibleScreenHeight = h; } #if USE(CHROME_NETWORK_STACK) void setWebRequestContextUserAgent(); void setWebRequestContextCacheMode(int mode); @@ -633,6 +637,11 @@ namespace android { CachedHistory m_history; int m_screenWidth; // width of the visible rect in document coordinates int m_screenHeight;// height of the visible rect in document coordinates + // The m_screenHeight is not equal to the visibleRect from WebView, + // using m_visibleScreenHeight to store that info. + // After we can fix the m_screenHeight in java side, we can merge them. + int m_visibleScreenWidth; + int m_visibleScreenHeight; int m_textWrapWidth; float m_scale; unsigned m_domtree_version; diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index 0c18d85..0fecf4f 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -481,6 +481,8 @@ bool drawGL(WebCore::IntRect& viewRect, float scale, int extras) SkRect visibleRect; calcOurContentVisibleRect(&visibleRect); + m_viewImpl->setVisibleScreenWidth(visibleRect.width()); + m_viewImpl->setVisibleScreenHeight(visibleRect.height()); bool ret = m_baseLayer->drawGL(viewRect, visibleRect, scale); if (ret || m_glWebViewState->currentPictureCounter() != pic) return true; @@ -543,6 +545,8 @@ PictureSet* draw(SkCanvas* canvas, SkColor bgColor, int extras, bool split) compositeLayer->setExtra(extra); SkRect visible; calcOurContentVisibleRect(&visible); + m_viewImpl->setVisibleScreenWidth(visible.width()); + m_viewImpl->setVisibleScreenHeight(visible.height()); // call this to be sure we've adjusted for any scrolling or animations // before we actually draw compositeLayer->updateFixedLayersPositions(visible); |