[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andersca at apple.com andersca at apple.com
Wed Dec 22 11:23:16 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 3a0324a222eb488fb04c94890dfd3c6eab8834ca
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 21 15:43:08 2010 +0000

    Handle WKView visibility changes
    <rdar://problem/7891077>
    
    Reviewed by Dan Bernstein.
    
    * Shared/mac/UpdateChunk.h:
    (WebKit::UpdateChunk::isEmpty):
    Add convenience getter.
    
    * UIProcess/API/mac/WKView.mm:
    (-[WKView viewDidMoveToWindow]):
    Reorder the calls to _updateActiveState and _updateVisibility based on whether the view is moved to
    a window or away from a window.
    
    * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp:
    (WebKit::ChunkedUpdateDrawingAreaProxy::ChunkedUpdateDrawingAreaProxy):
    Initialize m_forceRepaintWhenResumingPainting to false.
    
    (WebKit::ChunkedUpdateDrawingAreaProxy::setPageIsVisible):
    Pass the m_forceRepaintWhenResumingPainting along to the DrawingAreaMessage::ResumePainting message.
    
    (WebKit::ChunkedUpdateDrawingAreaProxy::didSetSize):
    Don't try to paint empty update chunks.
    
    (WebKit::ChunkedUpdateDrawingAreaProxy::update):
    Don't paint the update chunk if we're not visible. Instead, make sure that the entire page is being redrawn
    when its shown again.
    
    * UIProcess/ChunkedUpdateDrawingAreaProxy.h:
    * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp:
    (WebKit::ChunkedUpdateDrawingArea::ChunkedUpdateDrawingArea):
    (WebKit::ChunkedUpdateDrawingArea::display):
    (WebKit::ChunkedUpdateDrawingArea::suspendPainting):
    Rename m_shouldPaint to m_isPaintingSuspended and invert its logic.
    
    (WebKit::ChunkedUpdateDrawingArea::scheduleDisplay):
    Don't schedule a display timer if the dirty rect is empty.
    
    (WebKit::ChunkedUpdateDrawingArea::setSize):
    If painting is suspended, just send back an empty update chunk in the DidSetSize message.
    
    (WebKit::ChunkedUpdateDrawingArea::resumePainting):
    If forceRepaint is true, repaint the entire drawing area.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63821 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index d15e241..55e8357 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -53,6 +53,52 @@
 
         Reviewed by Dan Bernstein.
 
+        Handle WKView visibility changes
+        <rdar://problem/7891077>
+    
+        * Shared/mac/UpdateChunk.h:
+        (WebKit::UpdateChunk::isEmpty):
+        Add convenience getter.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView viewDidMoveToWindow]):
+        Reorder the calls to _updateActiveState and _updateVisibility based on whether the view is moved to
+        a window or away from a window.
+
+        * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp:
+        (WebKit::ChunkedUpdateDrawingAreaProxy::ChunkedUpdateDrawingAreaProxy):
+        Initialize m_forceRepaintWhenResumingPainting to false.
+
+        (WebKit::ChunkedUpdateDrawingAreaProxy::setPageIsVisible):
+        Pass the m_forceRepaintWhenResumingPainting along to the DrawingAreaMessage::ResumePainting message.
+
+        (WebKit::ChunkedUpdateDrawingAreaProxy::didSetSize):
+        Don't try to paint empty update chunks.
+
+        (WebKit::ChunkedUpdateDrawingAreaProxy::update):
+        Don't paint the update chunk if we're not visible. Instead, make sure that the entire page is being redrawn
+        when its shown again.
+
+        * UIProcess/ChunkedUpdateDrawingAreaProxy.h:
+        * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp:
+        (WebKit::ChunkedUpdateDrawingArea::ChunkedUpdateDrawingArea):
+        (WebKit::ChunkedUpdateDrawingArea::display):
+        (WebKit::ChunkedUpdateDrawingArea::suspendPainting):
+        Rename m_shouldPaint to m_isPaintingSuspended and invert its logic.
+        
+        (WebKit::ChunkedUpdateDrawingArea::scheduleDisplay):
+        Don't schedule a display timer if the dirty rect is empty.
+
+        (WebKit::ChunkedUpdateDrawingArea::setSize):
+        If painting is suspended, just send back an empty update chunk in the DidSetSize message.
+
+        (WebKit::ChunkedUpdateDrawingArea::resumePainting):
+        If forceRepaint is true, repaint the entire drawing area.
+
+2010-07-20  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Dan Bernstein.
+
         Implement NPN_GetURL and NPN_PostURL
         https://bugs.webkit.org/show_bug.cgi?id=42650
 
diff --git a/WebKit2/Shared/mac/UpdateChunk.h b/WebKit2/Shared/mac/UpdateChunk.h
index aee7982..711c848 100644
--- a/WebKit2/Shared/mac/UpdateChunk.h
+++ b/WebKit2/Shared/mac/UpdateChunk.h
@@ -44,12 +44,13 @@ public:
 
     uint8_t* data() { return m_data; }
     const WebCore::IntRect& rect() const { return m_rect; }
+    bool isEmpty() const { return m_rect.isEmpty(); }
 
     void encode(CoreIPC::ArgumentEncoder&) const;
     static bool decode(CoreIPC::ArgumentDecoder&, UpdateChunk&);
 
     RetainPtr<CGImageRef> createImage();
-    
+
 private:
     size_t size() const { return m_rect.width() * 4 * m_rect.height(); }
 
diff --git a/WebKit2/UIProcess/API/mac/WKView.mm b/WebKit2/UIProcess/API/mac/WKView.mm
index 2a9e0cd..2b7740b 100644
--- a/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/WebKit2/UIProcess/API/mac/WKView.mm
@@ -247,8 +247,16 @@ static bool isViewVisible(NSView *view)
 
 - (void)viewDidMoveToWindow
 {
-    [self _updateVisibility];
-    [self _updateActiveState];
+    // We want to make sure to update the active state while hidden, so if the view is about to become visible, we
+    // update the active state first and then make it visible. If the view is about to be hidden, we hide it first and then
+    // update the active state.
+    if ([self window]) {
+        [self _updateActiveState];
+        [self _updateVisibility];
+    } else {
+        [self _updateVisibility];
+        [self _updateActiveState];
+    }
 }
 
 - (void)_windowDidBecomeKey:(NSNotification *)notification
diff --git a/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp b/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp
index 754e4ca..5a0145f 100644
--- a/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp
+++ b/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp
@@ -41,6 +41,7 @@ ChunkedUpdateDrawingAreaProxy::ChunkedUpdateDrawingAreaProxy(PlatformWebView* we
     : DrawingAreaProxy(ChunkedUpdateDrawingAreaType)
     , m_isWaitingForDidSetFrameNotification(false)
     , m_isVisible(true)
+    , m_forceRepaintWhenResumingPainting(false)
     , m_webView(webView)
 {
 }
@@ -104,10 +105,9 @@ void ChunkedUpdateDrawingAreaProxy::setPageIsVisible(bool isVisible)
         return;
     }
     
-    // The page is now visible.
-    page->process()->send(DrawingAreaMessage::ResumePainting, page->pageID(), CoreIPC::In());
-    
-    // FIXME: We should request a full repaint here if needed.
+    // The page is now visible, resume painting.
+    page->process()->send(DrawingAreaMessage::ResumePainting, page->pageID(), CoreIPC::In(m_forceRepaintWhenResumingPainting));
+    m_forceRepaintWhenResumingPainting = false;
 }
     
 void ChunkedUpdateDrawingAreaProxy::didSetSize(UpdateChunk* updateChunk)
@@ -121,7 +121,8 @@ void ChunkedUpdateDrawingAreaProxy::didSetSize(UpdateChunk* updateChunk)
         setSize(m_lastSetViewSize);
 
     invalidateBackingStore();
-    drawUpdateChunkIntoBackingStore(updateChunk);
+    if (!updateChunk->isEmpty())
+        drawUpdateChunkIntoBackingStore(updateChunk);
 
     WebPageProxy* page = this->page();
     page->process()->responsivenessTimer()->stop();
@@ -129,7 +130,15 @@ void ChunkedUpdateDrawingAreaProxy::didSetSize(UpdateChunk* updateChunk)
 
 void ChunkedUpdateDrawingAreaProxy::update(UpdateChunk* updateChunk)
 {
-    drawUpdateChunkIntoBackingStore(updateChunk);
+    if (!m_isVisible) {
+        // We got an update request that must have been sent before we told the web process to suspend painting.
+        // Don't paint this into the backing store, because that could leave the backing store in an inconsistent state.
+        // Instead, we will just tell the drawing area to repaint everything when we resume painting.
+        m_forceRepaintWhenResumingPainting = true;
+    } else {
+        // Just paint into backing store.
+        drawUpdateChunkIntoBackingStore(updateChunk);
+    }
 
     WebPageProxy* page = this->page();
     page->process()->send(DrawingAreaMessage::DidUpdate, page->pageID(), CoreIPC::In());
diff --git a/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h b/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h
index 2644abb..58ccaca 100644
--- a/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h
+++ b/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h
@@ -89,6 +89,7 @@ private:
 
     bool m_isWaitingForDidSetFrameNotification;
     bool m_isVisible;
+    bool m_forceRepaintWhenResumingPainting;
 
     WebCore::IntSize m_viewSize; // Size of the BackingStore as well.
     WebCore::IntSize m_lastSetViewSize;
diff --git a/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp b/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
index 66d34e2..40a069f 100644
--- a/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
+++ b/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
@@ -40,7 +40,7 @@ namespace WebKit {
 ChunkedUpdateDrawingArea::ChunkedUpdateDrawingArea(WebPage* webPage)
     : DrawingArea(ChunkedUpdateDrawingAreaType, webPage)
     , m_isWaitingForUpdate(false)
-    , m_shouldPaint(true)
+    , m_paintingIsSuspended(false)
     , m_displayTimer(WebProcess::shared().runLoop(), this, &ChunkedUpdateDrawingArea::display)
 {
 }
@@ -81,7 +81,7 @@ void ChunkedUpdateDrawingArea::display()
 {
     ASSERT(!m_isWaitingForUpdate);
  
-    if (!m_shouldPaint)
+    if (m_paintingIsSuspended)
         return;
 
     if (m_dirtyRect.isEmpty())
@@ -105,12 +105,15 @@ void ChunkedUpdateDrawingArea::display()
 
 void ChunkedUpdateDrawingArea::scheduleDisplay()
 {
-    if (!m_shouldPaint)
+    if (m_paintingIsSuspended)
         return;
 
     if (m_isWaitingForUpdate)
         return;
     
+    if (m_dirtyRect.isEmpty())
+        return;
+
     if (m_displayTimer.isActive())
         return;
 
@@ -119,7 +122,6 @@ void ChunkedUpdateDrawingArea::scheduleDisplay()
 
 void ChunkedUpdateDrawingArea::setSize(const IntSize& viewSize)
 {
-    ASSERT(m_shouldPaint);
     ASSERT_ARG(viewSize, !viewSize.isEmpty());
 
     // We don't want to wait for an update until we display.
@@ -130,6 +132,14 @@ void ChunkedUpdateDrawingArea::setSize(const IntSize& viewSize)
     // Layout if necessary.
     m_webPage->layoutIfNeeded();
 
+    if (m_paintingIsSuspended) {
+        ASSERT(!m_displayTimer.isActive());
+
+        // Painting is suspended, just send back an empty update chunk.
+        WebProcess::shared().connection()->send(DrawingAreaProxyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(UpdateChunk()));
+        return;
+    }
+
     // Create a new UpdateChunk and paint into it.
     UpdateChunk updateChunk(IntRect(0, 0, viewSize.width(), viewSize.height()));
     paintIntoUpdateChunk(&updateChunk);
@@ -141,20 +151,25 @@ void ChunkedUpdateDrawingArea::setSize(const IntSize& viewSize)
 
 void ChunkedUpdateDrawingArea::suspendPainting()
 {
-    ASSERT(m_shouldPaint);
+    ASSERT(!m_paintingIsSuspended);
     
-    m_shouldPaint = false;
+    m_paintingIsSuspended = true;
     m_displayTimer.stop();
 }
 
-void ChunkedUpdateDrawingArea::resumePainting()
+void ChunkedUpdateDrawingArea::resumePainting(bool forceRepaint)
 {
-    ASSERT(!m_shouldPaint);
+    ASSERT(m_paintingIsSuspended);
     
-    m_shouldPaint = true;
-    
-    // Display if needed.
-    display();
+    m_paintingIsSuspended = false;
+
+    if (forceRepaint) {
+        // Just set the dirty rect to the entire page size.
+        m_dirtyRect = IntRect(IntPoint(0, 0), m_webPage->size());
+    }
+
+    // Schedule a display.
+    scheduleDisplay();
 }
 
 void ChunkedUpdateDrawingArea::didUpdate()
@@ -181,10 +196,14 @@ void ChunkedUpdateDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::
             suspendPainting();
             break;
 
-        case DrawingAreaMessage::ResumePainting:
-            resumePainting();
+        case DrawingAreaMessage::ResumePainting: {
+            bool forceRepaint;
+            if (!arguments.decode(CoreIPC::Out(forceRepaint)))
+                return;
+            
+            resumePainting(forceRepaint);
             break;
-
+        }
         case DrawingAreaMessage::DidUpdate:
             didUpdate();
             break;
diff --git a/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h b/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
index 13ae3fa..9b2e33c 100644
--- a/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
+++ b/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
@@ -61,7 +61,7 @@ private:
     // CoreIPC message handlers.
     void setSize(const WebCore::IntSize& viewSize);
     void suspendPainting();
-    void resumePainting();
+    void resumePainting(bool forceRepaint);
     void didUpdate();
 
     // Platform overrides
@@ -69,7 +69,7 @@ private:
 
     WebCore::IntRect m_dirtyRect;
     bool m_isWaitingForUpdate;
-    bool m_shouldPaint;
+    bool m_paintingIsSuspended;
     RunLoop::Timer<ChunkedUpdateDrawingArea> m_displayTimer;
 };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list