Title: [138973] trunk/Source/WebKit2
Revision
138973
Author
[email protected]
Date
2013-01-07 11:52:01 -0800 (Mon, 07 Jan 2013)

Log Message

Make WKViews work when layer-backed
https://bugs.webkit.org/show_bug.cgi?id=106166

Reviewed by Sam Weinig.

When not in TileCache mode, WebKit2 views had redraw problems on scrolling,
if layer-backed.

The issue is that the DrawingAreaProxy code tries to optimize scrolling by
calling -scrollRect:by: on the WKView (an NSView) to copy bits, rather than
repainting the entire view. However, -scrollRect:by: does nothing for NSViews
that have layers.

Fix by plumbing through a canScrollView() function which PageClientImpl()
implements, returning true if the view does not have layer backing.
When canScrollView() is false, DrawingAreaProxyImpl::incorporateUpdate()
dirties the entire view.

* UIProcess/API/gtk/PageClientImpl.h:
(WebKit::PageClientImpl::canScrollView):
* UIProcess/API/mac/PageClientImpl.h:
(PageClientImpl):
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::canScrollView):
* UIProcess/API/qt/raw/qrawwebview_p_p.h:
(QRawWebViewPrivate::canScrollView):
* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::incorporateUpdate):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::canScrollView):
* UIProcess/WebPageProxy.h:
* UIProcess/efl/PageClientBase.h:
(WebKit::PageClientBase::canScrollView):
* UIProcess/qt/QtPageClient.h:
(WebKit::QtPageClient::canScrollView):
* UIProcess/win/WebView.h:
(WebKit::WebView::canScrollView):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (138972 => 138973)


--- trunk/Source/WebKit2/ChangeLog	2013-01-07 19:44:34 UTC (rev 138972)
+++ trunk/Source/WebKit2/ChangeLog	2013-01-07 19:52:01 UTC (rev 138973)
@@ -1,3 +1,44 @@
+2013-01-07  Simon Fraser  <[email protected]>
+
+        Make WKViews work when layer-backed
+        https://bugs.webkit.org/show_bug.cgi?id=106166
+
+        Reviewed by Sam Weinig.
+        
+        When not in TileCache mode, WebKit2 views had redraw problems on scrolling,
+        if layer-backed.
+        
+        The issue is that the DrawingAreaProxy code tries to optimize scrolling by
+        calling -scrollRect:by: on the WKView (an NSView) to copy bits, rather than
+        repainting the entire view. However, -scrollRect:by: does nothing for NSViews
+        that have layers.
+        
+        Fix by plumbing through a canScrollView() function which PageClientImpl()
+        implements, returning true if the view does not have layer backing.
+        When canScrollView() is false, DrawingAreaProxyImpl::incorporateUpdate()
+        dirties the entire view.
+
+        * UIProcess/API/gtk/PageClientImpl.h:
+        (WebKit::PageClientImpl::canScrollView):
+        * UIProcess/API/mac/PageClientImpl.h:
+        (PageClientImpl):
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::canScrollView):
+        * UIProcess/API/qt/raw/qrawwebview_p_p.h:
+        (QRawWebViewPrivate::canScrollView):
+        * UIProcess/DrawingAreaProxyImpl.cpp:
+        (WebKit::DrawingAreaProxyImpl::incorporateUpdate):
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::canScrollView):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/efl/PageClientBase.h:
+        (WebKit::PageClientBase::canScrollView):
+        * UIProcess/qt/QtPageClient.h:
+        (WebKit::QtPageClient::canScrollView):
+        * UIProcess/win/WebView.h:
+        (WebKit::WebView::canScrollView):
+
 2013-01-04  Sam Weinig  <[email protected]>
 
         Remove WebProcessInitialization and NetworkProcessInitialization by putting the rest of initialization in ChildProcess derived classes

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h (138972 => 138973)


--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h	2013-01-07 19:44:34 UTC (rev 138972)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h	2013-01-07 19:52:01 UTC (rev 138973)
@@ -56,6 +56,7 @@
     virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
     virtual void setViewNeedsDisplay(const WebCore::IntRect&);
     virtual void displayView();
+    virtual bool canScrollView() { return false; }
     virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
     virtual WebCore::IntSize viewSize();
     virtual bool isViewWindowActive();

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h (138972 => 138973)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2013-01-07 19:44:34 UTC (rev 138972)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2013-01-07 19:52:01 UTC (rev 138973)
@@ -53,6 +53,7 @@
     virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
     virtual void setViewNeedsDisplay(const WebCore::IntRect&);
     virtual void displayView();
+    virtual bool canScrollView();
     virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
 
     virtual WebCore::IntSize viewSize();

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm (138972 => 138973)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2013-01-07 19:44:34 UTC (rev 138972)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2013-01-07 19:52:01 UTC (rev 138973)
@@ -153,6 +153,12 @@
     [m_wkView displayIfNeeded];
 }
 
+bool PageClientImpl::canScrollView()
+{
+    // -scrollRect:by: does nothing in layer-backed views <rdar://problem/12961719>.
+    return ![m_wkView layer];
+}
+
 void PageClientImpl::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset)
 {
     NSRect clippedScrollRect = NSIntersectionRect(scrollRect, NSOffsetRect(scrollRect, -scrollOffset.width(), -scrollOffset.height()));

Modified: trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h (138972 => 138973)


--- trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h	2013-01-07 19:44:34 UTC (rev 138972)
+++ trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h	2013-01-07 19:52:01 UTC (rev 138973)
@@ -75,6 +75,7 @@
     virtual void doneWithGestureEvent(const WebKit::WebGestureEvent& event, bool wasEventHandled);
 #endif
     virtual void displayView();
+    virtual bool canScrollView() { return false; }
     virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
 
     virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>&);

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp (138972 => 138973)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp	2013-01-07 19:44:34 UTC (rev 138972)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp	2013-01-07 19:52:01 UTC (rev 138973)
@@ -280,10 +280,14 @@
 
     if (shouldScroll)
         m_webPageProxy->scrollView(updateInfo.scrollRect, updateInfo.scrollOffset);
-
-    for (size_t i = 0; i < updateInfo.updateRects.size(); ++i)
-        m_webPageProxy->setViewNeedsDisplay(updateInfo.updateRects[i]);
-
+    
+    if (shouldScroll && !m_webPageProxy->canScrollView())
+        m_webPageProxy->setViewNeedsDisplay(IntRect(IntPoint(), m_webPageProxy->viewSize()));
+    else {
+        for (size_t i = 0; i < updateInfo.updateRects.size(); ++i)
+            m_webPageProxy->setViewNeedsDisplay(updateInfo.updateRects[i]);
+    }
+    
     if (WebPageProxy::debugPaintFlags() & kWKDebugFlashBackingStoreUpdates)
         m_webPageProxy->flashBackingStoreUpdates(updateInfo.updateRects);
 

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (138972 => 138973)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2013-01-07 19:44:34 UTC (rev 138972)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2013-01-07 19:52:01 UTC (rev 138973)
@@ -89,6 +89,8 @@
     // Tell the view to immediately display its invalid rect.
     virtual void displayView() = 0;
 
+    // Return true if scrollView() can copy bits in the view.
+    virtual bool canScrollView() = 0;
     // Tell the view to scroll scrollRect by scrollOffset.
     virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0;
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (138972 => 138973)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-01-07 19:44:34 UTC (rev 138972)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-01-07 19:52:01 UTC (rev 138973)
@@ -853,6 +853,11 @@
     m_pageClient->displayView();
 }
 
+bool WebPageProxy::canScrollView()
+{
+    return m_pageClient->canScrollView();
+}
+
 void WebPageProxy::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset)
 {
     m_pageClient->scrollView(scrollRect, scrollOffset);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (138972 => 138973)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-01-07 19:44:34 UTC (rev 138972)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-01-07 19:52:01 UTC (rev 138973)
@@ -338,6 +338,7 @@
 
     void setViewNeedsDisplay(const WebCore::IntRect&);
     void displayView();
+    bool canScrollView();
     void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
 
     enum {

Modified: trunk/Source/WebKit2/UIProcess/efl/PageClientBase.h (138972 => 138973)


--- trunk/Source/WebKit2/UIProcess/efl/PageClientBase.h	2013-01-07 19:44:34 UTC (rev 138972)
+++ trunk/Source/WebKit2/UIProcess/efl/PageClientBase.h	2013-01-07 19:52:01 UTC (rev 138973)
@@ -51,6 +51,7 @@
     virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
     virtual void setViewNeedsDisplay(const WebCore::IntRect&);
     virtual void displayView();
+    virtual bool canScrollView() { return false; }
     virtual void scrollView(const WebCore::IntRect&, const WebCore::IntSize&);
     virtual WebCore::IntSize viewSize();
     virtual bool isViewWindowActive();

Modified: trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h (138972 => 138973)


--- trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h	2013-01-07 19:44:34 UTC (rev 138972)
+++ trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h	2013-01-07 19:52:01 UTC (rev 138973)
@@ -61,6 +61,7 @@
     virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password);
 
     virtual void displayView();
+    virtual bool canScrollView() { return false; }
     virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
     virtual bool isViewWindowActive();
     virtual bool isViewInWindow();

Modified: trunk/Source/WebKit2/UIProcess/win/WebView.h (138972 => 138973)


--- trunk/Source/WebKit2/UIProcess/win/WebView.h	2013-01-07 19:44:34 UTC (rev 138972)
+++ trunk/Source/WebKit2/UIProcess/win/WebView.h	2013-01-07 19:52:01 UTC (rev 138973)
@@ -171,6 +171,7 @@
     virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
     virtual void setViewNeedsDisplay(const WebCore::IntRect&);
     virtual void displayView();
+    virtual bool canScrollView() { return false; }
     virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
     virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
     
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to