summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2010-05-14 15:31:44 -0400
committerCary Clark <cary@android.com>2010-05-14 15:52:58 -0400
commit0d4eb282a9331db55cb204c779cd172dba8ccf50 (patch)
tree4d481c9cb202616734ac57387fc5c54ff1682858
parent32c3075b9493cae498f938edbb48250b26c4c64c (diff)
downloadexternal_webkit-0d4eb282a9331db55cb204c779cd172dba8ccf50.zip
external_webkit-0d4eb282a9331db55cb204c779cd172dba8ccf50.tar.gz
external_webkit-0d4eb282a9331db55cb204c779cd172dba8ccf50.tar.bz2
suppress partial screen updates if a canvas element is visible
A PictureSet contains a list of pictures. Each picture draws part of the screen. If the picture contains a Canvas element, the corresponding bitmap is not shared. Small partial invalidates can create a dozen or so pictures, each of which may be quite small, a few hundred bytes. But the bitmap referenced by the picture may be large, several meg. The backing bitmap is unique to the Canvas element. Since a canvas rarely benefits from small updates, disable the partial invalidates if CacheBuilder detects a canvas. Change-Id: I5761667db3d037d7363dcb01f8a26f7f62e2eabc http://b/2678787
-rw-r--r--WebKit/android/jni/WebViewCore.cpp3
-rw-r--r--WebKit/android/nav/CacheBuilder.cpp3
-rw-r--r--WebKit/android/nav/CacheBuilder.h2
3 files changed, 8 insertions, 0 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 2efd074..beb38cd 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -590,6 +590,9 @@ void WebViewCore::recordPictureSet(PictureSet* content)
height = view->contentsHeight();
}
+ if (cacheBuilder().pictureSetDisabled())
+ content->clear();
+
content->checkDimensions(width, height, &m_addInval);
// The inval region may replace existing pictures. The existing pictures
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp
index 09e5e59..c343fa0 100644
--- a/WebKit/android/nav/CacheBuilder.cpp
+++ b/WebKit/android/nav/CacheBuilder.cpp
@@ -867,6 +867,7 @@ bool CacheBuilder::AnyIsClick(Node* node)
void CacheBuilder::buildCache(CachedRoot* root)
{
Frame* frame = FrameAnd(this);
+ mPictureSetDisabled = false;
BuildFrame(frame, frame, root, (CachedFrame*) root);
root->finishInit(); // set up frame parent pointers, child pointers
setData((CachedFrame*) root);
@@ -1131,6 +1132,8 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
if (node->hasTagName(HTMLNames::bodyTag))
bodyPos = originalAbsBounds.location();
+ else if (node->hasTagName(HTMLNames::canvasTag))
+ mPictureSetDisabled = true;
if (checkForPluginViewThatWantsFocus(nodeRenderer)) {
bounds = absBounds;
isUnclipped = true;
diff --git a/WebKit/android/nav/CacheBuilder.h b/WebKit/android/nav/CacheBuilder.h
index 4ded58d..8183954 100644
--- a/WebKit/android/nav/CacheBuilder.h
+++ b/WebKit/android/nav/CacheBuilder.h
@@ -94,6 +94,7 @@ public:
static IntRect getAreaRect(const HTMLAreaElement* area);
static void GetGlobalOffset(Frame* , int* x, int * y);
static void GetGlobalOffset(Node* , int* x, int * y);
+ bool pictureSetDisabled() { return mPictureSetDisabled; }
static bool validNode(Frame* startFrame, void* framePtr, void* nodePtr);
private:
enum AddressProgress {
@@ -249,6 +250,7 @@ private:
Node* tryFocus(Direction direction);
Node* trySegment(Direction direction, int mainStart, int mainEnd);
CachedNodeBits mAllowableTypes;
+ bool mPictureSetDisabled;
#if DUMP_NAV_CACHE
public:
class Debug {