Title: [104832] trunk/Source/WebKit2
Revision
104832
Author
noam.rosent...@nokia.com
Date
2012-01-12 09:27:41 -0800 (Thu, 12 Jan 2012)

Log Message

[Qt][WK2] WebProcesses crashes when composited reflections/masks are present
https://bugs.webkit.org/show_bug.cgi?id=75883

Reviewed by Kenneth Rohde Christiansen.

Make sure masks and replica layers can access layerTreeTileClient. Let masks
have the right contents/visible rect so that they can render content tiles.
Default the mask's size to be the layer's size.

* WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
(WebCore::WebGraphicsLayer::WebGraphicsLayer):
(WebCore::WebGraphicsLayer::setSize):
(WebCore::WebGraphicsLayer::setMaskLayer):
(WebCore::WebGraphicsLayer::setReplicatedByLayer):
(WebCore::WebGraphicsLayer::syncCompositingState):
(WebCore::WebGraphicsLayer::setContentsScale):
(WebCore::WebGraphicsLayer::setVisibleContentRect):
(WebCore::WebGraphicsLayer::tiledBackingStoreContentsRect):
(WebCore::WebGraphicsLayer::updateTileBuffersRecursively):
(WebCore::WebGraphicsLayer::layerTreeTileClient):
(WebCore::WebGraphicsLayer::purgeBackingStores):
(WebCore::WebGraphicsLayer::recreateBackingStoreIfNeeded):
(WebCore::WebGraphicsLayer::setLayerTreeTileClient):
* WebProcess/WebCoreSupport/WebGraphicsLayer.h:
(WebCore::WebGraphicsLayer::maskTarget):
(WebCore::WebGraphicsLayer::setMaskTarget):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (104831 => 104832)


--- trunk/Source/WebKit2/ChangeLog	2012-01-12 17:06:51 UTC (rev 104831)
+++ trunk/Source/WebKit2/ChangeLog	2012-01-12 17:27:41 UTC (rev 104832)
@@ -1,3 +1,32 @@
+2012-01-12  No'am Rosenthal  <noam.rosent...@nokia.com>
+
+        [Qt][WK2] WebProcesses crashes when composited reflections/masks are present
+        https://bugs.webkit.org/show_bug.cgi?id=75883
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Make sure masks and replica layers can access layerTreeTileClient. Let masks
+        have the right contents/visible rect so that they can render content tiles.
+        Default the mask's size to be the layer's size.
+
+        * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+        (WebCore::WebGraphicsLayer::WebGraphicsLayer):
+        (WebCore::WebGraphicsLayer::setSize):
+        (WebCore::WebGraphicsLayer::setMaskLayer):
+        (WebCore::WebGraphicsLayer::setReplicatedByLayer):
+        (WebCore::WebGraphicsLayer::syncCompositingState):
+        (WebCore::WebGraphicsLayer::setContentsScale):
+        (WebCore::WebGraphicsLayer::setVisibleContentRect):
+        (WebCore::WebGraphicsLayer::tiledBackingStoreContentsRect):
+        (WebCore::WebGraphicsLayer::updateTileBuffersRecursively):
+        (WebCore::WebGraphicsLayer::layerTreeTileClient):
+        (WebCore::WebGraphicsLayer::purgeBackingStores):
+        (WebCore::WebGraphicsLayer::recreateBackingStoreIfNeeded):
+        (WebCore::WebGraphicsLayer::setLayerTreeTileClient):
+        * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
+        (WebCore::WebGraphicsLayer::maskTarget):
+        (WebCore::WebGraphicsLayer::setMaskTarget):
+
 2012-01-12  Kenneth Rohde Christiansen  <kenn...@webkit.org>
 
         [Qt] Set the input method hints on the QtQuick item
@@ -11046,7 +11075,7 @@
 
         Reviewed by Adam Roben.
 
-        This avoids calling into the plug-in when only the plug-in position relative to the window changes.
+        This avoids calling into the plug-in when only the plug-in position relative to the window changes.
     
         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
         (WebKit::NetscapePlugin::geometryDidChange):

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp (104831 => 104832)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp	2012-01-12 17:06:51 UTC (rev 104831)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp	2012-01-12 17:27:41 UTC (rev 104832)
@@ -72,6 +72,7 @@
 
 WebGraphicsLayer::WebGraphicsLayer(GraphicsLayerClient* client)
     : GraphicsLayer(client)
+    , m_maskTarget(0)
     , m_needsDisplay(false)
     , m_modified(true)
     , m_contentNeedsDisplay(false)
@@ -192,6 +193,8 @@
 
     GraphicsLayer::setSize(size);
     setNeedsDisplay();
+    if (maskLayer())
+        maskLayer()->setSize(size);
     notifyChange();
 }
 
@@ -354,14 +357,32 @@
 
 void WebGraphicsLayer::setMaskLayer(GraphicsLayer* layer)
 {
+    if (layer == maskLayer())
+        return;
+
     GraphicsLayer::setMaskLayer(layer);
+
+    if (!layer)
+        return;
+
+    layer->setSize(size());
+    WebGraphicsLayer* webGraphicsLayer = toWebGraphicsLayer(layer);
+    webGraphicsLayer->setLayerTreeTileClient(layerTreeTileClient());
+    webGraphicsLayer->setMaskTarget(this);
+    webGraphicsLayer->setContentsScale(m_contentsScale);
+    webGraphicsLayer->notifyChange();
     notifyChange();
+
 }
 
 void WebGraphicsLayer::setReplicatedByLayer(GraphicsLayer* layer)
 {
     if (layer == replicaLayer())
         return;
+
+    if (layer)
+        toWebGraphicsLayer(layer)->setLayerTreeTileClient(layerTreeTileClient());
+
     GraphicsLayer::setReplicatedByLayer(layer);
     notifyChange();
 }
@@ -387,10 +408,13 @@
 {
     for (size_t i = 0; i < children().size(); ++i)
         children()[i]->syncCompositingState(rect);
-    if (replicaLayer())
-        replicaLayer()->syncCompositingState(rect);
-    if (maskLayer())
-        maskLayer()->syncCompositingState(rect);
+
+    if (WebGraphicsLayer* mask = toWebGraphicsLayer(maskLayer()))
+        mask->syncCompositingStateForThisLayerOnly();
+
+    if (WebGraphicsLayer* replica = toWebGraphicsLayer(replicaLayer()))
+        replica->syncCompositingStateForThisLayerOnly();
+
     syncCompositingStateForThisLayerOnly();
 }
 
@@ -456,6 +480,9 @@
         layer->setContentsScale(scale);
     }
 
+    if (WebGraphicsLayer* mask = toWebGraphicsLayer(maskLayer()))
+        mask->setContentsScale(scale);
+
     m_contentsScale = scale;
     if (m_mainBackingStore && m_mainBackingStore->contentsScale() == scale)
         return;
@@ -483,6 +510,8 @@
     m_visibleContentRect = rect;
     notifyChange();
     m_mainBackingStore->adjustVisibleRect();
+    if (maskLayer())
+        toWebGraphicsLayer(maskLayer())->setVisibleContentRect(rect);
 }
 
 void WebGraphicsLayer::tiledBackingStorePaint(GraphicsContext* context, const IntRect& rect)
@@ -508,7 +537,7 @@
 
 IntRect WebGraphicsLayer::tiledBackingStoreContentsRect()
 {
-    if (m_image)
+    if (!drawsContent())
         return IntRect();
     return IntRect(0, 0, size().width(), size().height());
 }
@@ -551,13 +580,23 @@
         WebGraphicsLayer* layer = toWebGraphicsLayer(this->children()[i]);
         layer->updateTileBuffersRecursively();
     }
+
+    if (WebGraphicsLayer* mask = toWebGraphicsLayer(maskLayer()))
+        mask->updateTileBuffersRecursively();
 }
 
 WebLayerTreeTileClient* WebGraphicsLayer::layerTreeTileClient() const
 {
     if (m_layerTreeTileClient)
         return m_layerTreeTileClient;
-    WebGraphicsLayer* parent = toWebGraphicsLayer(this->parent());
+    WebGraphicsLayer* parent;
+    if (this->replicatedLayer())
+        parent = toWebGraphicsLayer(this->replicatedLayer());
+    else if (this->maskTarget())
+        parent = toWebGraphicsLayer(this->maskTarget());
+    else
+        parent = toWebGraphicsLayer(this->parent());
+
     if (!parent)
         return 0;
     return parent->layerTreeTileClient();
@@ -586,6 +625,9 @@
         layer->purgeBackingStores();
     }
 
+    if (WebGraphicsLayer* mask = toWebGraphicsLayer(maskLayer()))
+        mask->purgeBackingStores();
+
     if (m_mainBackingStore)
         m_mainBackingStore.clear();
 
@@ -602,6 +644,8 @@
         WebGraphicsLayer* layer = toWebGraphicsLayer(this->children()[i]);
         layer->recreateBackingStoreIfNeeded();
     }
+    if (WebGraphicsLayer* mask = toWebGraphicsLayer(maskLayer()))
+        mask->recreateBackingStoreIfNeeded();
 
     if (!m_mainBackingStore) {
         m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
@@ -617,6 +661,10 @@
     if (m_layerTreeTileClient == client)
         return;
 
+    if (WebGraphicsLayer* replica = toWebGraphicsLayer(replicaLayer()))
+        replica->setLayerTreeTileClient(client);
+    if (WebGraphicsLayer* mask = toWebGraphicsLayer(maskLayer()))
+        mask->setLayerTreeTileClient(client);
     for (size_t i = 0; i < children().size(); ++i) {
         WebGraphicsLayer* layer = toWebGraphicsLayer(this->children()[i]);
         layer->setLayerTreeTileClient(client);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h (104831 => 104832)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h	2012-01-12 17:06:51 UTC (rev 104831)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h	2012-01-12 17:27:41 UTC (rev 104832)
@@ -107,6 +107,9 @@
     Image* image() { return m_image.get(); }
     void notifyAnimationStarted(double);
 
+    GraphicsLayer* maskTarget() const { return m_maskTarget; }
+    void setMaskTarget(GraphicsLayer* layer) { m_maskTarget = layer; }
+
     static void initFactory();
 
 #if USE(TILED_BACKING_STORE)
@@ -137,8 +140,8 @@
 
 private:
     WebKit::WebLayerInfo m_layerInfo;
-    WebKit::WebLayerTreeTileClient* m_layerTileClient;
     RefPtr<Image> m_image;
+    GraphicsLayer* m_maskTarget;
     FloatRect m_needsDisplayRect;
     IntRect m_visibleContentRect;
     bool m_needsDisplay : 1;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to