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

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

Issue 1405993008: compositor-worker: plumb element id and mutable properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed layout test (and logged bug) Created 5 years, 1 month 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "platform/LengthFunctions.h" 58 #include "platform/LengthFunctions.h"
59 #include "platform/RuntimeEnabledFeatures.h" 59 #include "platform/RuntimeEnabledFeatures.h"
60 #include "platform/fonts/FontCache.h" 60 #include "platform/fonts/FontCache.h"
61 #include "platform/geometry/TransformState.h" 61 #include "platform/geometry/TransformState.h"
62 #include "platform/graphics/BitmapImage.h" 62 #include "platform/graphics/BitmapImage.h"
63 #include "platform/graphics/GraphicsContext.h" 63 #include "platform/graphics/GraphicsContext.h"
64 #include "platform/graphics/paint/ClipDisplayItem.h" 64 #include "platform/graphics/paint/ClipDisplayItem.h"
65 #include "platform/graphics/paint/CullRect.h" 65 #include "platform/graphics/paint/CullRect.h"
66 #include "platform/graphics/paint/PaintController.h" 66 #include "platform/graphics/paint/PaintController.h"
67 #include "platform/graphics/paint/TransformDisplayItem.h" 67 #include "platform/graphics/paint/TransformDisplayItem.h"
68 #include "public/platform/WebMutableProperties.h"
68 #include "wtf/CurrentTime.h" 69 #include "wtf/CurrentTime.h"
69 #include "wtf/text/StringBuilder.h" 70 #include "wtf/text/StringBuilder.h"
70 71
71 namespace blink { 72 namespace blink {
72 73
73 using namespace HTMLNames; 74 using namespace HTMLNames;
74 75
75 static IntRect clipBox(LayoutBox* layoutObject); 76 static IntRect clipBox(LayoutBox* layoutObject);
76 77
77 static IntRect contentsRect(const LayoutObject* layoutObject) 78 static IntRect contentsRect(const LayoutObject* layoutObject)
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 if (layoutObject->isLayoutPart()) { 532 if (layoutObject->isLayoutPart()) {
532 if (PaintLayerCompositor::parentFrameContentLayers(toLayoutPart(layoutOb ject))) 533 if (PaintLayerCompositor::parentFrameContentLayers(toLayoutPart(layoutOb ject)))
533 layerConfigChanged = true; 534 layerConfigChanged = true;
534 } 535 }
535 536
536 // Changes to either the internal hierarchy or the mask layer have an impact 537 // Changes to either the internal hierarchy or the mask layer have an impact
537 // on painting phases, so we need to update when either are updated. 538 // on painting phases, so we need to update when either are updated.
538 if (layerConfigChanged || maskLayerChanged) 539 if (layerConfigChanged || maskLayerChanged)
539 updatePaintingPhases(); 540 updatePaintingPhases();
540 541
542 updateElementIdAndMutableProperties();
543
541 return layerConfigChanged; 544 return layerConfigChanged;
542 } 545 }
543 546
544 static IntRect clipBox(LayoutBox* layoutObject) 547 static IntRect clipBox(LayoutBox* layoutObject)
545 { 548 {
546 LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect()); 549 LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect());
547 if (layoutObject->hasOverflowClip()) 550 if (layoutObject->hasOverflowClip())
548 result = layoutObject->overflowClipRect(LayoutPoint()); 551 result = layoutObject->overflowClipRect(LayoutPoint());
549 552
550 if (layoutObject->hasClip()) 553 if (layoutObject->hasClip())
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 m_owningLayer.scrollableArea()->positionOverflowControls(); 721 m_owningLayer.scrollableArea()->positionOverflowControls();
719 722
720 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { 723 if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
721 updateLayerBlendMode(layoutObject()->styleRef()); 724 updateLayerBlendMode(layoutObject()->styleRef());
722 updateIsRootForIsolatedGroup(); 725 updateIsRootForIsolatedGroup();
723 } 726 }
724 727
725 updateContentsRect(); 728 updateContentsRect();
726 updateBackgroundColor(); 729 updateBackgroundColor();
727 updateDrawsContent(); 730 updateDrawsContent();
731 updateElementIdAndMutableProperties();
728 updateContentsOpaque(); 732 updateContentsOpaque();
729 updateAfterPartResize(); 733 updateAfterPartResize();
730 updateRenderingContext(); 734 updateRenderingContext();
731 updateShouldFlattenTransform(); 735 updateShouldFlattenTransform();
732 updateChildrenTransform(); 736 updateChildrenTransform();
733 updateScrollParent(scrollParent()); 737 updateScrollParent(scrollParent());
734 registerScrollingLayers(); 738 registerScrollingLayers();
735 739
736 updateCompositingReasons(); 740 updateCompositingReasons();
737 } 741 }
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 // selection layer (if they exist) as not flattening. Having them flatten 1484 // selection layer (if they exist) as not flattening. Having them flatten
1481 // causes unclipped render surfaces which cause bugs. 1485 // causes unclipped render surfaces which cause bugs.
1482 // http://crbug.com/521768 1486 // http://crbug.com/521768
1483 if (hasScrollingLayer()) { 1487 if (hasScrollingLayer()) {
1484 m_scrollingContentsLayer->setShouldFlattenTransform(false); 1488 m_scrollingContentsLayer->setShouldFlattenTransform(false);
1485 if (m_scrollingBlockSelectionLayer) 1489 if (m_scrollingBlockSelectionLayer)
1486 m_scrollingBlockSelectionLayer->setShouldFlattenTransform(false); 1490 m_scrollingBlockSelectionLayer->setShouldFlattenTransform(false);
1487 } 1491 }
1488 } 1492 }
1489 1493
1494 void CompositedLayerMapping::updateElementIdAndMutableProperties()
1495 {
1496 if (!RuntimeEnabledFeatures::compositorWorkerEnabled())
1497 return;
1498
1499 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositedLaye rMapping::updateElementId()");
1500
1501 uint64_t elementId = 0;
1502 uint32_t mainMutableProperties = WebMutablePropertyNone;
1503 uint32_t scrollMutableProperties = WebMutablePropertyNone;
1504
1505 if (m_owningLayer.layoutObject()->style()->hasCompositorProxy()) {
1506 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) {
1507 elementId = DOMNodeIds::idForNode(owningNode);
1508 mainMutableProperties = WebMutablePropertyOpacity | WebMutableProper tyTransform;
1509 scrollMutableProperties = WebMutablePropertyScrollLeft | WebMutableP ropertyScrollTop;
1510 }
1511 }
1512
1513 m_graphicsLayer->setElementId(elementId);
1514 m_graphicsLayer->setMutableProperties(mainMutableProperties);
1515
1516 if (m_scrollingContentsLayer.get()) {
1517 m_scrollingContentsLayer->setElementId(elementId);
1518 m_scrollingContentsLayer->setMutableProperties(scrollMutableProperties);
1519 }
1520 }
1521
1490 bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer) 1522 bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer)
1491 { 1523 {
1492 bool layerChanged = false; 1524 bool layerChanged = false;
1493 if (needsForegroundLayer) { 1525 if (needsForegroundLayer) {
1494 if (!m_foregroundLayer) { 1526 if (!m_foregroundLayer) {
1495 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor eground); 1527 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor eground);
1496 m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground); 1528 m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground);
1497 layerChanged = true; 1529 layerChanged = true;
1498 } 1530 }
1499 } else if (m_foregroundLayer) { 1531 } else if (m_foregroundLayer) {
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2538 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2507 name = "Scrolling Block Selection Layer"; 2539 name = "Scrolling Block Selection Layer";
2508 } else { 2540 } else {
2509 ASSERT_NOT_REACHED(); 2541 ASSERT_NOT_REACHED();
2510 } 2542 }
2511 2543
2512 return name; 2544 return name;
2513 } 2545 }
2514 2546
2515 } // namespace blink 2547 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698