Diff
Modified: trunk/Source/WebCore/ChangeLog (130675 => 130676)
--- trunk/Source/WebCore/ChangeLog 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebCore/ChangeLog 2012-10-08 20:10:22 UTC (rev 130676)
@@ -1,3 +1,56 @@
+2012-10-08 Simon Fraser <[email protected]>
+
+ Some GraphicsLayer cleanup to separate the concepts of using a tile cache, and being the main tile cache layer
+ https://bugs.webkit.org/show_bug.cgi?id=98574
+
+ Reviewed by Dean Jackson.
+
+ GraphicsLayerCA assumed that using a TileCache equated to being the main page tile
+ cache layer, which has some special considerations. Make these two concepts separate
+ to get closer to being able to use TileCaches in place of CATiledLayer.
+
+ * platform/graphics/GraphicsLayer.h:
+ (GraphicsLayer): Remove m_usingTileCache member, which was not appropriate
+ for this class to have.
+ * platform/graphics/GraphicsLayer.cpp:
+ (WebCore::GraphicsLayer::GraphicsLayer): Remove init of m_usingTileCache.
+ (WebCore::GraphicsLayer::debugBorderInfo): Can no longer use m_usingTileCache to
+ get the blue color, so moved code into a virtual debugBorderInfo() method.
+ (WebCore::GraphicsLayer::updateDebugIndicators): Call the virtual debugBorderInfo().
+ * platform/graphics/GraphicsLayerClient.h: Remove the usingTileCache() callback;
+ we now just cache this information in the GraphicsLayerCA on creation.
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::GraphicsLayerCA): Init m_isPageTileCacheLayer to false,
+ then set to m_isPageTileCacheLayer if the client says we should create a tile cache.
+ (WebCore::GraphicsLayerCA::platformCALayerShowRepaintCounter): Overidden to avoid duplicate repaint
+ counters in the top-left tile.
+ (WebCore::GraphicsLayerCA::updateLayerBackgroundColor): If this layer is the page tile cache layer,
+ we allow setting of its background color.
+ (WebCore::GraphicsLayerCA::debugBorderInfo): Overidden to use a blue color for tiles.
+ (WebCore::GraphicsLayerCA::requiresTiledLayer): Don't make CATiledLayers for the page tile cache.
+ * platform/graphics/ca/GraphicsLayerCA.h:
+ (GraphicsLayerCA):
+ * platform/graphics/ca/PlatformCALayerClient.h:
+ (PlatformCALayerClient): Need to pass the platform layer into platformCALayerShowRepaintCounter()
+ so we can distinguish between calls for tiles, and calls for the tile cache layer itself.
+ * platform/graphics/ca/mac/TileCache.mm:
+ (WebCore::TileCache::shouldShowRepaintCounters): Pass 0 to platformCALayerShowRepaintCounter() to
+ indicate that we're asking about a tile.
+ * platform/graphics/mac/WebLayer.mm:
+ (drawLayerContents): Now we can just rely on platformCALayerShowRepaintCounter() to tell us whether
+ to draw the repaint counter.
+ (-[WebLayer setNeedsDisplayInRect:]):
+ * platform/graphics/mac/WebTiledLayer.mm:
+ (-[WebTiledLayer setNeedsDisplayInRect:]):
+ * rendering/RenderLayerBacking.h:
+ (WebCore::RenderLayerBacking::usingTileCache):
+ (RenderLayerBacking):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::documentBackgroundColorDidChange): We can ask the RenderLayerBacking
+ whether it's for the tile cache, rather than going to the GraphicsLayer.
+ * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
+ (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerShowRepaintCounter):
+
2012-10-08 Huang Dongsung <[email protected]>
[Qt] Make ImageBufferQt use premultiplied converting functions in Color.h instead of its own mechanism.
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (130675 => 130676)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2012-10-08 20:10:22 UTC (rev 130676)
@@ -80,7 +80,6 @@
, m_acceleratesDrawing(false)
, m_maintainsPixelAlignment(false)
, m_appliesPageScale(false)
- , m_usingTileCache(false)
, m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip)
, m_contentsOrientation(CompositingCoordinatesTopDown)
, m_parent(0)
@@ -339,23 +338,41 @@
{
}
-void GraphicsLayer::updateDebugIndicators()
+void GraphicsLayer::getDebugBorderInfo(Color& color, float& width) const
{
- if (GraphicsLayer::showDebugBorders()) {
- if (drawsContent()) {
- if (m_usingTileCache) // tile cache layer: dark blue
- setDebugBorder(Color(0, 0, 128, 128), 0.5);
- else if (m_usingTiledLayer)
- setDebugBorder(Color(255, 128, 0, 128), 2); // tiled layer: orange
- else
- setDebugBorder(Color(0, 128, 32, 128), 2); // normal layer: green
- } else if (masksToBounds()) {
- setDebugBorder(Color(128, 255, 255, 48), 20); // masking layer: pale blue
- } else
- setDebugBorder(Color(255, 255, 0, 192), 2); // container: yellow
+ if (drawsContent()) {
+ if (m_usingTiledLayer) {
+ color = Color(255, 128, 0, 128); // tiled layer: orange
+ width = 2;
+ return;
+ }
+
+ color = Color(0, 128, 32, 128); // normal layer: green
+ width = 2;
+ return;
}
+
+ if (masksToBounds()) {
+ color = Color(128, 255, 255, 48); // masking layer: pale blue
+ width = 20;
+ return;
+ }
+
+ color = Color(255, 255, 0, 192); // container: yellow
+ width = 2;
}
+void GraphicsLayer::updateDebugIndicators()
+{
+ if (!GraphicsLayer::showDebugBorders())
+ return;
+
+ Color borderColor;
+ float width = 0;
+ getDebugBorderInfo(borderColor, width);
+ setDebugBorder(borderColor, width);
+}
+
void GraphicsLayer::setZPosition(float position)
{
m_zPosition = position;
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (130675 => 130676)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2012-10-08 20:10:22 UTC (rev 130676)
@@ -436,6 +436,7 @@
GraphicsLayer(GraphicsLayerClient*);
void dumpProperties(TextStream&, int indent, LayerTreeAsTextBehavior) const;
+ virtual void getDebugBorderInfo(Color&, float& width) const;
GraphicsLayerClient* m_client;
String m_name;
@@ -471,7 +472,6 @@
bool m_acceleratesDrawing : 1;
bool m_maintainsPixelAlignment : 1;
bool m_appliesPageScale : 1; // Set for the layer which has the page scale applied to it.
- bool m_usingTileCache : 1;
GraphicsLayerPaintingPhase m_paintingPhase;
CompositingCoordinatesOrientation m_contentsOrientation; // affects orientation of layer contents
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h (130675 => 130676)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h 2012-10-08 20:10:22 UTC (rev 130676)
@@ -58,7 +58,6 @@
virtual ~GraphicsLayerClient() {}
virtual bool shouldUseTileCache(const GraphicsLayer*) const { return false; }
- virtual bool usingTileCache(const GraphicsLayer*) const { return false; }
// Callback for when hardware-accelerated animation started.
virtual void notifyAnimationStarted(const GraphicsLayer*, double time) = 0;
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (130675 => 130676)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2012-10-08 20:10:22 UTC (rev 130676)
@@ -274,12 +274,13 @@
, m_contentsLayerPurpose(NoContentsLayer)
, m_contentsLayerHasBackgroundColor(false)
, m_allowTiledLayer(true)
+ , m_isPageTileCacheLayer(false)
, m_uncommittedChanges(0)
{
PlatformCALayer::LayerType layerType = PlatformCALayer::LayerTypeWebLayer;
if (client && client->shouldUseTileCache(this)) {
layerType = PlatformCALayer::LayerTypeTileCacheLayer;
- m_usingTileCache = true;
+ m_isPageTileCacheLayer = true;
}
m_layer = PlatformCALayer::create(layerType, this);
@@ -992,6 +993,16 @@
client()->didCommitChangesForLayer(this);
}
+bool GraphicsLayerCA::platformCALayerShowRepaintCounter(PlatformCALayer* platformLayer) const
+{
+ // The repaint counters are painted into the TileCache tiles (which have no corresponding platform layer),
+ // so we don't want to overpaint the repaint counter when called with the TileCache's own layer.
+ if (m_isPageTileCacheLayer && platformLayer)
+ return false;
+
+ return showRepaintCounter();
+}
+
void GraphicsLayerCA::platformCALayerPaintContents(GraphicsContext& context, const IntRect& clip)
{
paintGraphicsLayerContents(context, clip);
@@ -1497,7 +1508,7 @@
void GraphicsLayerCA::updateLayerBackgroundColor()
{
- if (m_layer->layerType() == PlatformCALayer::LayerTypeTileCacheLayer) {
+ if (m_isPageTileCacheLayer) {
m_layer->setBackgroundColor(m_backgroundColor);
return;
}
@@ -2391,6 +2402,17 @@
m_layer->setBackgroundColor(Color::transparent);
}
+void GraphicsLayerCA::getDebugBorderInfo(Color& color, float& width) const
+{
+ if (m_isPageTileCacheLayer) {
+ color = Color(0, 0, 128, 128); // tile cache layer: dark blue
+ width = 0.5;
+ return;
+ }
+
+ GraphicsLayer::getDebugBorderInfo(color, width);
+}
+
void GraphicsLayerCA::setDebugBorder(const Color& color, float borderWidth)
{
if (color.isValid()) {
@@ -2428,7 +2450,7 @@
bool GraphicsLayerCA::requiresTiledLayer(float pageScaleFactor) const
{
- if (!m_drawsContent || !m_allowTiledLayer || m_layer->layerType() == PlatformCALayer::LayerTypeTileCacheLayer)
+ if (!m_drawsContent || !m_allowTiledLayer || m_isPageTileCacheLayer)
return false;
// FIXME: catch zero-size height or width here (or earlier)?
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (130675 => 130676)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2012-10-08 20:10:22 UTC (rev 130676)
@@ -153,7 +153,7 @@
virtual CompositingCoordinatesOrientation platformCALayerContentsOrientation() const { return contentsOrientation(); }
virtual void platformCALayerPaintContents(GraphicsContext&, const IntRect& clip);
virtual bool platformCALayerShowDebugBorders() const { return showDebugBorders(); }
- virtual bool platformCALayerShowRepaintCounter() const { return showRepaintCounter(); }
+ virtual bool platformCALayerShowRepaintCounter(PlatformCALayer*) const;
virtual int platformCALayerIncrementRepaintCount() { return incrementRepaintCount(); }
virtual bool platformCALayerContentsOpaque() const { return contentsOpaque(); }
@@ -228,6 +228,8 @@
virtual void setReplicatedByLayer(GraphicsLayer*);
+ virtual void getDebugBorderInfo(Color&, float& width) const;
+
void computePixelAlignment(float pixelAlignmentScale, const FloatPoint& positionRelativeToBase,
FloatPoint& position, FloatSize&, FloatPoint3D& anchorPoint, FloatSize& alignmentOffset) const;
@@ -403,6 +405,7 @@
ContentsLayerPurpose m_contentsLayerPurpose;
bool m_contentsLayerHasBackgroundColor : 1;
bool m_allowTiledLayer : 1;
+ bool m_isPageTileCacheLayer : 1;
RetainPtr<CGImageRef> m_uncorrectedContentsImage;
RetainPtr<CGImageRef> m_pendingContentsImage;
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h (130675 => 130676)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h 2012-10-08 20:10:22 UTC (rev 130676)
@@ -52,7 +52,7 @@
virtual GraphicsLayer::CompositingCoordinatesOrientation platformCALayerContentsOrientation() const = 0;
virtual void platformCALayerPaintContents(GraphicsContext&, const IntRect& inClip) = 0;
virtual bool platformCALayerShowDebugBorders() const = 0;
- virtual bool platformCALayerShowRepaintCounter() const = 0;
+ virtual bool platformCALayerShowRepaintCounter(PlatformCALayer*) const = 0;
virtual int platformCALayerIncrementRepaintCount() = 0;
virtual bool platformCALayerContentsOpaque() const = 0;
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm (130675 => 130676)
--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm 2012-10-08 20:10:22 UTC (rev 130676)
@@ -480,7 +480,7 @@
if (!layerContents)
return false;
- return layerContents->platformCALayerShowRepaintCounter();
+ return layerContents->platformCALayerShowRepaintCounter(0);
}
void TileCache::drawRepaintCounter(WebTileLayer *layer, CGContextRef context)
Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp (130675 => 130676)
--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp 2012-10-08 20:10:22 UTC (rev 130676)
@@ -96,7 +96,7 @@
}
#endif
- if (owner()->owner()->platformCALayerShowRepaintCounter()) {
+ if (owner()->owner()->platformCALayerShowRepaintCounter(owner())) {
FontCachePurgePreventer fontCachePurgePreventer;
String text = String::number(owner()->owner()->platformCALayerIncrementRepaintCount());
@@ -165,14 +165,14 @@
for (int i = 0; i < numTileLayers; ++i)
CACFLayerSetNeedsDisplay(tileAtIndex(i), dirtyRect ? &rect : 0);
- if (m_owner->owner() && m_owner->owner()->platformCALayerShowRepaintCounter()) {
+ if (m_owner->owner() && m_owner->owner()->platformCALayerShowRepaintCounter(m_owner)) {
CGRect layerBounds = m_owner->bounds();
CGRect indicatorRect = CGRectMake(layerBounds.origin.x, layerBounds.origin.y, 80, 25);
CACFLayerSetNeedsDisplay(tileAtIndex(0), &indicatorRect);
}
} else if (owner()->layerType() == PlatformCALayer::LayerTypeWebLayer) {
if (owner() && owner()->owner()) {
- if (owner()->owner()->platformCALayerShowRepaintCounter()) {
+ if (owner()->owner()->platformCALayerShowRepaintCounter(owner())) {
FloatRect layerBounds = owner()->bounds();
FloatRect repaintCounterRect = layerBounds;
Modified: trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm (130675 => 130676)
--- trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm 2012-10-08 20:10:22 UTC (rev 130676)
@@ -109,7 +109,7 @@
// Re-fetch the layer owner, since <rdar://problem/9125151> indicates that it might have been destroyed during painting.
layerContents = platformLayer->owner();
ASSERT(layerContents);
- if (platformLayer->layerType() != PlatformCALayer::LayerTypeTileCacheLayer && layerContents && layerContents->platformCALayerShowRepaintCounter()) {
+ if (layerContents && layerContents->platformCALayerShowRepaintCounter(platformLayer)) {
bool isTiledLayer = [layer isKindOfClass:[CATiledLayer class]];
char text[16]; // that's a lot of repaints
@@ -178,7 +178,7 @@
[super setNeedsDisplayInRect:dirtyRect];
- if (layerOwner->platformCALayerShowRepaintCounter()) {
+ if (layerOwner->platformCALayerShowRepaintCounter(platformLayer)) {
CGRect bounds = [self bounds];
CGRect indicatorRect = CGRectMake(bounds.origin.x, bounds.origin.y, 52, 27);
if (layerOwner->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
Modified: trunk/Source/WebCore/platform/graphics/mac/WebTiledLayer.mm (130675 => 130676)
--- trunk/Source/WebCore/platform/graphics/mac/WebTiledLayer.mm 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebCore/platform/graphics/mac/WebTiledLayer.mm 2012-10-08 20:10:22 UTC (rev 130676)
@@ -84,7 +84,7 @@
[super setNeedsDisplayInRect:dirtyRect];
- if (layerOwner->platformCALayerShowRepaintCounter()) {
+ if (layerOwner->platformCALayerShowRepaintCounter(platformLayer)) {
CGRect bounds = [self bounds];
CGRect indicatorRect = CGRectMake(bounds.origin.x, bounds.origin.y, 52, 27);
if (layerOwner->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
Modified: trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp (130675 => 130676)
--- trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp 2012-10-08 20:10:22 UTC (rev 130676)
@@ -101,7 +101,7 @@
virtual GraphicsLayer::CompositingCoordinatesOrientation platformCALayerContentsOrientation() const { return GraphicsLayer::CompositingCoordinatesBottomUp; }
virtual void platformCALayerPaintContents(GraphicsContext&, const IntRect& inClip) { }
virtual bool platformCALayerShowDebugBorders() const { return false; }
- virtual bool platformCALayerShowRepaintCounter() const { return false; }
+ virtual bool platformCALayerShowRepaintCounter(PlatformCALayer*) const { return false; }
virtual int platformCALayerIncrementRepaintCount() { return 0; }
virtual bool platformCALayerContentsOpaque() const { return false; }
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (130675 => 130676)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2012-10-08 20:10:22 UTC (rev 130676)
@@ -133,9 +133,10 @@
void updateAfterWidgetResize();
void positionOverflowControlsLayers(const IntSize& offsetFromRoot);
+ bool usingTileCache() const { return m_usingTiledCacheLayer; }
+
// GraphicsLayerClient interface
virtual bool shouldUseTileCache(const GraphicsLayer*) const;
- virtual bool usingTileCache(const GraphicsLayer*) const { return m_usingTiledCacheLayer; }
virtual void notifyAnimationStarted(const GraphicsLayer*, double startTime);
virtual void notifyFlushRequired(const GraphicsLayer*);
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (130675 => 130676)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-10-08 20:10:22 UTC (rev 130676)
@@ -1935,13 +1935,10 @@
void RenderLayerCompositor::documentBackgroundColorDidChange()
{
RenderLayerBacking* backing = rootRenderLayer()->backing();
- if (!backing)
+ if (!backing || !backing->usingTileCache())
return;
GraphicsLayer* graphicsLayer = backing->graphicsLayer();
- if (!graphicsLayer->client()->usingTileCache(graphicsLayer))
- return;
-
Color backgroundColor = m_renderView->frameView()->documentBackgroundColor();
if (!backgroundColor.isValid() || backgroundColor.hasAlpha())
backgroundColor = Color::white;
Modified: trunk/Source/WebKit/win/ChangeLog (130675 => 130676)
--- trunk/Source/WebKit/win/ChangeLog 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebKit/win/ChangeLog 2012-10-08 20:10:22 UTC (rev 130676)
@@ -1,3 +1,17 @@
+2012-10-08 Simon Fraser <[email protected]>
+
+ Some GraphicsLayer cleanup to separate the concepts of using a tile cache, and being the main tile cache layer
+ https://bugs.webkit.org/show_bug.cgi?id=98574
+
+ Reviewed by Dean Jackson.
+
+ GraphicsLayerCA assumed that using a TileCache equated to being the main page tile
+ cache layer, which has some special considerations. Make these two concepts separate
+ to get closer to being able to use TileCaches in place of CATiledLayer.
+
+ * FullscreenVideoController.cpp:
+ (FullscreenVideoController::LayerClient::platformCALayerShowRepaintCounter):
+
2012-10-07 Caio Marcelo de Oliveira Filho <[email protected]>
Rename first/second to key/value in HashMap iterators
Modified: trunk/Source/WebKit/win/FullscreenVideoController.cpp (130675 => 130676)
--- trunk/Source/WebKit/win/FullscreenVideoController.cpp 2012-10-08 19:46:06 UTC (rev 130675)
+++ trunk/Source/WebKit/win/FullscreenVideoController.cpp 2012-10-08 20:10:22 UTC (rev 130676)
@@ -189,7 +189,7 @@
virtual GraphicsLayer::CompositingCoordinatesOrientation platformCALayerContentsOrientation() const { return GraphicsLayer::CompositingCoordinatesBottomUp; }
virtual void platformCALayerPaintContents(GraphicsContext&, const IntRect& inClip) { }
virtual bool platformCALayerShowDebugBorders() const { return false; }
- virtual bool platformCALayerShowRepaintCounter() const { return false; }
+ virtual bool platformCALayerShowRepaintCounter(PlatformCALayer*) const { return false; }
virtual int platformCALayerIncrementRepaintCount() { return 0; }
virtual bool platformCALayerContentsOpaque() const { return false; }