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 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1515 // causes unclipped render surfaces which cause bugs. | 1515 // causes unclipped render surfaces which cause bugs. |
1516 // http://crbug.com/521768 | 1516 // http://crbug.com/521768 |
1517 if (hasScrollingLayer()) { | 1517 if (hasScrollingLayer()) { |
1518 m_graphicsLayer->setShouldFlattenTransform(false); | 1518 m_graphicsLayer->setShouldFlattenTransform(false); |
1519 m_scrollingLayer->setShouldFlattenTransform(false); | 1519 m_scrollingLayer->setShouldFlattenTransform(false); |
1520 } | 1520 } |
1521 } | 1521 } |
1522 | 1522 |
1523 void CompositedLayerMapping::updateElementIdAndCompositorMutableProperties() | 1523 void CompositedLayerMapping::updateElementIdAndCompositorMutableProperties() |
1524 { | 1524 { |
1525 if (!RuntimeEnabledFeatures::compositorWorkerEnabled()) | |
1526 return; | |
1527 | |
1528 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositedLaye rMapping::updateElementId()"); | |
1529 | |
1530 uint64_t elementId = 0; | 1525 uint64_t elementId = 0; |
1531 uint32_t mainMutableProperties = CompositorMutableProperty::kNone; | 1526 uint32_t mainMutableProperties = CompositorMutableProperty::kNone; |
1532 uint32_t scrollMutableProperties = CompositorMutableProperty::kNone; | 1527 uint32_t scrollMutableProperties = CompositorMutableProperty::kNone; |
1533 | 1528 |
1534 if (m_owningLayer.layoutObject()->style()->hasCompositorProxy()) { | 1529 Node* owningNode = m_owningLayer.layoutObject()->generatingNode(); |
1535 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) { | 1530 Element* owningElement = nullptr; |
1536 if (owningNode->isElementNode()) { | 1531 if (owningNode && owningNode->isElementNode()) |
1537 Element* owningElement = toElement(owningNode); | 1532 owningElement = toElement(owningNode); |
1538 uint32_t compositorMutableProperties = owningElement->compositor MutableProperties(); | 1533 |
1539 elementId = DOMNodeIds::idForNode(owningNode); | 1534 if (RuntimeEnabledFeatures::compositorWorkerEnabled() && owningElement && m_ owningLayer.layoutObject()->style()->hasCompositorProxy()) { |
1540 mainMutableProperties = (CompositorMutableProperty::kOpacity | C ompositorMutableProperty::kTransform) & compositorMutableProperties; | 1535 uint32_t compositorMutableProperties = owningElement->compositorMutableP roperties(); |
1541 scrollMutableProperties = (CompositorMutableProperty::kScrollLef t | CompositorMutableProperty::kScrollTop) & compositorMutableProperties; | 1536 elementId = DOMNodeIds::idForNode(owningNode); |
1542 } | 1537 mainMutableProperties = (CompositorMutableProperty::kOpacity | Composito rMutableProperty::kTransform) & compositorMutableProperties; |
ajuma
2016/06/01 23:53:42
Nit: maybe call this something like primaryMutable
Ian Vollick
2016/06/02 19:03:11
Done.
| |
1543 } | 1538 scrollMutableProperties = (CompositorMutableProperty::kScrollLeft | Comp ositorMutableProperty::kScrollTop) & compositorMutableProperties; |
1544 } | 1539 } |
1545 | 1540 |
1546 m_graphicsLayer->setElementId(elementId); | 1541 if (m_owningLayer.layoutObject()->style()->shouldCompositeForCurrentAnimatio ns() && owningNode) |
1542 elementId = DOMNodeIds::idForNode(owningNode); | |
1543 | |
1544 m_graphicsLayer->setElementId(CompositorElementId(elementId)); | |
1547 m_graphicsLayer->setCompositorMutableProperties(mainMutableProperties); | 1545 m_graphicsLayer->setCompositorMutableProperties(mainMutableProperties); |
1548 | 1546 |
1549 if (m_scrollingContentsLayer.get()) { | 1547 // We always set the elementId for m_scrollingContentsLayer since it can be |
1550 m_scrollingContentsLayer->setElementId(elementId); | 1548 // animated for smooth scrolling. |
1549 if (m_scrollingContentsLayer.get()) | |
1551 m_scrollingContentsLayer->setCompositorMutableProperties(scrollMutablePr operties); | 1550 m_scrollingContentsLayer->setCompositorMutableProperties(scrollMutablePr operties); |
1552 } | |
1553 } | 1551 } |
1554 | 1552 |
1555 bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer) | 1553 bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer) |
1556 { | 1554 { |
1557 bool layerChanged = false; | 1555 bool layerChanged = false; |
1558 if (needsForegroundLayer) { | 1556 if (needsForegroundLayer) { |
1559 if (!m_foregroundLayer) { | 1557 if (!m_foregroundLayer) { |
1560 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor eground); | 1558 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor eground); |
1561 layerChanged = true; | 1559 layerChanged = true; |
1562 } | 1560 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1629 bool layerChanged = false; | 1627 bool layerChanged = false; |
1630 if (needsScrollingLayers) { | 1628 if (needsScrollingLayers) { |
1631 if (!m_scrollingLayer) { | 1629 if (!m_scrollingLayer) { |
1632 // Outer layer which corresponds with the scroll view. | 1630 // Outer layer which corresponds with the scroll view. |
1633 m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForScro llingContainer); | 1631 m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForScro llingContainer); |
1634 m_scrollingLayer->setDrawsContent(false); | 1632 m_scrollingLayer->setDrawsContent(false); |
1635 m_scrollingLayer->setMasksToBounds(true); | 1633 m_scrollingLayer->setMasksToBounds(true); |
1636 | 1634 |
1637 // Inner layer which renders the content that scrolls. | 1635 // Inner layer which renders the content that scrolls. |
1638 m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLaye rForScrollingContents); | 1636 m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLaye rForScrollingContents); |
1637 | |
1638 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode( )) { | |
1639 m_scrollingContentsLayer->setElementId(CompositorElementId(DOMNo deIds::idForNode(owningNode) | kScrollSubElement)); | |
Ian Vollick
2016/06/01 18:08:26
NB: this is some of the glue code that knows about
ajuma
2016/06/01 23:53:42
I'm probably missing something obvious, but should
Ian Vollick
2016/06/02 19:03:11
It should indeed be shifted. I'd started implement
| |
1640 m_scrollingContentsLayer->setCompositorMutableProperties(Composi torMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop); | |
1641 } | |
1642 | |
1639 m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); | 1643 m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); |
1640 | 1644 |
1641 layerChanged = true; | 1645 layerChanged = true; |
1642 if (scrollingCoordinator) { | 1646 if (scrollingCoordinator) { |
1643 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin gLayer.getScrollableArea()); | 1647 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin gLayer.getScrollableArea()); |
1644 scrollingCoordinator->scrollableAreasDidChange(); | 1648 scrollingCoordinator->scrollableAreasDidChange(); |
1645 } | 1649 } |
1646 } | 1650 } |
1647 } else if (m_scrollingLayer) { | 1651 } else if (m_scrollingLayer) { |
1648 m_scrollingLayer = nullptr; | 1652 m_scrollingLayer = nullptr; |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2636 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2640 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2637 name = "Scrolling Contents Layer"; | 2641 name = "Scrolling Contents Layer"; |
2638 } else { | 2642 } else { |
2639 ASSERT_NOT_REACHED(); | 2643 ASSERT_NOT_REACHED(); |
2640 } | 2644 } |
2641 | 2645 |
2642 return name; | 2646 return name; |
2643 } | 2647 } |
2644 | 2648 |
2645 } // namespace blink | 2649 } // namespace blink |
OLD | NEW |