Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1024)

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 1944623002: CC Animation: Use ElementId to attach CC animation players. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@erasedomids
Patch Set: Let CC clients generate their own ElementIds locally. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index 9daccaf0230176950c136827b4cd06c43b25b49a..6d3121bd6a75db04bc750c64f870f330007f6bba 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -555,7 +555,8 @@ bool CompositedLayerMapping::updateGraphicsLayerConfiguration()
if (layerConfigChanged || maskLayerChanged)
updatePaintingPhases();
- updateElementIdAndCompositorMutableProperties();
+ updateCompositorElementId();
+ updateCompositorMutableProperties();
return layerConfigChanged;
}
@@ -741,7 +742,8 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry(const PaintLayer* compo
updateContentsRect();
updateBackgroundColor();
updateDrawsContent();
- updateElementIdAndCompositorMutableProperties();
+ updateCompositorElementId();
+ updateCompositorMutableProperties();
updateContentsOpaque();
updateAfterPartResize();
updateRenderingContext();
@@ -1488,14 +1490,32 @@ void CompositedLayerMapping::updateShouldFlattenTransform()
}
}
-void CompositedLayerMapping::updateElementIdAndCompositorMutableProperties()
+void CompositedLayerMapping::updateCompositorElementId()
+{
+ if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) {
esprehn 2016/05/10 22:55:13 we can just keep a data member on CompositedLayerM
loyso (OOO) 2016/05/12 06:02:15 Do you mean Node* CompositedLayerMapping::m_owning
+ if (owningNode->isElementNode()) {
+ Element* owningElement = toElement(owningNode);
+ if (owningElement->layoutObject() == m_owningLayer.layoutObject()) {
+ CompositorElementId elementId = owningElement->compositorElementId();
+ if (m_scrollingContentsLayer.get()) {
+ // Any scrolling layer may attract compositor-initiated
+ // animation, so assign an id in advance.
+ elementId = owningElement->assignCompositorElementId();
+ m_scrollingContentsLayer->setElementId(elementId);
+ }
+ m_graphicsLayer->setElementId(elementId);
+ }
+ }
+ }
+}
+
+void CompositedLayerMapping::updateCompositorMutableProperties()
{
if (!RuntimeEnabledFeatures::compositorWorkerEnabled())
return;
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositedLayerMapping::updateElementId()");
- CompositorElementId elementId = 0;
uint32_t mainMutableProperties = CompositorMutableProperty::kNone;
uint32_t scrollMutableProperties = CompositorMutableProperty::kNone;
@@ -1503,22 +1523,23 @@ void CompositedLayerMapping::updateElementIdAndCompositorMutableProperties()
if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) {
if (owningNode->isElementNode()) {
Element* owningElement = toElement(owningNode);
- uint32_t compositorMutableProperties = owningElement->compositorMutableProperties();
- elementId = owningElement->assignCompositorElementId();
+
+ const CompositorElementId elementId = owningElement->assignCompositorElementId();
CompositorIdToElementMap::registerElement(*owningElement);
+ m_graphicsLayer->setElementId(elementId);
+ if (m_scrollingContentsLayer.get())
+ m_scrollingContentsLayer->setElementId(elementId);
+
+ uint32_t compositorMutableProperties = owningElement->compositorMutableProperties();
mainMutableProperties = (CompositorMutableProperty::kOpacity | CompositorMutableProperty::kTransform) & compositorMutableProperties;
scrollMutableProperties = (CompositorMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop) & compositorMutableProperties;
}
}
}
- m_graphicsLayer->setElementId(elementId);
m_graphicsLayer->setCompositorMutableProperties(mainMutableProperties);
-
- if (m_scrollingContentsLayer.get()) {
- m_scrollingContentsLayer->setElementId(elementId);
+ if (m_scrollingContentsLayer.get())
m_scrollingContentsLayer->setCompositorMutableProperties(scrollMutableProperties);
- }
}
bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer)

Powered by Google App Engine
This is Rietveld 408576698