summaryrefslogtreecommitdiffstats
path: root/WebCore
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2011-02-08 18:33:22 -0800
committerTeng-Hui Zhu <ztenghui@google.com>2011-02-09 18:08:46 -0800
commit3a7568b5aa8ee4ef6ba961eae690b498f5ba8e9e (patch)
tree8b3bed2574fd759eedff5a9d92f951820552cf5d /WebCore
parenta06decf9b3f66476b76925670e73fe4ac873b58f (diff)
downloadexternal_webkit-3a7568b5aa8ee4ef6ba961eae690b498f5ba8e9e.zip
external_webkit-3a7568b5aa8ee4ef6ba961eae690b498f5ba8e9e.tar.gz
external_webkit-3a7568b5aa8ee4ef6ba961eae690b498f5ba8e9e.tar.bz2
Improve the fixed element position calculation
In the previous WAR, we get the screen size from UI thread at every draw call. That is awkward. Now with Java side fix, we can get the screen size from setSize call now. However, forcing a full re-layout seems like an expensive operation. What we need to make the webkit to know the update can be done by just updating the fixed position elements only. So I have done these: 1. Take away the WAR by forcing the update at the convertToLayerCoord. 2. Get rid of the UI thread stuff used to tell WebViewCore the screen size. And get rid of the redundant variables, too. 3. update the fixed element at the setSize time. BTW, I also rename the PlatformBridge functions name. bug: 3397602 Change-Id: I0c422ecdb570de89aecb6e568d5067acf18ecfc6
Diffstat (limited to 'WebCore')
-rw-r--r--WebCore/page/FrameView.cpp23
-rw-r--r--WebCore/page/FrameView.h4
-rw-r--r--WebCore/platform/android/PlatformBridge.h4
-rw-r--r--WebCore/rendering/RenderBox.cpp4
4 files changed, 31 insertions, 4 deletions
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 5314a32..1f03599 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -1067,6 +1067,29 @@ void FrameView::removeFixedObject()
updateCanBlitOnScrollRecursively();
}
+#if PLATFORM(ANDROID)
+// When the screen size change, fixed positioned element should be updated.
+void FrameView::updatePositionedObjects()
+{
+ RenderBlock::PositionedObjectsListHashSet* positionedObjects = 0;
+ if (RenderView* root = m_frame->contentRenderer())
+ positionedObjects = root->positionedObjects();
+
+ if (!positionedObjects || positionedObjects->isEmpty())
+ return;
+
+ RenderBlock::PositionedObjectsListHashSet::const_iterator end = positionedObjects->end();
+ for (RenderBlock::PositionedObjectsListHashSet::const_iterator it = positionedObjects->begin(); it != end; ++it) {
+ RenderBox* renderBox = *it;
+ if (renderBox->style()->position() != FixedPosition)
+ continue;
+
+ renderBox->computeLogicalWidth();
+ renderBox->computeLogicalHeight();
+ }
+}
+#endif
+
bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
{
const size_t fixedObjectThreshold = 5;
diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h
index 1b5b322..4135045 100644
--- a/WebCore/page/FrameView.h
+++ b/WebCore/page/FrameView.h
@@ -97,6 +97,10 @@ public:
bool needsFullRepaint() const { return m_doFullRepaint; }
+#if PLATFORM(ANDROID)
+ void updatePositionedObjects();
+#endif
+
#if USE(ACCELERATED_COMPOSITING)
void updateCompositingLayers();
diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h
index 3f559d5..faa823e 100644
--- a/WebCore/platform/android/PlatformBridge.h
+++ b/WebCore/platform/android/PlatformBridge.h
@@ -149,8 +149,8 @@ public:
static int memoryUsageMB();
static int actualMemoryUsageMB();
- static int visibleScreenWidth(const FrameView*);
- static int visibleScreenHeight(const FrameView*);
+ static int screenWidthInDocCoord(const FrameView*);
+ static int screenHeightInDocCoord(const FrameView*);
};
}
diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp
index 3c8e2ca..ebd7d54 100644
--- a/WebCore/rendering/RenderBox.cpp
+++ b/WebCore/rendering/RenderBox.cpp
@@ -2085,7 +2085,7 @@ int RenderBox::containingBlockWidthForPositioned(const RenderBoxModelObject* con
// That is in the doc coordindate.
if (style()->position() == FixedPosition && containingBlock->isRenderView()) {
const RenderView* view = toRenderView(containingBlock);
- return PlatformBridge::visibleScreenWidth(view->frameView());
+ return PlatformBridge::screenWidthInDocCoord(view->frameView());
}
#endif
if (containingBlock->isBox()) {
@@ -2123,7 +2123,7 @@ int RenderBox::containingBlockHeightForPositioned(const RenderBoxModelObject* co
// That is in the doc coordindate.
if (style()->position() == FixedPosition && containingBlock->isRenderView()) {
const RenderView* view = toRenderView(containingBlock);
- return PlatformBridge::visibleScreenHeight(view->frameView());
+ return PlatformBridge::screenHeightInDocCoord(view->frameView());
}
#endif
int heightResult = 0;