Chromium Code Reviews| 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 d36b46bdf321ddeb49160399dbc4ad3b18f0d130..2c51ebe4ec9910ec0da8ceebdd8f589eb3da71f8 100644 |
| --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
| +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
| @@ -1522,34 +1522,32 @@ void CompositedLayerMapping::updateShouldFlattenTransform() |
| void CompositedLayerMapping::updateElementIdAndCompositorMutableProperties() |
| { |
| - if (!RuntimeEnabledFeatures::compositorWorkerEnabled()) |
| - return; |
| - |
| - TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositedLayerMapping::updateElementId()"); |
| - |
| uint64_t elementId = 0; |
| - uint32_t mainMutableProperties = CompositorMutableProperty::kNone; |
| + uint32_t primaryMutableProperties = CompositorMutableProperty::kNone; |
| uint32_t scrollMutableProperties = CompositorMutableProperty::kNone; |
| - if (m_owningLayer.layoutObject()->style()->hasCompositorProxy()) { |
| - if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) { |
| - if (owningNode->isElementNode()) { |
| - Element* owningElement = toElement(owningNode); |
| - uint32_t compositorMutableProperties = owningElement->compositorMutableProperties(); |
| - elementId = DOMNodeIds::idForNode(owningNode); |
| - mainMutableProperties = (CompositorMutableProperty::kOpacity | CompositorMutableProperty::kTransform) & compositorMutableProperties; |
| - scrollMutableProperties = (CompositorMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop) & compositorMutableProperties; |
| - } |
| - } |
| + Node* owningNode = m_owningLayer.layoutObject()->generatingNode(); |
| + Element* owningElement = nullptr; |
| + if (owningNode && owningNode->isElementNode()) |
| + owningElement = toElement(owningNode); |
| + |
| + if (RuntimeEnabledFeatures::compositorWorkerEnabled() && owningElement && m_owningLayer.layoutObject()->style()->hasCompositorProxy()) { |
| + uint32_t compositorMutableProperties = owningElement->compositorMutableProperties(); |
| + elementId = DOMNodeIds::idForNode(owningNode); |
| + primaryMutableProperties = (CompositorMutableProperty::kOpacity | CompositorMutableProperty::kTransform) & compositorMutableProperties; |
| + scrollMutableProperties = (CompositorMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop) & compositorMutableProperties; |
| } |
| - m_graphicsLayer->setElementId(elementId); |
| - m_graphicsLayer->setCompositorMutableProperties(mainMutableProperties); |
| + if (m_owningLayer.layoutObject()->style()->shouldCompositeForCurrentAnimations() && owningNode) |
| + elementId = DOMNodeIds::idForNode(owningNode); |
| - if (m_scrollingContentsLayer.get()) { |
| - m_scrollingContentsLayer->setElementId(elementId); |
| + m_graphicsLayer->setElementId(CompositorElementId(elementId)); |
|
ajuma
2016/06/02 19:37:26
Just for the sake of consistency, how about adding
Ian Vollick
2016/06/02 19:56:30
sg. Done.
|
| + m_graphicsLayer->setCompositorMutableProperties(primaryMutableProperties); |
| + |
| + // We always set the elementId for m_scrollingContentsLayer since it can be |
| + // animated for smooth scrolling. |
| + if (m_scrollingContentsLayer.get()) |
| m_scrollingContentsLayer->setCompositorMutableProperties(scrollMutableProperties); |
| - } |
| } |
| bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer) |
| @@ -1636,6 +1634,12 @@ bool CompositedLayerMapping::updateScrollingLayers(bool needsScrollingLayers) |
| // Inner layer which renders the content that scrolls. |
| m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLayerForScrollingContents); |
| + |
| + if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) { |
| + m_scrollingContentsLayer->setElementId(createCompositorElementId(DOMNodeIds::idForNode(owningNode), CompositorSubElementId::Value::Scroll)); |
| + m_scrollingContentsLayer->setCompositorMutableProperties(CompositorMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop); |
| + } |
| + |
| m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); |
| layerChanged = true; |