[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
andersca at apple.com
andersca at apple.com
Sun Feb 20 23:00:29 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit e1db25f235171d7005f2e91693b2f9b438955088
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Jan 15 01:18:58 2011 +0000
2011-01-14 Anders Carlsson <andersca at apple.com>
Reviewed by Sam Weinig.
Implement the "should paint bounds instead of indiviual rects" algorithm from WebKit1
https://bugs.webkit.org/show_bug.cgi?id=52499
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::shouldPaintBoundsRect):
Port code from -[WebView _mustDrawUnionedRect:singleRects:count:].
(WebKit::DrawingAreaImpl::display):
If shouldPaintBoundsRect returns true, clear the rects vector and append the bounds rect.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75849 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 8c26b4a..013432f 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,17 @@
+2011-01-14 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implement the "should paint bounds instead of indiviual rects" algorithm from WebKit1
+ https://bugs.webkit.org/show_bug.cgi?id=52499
+
+ * WebProcess/WebPage/DrawingAreaImpl.cpp:
+ (WebKit::shouldPaintBoundsRect):
+ Port code from -[WebView _mustDrawUnionedRect:singleRects:count:].
+
+ (WebKit::DrawingAreaImpl::display):
+ If shouldPaintBoundsRect returns true, clear the rects vector and append the bounds rect.
+
2011-01-14 Brian Weinstein <bweinstein at apple.com>
Reviewed by Geoff Garen.
diff --git a/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
index 1e477a2..06d10e4 100644
--- a/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
+++ b/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
@@ -68,8 +68,8 @@ void DrawingAreaImpl::setNeedsDisplay(const IntRect& rect)
void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollDelta)
{
if (!m_scrollRect.isEmpty() && scrollRect != m_scrollRect) {
- unsigned long long scrollArea = scrollRect.width() * scrollRect.height();
- unsigned long long currentScrollArea = m_scrollRect.width() * m_scrollRect.height();
+ unsigned scrollArea = scrollRect.width() * scrollRect.height();
+ unsigned currentScrollArea = m_scrollRect.width() * m_scrollRect.height();
if (currentScrollArea >= scrollArea) {
// The rect being scrolled is at least as large as the rect we'd like to scroll.
@@ -178,6 +178,27 @@ void DrawingAreaImpl::display()
m_isWaitingForDidUpdate = true;
}
+static bool shouldPaintBoundsRect(const IntRect& bounds, const Vector<IntRect>& rects)
+{
+ const size_t rectThreshold = 10;
+ const float wastedSpaceThreshold = 0.75f;
+
+ if (rects.size() <= 1 || rects.size() > rectThreshold)
+ return true;
+
+ // Attempt to guess whether or not we should use the region bounds rect or the individual rects.
+ // We do this by computing the percentage of "wasted space" in the bounds. If that wasted space
+ // is too large, then we will do individual rect painting instead.
+ unsigned boundsArea = bounds.width() * bounds.height();
+ unsigned rectsArea = 0;
+ for (size_t i = 0; i < rects.size(); ++i)
+ rectsArea += rects[i].width() * rects[i].height();
+
+ float wastedSpace = 1 - (rectsArea / boundsArea);
+
+ return wastedSpace <= wastedSpaceThreshold;
+}
+
void DrawingAreaImpl::display(UpdateInfo& updateInfo)
{
// FIXME: It would be better if we could avoid painting altogether when there is a custom representation.
@@ -187,6 +208,11 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
IntRect bounds = m_dirtyRegion.bounds();
Vector<IntRect> rects = m_dirtyRegion.rects();
+ if (shouldPaintBoundsRect(bounds, rects)) {
+ rects.clear();
+ rects.append(bounds);
+ }
+
m_dirtyRegion = Region();
m_scrollRect = IntRect();
m_scrollDelta = IntSize();
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list