Title: [102407] trunk/Source/WebKit2
Revision
102407
Author
simon.fra...@apple.com
Date
2011-12-08 17:46:30 -0800 (Thu, 08 Dec 2011)

Log Message

Forced compositing mode breaks display of full-page PDFs in WK2
https://bugs.webkit.org/show_bug.cgi?id=74122
<rdar://problem/9550059>

Reviewed by Dan Bernstein.

Full page PDFs are displayed in WK2 in a subview of the WKView. However,
when the WKView is forced to use accelerated compositing, the layer obscures
the PDF subview.

To fix this we have to drop out of compositing mode when the WKView is showing
a custom representation.

* UIProcess/API/mac/WKView.mm:
(-[WKView _setPageHasCustomRepresentation:]): Tell the drawing area that the view
gained or lost a custom representation.
* UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::pageCustomRepresentationChanged):
* UIProcess/DrawingAreaProxyImpl.h:
* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::pageCustomRepresentationChanged): Send a messgae to the web process
to indicate that the custom representation changed.
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::pageCustomRepresentationChanged):
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::pageCustomRepresentationChanged): Enter or exit compositing mode
as appropriate when we gain or lost a custom represenetation.
(WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode):
* WebProcess/WebPage/DrawingAreaImpl.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (102406 => 102407)


--- trunk/Source/WebKit2/ChangeLog	2011-12-09 01:35:25 UTC (rev 102406)
+++ trunk/Source/WebKit2/ChangeLog	2011-12-09 01:46:30 UTC (rev 102407)
@@ -1,3 +1,36 @@
+2011-12-08  Simon Fraser  <simon.fra...@apple.com>
+
+        Forced compositing mode breaks display of full-page PDFs in WK2
+        https://bugs.webkit.org/show_bug.cgi?id=74122
+        <rdar://problem/9550059>
+
+        Reviewed by Dan Bernstein.
+        
+        Full page PDFs are displayed in WK2 in a subview of the WKView. However,
+        when the WKView is forced to use accelerated compositing, the layer obscures
+        the PDF subview.
+        
+        To fix this we have to drop out of compositing mode when the WKView is showing
+        a custom representation.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _setPageHasCustomRepresentation:]): Tell the drawing area that the view
+        gained or lost a custom representation.
+        * UIProcess/DrawingAreaProxy.h:
+        (WebKit::DrawingAreaProxy::pageCustomRepresentationChanged):
+        * UIProcess/DrawingAreaProxyImpl.h:
+        * UIProcess/DrawingAreaProxyImpl.cpp:
+        (WebKit::DrawingAreaProxyImpl::pageCustomRepresentationChanged): Send a messgae to the web process
+        to indicate that the custom representation changed.
+        * WebProcess/WebPage/DrawingArea.h:
+        (WebKit::DrawingArea::pageCustomRepresentationChanged):
+        * WebProcess/WebPage/DrawingArea.messages.in:
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::pageCustomRepresentationChanged): Enter or exit compositing mode
+        as appropriate when we gain or lost a custom represenetation.
+        (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode):
+        * WebProcess/WebPage/DrawingAreaImpl.h:
+
 2011-12-08  Jer Noble  <jer.no...@apple.com>
 
         HiDPI: Switching a video element to full screen in HiDPI mode doesn't fit the screen correctly

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (102406 => 102407)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-12-09 01:35:25 UTC (rev 102406)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-12-09 01:46:30 UTC (rev 102407)
@@ -2445,10 +2445,14 @@
 
 - (void)_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation
 {
+    bool hadPDFView = _data->_pdfViewController;
     _data->_pdfViewController = nullptr;
 
     if (pageHasCustomRepresentation)
         _data->_pdfViewController = PDFViewController::create(self);
+    
+    if (pageHasCustomRepresentation != hadPDFView)
+        _data->_page->drawingArea()->pageCustomRepresentationChanged();
 }
 
 - (void)_didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:(const String&)suggestedFilename dataReference:(const CoreIPC::DataReference&)dataReference

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h (102406 => 102407)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h	2011-12-09 01:35:25 UTC (rev 102406)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h	2011-12-09 01:46:30 UTC (rev 102407)
@@ -80,6 +80,8 @@
     const WebCore::IntSize& size() const { return m_size; }
     void setSize(const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);
 
+    virtual void pageCustomRepresentationChanged() { }
+
 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
     virtual void updateViewport();
     virtual WebCore::IntRect viewportVisibleRect() const { return contentsRect(); }

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp (102406 => 102407)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp	2011-12-09 01:35:25 UTC (rev 102406)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp	2011-12-09 01:46:30 UTC (rev 102407)
@@ -369,6 +369,11 @@
 }
 #endif
 
+void DrawingAreaProxyImpl::pageCustomRepresentationChanged()
+{
+    m_webPageProxy->process()->send(Messages::DrawingArea::PageCustomRepresentationChanged(), m_webPageProxy->pageID());
+}
+
 void DrawingAreaProxyImpl::discardBackingStoreSoon()
 {
     if (!m_isBackingStoreDiscardable || m_discardBackingStoreTimer.isActive())

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h (102406 => 102407)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h	2011-12-09 01:35:25 UTC (rev 102406)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h	2011-12-09 01:46:30 UTC (rev 102407)
@@ -87,6 +87,8 @@
     bool isInAcceleratedCompositingMode() const { return false; }
 #endif
 
+    virtual void pageCustomRepresentationChanged();
+
     void discardBackingStoreSoon();
     void discardBackingStore();
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (102406 => 102407)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2011-12-09 01:35:25 UTC (rev 102406)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2011-12-09 01:46:30 UTC (rev 102407)
@@ -74,6 +74,7 @@
     virtual void didInstallPageOverlay() { }
     virtual void didUninstallPageOverlay() { }
     virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&) { }
+    virtual void pageCustomRepresentationChanged() { }
 
     virtual void setPaintingEnabled(bool) { }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in (102406 => 102407)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in	2011-12-09 01:35:25 UTC (rev 102406)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in	2011-12-09 01:46:30 UTC (rev 102407)
@@ -25,6 +25,7 @@
     DidUpdate()
     SuspendPainting()
     ResumePainting()
+    PageCustomRepresentationChanged()
 
 #if PLATFORM(MAC)
     // Used by TiledCoreAnimationDrawingArea.

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp (102406 => 102407)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp	2011-12-09 01:35:25 UTC (rev 102406)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp	2011-12-09 01:46:30 UTC (rev 102407)
@@ -235,6 +235,18 @@
     setNeedsDisplay(rect);
 }
 
+void DrawingAreaImpl::pageCustomRepresentationChanged()
+{
+    if (!m_alwaysUseCompositing)
+        return;
+
+    if (m_webPage->mainFrameHasCustomRepresentation()) {
+        if (m_layerTreeHost)
+            exitAcceleratedCompositingMode();
+    } else if (!m_layerTreeHost)
+        enterAcceleratedCompositingMode(0);
+}
+
 void DrawingAreaImpl::setPaintingEnabled(bool paintingEnabled)
 {
     m_isPaintingEnabled = paintingEnabled;
@@ -460,7 +472,7 @@
 
 void DrawingAreaImpl::exitAcceleratedCompositingMode()
 {
-    if (m_alwaysUseCompositing)
+    if (m_alwaysUseCompositing && !m_webPage->mainFrameHasCustomRepresentation())
         return;
 
     ASSERT(!m_layerTreeStateIsFrozen);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h (102406 => 102407)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h	2011-12-09 01:35:25 UTC (rev 102406)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h	2011-12-09 01:46:30 UTC (rev 102407)
@@ -82,6 +82,8 @@
     virtual void didUpdate();
     virtual void suspendPainting();
     virtual void resumePainting();
+    
+    virtual void pageCustomRepresentationChanged();
 
     void sendDidUpdateBackingStoreState();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to