| 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 6c4f7906a3218b9eecc58d52fd157663539a0c4b..11edfd3360616fe64dbb37fd37291b8e5506da92 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(createCompositorElementId(elementId, CompositorSubElementId::Primary));
|
| + 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::Scroll));
|
| + m_scrollingContentsLayer->setCompositorMutableProperties(CompositorMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop);
|
| + }
|
| +
|
| m_scrollingLayer->addChild(m_scrollingContentsLayer.get());
|
|
|
| layerChanged = true;
|
|
|