- Revision
- 158889
- Author
- [email protected]
- Date
- 2013-11-07 17:42:59 -0800 (Thu, 07 Nov 2013)
Log Message
Lots of layers get solid color but transparent contents layers now
https://bugs.webkit.org/show_bug.cgi?id=123537
Source/WebCore:
Reviewed by Tim Horton.
We call rendererBackgroundColor() to determine the layer's background color,
but on most elements this returns the transparent color (a valid color).
This caused us to allocate a contentsLayer, and use the transparent color as its
backgroundColor, which was wasteful.
Fix by only making a background-color layer if the color is not transparent (zero alpha).
Also avoid making a new contents layer on every color change, and make sure that
we don't do implicit animations for backgroundColor, and some other properties
that were omitted by mistake.
Layer tree dumps don't dump content layers, so no way to test easily.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setContentsToSolidColor):
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(nullActionsDictionary):
Source/WebKit2:
Reviewed by Tim Horton.
Add some properties to the list of things not to implicitly animate.
* Shared/mac/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::disableActionsForLayer):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (158888 => 158889)
--- trunk/Source/WebCore/ChangeLog 2013-11-08 01:29:03 UTC (rev 158888)
+++ trunk/Source/WebCore/ChangeLog 2013-11-08 01:42:59 UTC (rev 158889)
@@ -1,3 +1,28 @@
+2013-11-07 Simon Fraser <[email protected]>
+
+ Lots of layers get solid color but transparent contents layers now
+ https://bugs.webkit.org/show_bug.cgi?id=123537
+
+ Reviewed by Tim Horton.
+
+ We call rendererBackgroundColor() to determine the layer's background color,
+ but on most elements this returns the transparent color (a valid color).
+ This caused us to allocate a contentsLayer, and use the transparent color as its
+ backgroundColor, which was wasteful.
+
+ Fix by only making a background-color layer if the color is not transparent (zero alpha).
+
+ Also avoid making a new contents layer on every color change, and make sure that
+ we don't do implicit animations for backgroundColor, and some other properties
+ that were omitted by mistake.
+
+ Layer tree dumps don't dump content layers, so no way to test easily.
+
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::setContentsToSolidColor):
+ * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+ (nullActionsDictionary):
+
2013-11-07 Ryosuke Niwa <[email protected]>
DOMTokenList::add can add duplicated values if arguments had duplicated values
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (158888 => 158889)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2013-11-08 01:29:03 UTC (rev 158888)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2013-11-08 01:42:59 UTC (rev 158889)
@@ -818,19 +818,27 @@
return;
m_contentsSolidColor = color;
+
+ bool contentsLayerChanged = false;
- if (m_contentsSolidColor.isValid()) {
- m_contentsLayerPurpose = ContentsLayerForBackgroundColor;
- m_contentsLayer = createPlatformCALayer(PlatformCALayer::LayerTypeLayer, this);
+ if (m_contentsSolidColor.isValid() && m_contentsSolidColor.alpha()) {
+ if (!m_contentsLayer || m_contentsLayerPurpose != ContentsLayerForBackgroundColor) {
+ m_contentsLayerPurpose = ContentsLayerForBackgroundColor;
+ m_contentsLayer = createPlatformCALayer(PlatformCALayer::LayerTypeLayer, this);
#ifndef NDEBUG
- m_contentsLayer->setName("Background Color Layer");
+ m_contentsLayer->setName("Background Color Layer");
#endif
+ contentsLayerChanged = true;
+ }
} else {
+ contentsLayerChanged = m_contentsLayer;
m_contentsLayerPurpose = NoContentsLayer;
m_contentsLayer = 0;
}
- noteSublayersChanged();
+ if (contentsLayerChanged)
+ noteSublayersChanged();
+
noteLayerPropertyChanged(ContentsColorLayerChanged);
}
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (158888 => 158889)
--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2013-11-08 01:29:03 UTC (rev 158888)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2013-11-08 01:42:59 UTC (rev 158889)
@@ -147,9 +147,14 @@
NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys:
nullValue, @"anchorPoint",
nullValue, @"anchorPointZ",
+ nullValue, @"backgroundColor",
+ nullValue, @"borderColor",
+ nullValue, @"borderWidth",
nullValue, @"bounds",
nullValue, @"contents",
nullValue, @"contentsRect",
+ nullValue, @"contentsScale",
+ nullValue, @"cornerRadius",
nullValue, @"opacity",
nullValue, @"position",
nullValue, @"shadowColor",
Modified: trunk/Source/WebKit2/ChangeLog (158888 => 158889)
--- trunk/Source/WebKit2/ChangeLog 2013-11-08 01:29:03 UTC (rev 158888)
+++ trunk/Source/WebKit2/ChangeLog 2013-11-08 01:42:59 UTC (rev 158889)
@@ -1,3 +1,15 @@
+2013-11-07 Simon Fraser <[email protected]>
+
+ Lots of layers get solid color but transparent contents layers now
+ https://bugs.webkit.org/show_bug.cgi?id=123537
+
+ Reviewed by Tim Horton.
+
+ Add some properties to the list of things not to implicitly animate.
+
+ * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+ (WebKit::RemoteLayerTreePropertyApplier::disableActionsForLayer):
+
2013-11-07 Anders Carlsson <[email protected]>
Remove more dead code
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm (158888 => 158889)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm 2013-11-08 01:29:03 UTC (rev 158888)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm 2013-11-08 01:42:59 UTC (rev 158889)
@@ -161,9 +161,14 @@
@"actions" : @{
@"anchorPoint" : nullValue,
@"anchorPointZ" : nullValue,
+ @"backgroundColor" : nullValue,
+ @"borderColor" : nullValue,
+ @"borderWidth" : nullValue,
@"bounds" : nullValue,
@"contents" : nullValue,
@"contentsRect" : nullValue,
+ @"contentsScale" : nullValue,
+ @"cornerRadius" : nullValue,
@"opacity" : nullValue,
@"position" : nullValue,
@"shadowColor" : nullValue,