Modified: trunk/Source/WebCore/ChangeLog (177213 => 177214)
--- trunk/Source/WebCore/ChangeLog 2014-12-12 06:00:59 UTC (rev 177213)
+++ trunk/Source/WebCore/ChangeLog 2014-12-12 09:16:13 UTC (rev 177214)
@@ -1,3 +1,30 @@
+2014-12-12 Simon Fraser <[email protected]>
+
+ Layer borders on contentsLayers don't correctly toggle with the rest of the borders
+ https://bugs.webkit.org/show_bug.cgi?id=139570
+ rdar://problem/18007746
+
+ Reviewed by Tim Horton.
+
+ The "Show Debug Borders" toggle didn't cleanly remove layer borders from
+ content layers (image, video), nor did it deal with cloned layers (reflections).
+
+ Fix by making updateDebugBorder() update the layer borders on the contents
+ layer and cloned layers, moving some code around to avoid having colors
+ in more than one place. If the borders are hidden, send an invalid color
+ to PlatformCALayer::setBorderColor(), which now knows to remove the color
+ property on the layer (to avoid leaving transparent border color properties
+ on CALayers).
+
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::setLayerDebugBorder):
+ (WebCore::contentsLayerDebugBorderColor):
+ (WebCore::cloneLayerDebugBorderColor):
+ (WebCore::GraphicsLayerCA::updateDebugBorder):
+ (WebCore::GraphicsLayerCA::setDebugBorder):
+ * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+ (PlatformCALayerMac::setBorderColor):
+
2014-12-11 Joseph Pecoraro <[email protected]>
Web Inspector: Crash when trying to inspect LocalStorage
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (177213 => 177214)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2014-12-12 06:00:59 UTC (rev 177213)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2014-12-12 09:16:13 UTC (rev 177214)
@@ -1820,12 +1820,53 @@
m_layer->setAcceleratesDrawing(m_acceleratesDrawing);
}
+static void setLayerDebugBorder(PlatformCALayer& layer, Color borderColor, float borderWidth)
+{
+ layer.setBorderColor(borderColor);
+ layer.setBorderWidth(borderColor.isValid() ? borderWidth : 0);
+}
+
+static float contentsLayerBorderWidth = 4;
+static Color contentsLayerDebugBorderColor(bool showingBorders)
+{
+ return showingBorders ? Color(0, 0, 128, 180) : Color();
+}
+
+static float cloneLayerBorderWidth = 2;
+static Color cloneLayerDebugBorderColor(bool showingBorders)
+{
+ return showingBorders ? Color(255, 122, 251) : Color();
+}
+
void GraphicsLayerCA::updateDebugBorder()
{
- if (isShowingDebugBorder())
- updateDebugIndicators();
- else
- m_layer->setBorderWidth(0);
+ Color borderColor;
+ float width = 0;
+
+ bool showDebugBorders = isShowingDebugBorder();
+ if (showDebugBorders)
+ getDebugBorderInfo(borderColor, width);
+
+ setLayerDebugBorder(*m_layer, borderColor, width);
+ if (m_contentsLayer)
+ setLayerDebugBorder(*m_contentsLayer, contentsLayerDebugBorderColor(showDebugBorders), contentsLayerBorderWidth);
+
+ if (m_layerClones) {
+ for (auto& clone : m_layerClones->values())
+ setLayerDebugBorder(*clone, borderColor, width);
+ }
+
+ if (m_structuralLayerClones) {
+ Color cloneLayerBorderColor = cloneLayerDebugBorderColor(showDebugBorders);
+ for (auto& clone : m_structuralLayerClones->values())
+ setLayerDebugBorder(*clone, cloneLayerBorderColor, cloneLayerBorderWidth);
+ }
+
+ if (m_contentsLayerClones) {
+ Color contentsLayerBorderColor = contentsLayerDebugBorderColor(showDebugBorders);
+ for (auto& contentsLayerClone : m_contentsLayerClones->values())
+ setLayerDebugBorder(*contentsLayerClone, contentsLayerBorderColor, contentsLayerBorderWidth);
+ }
}
FloatRect GraphicsLayerCA::adjustTiledLayerVisibleRect(TiledBacking* tiledBacking, const FloatRect& oldVisibleRect, const FloatRect& newVisibleRect, const FloatSize& oldSize, const FloatSize& newSize)
@@ -3009,14 +3050,8 @@
}
void GraphicsLayerCA::setDebugBorder(const Color& color, float borderWidth)
-{
- if (color.isValid()) {
- m_layer->setBorderColor(color);
- m_layer->setBorderWidth(borderWidth);
- } else {
- m_layer->setBorderColor(Color::transparent);
- m_layer->setBorderWidth(0);
- }
+{
+ setLayerDebugBorder(*m_layer, color, borderWidth);
}
void GraphicsLayerCA::setCustomAppearance(CustomAppearance customAppearance)
@@ -3138,10 +3173,7 @@
} else
contentsLayer->setAnchorPoint(FloatPoint3D());
- if (isShowingDebugBorder()) {
- contentsLayer->setBorderColor(Color(0, 0, 128, 180));
- contentsLayer->setBorderWidth(4);
- }
+ setLayerDebugBorder(*contentsLayer, contentsLayerDebugBorderColor(isShowingDebugBorder()), contentsLayerBorderWidth);
}
PassRefPtr<PlatformCALayer> GraphicsLayerCA::findOrMakeClone(CloneID cloneID, PlatformCALayer *sourceLayer, LayerMap* clones, CloneLevel cloneLevel)
@@ -3339,12 +3371,9 @@
newLayer->setOpacity(layer->opacity());
moveOrCopyAnimations(Copy, layer, newLayer.get());
}
-
- if (isShowingDebugBorder()) {
- newLayer->setBorderColor(Color(255, 122, 251));
- newLayer->setBorderWidth(2);
- }
-
+
+ setLayerDebugBorder(*newLayer, cloneLayerDebugBorderColor(isShowingDebugBorder()), cloneLayerBorderWidth);
+
return newLayer;
}
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (177213 => 177214)
--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2014-12-12 06:00:59 UTC (rev 177213)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2014-12-12 09:16:13 UTC (rev 177214)
@@ -694,15 +694,21 @@
void PlatformCALayerMac::setBorderColor(const Color& value)
{
- CGFloat components[4];
- value.getRGBA(components[0], components[1], components[2], components[3]);
+ if (value.isValid()) {
+ CGFloat components[4];
+ value.getRGBA(components[0], components[1], components[2], components[3]);
- RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
- RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
+ RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
+ RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
- BEGIN_BLOCK_OBJC_EXCEPTIONS
- [m_layer.get() setBorderColor:color.get()];
- END_BLOCK_OBJC_EXCEPTIONS
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+ [m_layer.get() setBorderColor:color.get()];
+ END_BLOCK_OBJC_EXCEPTIONS
+ } else {
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+ [m_layer.get() setBorderColor:nil];
+ END_BLOCK_OBJC_EXCEPTIONS
+ }
}
float PlatformCALayerMac::opacity() const
Modified: trunk/Source/WebKit2/ChangeLog (177213 => 177214)
--- trunk/Source/WebKit2/ChangeLog 2014-12-12 06:00:59 UTC (rev 177213)
+++ trunk/Source/WebKit2/ChangeLog 2014-12-12 09:16:13 UTC (rev 177214)
@@ -1,3 +1,17 @@
+2014-12-12 Simon Fraser <[email protected]>
+
+ Layer borders on contentsLayers don't correctly toggle with the rest of the borders
+ https://bugs.webkit.org/show_bug.cgi?id=139570
+ rdar://problem/18007746
+
+ Reviewed by Tim Horton.
+
+ Return nil if the color is invalid, to remove the color from the layer's
+ border or background.
+
+ * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+ (WebKit::cgColorFromColor):
+
2014-12-11 Gavin Barraclough <[email protected]>
Track pages preventing suppression in WebProcessProxy using RefCounter
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm (177213 => 177214)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm 2014-12-12 06:00:59 UTC (rev 177213)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm 2014-12-12 09:16:13 UTC (rev 177214)
@@ -82,6 +82,9 @@
static RetainPtr<CGColorRef> cgColorFromColor(Color color)
{
+ if (!color.isValid())
+ return nil;
+
CGFloat components[4];
color.getRGBA(components[0], components[1], components[2], components[3]);