OLD | NEW |
---|---|
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
548 if (layoutObject->isLayoutPart()) { | 548 if (layoutObject->isLayoutPart()) { |
549 if (PaintLayerCompositor::attachFrameContentLayersToIframeLayer(toLayout Part(layoutObject))) | 549 if (PaintLayerCompositor::attachFrameContentLayersToIframeLayer(toLayout Part(layoutObject))) |
550 layerConfigChanged = true; | 550 layerConfigChanged = true; |
551 } | 551 } |
552 | 552 |
553 // Changes to either the internal hierarchy or the mask layer have an impact | 553 // Changes to either the internal hierarchy or the mask layer have an impact |
554 // on painting phases, so we need to update when either are updated. | 554 // on painting phases, so we need to update when either are updated. |
555 if (layerConfigChanged || maskLayerChanged) | 555 if (layerConfigChanged || maskLayerChanged) |
556 updatePaintingPhases(); | 556 updatePaintingPhases(); |
557 | 557 |
558 updateElementIdAndCompositorMutableProperties(); | 558 updateCompositorElementId(); |
559 updateCompositorMutableProperties(); | |
559 | 560 |
560 return layerConfigChanged; | 561 return layerConfigChanged; |
561 } | 562 } |
562 | 563 |
563 static IntRect clipBox(LayoutBox* layoutObject) | 564 static IntRect clipBox(LayoutBox* layoutObject) |
564 { | 565 { |
565 LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect()); | 566 LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect()); |
566 if (layoutObject->hasOverflowClip() || layoutObject->style()->containsPaint( )) | 567 if (layoutObject->hasOverflowClip() || layoutObject->style()->containsPaint( )) |
567 result = layoutObject->overflowClipRect(LayoutPoint()); | 568 result = layoutObject->overflowClipRect(LayoutPoint()); |
568 | 569 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
734 updateChildClippingMaskLayerGeometry(); | 735 updateChildClippingMaskLayerGeometry(); |
735 | 736 |
736 if (m_owningLayer.getScrollableArea() && m_owningLayer.getScrollableArea()-> scrollsOverflow()) | 737 if (m_owningLayer.getScrollableArea() && m_owningLayer.getScrollableArea()-> scrollsOverflow()) |
737 m_owningLayer.getScrollableArea()->positionOverflowControls(); | 738 m_owningLayer.getScrollableArea()->positionOverflowControls(); |
738 | 739 |
739 updateLayerBlendMode(layoutObject()->styleRef()); | 740 updateLayerBlendMode(layoutObject()->styleRef()); |
740 updateIsRootForIsolatedGroup(); | 741 updateIsRootForIsolatedGroup(); |
741 updateContentsRect(); | 742 updateContentsRect(); |
742 updateBackgroundColor(); | 743 updateBackgroundColor(); |
743 updateDrawsContent(); | 744 updateDrawsContent(); |
744 updateElementIdAndCompositorMutableProperties(); | 745 updateCompositorElementId(); |
746 updateCompositorMutableProperties(); | |
745 updateContentsOpaque(); | 747 updateContentsOpaque(); |
746 updateAfterPartResize(); | 748 updateAfterPartResize(); |
747 updateRenderingContext(); | 749 updateRenderingContext(); |
748 updateShouldFlattenTransform(); | 750 updateShouldFlattenTransform(); |
749 updateChildrenTransform(); | 751 updateChildrenTransform(); |
750 updateScrollParent(scrollParent()); | 752 updateScrollParent(scrollParent()); |
751 registerScrollingLayers(); | 753 registerScrollingLayers(); |
752 | 754 |
753 updateCompositingReasons(); | 755 updateCompositingReasons(); |
754 } | 756 } |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1481 // Regardless, mark the graphics layer, scrolling layer and scrolling block | 1483 // Regardless, mark the graphics layer, scrolling layer and scrolling block |
1482 // selection layer (if they exist) as not flattening. Having them flatten | 1484 // selection layer (if they exist) as not flattening. Having them flatten |
1483 // causes unclipped render surfaces which cause bugs. | 1485 // causes unclipped render surfaces which cause bugs. |
1484 // http://crbug.com/521768 | 1486 // http://crbug.com/521768 |
1485 if (hasScrollingLayer()) { | 1487 if (hasScrollingLayer()) { |
1486 m_graphicsLayer->setShouldFlattenTransform(false); | 1488 m_graphicsLayer->setShouldFlattenTransform(false); |
1487 m_scrollingLayer->setShouldFlattenTransform(false); | 1489 m_scrollingLayer->setShouldFlattenTransform(false); |
1488 } | 1490 } |
1489 } | 1491 } |
1490 | 1492 |
1491 void CompositedLayerMapping::updateElementIdAndCompositorMutableProperties() | 1493 void CompositedLayerMapping::updateCompositorElementId() |
1494 { | |
1495 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) { | |
esprehn
2016/05/10 22:55:13
we can just keep a data member on CompositedLayerM
loyso (OOO)
2016/05/12 06:02:15
Do you mean
Node* CompositedLayerMapping::m_owning
| |
1496 if (owningNode->isElementNode()) { | |
1497 Element* owningElement = toElement(owningNode); | |
1498 if (owningElement->layoutObject() == m_owningLayer.layoutObject()) { | |
1499 CompositorElementId elementId = owningElement->compositorElement Id(); | |
1500 if (m_scrollingContentsLayer.get()) { | |
1501 // Any scrolling layer may attract compositor-initiated | |
1502 // animation, so assign an id in advance. | |
1503 elementId = owningElement->assignCompositorElementId(); | |
1504 m_scrollingContentsLayer->setElementId(elementId); | |
1505 } | |
1506 m_graphicsLayer->setElementId(elementId); | |
1507 } | |
1508 } | |
1509 } | |
1510 } | |
1511 | |
1512 void CompositedLayerMapping::updateCompositorMutableProperties() | |
1492 { | 1513 { |
1493 if (!RuntimeEnabledFeatures::compositorWorkerEnabled()) | 1514 if (!RuntimeEnabledFeatures::compositorWorkerEnabled()) |
1494 return; | 1515 return; |
1495 | 1516 |
1496 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositedLaye rMapping::updateElementId()"); | 1517 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositedLaye rMapping::updateElementId()"); |
1497 | 1518 |
1498 CompositorElementId elementId = 0; | |
1499 uint32_t mainMutableProperties = CompositorMutableProperty::kNone; | 1519 uint32_t mainMutableProperties = CompositorMutableProperty::kNone; |
1500 uint32_t scrollMutableProperties = CompositorMutableProperty::kNone; | 1520 uint32_t scrollMutableProperties = CompositorMutableProperty::kNone; |
1501 | 1521 |
1502 if (m_owningLayer.layoutObject()->style()->hasCompositorProxy()) { | 1522 if (m_owningLayer.layoutObject()->style()->hasCompositorProxy()) { |
1503 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) { | 1523 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) { |
1504 if (owningNode->isElementNode()) { | 1524 if (owningNode->isElementNode()) { |
1505 Element* owningElement = toElement(owningNode); | 1525 Element* owningElement = toElement(owningNode); |
1526 | |
1527 const CompositorElementId elementId = owningElement->assignCompo sitorElementId(); | |
1528 CompositorIdToElementMap::registerElement(*owningElement); | |
1529 m_graphicsLayer->setElementId(elementId); | |
1530 if (m_scrollingContentsLayer.get()) | |
1531 m_scrollingContentsLayer->setElementId(elementId); | |
1532 | |
1506 uint32_t compositorMutableProperties = owningElement->compositor MutableProperties(); | 1533 uint32_t compositorMutableProperties = owningElement->compositor MutableProperties(); |
1507 elementId = owningElement->assignCompositorElementId(); | |
1508 CompositorIdToElementMap::registerElement(*owningElement); | |
1509 mainMutableProperties = (CompositorMutableProperty::kOpacity | C ompositorMutableProperty::kTransform) & compositorMutableProperties; | 1534 mainMutableProperties = (CompositorMutableProperty::kOpacity | C ompositorMutableProperty::kTransform) & compositorMutableProperties; |
1510 scrollMutableProperties = (CompositorMutableProperty::kScrollLef t | CompositorMutableProperty::kScrollTop) & compositorMutableProperties; | 1535 scrollMutableProperties = (CompositorMutableProperty::kScrollLef t | CompositorMutableProperty::kScrollTop) & compositorMutableProperties; |
1511 } | 1536 } |
1512 } | 1537 } |
1513 } | 1538 } |
1514 | 1539 |
1515 m_graphicsLayer->setElementId(elementId); | |
1516 m_graphicsLayer->setCompositorMutableProperties(mainMutableProperties); | 1540 m_graphicsLayer->setCompositorMutableProperties(mainMutableProperties); |
1517 | 1541 if (m_scrollingContentsLayer.get()) |
1518 if (m_scrollingContentsLayer.get()) { | |
1519 m_scrollingContentsLayer->setElementId(elementId); | |
1520 m_scrollingContentsLayer->setCompositorMutableProperties(scrollMutablePr operties); | 1542 m_scrollingContentsLayer->setCompositorMutableProperties(scrollMutablePr operties); |
1521 } | |
1522 } | 1543 } |
1523 | 1544 |
1524 bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer) | 1545 bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer) |
1525 { | 1546 { |
1526 bool layerChanged = false; | 1547 bool layerChanged = false; |
1527 if (needsForegroundLayer) { | 1548 if (needsForegroundLayer) { |
1528 if (!m_foregroundLayer) { | 1549 if (!m_foregroundLayer) { |
1529 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor eground); | 1550 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor eground); |
1530 layerChanged = true; | 1551 layerChanged = true; |
1531 } | 1552 } |
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2574 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2595 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2575 name = "Scrolling Contents Layer"; | 2596 name = "Scrolling Contents Layer"; |
2576 } else { | 2597 } else { |
2577 ASSERT_NOT_REACHED(); | 2598 ASSERT_NOT_REACHED(); |
2578 } | 2599 } |
2579 | 2600 |
2580 return name; | 2601 return name; |
2581 } | 2602 } |
2582 | 2603 |
2583 } // namespace blink | 2604 } // namespace blink |
OLD | NEW |