diff options
author | Cary Clark <cary@android.com> | 2009-11-09 12:12:40 -0500 |
---|---|---|
committer | Cary Clark <cary@android.com> | 2009-11-10 15:02:29 -0500 |
commit | 025ac4e283bb4b48f580d48541224e3996dc6f84 (patch) | |
tree | 98c3d496f3310db2229a62e91c1bdd5b7e7cafe6 | |
parent | 7b1ba95f7d592009a5674bbc38e3af9ee83a796a (diff) | |
download | external_webkit-025ac4e283bb4b48f580d48541224e3996dc6f84.zip external_webkit-025ac4e283bb4b48f580d48541224e3996dc6f84.tar.gz external_webkit-025ac4e283bb4b48f580d48541224e3996dc6f84.tar.bz2 |
capture offscreen invalidates in webkit
The latest update of webkit changed the way drawing invalidates
are captured. ScrollView::repaintContentRectangle now includes
an intersect test that short-circuits if rect to repaint is
outside the visible content.
FrameView::repaintContentRectangle had logic to capture offscreen
drawing, but only if the repaint rect was entirely clipped out.
This changes both FrameView and ScrollView to send partial
repaints to the offscreen code, up to four rects per draw.
fixes http://b/issue?id=2207086
-rw-r--r-- | WebCore/page/FrameView.cpp | 7 | ||||
-rw-r--r-- | WebCore/platform/ScrollView.cpp | 8 | ||||
-rw-r--r-- | WebCore/platform/ScrollView.h | 4 | ||||
-rw-r--r-- | WebCore/platform/android/ScrollViewAndroid.cpp | 16 |
4 files changed, 29 insertions, 6 deletions
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp index 888e975..587048c 100644 --- a/WebCore/page/FrameView.cpp +++ b/WebCore/page/FrameView.cpp @@ -850,10 +850,13 @@ void FrameView::repaintContentRectangle(const IntRect& r, bool immediate) double delay = adjustedDeferredRepaintDelay(); if ((m_deferringRepaints || m_deferredRepaintTimer.isActive() || delay) && !immediate) { IntRect visibleContent = visibleContentRect(); +#ifdef ANDROID_CAPTURE_OFFSCREEN_PAINTS + IntRect fullVis = visibleContent; +#endif visibleContent.intersect(r); #ifdef ANDROID_CAPTURE_OFFSCREEN_PAINTS - if (visibleContent.isEmpty()) - ScrollView::platformOffscreenContentRectangle(r); + if (r != visibleContent) + ScrollView::platformOffscreenContentRectangle(fullVis, r); #endif if (visibleContent.isEmpty()) return; diff --git a/WebCore/platform/ScrollView.cpp b/WebCore/platform/ScrollView.cpp index 8c4b115..d59d10a 100644 --- a/WebCore/platform/ScrollView.cpp +++ b/WebCore/platform/ScrollView.cpp @@ -713,10 +713,16 @@ void ScrollView::frameRectsChanged() void ScrollView::repaintContentRectangle(const IntRect& rect, bool now) { IntRect visibleContent = visibleContentRect(); +#ifdef ANDROID_CAPTURE_OFFSCREEN_PAINTS + IntRect fullVis = visibleContent; +#endif visibleContent.intersect(rect); +#ifdef ANDROID_CAPTURE_OFFSCREEN_PAINTS + if (rect != visibleContent) + platformOffscreenContentRectangle(fullVis, rect); +#endif if (visibleContent.isEmpty()) return; - if (platformWidget()) { platformRepaintContentRectangle(visibleContent, now); return; diff --git a/WebCore/platform/ScrollView.h b/WebCore/platform/ScrollView.h index ef3d03d..2da6829 100644 --- a/WebCore/platform/ScrollView.h +++ b/WebCore/platform/ScrollView.h @@ -334,7 +334,9 @@ private: public: bool platformProhibitsScrolling(); #ifdef ANDROID_CAPTURE_OFFSCREEN_PAINTS - void platformOffscreenContentRectangle(const IntRect& ); + // capture parts of rect not contained by vis + void platformOffscreenContentRectangle(const IntRect& vis, + const IntRect& rect); #endif #endif }; // class ScrollView diff --git a/WebCore/platform/android/ScrollViewAndroid.cpp b/WebCore/platform/android/ScrollViewAndroid.cpp index 274c04f..9149deb 100644 --- a/WebCore/platform/android/ScrollViewAndroid.cpp +++ b/WebCore/platform/android/ScrollViewAndroid.cpp @@ -30,6 +30,7 @@ #include "FloatRect.h" #include "FrameView.h" #include "IntRect.h" +#include "SkRegion.h" #include "WebCoreFrameBridge.h" #include "WebCoreViewBridge.h" #include "WebViewCore.h" @@ -96,9 +97,20 @@ void ScrollView::platformRepaintContentRectangle(const IntRect &rect, bool now) } #ifdef ANDROID_CAPTURE_OFFSCREEN_PAINTS -void ScrollView::platformOffscreenContentRectangle(const IntRect& rect) +/* + Compute the offscreen parts of the drawn rectangle by subtracting + vis from rect. This can compute up to four rectangular slices. +*/ +void ScrollView::platformOffscreenContentRectangle(const IntRect& vis, + const IntRect& rect) { - android::WebViewCore::getWebViewCore(this)->offInvalidate(rect); + SkRegion rectRgn = SkRegion(rect); + rectRgn.op(vis, SkRegion::kDifference_Op); + SkRegion::Iterator iter(rectRgn); + for (; !iter.done(); iter.next()) { + const SkIRect& diff = iter.rect(); + android::WebViewCore::getWebViewCore(this)->offInvalidate(diff); + } } #endif |