| 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 ad9321248946c465250f03c8be370239bc69fc71..f6ba036b0fba588ba276e462646a35220160c694 100644
|
| --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
|
| @@ -1521,52 +1521,36 @@
|
| }
|
| }
|
|
|
| -// Some background on when you receive an element id or mutable properties.
|
| -//
|
| -// element id:
|
| -// If you have a compositor proxy, an animation, or you're a scroller (and
|
| -// might impl animate).
|
| -//
|
| -// mutable properties:
|
| -// Only if you have a compositor proxy.
|
| -//
|
| -// The element id for the scroll layers is assigned when they're constructed,
|
| -// since this is unconditional. However, the element id for the primary layer as
|
| -// well as the mutable properties for all layers may change according to the
|
| -// rules above so we update those values here.
|
| void CompositedLayerMapping::updateElementIdAndCompositorMutableProperties()
|
| {
|
| - int elementId = 0;
|
| - uint32_t primaryMutableProperties = CompositorMutableProperty::kNone;
|
| + 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 scrollMutableProperties = CompositorMutableProperty::kNone;
|
|
|
| - 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;
|
| - }
|
| -
|
| - if (m_owningLayer.layoutObject()->style()->shouldCompositeForCurrentAnimations() && owningNode)
|
| - elementId = DOMNodeIds::idForNode(owningNode);
|
| -
|
| - CompositorElementId compositorElementId;
|
| - if (elementId)
|
| - compositorElementId = createCompositorElementId(elementId, CompositorSubElementId::Primary);
|
| -
|
| - m_graphicsLayer->setElementId(compositorElementId);
|
| - m_graphicsLayer->setCompositorMutableProperties(primaryMutableProperties);
|
| -
|
| - // We always set the elementId for m_scrollingContentsLayer since it can be
|
| - // animated for smooth scrolling, so we don't need to set it conditionally
|
| - // here.
|
| - if (m_scrollingContentsLayer.get())
|
| + 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;
|
| + }
|
| + }
|
| + }
|
| +
|
| + m_graphicsLayer->setElementId(elementId);
|
| + m_graphicsLayer->setCompositorMutableProperties(mainMutableProperties);
|
| +
|
| + if (m_scrollingContentsLayer.get()) {
|
| + m_scrollingContentsLayer->setElementId(elementId);
|
| m_scrollingContentsLayer->setCompositorMutableProperties(scrollMutableProperties);
|
| + }
|
| }
|
|
|
| bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer)
|
| @@ -1653,12 +1637,6 @@
|
|
|
| // 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;
|
|
|