3D transformed elements hide when showing the print dialog
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jan 2012 04:43:58 +0000 (04:43 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jan 2012 04:43:58 +0000 (04:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=45894
<rdar://problem/7441593>

Reviewed by Andy Estes.

Suspend updates of the compositing layer tree while printing is taking place,
preventing on-screen layers from moving to their print-mode positions.

No new tests, as WebKitTestRunner doesn't support putting the document
into printing mode.

* page/FrameView.cpp:
(WebCore::FrameView::syncCompositingStateForThisFrame):
(WebCore::FrameView::paintContents):
* platform/graphics/ca/LayerFlushScheduler.h:
(WebCore::LayerFlushScheduler::isSuspended): Added.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::beginPrinting):
(WebKit::WebPage::endPrinting):
* WebProcess/WebPage/ca/LayerTreeHostCA.h:
* WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h:
* WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm:
(WebKit::LayerTreeHostCAMac::forceRepaint):
(WebKit::LayerTreeHostCAMac::flushPendingLayerChanges):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106083 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Source/WebCore/platform/graphics/ca/LayerFlushScheduler.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h
Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h
Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm

index 0f1fb1f..f48d5b3 100644 (file)
@@ -1,3 +1,23 @@
+2012-01-26  Tim Horton  <hortont424@gmail.com>
+
+        3D transformed elements hide when showing the print dialog
+        https://bugs.webkit.org/show_bug.cgi?id=45894
+        <rdar://problem/7441593>
+
+        Reviewed by Andy Estes.
+
+        Suspend updates of the compositing layer tree while printing is taking place,
+        preventing on-screen layers from moving to their print-mode positions.
+
+        No new tests, as WebKitTestRunner doesn't support putting the document
+        into printing mode.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::syncCompositingStateForThisFrame):
+        (WebCore::FrameView::paintContents):
+        * platform/graphics/ca/LayerFlushScheduler.h:
+        (WebCore::LayerFlushScheduler::isSuspended): Added.
+
 2012-01-26  Pablo Flouret  <pablof@motorola.com>
 
         Fix bad code generated by the JSC idl code generator for [CachedAttribute] attributes
index 65b483f..64ba81c 100644 (file)
@@ -742,7 +742,7 @@ bool FrameView::syncCompositingStateForThisFrame(Frame* rootFrameForSync)
     root->compositor()->flushPendingLayerChanges(rootFrameForSync == m_frame);
 
 #if ENABLE(FULLSCREEN_API)
-    // The fullScreenRenderer's graphicsLayer  has been re-parented, and the above recursive syncCompositingState
+    // The fullScreenRenderer's graphicsLayer has been re-parented, and the above recursive syncCompositingState
     // call will not cause the subtree under it to repaint.  Explicitly call the syncCompositingState on 
     // the fullScreenRenderer's graphicsLayer here:
     Document* document = m_frame->document();
@@ -2848,7 +2848,7 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect)
     FontCachePurgePreventer fontCachePurgePreventer;
 
 #if USE(ACCELERATED_COMPOSITING)
-    if (!p->paintingDisabled())
+    if (!p->paintingDisabled() && !document->printing())
         syncCompositingStateForThisFrame(m_frame.get());
 #endif
 
index f59071e..36b6041 100644 (file)
@@ -46,6 +46,8 @@ public:
     void suspend();
     void resume();
 
+    bool isSuspended() const { return m_isSuspended; }
+
 private:
     bool m_isSuspended;
     LayerFlushSchedulerClient* m_client;
index afb444a..21b1b42 100644 (file)
@@ -1,3 +1,23 @@
+2012-01-26  Tim Horton  <hortont424@gmail.com>
+
+        3D transformed elements hide when showing the print dialog
+        https://bugs.webkit.org/show_bug.cgi?id=45894
+        <rdar://problem/7441593>
+
+        Reviewed by Andy Estes.
+
+        Suspend updates of the compositing layer tree while printing is taking place,
+        preventing on-screen layers from moving to their print-mode positions.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::beginPrinting):
+        (WebKit::WebPage::endPrinting):
+        * WebProcess/WebPage/ca/LayerTreeHostCA.h:
+        * WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h:
+        * WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm:
+        (WebKit::LayerTreeHostCAMac::forceRepaint):
+        (WebKit::LayerTreeHostCAMac::flushPendingLayerChanges):
+
 2012-01-26  Andras Becsi  <andras.becsi@nokia.com>
 
         [Qt][WK2] Add the componentComplete method to WebView
index d036e56..7512965 100644 (file)
@@ -2679,6 +2679,7 @@ void WebPage::beginPrinting(uint64_t frameID, const PrintInfo& printInfo)
     if (!m_printContext)
         m_printContext = adoptPtr(new PrintContext(coreFrame));
 
+    drawingArea()->setLayerTreeStateIsFrozen(true);
     m_printContext->begin(printInfo.availablePaperWidth, printInfo.availablePaperHeight);
 
     float fullPageHeight;
@@ -2687,6 +2688,7 @@ void WebPage::beginPrinting(uint64_t frameID, const PrintInfo& printInfo)
 
 void WebPage::endPrinting()
 {
+    drawingArea()->setLayerTreeStateIsFrozen(false);
     m_printContext = nullptr;
 }
 
index 0c3c7a1..6423334 100644 (file)
@@ -54,6 +54,7 @@ protected:
 
     // LayerTreeHostCA
     virtual void didPerformScheduledLayerFlush();
+    virtual bool flushPendingLayerChanges();
 
     bool m_layerFlushSchedulingEnabled;
 
@@ -81,8 +82,6 @@ private:
     // LayerTreeHostCA
     virtual void platformInitialize(LayerTreeContext&) = 0;
 
-    bool flushPendingLayerChanges();
-
     void createPageOverlayLayer();
     void destroyPageOverlayLayer();
 
index 06759e2..153256b 100644 (file)
@@ -55,7 +55,9 @@ private:
     // LayerTreeHostCA
     virtual void platformInitialize(LayerTreeContext&);
     virtual void didPerformScheduledLayerFlush();
-    
+
+    virtual bool flushPendingLayerChanges();
+
     // LayerFlushSchedulerClient
     virtual bool flushLayers();
 
index 5ff8ad1..d45837f 100644 (file)
@@ -133,4 +133,12 @@ void LayerTreeHostCAMac::didPerformScheduledLayerFlush()
     LayerTreeHostCA::didPerformScheduledLayerFlush();
 }
 
+bool LayerTreeHostCAMac::flushPendingLayerChanges()
+{
+    if (m_layerFlushScheduler.isSuspended())
+        return false;
+
+    return LayerTreeHostCA::flushPendingLayerChanges();
+}
+
 } // namespace WebKit