Title: [161570] trunk/Source/WebCore
Revision
161570
Author
[email protected]
Date
2014-01-09 12:20:26 -0800 (Thu, 09 Jan 2014)

Log Message

Margin tiles are not repainted when background color changes
https://bugs.webkit.org/show_bug.cgi?id=126541
-and corresponding-
<rdar://problem/15578131>

Reviewed by Simon Fraser.

This patch adds an optional parameter to GraphicsLayer::setNeedsDisplayInRect, 
RenderLayerBacking::setContentsNeedDisplay(), and 
RenderLayer::setBackingNeedsRepaint() that is used to determine whether or not to 
clip the invalidation rect to the size of the layer. Then whenever the margin 
needs to be repainted, we can call setNeedsDisplayInRect() with a rect that 
includes the margin, and also indicate that it should not be clipped.

GraphicsLayer now takes an optional parameter which is an enum called 
ShouldClipToLayer.
* WebCore.exp.in:
* platform/graphics/GraphicsLayer.h:
* platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:
(WebCore::GraphicsLayerBlackBerry::setNeedsDisplayInRect):
* platform/graphics/blackberry/GraphicsLayerBlackBerry.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setNeedsDisplayInRect):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayerTextureMapper::setNeedsDisplayInRect):
* platform/graphics/texmap/GraphicsLayerTextureMapper.h:
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:

Make TileController::bounds() a virtual function, and declare it on TiledBacking 
so that we can call it from RenderLayerBacking.
* platform/graphics/TiledBacking.h:
* platform/graphics/ca/mac/TileController.h:

RenderLayer also now takes an optional parameter which is an enum called 
ShouldClipToLayer.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderLayer.h:

If the margin needs to be repainted, call GraphicsLayer::setNeedsDisplayInRect 
with a big enough rect and a ShouldClipToLayer value of DoNotClipToLayer.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::setContentsNeedDisplay):
* rendering/RenderLayerBacking.h:

Whenever all of the root contents need to be repainted the margin will also need 
to be repainted, so call setBackingNeedsRepaint() with the new parameter 
indicating the the invalidation should NOT be clipped to the layer size.
* rendering/RenderView.cpp:
(WebCore::RenderView::repaintRootContents):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (161569 => 161570)


--- trunk/Source/WebCore/ChangeLog	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/ChangeLog	2014-01-09 20:20:26 UTC (rev 161570)
@@ -1,3 +1,59 @@
+2014-01-09  Beth Dakin  <[email protected]>
+
+        Margin tiles are not repainted when background color changes
+        https://bugs.webkit.org/show_bug.cgi?id=126541
+        -and corresponding-
+        <rdar://problem/15578131>
+
+        Reviewed by Simon Fraser.
+
+        This patch adds an optional parameter to GraphicsLayer::setNeedsDisplayInRect, 
+        RenderLayerBacking::setContentsNeedDisplay(), and 
+        RenderLayer::setBackingNeedsRepaint() that is used to determine whether or not to 
+        clip the invalidation rect to the size of the layer. Then whenever the margin 
+        needs to be repainted, we can call setNeedsDisplayInRect() with a rect that 
+        includes the margin, and also indicate that it should not be clipped.
+
+        GraphicsLayer now takes an optional parameter which is an enum called 
+        ShouldClipToLayer.
+        * WebCore.exp.in:
+        * platform/graphics/GraphicsLayer.h:
+        * platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:
+        (WebCore::GraphicsLayerBlackBerry::setNeedsDisplayInRect):
+        * platform/graphics/blackberry/GraphicsLayerBlackBerry.h:
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::setNeedsDisplayInRect):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
+        (WebCore::GraphicsLayerTextureMapper::setNeedsDisplayInRect):
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
+
+        Make TileController::bounds() a virtual function, and declare it on TiledBacking 
+        so that we can call it from RenderLayerBacking.
+        * platform/graphics/TiledBacking.h:
+        * platform/graphics/ca/mac/TileController.h:
+
+        RenderLayer also now takes an optional parameter which is an enum called 
+        ShouldClipToLayer.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::calculateClipRects):
+        * rendering/RenderLayer.h:
+
+        If the margin needs to be repainted, call GraphicsLayer::setNeedsDisplayInRect 
+        with a big enough rect and a ShouldClipToLayer value of DoNotClipToLayer.
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::setContentsNeedDisplay):
+        * rendering/RenderLayerBacking.h:
+
+        Whenever all of the root contents need to be repainted the margin will also need 
+        to be repainted, so call setBackingNeedsRepaint() with the new parameter 
+        indicating the the invalidation should NOT be clipped to the layer size.
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::repaintRootContents):
+
 2014-01-09  Bear Travis  <[email protected]>
 
         [CSS Shapes] Factor the ReferenceBox type out of BasicShapes

Modified: trunk/Source/WebCore/WebCore.exp.in (161569 => 161570)


--- trunk/Source/WebCore/WebCore.exp.in	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-01-09 20:20:26 UTC (rev 161570)
@@ -556,7 +556,7 @@
 __ZN7WebCore15GraphicsLayerCA21flushCompositingStateERKNS_9FloatRectE
 __ZN7WebCore15GraphicsLayerCA21setAcceleratesDrawingEb
 __ZN7WebCore15GraphicsLayerCA21setBackfaceVisibilityEb
-__ZN7WebCore15GraphicsLayerCA21setNeedsDisplayInRectERKNS_9FloatRectE
+__ZN7WebCore15GraphicsLayerCA21setNeedsDisplayInRectERKNS_9FloatRectENS_13GraphicsLayer17ShouldClipToLayerE
 __ZN7WebCore15GraphicsLayerCA21setShowRepaintCounterEb
 __ZN7WebCore15GraphicsLayerCA23setContentsClippingRectERKNS_7IntRectE
 __ZN7WebCore15GraphicsLayerCA23setContentsNeedsDisplayEv

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (161569 => 161570)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2014-01-09 20:20:26 UTC (rev 161570)
@@ -349,9 +349,14 @@
     GraphicsLayerPaintingPhase paintingPhase() const { return m_paintingPhase; }
     void setPaintingPhase(GraphicsLayerPaintingPhase phase) { m_paintingPhase = phase; }
 
+    enum ShouldClipToLayer {
+        DoNotClipToLayer,
+        ClipToLayer
+    };
+
     virtual void setNeedsDisplay() = 0;
     // mark the given rect (in layer coords) as needing dispay. Never goes deep.
-    virtual void setNeedsDisplayInRect(const FloatRect&) = 0;
+    virtual void setNeedsDisplayInRect(const FloatRect&, ShouldClipToLayer = ClipToLayer) = 0;
 
     virtual void setContentsNeedsDisplay() { };
 

Modified: trunk/Source/WebCore/platform/graphics/TiledBacking.h (161569 => 161570)


--- trunk/Source/WebCore/platform/graphics/TiledBacking.h	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/platform/graphics/TiledBacking.h	2014-01-09 20:20:26 UTC (rev 161570)
@@ -89,6 +89,9 @@
     virtual int leftMarginWidth() const = 0;
     virtual int rightMarginWidth() const = 0;
 
+    // Includes margins.
+    virtual IntRect bounds() const = 0;
+
     // Exposed for testing
     virtual IntRect tileCoverageRect() const = 0;
     virtual IntRect tileGridExtent() const = 0;

Modified: trunk/Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp (161569 => 161570)


--- trunk/Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp	2014-01-09 20:20:26 UTC (rev 161570)
@@ -364,7 +364,7 @@
         m_layer->setNeedsDisplay();
 }
 
-void GraphicsLayerBlackBerry::setNeedsDisplayInRect(const FloatRect& rect)
+void GraphicsLayerBlackBerry::setNeedsDisplayInRect(const FloatRect& rect, ShouldClipToLayer)
 {
     if (drawsContent())
         m_layer->setNeedsDisplayInRect(rect);

Modified: trunk/Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.h (161569 => 161570)


--- trunk/Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.h	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.h	2014-01-09 20:20:26 UTC (rev 161570)
@@ -90,7 +90,7 @@
     virtual void setOpacity(float);
 
     virtual void setNeedsDisplay();
-    virtual void setNeedsDisplayInRect(const FloatRect&);
+    virtual void setNeedsDisplayInRect(const FloatRect&, ShouldClipToLayer = ClipToLayer);
 
     virtual void setContentsNeedsDisplay();
 

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (161569 => 161570)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2014-01-09 20:20:26 UTC (rev 161570)
@@ -708,14 +708,17 @@
     setNeedsDisplayInRect(FloatRect::infiniteRect());
 }
 
-void GraphicsLayerCA::setNeedsDisplayInRect(const FloatRect& r)
+void GraphicsLayerCA::setNeedsDisplayInRect(const FloatRect& r, ShouldClipToLayer shouldClip)
 {
     if (!drawsContent())
         return;
 
     FloatRect rect(r);
-    FloatRect layerBounds(FloatPoint(), m_size);
-    rect.intersect(layerBounds);
+    if (shouldClip == ClipToLayer) {
+        FloatRect layerBounds(FloatPoint(), m_size);
+        rect.intersect(layerBounds);
+    }
+
     if (rect.isEmpty())
         return;
     

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (161569 => 161570)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2014-01-09 20:20:26 UTC (rev 161570)
@@ -106,7 +106,7 @@
 #endif
 
     virtual void setNeedsDisplay();
-    virtual void setNeedsDisplayInRect(const FloatRect&);
+    virtual void setNeedsDisplayInRect(const FloatRect&, ShouldClipToLayer = ClipToLayer);
     virtual void setContentsNeedsDisplay();
     
     virtual void setContentsRect(const IntRect&);

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h (161569 => 161570)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h	2014-01-09 20:20:26 UTC (rev 161570)
@@ -145,7 +145,7 @@
     virtual void platformCALayerSetNeedsToRevalidateTiles() OVERRIDE { }
     virtual float platformCALayerDeviceScaleFactor() const OVERRIDE;
 
-    IntRect bounds() const;
+    virtual IntRect bounds() const OVERRIDE;
     IntRect boundsWithoutMargin() const;
     IntRect boundsAtLastRevalidateWithoutMargin() const;
 

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp (161569 => 161570)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2014-01-09 20:20:26 UTC (rev 161570)
@@ -105,7 +105,7 @@
 
 /* \reimp (GraphicsLayer.h)
 */
-void GraphicsLayerTextureMapper::setNeedsDisplayInRect(const FloatRect& rect)
+void GraphicsLayerTextureMapper::setNeedsDisplayInRect(const FloatRect& rect, ShouldClipToLayer)
 {
     if (!drawsContent())
         return;

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h (161569 => 161570)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h	2014-01-09 20:20:26 UTC (rev 161570)
@@ -43,7 +43,7 @@
     // reimps from GraphicsLayer.h
     virtual void setNeedsDisplay();
     virtual void setContentsNeedsDisplay();
-    virtual void setNeedsDisplayInRect(const FloatRect&);
+    virtual void setNeedsDisplayInRect(const FloatRect&, ShouldClipToLayer = ClipToLayer);
     virtual bool setChildren(const Vector<GraphicsLayer*>&);
     virtual void addChild(GraphicsLayer*);
     virtual void addChildAtIndex(GraphicsLayer*, int index);

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp (161569 => 161570)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2014-01-09 20:20:26 UTC (rev 161570)
@@ -538,7 +538,7 @@
     setNeedsDisplayInRect(FloatRect(FloatPoint(), size()));
 }
 
-void CoordinatedGraphicsLayer::setNeedsDisplayInRect(const FloatRect& rect)
+void CoordinatedGraphicsLayer::setNeedsDisplayInRect(const FloatRect& rect, ShouldClipToLayer)
 {
     if (m_mainBackingStore)
         m_mainBackingStore->invalidate(IntRect(rect));

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h (161569 => 161570)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h	2014-01-09 20:20:26 UTC (rev 161570)
@@ -96,7 +96,7 @@
     virtual void setMaskLayer(GraphicsLayer*) OVERRIDE;
     virtual void setReplicatedByLayer(GraphicsLayer*) OVERRIDE;
     virtual void setNeedsDisplay() OVERRIDE;
-    virtual void setNeedsDisplayInRect(const FloatRect&) OVERRIDE;
+    virtual void setNeedsDisplayInRect(const FloatRect&, ShouldClipToLayer = ClipToLayer) OVERRIDE;
     virtual void setContentsNeedsDisplay() OVERRIDE;
     virtual void deviceOrPageScaleFactorChanged() OVERRIDE;
     virtual void flushCompositingState(const FloatRect&) OVERRIDE;

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (161569 => 161570)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-01-09 20:20:26 UTC (rev 161570)
@@ -6275,7 +6275,7 @@
 
 #if USE(ACCELERATED_COMPOSITING)
 
-void RenderLayer::setBackingNeedsRepaint()
+void RenderLayer::setBackingNeedsRepaint(GraphicsLayer::ShouldClipToLayer shouldClip)
 {
     ASSERT(isComposited());
     if (backing()->paintsIntoWindow()) {
@@ -6283,7 +6283,7 @@
         // repaint to the native view system.
         renderer().view().repaintViewRectangle(absoluteBoundingBox());
     } else
-        backing()->setContentsNeedDisplay();
+        backing()->setContentsNeedDisplay(shouldClip);
 }
 
 void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r)

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (161569 => 161570)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2014-01-09 20:20:26 UTC (rev 161570)
@@ -44,6 +44,7 @@
 #ifndef RenderLayer_h
 #define RenderLayer_h
 
+#include "GraphicsLayer.h"
 #include "PaintInfo.h"
 #include "RenderBox.h"
 #include "RenderPtr.h"
@@ -346,7 +347,7 @@
 #if USE(ACCELERATED_COMPOSITING)
     // Indicate that the layer contents need to be repainted. Only has an effect
     // if layer compositing is being used,
-    void setBackingNeedsRepaint();
+    void setBackingNeedsRepaint(GraphicsLayer::ShouldClipToLayer = GraphicsLayer::ClipToLayer);
     void setBackingNeedsRepaintInRect(const LayoutRect&); // r is in the coordinate space of the layer's render object
     void repaintIncludingNonCompositingDescendants(RenderLayerModelObject* repaintContainer);
 #endif

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (161569 => 161570)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2014-01-09 20:20:26 UTC (rev 161570)
@@ -2075,7 +2075,7 @@
 }
 #endif
 
-void RenderLayerBacking::setContentsNeedDisplay()
+void RenderLayerBacking::setContentsNeedDisplay(GraphicsLayer::ShouldClipToLayer shouldClip)
 {
     ASSERT(!paintsIntoCompositedAncestor());
 
@@ -2083,8 +2083,14 @@
     if (m_isMainFrameRenderViewLayer && frameView.isTrackingRepaints())
         frameView.addTrackedRepaintRect(owningLayer().absoluteBoundingBox());
     
-    if (m_graphicsLayer && m_graphicsLayer->drawsContent())
-        m_graphicsLayer->setNeedsDisplay();
+    if (m_graphicsLayer && m_graphicsLayer->drawsContent()) {
+        // By default, setNeedsDisplay will clip to the size of the GraphicsLayer, which does not include margin tiles.
+        // So if the TiledBacking has a margin that needs to be invalidated, we need to send in a rect to setNeedsDisplayInRect
+        // that is large enough to include the margin. TiledBacking::bounds() includes the margin.
+        TiledBacking* tiledBacking = this->tiledBacking();
+        FloatRect rectToRepaint = tiledBacking ? tiledBacking->bounds() : FloatRect(FloatPoint(0, 0), m_graphicsLayer->size());
+        m_graphicsLayer->setNeedsDisplayInRect(rectToRepaint, shouldClip);
+    }
     
     if (m_foregroundLayer && m_foregroundLayer->drawsContent())
         m_foregroundLayer->setNeedsDisplay();

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (161569 => 161570)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2014-01-09 20:20:26 UTC (rev 161570)
@@ -126,7 +126,7 @@
 
     void setRequiresOwnBackingStore(bool);
 
-    void setContentsNeedDisplay();
+    void setContentsNeedDisplay(GraphicsLayer::ShouldClipToLayer = GraphicsLayer::ClipToLayer);
     // r is in the coordinate space of the layer's render object
     void setContentsNeedDisplayInRect(const IntRect&);
 

Modified: trunk/Source/WebCore/rendering/RenderView.cpp (161569 => 161570)


--- trunk/Source/WebCore/rendering/RenderView.cpp	2014-01-09 20:16:23 UTC (rev 161569)
+++ trunk/Source/WebCore/rendering/RenderView.cpp	2014-01-09 20:20:26 UTC (rev 161570)
@@ -574,7 +574,7 @@
 {
 #if USE(ACCELERATED_COMPOSITING)
     if (layer()->isComposited()) {
-        layer()->setBackingNeedsRepaint();
+        layer()->setBackingNeedsRepaint(GraphicsLayer::DoNotClipToLayer);
         return;
     }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to