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

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

Issue 2150413002: Use node() when generating element id's (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 updateSquashingLayers(false); 222 updateSquashingLayers(false);
223 destroyGraphicsLayers(); 223 destroyGraphicsLayers();
224 } 224 }
225 225
226 std::unique_ptr<GraphicsLayer> CompositedLayerMapping::createGraphicsLayer(Compo sitingReasons reasons, SquashingDisallowedReasons squashingDisallowedReasons) 226 std::unique_ptr<GraphicsLayer> CompositedLayerMapping::createGraphicsLayer(Compo sitingReasons reasons, SquashingDisallowedReasons squashingDisallowedReasons)
227 { 227 {
228 std::unique_ptr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(this); 228 std::unique_ptr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(this);
229 229
230 graphicsLayer->setCompositingReasons(reasons); 230 graphicsLayer->setCompositingReasons(reasons);
231 graphicsLayer->setSquashingDisallowedReasons(squashingDisallowedReasons); 231 graphicsLayer->setSquashingDisallowedReasons(squashingDisallowedReasons);
232 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) 232 if (Node* owningNode = m_owningLayer.layoutObject()->node())
233 graphicsLayer->setOwnerNodeId(DOMNodeIds::idForNode(owningNode)); 233 graphicsLayer->setOwnerNodeId(DOMNodeIds::idForNode(owningNode));
234 234
235 return graphicsLayer; 235 return graphicsLayer;
236 } 236 }
237 237
238 void CompositedLayerMapping::createPrimaryGraphicsLayer() 238 void CompositedLayerMapping::createPrimaryGraphicsLayer()
239 { 239 {
240 m_graphicsLayer = createGraphicsLayer(m_owningLayer.getCompositingReasons(), m_owningLayer.getSquashingDisallowedReasons()); 240 m_graphicsLayer = createGraphicsLayer(m_owningLayer.getCompositingReasons(), m_owningLayer.getSquashingDisallowedReasons());
241 241
242 updateOpacity(layoutObject()->styleRef()); 242 updateOpacity(layoutObject()->styleRef());
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 // The element id for the scroll layers is assigned when they're constructed, 1540 // The element id for the scroll layers is assigned when they're constructed,
1541 // since this is unconditional. However, the element id for the primary layer as 1541 // since this is unconditional. However, the element id for the primary layer as
1542 // well as the mutable properties for all layers may change according to the 1542 // well as the mutable properties for all layers may change according to the
1543 // rules above so we update those values here. 1543 // rules above so we update those values here.
1544 void CompositedLayerMapping::updateElementIdAndCompositorMutableProperties() 1544 void CompositedLayerMapping::updateElementIdAndCompositorMutableProperties()
1545 { 1545 {
1546 int elementId = 0; 1546 int elementId = 0;
1547 uint32_t primaryMutableProperties = CompositorMutableProperty::kNone; 1547 uint32_t primaryMutableProperties = CompositorMutableProperty::kNone;
1548 uint32_t scrollMutableProperties = CompositorMutableProperty::kNone; 1548 uint32_t scrollMutableProperties = CompositorMutableProperty::kNone;
1549 1549
1550 Node* owningNode = m_owningLayer.layoutObject()->generatingNode(); 1550 Node* owningNode = m_owningLayer.layoutObject()->node();
1551 Element* owningElement = nullptr; 1551 Element* owningElement = nullptr;
1552 if (owningNode && owningNode->isElementNode()) 1552 if (owningNode && owningNode->isElementNode())
1553 owningElement = toElement(owningNode); 1553 owningElement = toElement(owningNode);
1554 1554
1555 if (RuntimeEnabledFeatures::compositorWorkerEnabled() && owningElement && m_ owningLayer.layoutObject()->style()->hasCompositorProxy()) { 1555 if (RuntimeEnabledFeatures::compositorWorkerEnabled() && owningElement && m_ owningLayer.layoutObject()->style()->hasCompositorProxy()) {
1556 uint32_t compositorMutableProperties = owningElement->compositorMutableP roperties(); 1556 uint32_t compositorMutableProperties = owningElement->compositorMutableP roperties();
1557 elementId = DOMNodeIds::idForNode(owningNode); 1557 elementId = DOMNodeIds::idForNode(owningNode);
1558 primaryMutableProperties = (CompositorMutableProperty::kOpacity | Compos itorMutableProperty::kTransform) & compositorMutableProperties; 1558 primaryMutableProperties = (CompositorMutableProperty::kOpacity | Compos itorMutableProperty::kTransform) & compositorMutableProperties;
1559 scrollMutableProperties = (CompositorMutableProperty::kScrollLeft | Comp ositorMutableProperty::kScrollTop) & compositorMutableProperties; 1559 scrollMutableProperties = (CompositorMutableProperty::kScrollLeft | Comp ositorMutableProperty::kScrollTop) & compositorMutableProperties;
1560 } 1560 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 if (needsScrollingLayers) { 1654 if (needsScrollingLayers) {
1655 if (!m_scrollingLayer) { 1655 if (!m_scrollingLayer) {
1656 // Outer layer which corresponds with the scroll view. 1656 // Outer layer which corresponds with the scroll view.
1657 m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForScro llingContainer); 1657 m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForScro llingContainer);
1658 m_scrollingLayer->setDrawsContent(false); 1658 m_scrollingLayer->setDrawsContent(false);
1659 m_scrollingLayer->setMasksToBounds(true); 1659 m_scrollingLayer->setMasksToBounds(true);
1660 1660
1661 // Inner layer which renders the content that scrolls. 1661 // Inner layer which renders the content that scrolls.
1662 m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLaye rForScrollingContents); 1662 m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLaye rForScrollingContents);
1663 1663
1664 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode( )) { 1664 if (Node* owningNode = m_owningLayer.layoutObject()->node()) {
1665 m_scrollingContentsLayer->setElementId(createCompositorElementId (DOMNodeIds::idForNode(owningNode), CompositorSubElementId::Scroll)); 1665 m_scrollingContentsLayer->setElementId(createCompositorElementId (DOMNodeIds::idForNode(owningNode), CompositorSubElementId::Scroll));
1666 m_scrollingContentsLayer->setCompositorMutableProperties(Composi torMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop); 1666 m_scrollingContentsLayer->setCompositorMutableProperties(Composi torMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop);
1667 } 1667 }
1668 1668
1669 m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); 1669 m_scrollingLayer->addChild(m_scrollingContentsLayer.get());
1670 1670
1671 layerChanged = true; 1671 layerChanged = true;
1672 if (scrollingCoordinator) { 1672 if (scrollingCoordinator) {
1673 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin gLayer.getScrollableArea()); 1673 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin gLayer.getScrollableArea());
1674 scrollingCoordinator->scrollableAreasDidChange(); 1674 scrollingCoordinator->scrollableAreasDidChange();
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
2669 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2669 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2670 name = "Scrolling Contents Layer"; 2670 name = "Scrolling Contents Layer";
2671 } else { 2671 } else {
2672 ASSERT_NOT_REACHED(); 2672 ASSERT_NOT_REACHED();
2673 } 2673 }
2674 2674
2675 return name; 2675 return name;
2676 } 2676 }
2677 2677
2678 } // namespace blink 2678 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698