diff options
-rw-r--r-- | WebCore/config.h | 4 | ||||
-rw-r--r-- | WebCore/platform/android/PlatformBridge.h | 2 | ||||
-rw-r--r-- | WebCore/rendering/RenderBox.cpp | 16 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/PlatformBridge.cpp | 12 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 1 |
5 files changed, 35 insertions, 0 deletions
diff --git a/WebCore/config.h b/WebCore/config.h index 8494f9e..4c7c2a9 100644 --- a/WebCore/config.h +++ b/WebCore/config.h @@ -135,6 +135,10 @@ #define ANDROID_FIX +// Ensure that the fixed elements are set relative to the screen +// rather than the virtual viewport +#define ANDROID_FIXED_ELEMENTS + // Passes the webkit-originated changes of a focused textfield to our UI // thread #define ANDROID_ACCEPT_CHANGES_TO_FOCUSED_TEXTFIELDS diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h index 45da526..43313a5 100644 --- a/WebCore/platform/android/PlatformBridge.h +++ b/WebCore/platform/android/PlatformBridge.h @@ -128,6 +128,8 @@ public: static void setUIRootLayer(const FrameView* view, const LayerAndroid* layer); static void immediateRepaint(const FrameView* view); #endif // USE(ACCELERATED_COMPOSITING) + static int screenWidth(const FrameView* view); + static int screenHeight(const FrameView* view); // Whether the WebView is paused. // ANDROID diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index 92c3d99..722b772 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -56,6 +56,10 @@ #include "WMLNames.h" #endif +#ifdef ANDROID_FIXED_ELEMENTS +#include "PlatformBridge.h" +#endif + using namespace std; namespace WebCore { @@ -1786,6 +1790,12 @@ void RenderBox::calcVerticalMargins() int RenderBox::containingBlockWidthForPositioned(const RenderBoxModelObject* containingBlock) const { +#ifdef ANDROID_FIXED_ELEMENTS + if (containingBlock->isRenderView()) { + const RenderView* view = toRenderView(containingBlock); + return PlatformBridge::screenWidth(view->frameView()); + } +#endif if (containingBlock->isBox()) { const RenderBox* containingBlockBox = toRenderBox(containingBlock); return containingBlockBox->width() - containingBlockBox->borderLeft() - containingBlockBox->borderRight() - containingBlockBox->verticalScrollbarWidth(); @@ -1816,6 +1826,12 @@ int RenderBox::containingBlockWidthForPositioned(const RenderBoxModelObject* con int RenderBox::containingBlockHeightForPositioned(const RenderBoxModelObject* containingBlock) const { +#ifdef ANDROID_FIXED_ELEMENTS + if (containingBlock->isRenderView()) { + const RenderView* view = toRenderView(containingBlock); + return PlatformBridge::screenHeight(view->frameView()); + } +#endif 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 b8bee7b..05aa42b 100644 --- a/WebKit/android/WebCoreSupport/PlatformBridge.cpp +++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp @@ -59,6 +59,18 @@ void PlatformBridge::immediateRepaint(const WebCore::FrameView* view) #endif // USE(ACCELERATED_COMPOSITING) +int PlatformBridge::screenWidth(const WebCore::FrameView* view) +{ + android::WebViewCore* core = android::WebViewCore::getWebViewCore(view); + return static_cast<int>((core->screenWidthScale() * core->screenWidth()) / core->scale()); +} + +int PlatformBridge::screenHeight(const WebCore::FrameView* view) +{ + android::WebViewCore* core = android::WebViewCore::getWebViewCore(view); + return core->screenHeight(); +} + WTF::Vector<String> PlatformBridge::getSupportedKeyStrengthList() { KeyGeneratorClient* client = JavaSharedClient::GetKeyGeneratorClient(); diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index 01033f2..0ec8bed 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -445,6 +445,7 @@ namespace android { // record the inval area, and the picture size bool recordContent(SkRegion* , SkIPoint* ); int screenWidth() const { return m_screenWidth; } + int screenHeight() const { return m_screenHeight; } float scale() const { return m_scale; } float screenWidthScale() const { return m_screenWidthScale; } WebCore::Frame* mainFrame() const { return m_mainFrame; } |