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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #include "platform/LengthFunctions.h" | 60 #include "platform/LengthFunctions.h" |
61 #include "platform/RuntimeEnabledFeatures.h" | 61 #include "platform/RuntimeEnabledFeatures.h" |
62 #include "platform/fonts/FontCache.h" | 62 #include "platform/fonts/FontCache.h" |
63 #include "platform/geometry/TransformState.h" | 63 #include "platform/geometry/TransformState.h" |
64 #include "platform/graphics/BitmapImage.h" | 64 #include "platform/graphics/BitmapImage.h" |
65 #include "platform/graphics/GraphicsContext.h" | 65 #include "platform/graphics/GraphicsContext.h" |
66 #include "platform/graphics/paint/ClipDisplayItem.h" | 66 #include "platform/graphics/paint/ClipDisplayItem.h" |
67 #include "platform/graphics/paint/CullRect.h" | 67 #include "platform/graphics/paint/CullRect.h" |
68 #include "platform/graphics/paint/PaintController.h" | 68 #include "platform/graphics/paint/PaintController.h" |
69 #include "platform/graphics/paint/TransformDisplayItem.h" | 69 #include "platform/graphics/paint/TransformDisplayItem.h" |
| 70 #include "public/platform/WebCompositorMutableProperties.h" |
70 #include "wtf/CurrentTime.h" | 71 #include "wtf/CurrentTime.h" |
71 #include "wtf/text/StringBuilder.h" | 72 #include "wtf/text/StringBuilder.h" |
72 | 73 |
73 namespace blink { | 74 namespace blink { |
74 | 75 |
75 using namespace HTMLNames; | 76 using namespace HTMLNames; |
76 | 77 |
77 static IntRect clipBox(LayoutBox* layoutObject); | 78 static IntRect clipBox(LayoutBox* layoutObject); |
78 | 79 |
79 static IntRect contentsRect(const LayoutObject* layoutObject) | 80 static IntRect contentsRect(const LayoutObject* layoutObject) |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 if (layoutObject->isLayoutPart()) { | 553 if (layoutObject->isLayoutPart()) { |
553 if (PaintLayerCompositor::attachFrameContentLayersToIframeLayer(toLayout
Part(layoutObject))) | 554 if (PaintLayerCompositor::attachFrameContentLayersToIframeLayer(toLayout
Part(layoutObject))) |
554 layerConfigChanged = true; | 555 layerConfigChanged = true; |
555 } | 556 } |
556 | 557 |
557 // Changes to either the internal hierarchy or the mask layer have an impact | 558 // Changes to either the internal hierarchy or the mask layer have an impact |
558 // on painting phases, so we need to update when either are updated. | 559 // on painting phases, so we need to update when either are updated. |
559 if (layerConfigChanged || maskLayerChanged) | 560 if (layerConfigChanged || maskLayerChanged) |
560 updatePaintingPhases(); | 561 updatePaintingPhases(); |
561 | 562 |
| 563 updateElementIdAndCompositorMutableProperties(); |
| 564 |
562 return layerConfigChanged; | 565 return layerConfigChanged; |
563 } | 566 } |
564 | 567 |
565 static IntRect clipBox(LayoutBox* layoutObject) | 568 static IntRect clipBox(LayoutBox* layoutObject) |
566 { | 569 { |
567 LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect()); | 570 LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect()); |
568 if (layoutObject->hasOverflowClip()) | 571 if (layoutObject->hasOverflowClip()) |
569 result = layoutObject->overflowClipRect(LayoutPoint()); | 572 result = layoutObject->overflowClipRect(LayoutPoint()); |
570 | 573 |
571 if (layoutObject->hasClip()) | 574 if (layoutObject->hasClip()) |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 m_owningLayer.scrollableArea()->positionOverflowControls(); | 742 m_owningLayer.scrollableArea()->positionOverflowControls(); |
740 | 743 |
741 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { | 744 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { |
742 updateLayerBlendMode(layoutObject()->styleRef()); | 745 updateLayerBlendMode(layoutObject()->styleRef()); |
743 updateIsRootForIsolatedGroup(); | 746 updateIsRootForIsolatedGroup(); |
744 } | 747 } |
745 | 748 |
746 updateContentsRect(); | 749 updateContentsRect(); |
747 updateBackgroundColor(); | 750 updateBackgroundColor(); |
748 updateDrawsContent(); | 751 updateDrawsContent(); |
| 752 updateElementIdAndCompositorMutableProperties(); |
749 updateContentsOpaque(); | 753 updateContentsOpaque(); |
750 updateAfterPartResize(); | 754 updateAfterPartResize(); |
751 updateRenderingContext(); | 755 updateRenderingContext(); |
752 updateShouldFlattenTransform(); | 756 updateShouldFlattenTransform(); |
753 updateChildrenTransform(); | 757 updateChildrenTransform(); |
754 updateScrollParent(scrollParent()); | 758 updateScrollParent(scrollParent()); |
755 registerScrollingLayers(); | 759 registerScrollingLayers(); |
756 | 760 |
757 updateCompositingReasons(); | 761 updateCompositingReasons(); |
758 } | 762 } |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 // selection layer (if they exist) as not flattening. Having them flatten | 1515 // selection layer (if they exist) as not flattening. Having them flatten |
1512 // causes unclipped render surfaces which cause bugs. | 1516 // causes unclipped render surfaces which cause bugs. |
1513 // http://crbug.com/521768 | 1517 // http://crbug.com/521768 |
1514 if (hasScrollingLayer()) { | 1518 if (hasScrollingLayer()) { |
1515 m_scrollingContentsLayer->setShouldFlattenTransform(false); | 1519 m_scrollingContentsLayer->setShouldFlattenTransform(false); |
1516 if (m_scrollingBlockSelectionLayer) | 1520 if (m_scrollingBlockSelectionLayer) |
1517 m_scrollingBlockSelectionLayer->setShouldFlattenTransform(false); | 1521 m_scrollingBlockSelectionLayer->setShouldFlattenTransform(false); |
1518 } | 1522 } |
1519 } | 1523 } |
1520 | 1524 |
| 1525 void CompositedLayerMapping::updateElementIdAndCompositorMutableProperties() |
| 1526 { |
| 1527 if (!RuntimeEnabledFeatures::compositorWorkerEnabled()) |
| 1528 return; |
| 1529 |
| 1530 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositedLaye
rMapping::updateElementId()"); |
| 1531 |
| 1532 uint64_t elementId = 0; |
| 1533 uint32_t mainMutableProperties = WebCompositorMutablePropertyNone; |
| 1534 uint32_t scrollMutableProperties = WebCompositorMutablePropertyNone; |
| 1535 |
| 1536 if (m_owningLayer.layoutObject()->style()->hasCompositorProxy()) { |
| 1537 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) { |
| 1538 if (owningNode->isElementNode()) { |
| 1539 Element* owningElement = toElement(owningNode); |
| 1540 uint32_t compositorMutableProperties = owningElement->compositor
MutableProperties(); |
| 1541 elementId = DOMNodeIds::idForNode(owningNode); |
| 1542 mainMutableProperties = (WebCompositorMutablePropertyOpacity | W
ebCompositorMutablePropertyTransform) & compositorMutableProperties; |
| 1543 scrollMutableProperties = (WebCompositorMutablePropertyScrollLef
t | WebCompositorMutablePropertyScrollTop) & compositorMutableProperties; |
| 1544 } |
| 1545 } |
| 1546 } |
| 1547 |
| 1548 m_graphicsLayer->setElementId(elementId); |
| 1549 m_graphicsLayer->setCompositorMutableProperties(mainMutableProperties); |
| 1550 |
| 1551 if (m_scrollingContentsLayer.get()) { |
| 1552 m_scrollingContentsLayer->setElementId(elementId); |
| 1553 m_scrollingContentsLayer->setCompositorMutableProperties(scrollMutablePr
operties); |
| 1554 } |
| 1555 } |
| 1556 |
1521 bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer) | 1557 bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer) |
1522 { | 1558 { |
1523 bool layerChanged = false; | 1559 bool layerChanged = false; |
1524 if (needsForegroundLayer) { | 1560 if (needsForegroundLayer) { |
1525 if (!m_foregroundLayer) { | 1561 if (!m_foregroundLayer) { |
1526 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor
eground); | 1562 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor
eground); |
1527 m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground); | 1563 m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground); |
1528 layerChanged = true; | 1564 layerChanged = true; |
1529 } | 1565 } |
1530 } else if (m_foregroundLayer) { | 1566 } else if (m_foregroundLayer) { |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2565 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2601 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2566 name = "Scrolling Block Selection Layer"; | 2602 name = "Scrolling Block Selection Layer"; |
2567 } else { | 2603 } else { |
2568 ASSERT_NOT_REACHED(); | 2604 ASSERT_NOT_REACHED(); |
2569 } | 2605 } |
2570 | 2606 |
2571 return name; | 2607 return name; |
2572 } | 2608 } |
2573 | 2609 |
2574 } // namespace blink | 2610 } // namespace blink |
OLD | NEW |