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

Side by Side 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: 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 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 if (layoutObject->isLayoutPart()) { 549 if (layoutObject->isLayoutPart()) {
550 if (PaintLayerCompositor::attachFrameContentLayersToIframeLayer(toLayout Part(layoutObject))) 550 if (PaintLayerCompositor::attachFrameContentLayersToIframeLayer(toLayout Part(layoutObject)))
551 layerConfigChanged = true; 551 layerConfigChanged = true;
552 } 552 }
553 553
554 // Changes to either the internal hierarchy or the mask layer have an impact 554 // Changes to either the internal hierarchy or the mask layer have an impact
555 // on painting phases, so we need to update when either are updated. 555 // on painting phases, so we need to update when either are updated.
556 if (layerConfigChanged || maskLayerChanged) 556 if (layerConfigChanged || maskLayerChanged)
557 updatePaintingPhases(); 557 updatePaintingPhases();
558 558
559 updateElementIdAndCompositorMutableProperties(); 559 updateCompositorElementId();
560 updateCompositorMutableProperties();
560 561
561 return layerConfigChanged; 562 return layerConfigChanged;
562 } 563 }
563 564
564 static IntRect clipBox(LayoutBox* layoutObject) 565 static IntRect clipBox(LayoutBox* layoutObject)
565 { 566 {
566 LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect()); 567 LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect());
567 if (layoutObject->hasOverflowClip() || layoutObject->style()->containsPaint( )) 568 if (layoutObject->hasOverflowClip() || layoutObject->style()->containsPaint( ))
568 result = layoutObject->overflowClipRect(LayoutPoint()); 569 result = layoutObject->overflowClipRect(LayoutPoint());
569 570
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 updateChildClippingMaskLayerGeometry(); 736 updateChildClippingMaskLayerGeometry();
736 737
737 if (m_owningLayer.getScrollableArea() && m_owningLayer.getScrollableArea()-> scrollsOverflow()) 738 if (m_owningLayer.getScrollableArea() && m_owningLayer.getScrollableArea()-> scrollsOverflow())
738 m_owningLayer.getScrollableArea()->positionOverflowControls(); 739 m_owningLayer.getScrollableArea()->positionOverflowControls();
739 740
740 updateLayerBlendMode(layoutObject()->styleRef()); 741 updateLayerBlendMode(layoutObject()->styleRef());
741 updateIsRootForIsolatedGroup(); 742 updateIsRootForIsolatedGroup();
742 updateContentsRect(); 743 updateContentsRect();
743 updateBackgroundColor(); 744 updateBackgroundColor();
744 updateDrawsContent(); 745 updateDrawsContent();
745 updateElementIdAndCompositorMutableProperties(); 746 updateCompositorElementId();
747 updateCompositorMutableProperties();
746 updateContentsOpaque(); 748 updateContentsOpaque();
747 updateAfterPartResize(); 749 updateAfterPartResize();
748 updateRenderingContext(); 750 updateRenderingContext();
749 updateShouldFlattenTransform(); 751 updateShouldFlattenTransform();
750 updateChildrenTransform(); 752 updateChildrenTransform();
751 updateScrollParent(scrollParent()); 753 updateScrollParent(scrollParent());
752 registerScrollingLayers(); 754 registerScrollingLayers();
753 755
754 updateCompositingReasons(); 756 updateCompositingReasons();
755 } 757 }
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 // Regardless, mark the graphics layer, scrolling layer and scrolling block 1491 // Regardless, mark the graphics layer, scrolling layer and scrolling block
1490 // selection layer (if they exist) as not flattening. Having them flatten 1492 // selection layer (if they exist) as not flattening. Having them flatten
1491 // causes unclipped render surfaces which cause bugs. 1493 // causes unclipped render surfaces which cause bugs.
1492 // http://crbug.com/521768 1494 // http://crbug.com/521768
1493 if (hasScrollingLayer()) { 1495 if (hasScrollingLayer()) {
1494 m_graphicsLayer->setShouldFlattenTransform(false); 1496 m_graphicsLayer->setShouldFlattenTransform(false);
1495 m_scrollingLayer->setShouldFlattenTransform(false); 1497 m_scrollingLayer->setShouldFlattenTransform(false);
1496 } 1498 }
1497 } 1499 }
1498 1500
1499 void CompositedLayerMapping::updateElementIdAndCompositorMutableProperties() 1501 void CompositedLayerMapping::updateCompositorElementId()
1502 {
1503 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) {
1504 if (owningNode->isElementNode()) {
1505 Element* owningElement = toElement(owningNode);
1506 CompositorElementId elementId = owningElement->compositorElementId() ;
1507 m_graphicsLayer->setElementId(elementId);
1508 if (m_scrollingContentsLayer.get())
1509 m_scrollingContentsLayer->setElementId(elementId);
1510 }
1511 }
1512 }
1513
1514 void CompositedLayerMapping::updateCompositorMutableProperties()
1500 { 1515 {
1501 if (!RuntimeEnabledFeatures::compositorWorkerEnabled()) 1516 if (!RuntimeEnabledFeatures::compositorWorkerEnabled())
1502 return; 1517 return;
1503 1518
1504 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositedLaye rMapping::updateElementId()"); 1519 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositedLaye rMapping::updateElementId()");
1505 1520
1506 CompositorElementId elementId = 0;
1507 uint32_t mainMutableProperties = CompositorMutableProperty::kNone; 1521 uint32_t mainMutableProperties = CompositorMutableProperty::kNone;
1508 uint32_t scrollMutableProperties = CompositorMutableProperty::kNone; 1522 uint32_t scrollMutableProperties = CompositorMutableProperty::kNone;
1509 1523
1510 if (m_owningLayer.layoutObject()->style()->hasCompositorProxy()) { 1524 if (m_owningLayer.layoutObject()->style()->hasCompositorProxy()) {
1511 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) { 1525 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) {
1512 if (owningNode->isElementNode()) { 1526 if (owningNode->isElementNode()) {
1513 Element* owningElement = toElement(owningNode); 1527 Element* owningElement = toElement(owningNode);
1514 uint32_t compositorMutableProperties = owningElement->compositor MutableProperties(); 1528 uint32_t compositorMutableProperties = owningElement->compositor MutableProperties();
1515 elementId = owningElement->compositorElementId();
1516 CompositorIdToElementMap::registerElement(*owningElement); 1529 CompositorIdToElementMap::registerElement(*owningElement);
1517 mainMutableProperties = (CompositorMutableProperty::kOpacity | C ompositorMutableProperty::kTransform) & compositorMutableProperties; 1530 mainMutableProperties = (CompositorMutableProperty::kOpacity | C ompositorMutableProperty::kTransform) & compositorMutableProperties;
1518 scrollMutableProperties = (CompositorMutableProperty::kScrollLef t | CompositorMutableProperty::kScrollTop) & compositorMutableProperties; 1531 scrollMutableProperties = (CompositorMutableProperty::kScrollLef t | CompositorMutableProperty::kScrollTop) & compositorMutableProperties;
1519 } 1532 }
1520 } 1533 }
1521 } 1534 }
1522 1535
1523 m_graphicsLayer->setElementId(elementId);
1524 m_graphicsLayer->setCompositorMutableProperties(mainMutableProperties); 1536 m_graphicsLayer->setCompositorMutableProperties(mainMutableProperties);
1525 1537 if (m_scrollingContentsLayer.get())
1526 if (m_scrollingContentsLayer.get()) {
1527 m_scrollingContentsLayer->setElementId(elementId);
1528 m_scrollingContentsLayer->setCompositorMutableProperties(scrollMutablePr operties); 1538 m_scrollingContentsLayer->setCompositorMutableProperties(scrollMutablePr operties);
1529 }
1530 } 1539 }
1531 1540
1532 bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer) 1541 bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer)
1533 { 1542 {
1534 bool layerChanged = false; 1543 bool layerChanged = false;
1535 if (needsForegroundLayer) { 1544 if (needsForegroundLayer) {
1536 if (!m_foregroundLayer) { 1545 if (!m_foregroundLayer) {
1537 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor eground); 1546 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor eground);
1538 layerChanged = true; 1547 layerChanged = true;
1539 } 1548 }
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2591 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2583 name = "Scrolling Contents Layer"; 2592 name = "Scrolling Contents Layer";
2584 } else { 2593 } else {
2585 ASSERT_NOT_REACHED(); 2594 ASSERT_NOT_REACHED();
2586 } 2595 }
2587 2596
2588 return name; 2597 return name;
2589 } 2598 }
2590 2599
2591 } // namespace blink 2600 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698