summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android/jni/WebViewCore.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-05-15 16:30:20 -0700
committerJohn Reck <jreck@google.com>2012-05-15 20:18:28 -0700
commite73b71c2e699401389367aaaf2866af4b796cd50 (patch)
tree48f9db3c72bd51f19e90ff4c129f99736ccbe91c /Source/WebKit/android/jni/WebViewCore.cpp
parent8001929cfbff025063aab7bd129277b24cf3a9ff (diff)
downloadexternal_webkit-e73b71c2e699401389367aaaf2866af4b796cd50.zip
external_webkit-e73b71c2e699401389367aaaf2866af4b796cd50.tar.gz
external_webkit-e73b71c2e699401389367aaaf2866af4b796cd50.tar.bz2
flicker fix
Bug: 6479523 After a layout, sync the compositing tree *before* doing any drawing Change-Id: I2c314731620be58c044f100ef335087961cbd223
Diffstat (limited to 'Source/WebKit/android/jni/WebViewCore.cpp')
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index ede8b69..734eb76 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -617,7 +617,7 @@ WebCore::Node* WebViewCore::currentFocus()
return focusedFrame()->document()->focusedNode();
}
-void WebViewCore::recordPicturePile()
+void WebViewCore::layout()
{
TRACE_METHOD();
@@ -631,9 +631,7 @@ void WebViewCore::recordPicturePile()
// it's fine for layout to gather invalidates, but defeat sending a message
// back to java to call webkitDraw, since we're already in the middle of
// doing that
- m_skipContentDraw = true;
bool success = layoutIfNeededRecursive(m_mainFrame);
- m_skipContentDraw = false;
// We may be mid-layout and thus cannot draw.
if (!success)
@@ -699,16 +697,16 @@ void WebViewCore::recordPicturePile()
view->forceLayout();
// Relayout similar to above
- m_skipContentDraw = true;
- bool success = layoutIfNeededRecursive(m_mainFrame);
- m_skipContentDraw = false;
- if (!success)
- return;
-
- // Set the computed content width
- width = view->contentsWidth();
- height = view->contentsHeight();
+ layoutIfNeededRecursive(m_mainFrame);
}
+}
+
+void WebViewCore::recordPicturePile()
+{
+ // if the webkit page dimensions changed, discard the pictureset and redraw.
+ WebCore::FrameView* view = m_mainFrame->view();
+ int width = view ? view->contentsWidth() : 0;
+ int height = view ? view->contentsHeight() : 0;
m_content.setSize(IntSize(width, height));
@@ -732,6 +730,11 @@ bool WebViewCore::focusBoundsChanged()
void WebViewCore::paintContents(WebCore::GraphicsContext* gc, WebCore::IntRect& dirty)
{
WebCore::FrameView* view = m_mainFrame->view();
+ if (!view) {
+ gc->setFillColor(WebCore::Color::white, WebCore::ColorSpaceDeviceRGB);
+ gc->fillColor();
+ return;
+ }
IntPoint origin = view->minimumScrollPosition();
IntRect drawArea = dirty;
@@ -813,7 +816,7 @@ void WebViewCore::notifyAnimationStarted()
}
-BaseLayerAndroid* WebViewCore::createBaseLayer()
+BaseLayerAndroid* WebViewCore::createBaseLayer(GraphicsLayerAndroid* root)
{
// We set the background color
Color background = Color::white;
@@ -877,15 +880,7 @@ BaseLayerAndroid* WebViewCore::createBaseLayer()
SkSafeUnref(content);
- m_skipContentDraw = true;
- bool layoutSucceeded = layoutIfNeededRecursive(m_mainFrame);
- m_skipContentDraw = false;
- // Layout only fails if called during a layout.
- ALOG_ASSERT(layoutSucceeded, "Can never be called recursively");
-
// We update the layers
- ChromeClientAndroid* chromeC = static_cast<ChromeClientAndroid*>(m_mainFrame->page()->chrome()->client());
- GraphicsLayerAndroid* root = static_cast<GraphicsLayerAndroid*>(chromeC->layersSync());
if (root) {
LayerAndroid* copyLayer = new LayerAndroid(*root->contentLayer());
base->addChild(copyLayer);
@@ -898,9 +893,14 @@ BaseLayerAndroid* WebViewCore::createBaseLayer()
BaseLayerAndroid* WebViewCore::recordContent(SkIPoint* point)
{
+ m_skipContentDraw = true;
+ layout();
+ ChromeClientAndroid* chromeC = static_cast<ChromeClientAndroid*>(m_mainFrame->page()->chrome()->client());
+ GraphicsLayerAndroid* root = static_cast<GraphicsLayerAndroid*>(chromeC->layersSync());
+ m_skipContentDraw = false;
recordPicturePile();
- BaseLayerAndroid* baseLayer = createBaseLayer();
+ BaseLayerAndroid* baseLayer = createBaseLayer(root);
baseLayer->markAsDirty(m_content.dirtyRegion());
m_content.dirtyRegion().setEmpty();