summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Roard <nicolas@android.com>2010-03-16 20:34:40 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-03-16 20:34:40 -0700
commitb0c2f7b33106420933e04a3b0a69ca4d1d1b3fd8 (patch)
tree3e56539494fa5c5096ca2d5055ad3c7c45081061
parentd68483b2c8871634da4f12a5c7c272c47ee8e646 (diff)
parent15e726c96b7c81e9bbacac36d6abdff2eea4f44e (diff)
downloadexternal_webkit-b0c2f7b33106420933e04a3b0a69ca4d1d1b3fd8.zip
external_webkit-b0c2f7b33106420933e04a3b0a69ca4d1d1b3fd8.tar.gz
external_webkit-b0c2f7b33106420933e04a3b0a69ca4d1d1b3fd8.tar.bz2
Merge "Compute the position of the fixed elements to be relative to the screen and not the virtual viewport."
-rw-r--r--WebCore/config.h4
-rw-r--r--WebCore/platform/android/PlatformBridge.h2
-rw-r--r--WebCore/rendering/RenderBox.cpp16
-rw-r--r--WebKit/android/WebCoreSupport/PlatformBridge.cpp12
-rw-r--r--WebKit/android/jni/WebViewCore.h1
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; }