[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 22:53:52 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit c37d9399e0fb13cc26dd3e584dfe5b56548b3c55
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 13 02:50:58 2011 +0000

    2011-01-12  Anders Carlsson  <andersca at apple.com>
    
            Reviewed by Sam Weinig.
    
            Implement DrawingAreaImpl::scroll
            https://bugs.webkit.org/show_bug.cgi?id=52346
    
            * WebProcess/WebPage/DrawingAreaImpl.cpp:
            (WebKit::DrawingAreaImpl::scroll):
            If there is already an active scroll, compute the area of both scroll rects and
            invalidate the smallest one. Compute a new dirty region if necessary and also
            add the scroll repaint region to the dirty region.
    
            (WebKit::DrawingAreaImpl::display):
            Reset the scroll area and scroll delta.
    
            * WebProcess/WebPage/DrawingAreaImpl.h:
            Add scroll area and scroll delta member variables.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75670 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index a6667ad..096971c 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,24 @@
 2011-01-12  Anders Carlsson  <andersca at apple.com>
 
+        Reviewed by Sam Weinig.
+
+        Implement DrawingAreaImpl::scroll
+        https://bugs.webkit.org/show_bug.cgi?id=52346
+
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::scroll):
+        If there is already an active scroll, compute the area of both scroll rects and
+        invalidate the smallest one. Compute a new dirty region if necessary and also
+        add the scroll repaint region to the dirty region.
+
+        (WebKit::DrawingAreaImpl::display):
+        Reset the scroll area and scroll delta.
+
+        * WebProcess/WebPage/DrawingAreaImpl.h:
+        Add scroll area and scroll delta member variables.
+
+2011-01-12  Anders Carlsson  <andersca at apple.com>
+
         Reviewed by Dan Bernstein.
 
         Region improvements
diff --git a/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
index fcc1b30..8f7e734 100644
--- a/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
+++ b/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
@@ -67,6 +67,46 @@ 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();
+
+        if (currentScrollArea > scrollArea) {
+            // The rect being scrolled has a greater area than the rect we'd like to scroll.
+            // Go ahead and just invalidate the scroll rect.
+            setNeedsDisplay(scrollRect);
+            return;
+        }
+
+        ASSERT(scrollArea > currentScrollArea);
+
+        // Just repaint the entire current scroll rect, we'll scroll the new rect instead.
+        setNeedsDisplay(m_scrollRect);
+        m_scrollRect = IntRect();
+        m_scrollDelta = IntSize();
+    }
+
+    // Get the part of the dirty region that is in the scroll rect.
+    Region dirtyRegionInScrollRect = intersect(scrollRect, m_dirtyRegion);
+    if (!dirtyRegionInScrollRect.isEmpty()) {
+        // There are parts of the dirty region that are inside the scroll rect.
+        // We need to subtract them from the region, move them and re-add them.
+        m_dirtyRegion.subtract(scrollRect);
+
+        // Move the dirty parts.
+        Region movedDirtyRegionInScrollRect = intersect(translate(dirtyRegionInScrollRect, scrollDelta), scrollRect);
+
+        // And add them back.
+        m_dirtyRegion.unite(movedDirtyRegionInScrollRect);
+    } 
+    
+    // Compute the scroll repaint region.
+    Region scrollRepaintRegion = subtract(scrollRect, translate(scrollRect, scrollDelta));
+
+    m_dirtyRegion.unite(scrollRepaintRegion);
+
+    m_scrollRect = scrollRect;
+    m_scrollDelta += scrollDelta;
 }
 
 void DrawingAreaImpl::attachCompositingContext()
@@ -150,7 +190,9 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
     Vector<IntRect> rects = m_dirtyRegion.rects();
 
     m_dirtyRegion = Region();
-
+    m_scrollRect = IntRect();
+    m_scrollDelta = IntSize();
+    
     RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(bounds.size());
     if (!bitmap->createHandle(updateInfo.bitmapHandle))
         return;
diff --git a/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h b/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
index dee6529..1f1b2e2 100644
--- a/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
+++ b/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
@@ -61,7 +61,9 @@ private:
     void display(UpdateInfo&);
 
     Region m_dirtyRegion;
-
+    WebCore::IntRect m_scrollRect;
+    WebCore::IntSize m_scrollDelta;
+    
     // Whether we're waiting for a DidUpdate message. Used for throttling paints so that the 
     // web process won't paint more frequent than the UI process can handle.
     bool m_isWaitingForDidUpdate;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list