summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-05-15 20:38:02 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-15 20:38:02 -0700
commit9710142abfa1dd8dcedad50cc35b49c9e7c6cc57 (patch)
treed13016542d703180b6da61f9e28015f3355fe144 /Source/WebKit/android
parentd26ada95f7be3d78d3e718118c591fe110675b78 (diff)
parente73b71c2e699401389367aaaf2866af4b796cd50 (diff)
downloadexternal_webkit-9710142abfa1dd8dcedad50cc35b49c9e7c6cc57.zip
external_webkit-9710142abfa1dd8dcedad50cc35b49c9e7c6cc57.tar.gz
external_webkit-9710142abfa1dd8dcedad50cc35b49c9e7c6cc57.tar.bz2
Merge "flicker fix" into jb-dev
Diffstat (limited to 'Source/WebKit/android')
-rw-r--r--Source/WebKit/android/jni/PicturePile.cpp8
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp44
-rw-r--r--Source/WebKit/android/jni/WebViewCore.h8
3 files changed, 29 insertions, 31 deletions
diff --git a/Source/WebKit/android/jni/PicturePile.cpp b/Source/WebKit/android/jni/PicturePile.cpp
index f3e46ac..ccdfa59 100644
--- a/Source/WebKit/android/jni/PicturePile.cpp
+++ b/Source/WebKit/android/jni/PicturePile.cpp
@@ -144,9 +144,11 @@ void PicturePile::setSize(const IntSize& size)
// TODO: See above about just adding invals for new content
m_pile.clear();
m_webkitInvals.clear();
- IntRect area(0, 0, size.width(), size.height());
- m_webkitInvals.append(area);
- m_pile.append(area);
+ if (!size.isEmpty()) {
+ IntRect area(0, 0, size.width(), size.height());
+ m_webkitInvals.append(area);
+ m_pile.append(area);
+ }
}
void PicturePile::updatePicturesIfNeeded(PicturePainter* painter)
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index bb3307c..dc4f70c 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;
@@ -878,15 +881,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);
@@ -899,9 +894,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();
diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h
index fb732e5..c6b26c6 100644
--- a/Source/WebKit/android/jni/WebViewCore.h
+++ b/Source/WebKit/android/jni/WebViewCore.h
@@ -161,11 +161,6 @@ namespace android {
*/
void contentDraw();
- /**
- * copy the layers to the UI side
- */
- void layersDraw();
-
#if USE(ACCELERATED_COMPOSITING)
WebCore::GraphicsLayerAndroid* graphicsRootLayer() const;
#endif
@@ -517,7 +512,7 @@ namespace android {
// This creates a new BaseLayerAndroid by copying the current m_content
// and doing a copy of the layers. The layers' content may be updated
// as we are calling layersSync().
- WebCore::BaseLayerAndroid* createBaseLayer();
+ WebCore::BaseLayerAndroid* createBaseLayer(GraphicsLayerAndroid* root);
bool updateLayers(WebCore::LayerAndroid*);
void notifyAnimationStarted();
@@ -618,6 +613,7 @@ namespace android {
};
WebCore::Node* currentFocus();
+ void layout();
// Create a set of pictures to represent the drawn DOM, driven by
// the invalidated region and the time required to draw (used to draw)
void recordPicturePile();