Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "web/tests/sim/SimCompositor.h" | 5 #include "web/tests/sim/SimCompositor.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/layout/api/LayoutViewItem.h" | 8 #include "core/layout/api/LayoutViewItem.h" |
| 9 #include "core/layout/compositing/CompositedLayerMapping.h" | 9 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 10 #include "core/layout/compositing/PaintLayerCompositor.h" | |
| 10 #include "core/paint/PaintLayer.h" | 11 #include "core/paint/PaintLayer.h" |
| 11 #include "platform/graphics/ContentLayerDelegate.h" | 12 #include "platform/graphics/ContentLayerDelegate.h" |
| 13 #include "platform/graphics/GraphicsLayer.h" | |
| 12 #include "public/platform/WebRect.h" | 14 #include "public/platform/WebRect.h" |
| 13 #include "web/WebLocalFrameImpl.h" | 15 #include "web/WebLocalFrameImpl.h" |
| 14 #include "web/WebViewImpl.h" | 16 #include "web/WebViewImpl.h" |
| 15 #include "web/tests/sim/SimDisplayItemList.h" | 17 #include "web/tests/sim/SimDisplayItemList.h" |
| 16 #include "wtf/CurrentTime.h" | 18 #include "wtf/CurrentTime.h" |
| 17 | 19 |
| 18 namespace blink { | 20 namespace blink { |
| 19 | 21 |
| 22 /* | |
| 20 static void paintLayers(PaintLayer& layer, SimDisplayItemList& displayList) | 23 static void paintLayers(PaintLayer& layer, SimDisplayItemList& displayList) |
|
Sami
2016/09/07 14:48:43
Probably meant to delete this completely?
szager1
2016/09/07 16:53:01
Yep, done.
| |
| 21 { | 24 { |
| 22 if (layer.isAllowedToQueryCompositingState() && layer.compositingState() == PaintsIntoOwnBacking) { | 25 if (layer.isAllowedToQueryCompositingState() && layer.compositingState() == PaintsIntoOwnBacking) { |
| 23 CompositedLayerMapping* mapping = layer.compositedLayerMapping(); | 26 CompositedLayerMapping* mapping = layer.compositedLayerMapping(); |
| 24 GraphicsLayer* graphicsLayer = mapping->mainGraphicsLayer(); | 27 GraphicsLayer* graphicsLayer = mapping->mainGraphicsLayer(); |
| 25 if (graphicsLayer->hasTrackedPaintInvalidations()) { | 28 if (graphicsLayer->hasTrackedPaintInvalidations()) { |
| 26 ContentLayerDelegate* delegate = graphicsLayer->contentLayerDelegate ForTesting(); | 29 ContentLayerDelegate* delegate = graphicsLayer->contentLayerDelegate ForTesting(); |
| 27 delegate->paintContents(&displayList); | 30 delegate->paintContents(&displayList); |
| 28 graphicsLayer->resetTrackedPaintInvalidations(); | 31 graphicsLayer->resetTrackedPaintInvalidations(); |
| 29 } | 32 } |
| 30 } | 33 } |
| 31 for (PaintLayer* child = layer.firstChild(); child; child = child->nextSibli ng()) | 34 for (PaintLayer* child = layer.firstChild(); child; child = child->nextSibli ng()) |
| 32 paintLayers(*child, displayList); | 35 paintLayers(*child, displayList); |
| 33 } | 36 } |
| 37 */ | |
| 38 | |
| 39 static void paintLayers(GraphicsLayer& layer, SimDisplayItemList& displayList) | |
| 40 { | |
| 41 if (layer.drawsContent() && layer.hasTrackedPaintInvalidations()) { | |
| 42 ContentLayerDelegate* delegate = layer.contentLayerDelegateForTesting(); | |
| 43 delegate->paintContents(&displayList); | |
| 44 layer.resetTrackedPaintInvalidations(); | |
| 45 } | |
| 46 | |
| 47 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | |
|
chrishtr
2016/09/07 16:40:49
I don't think you need this conditional.
szager1
2016/09/07 16:53:01
Done.
| |
| 48 if (GraphicsLayer* maskLayer = layer.maskLayer()) | |
| 49 paintLayers(*maskLayer, displayList); | |
| 50 if (GraphicsLayer* contentsClippingMaskLayer = layer.contentsClippingMas kLayer()) | |
| 51 paintLayers(*contentsClippingMaskLayer, displayList); | |
| 52 if (GraphicsLayer* replicaLayer = layer.replicaLayer()) | |
| 53 paintLayers(*replicaLayer, displayList); | |
| 54 } | |
| 55 | |
| 56 for (auto child : layer.children()) | |
| 57 paintLayers(*child, displayList); | |
| 58 } | |
| 34 | 59 |
| 35 static void paintFrames(LocalFrame& root, SimDisplayItemList& displayList) | 60 static void paintFrames(LocalFrame& root, SimDisplayItemList& displayList) |
| 36 { | 61 { |
| 37 for (Frame* frame = &root; frame; frame = frame->tree().traverseNext(&root)) { | 62 GraphicsLayer* layer = root.view()->layoutViewItem().compositor()->rootGraph icsLayer(); |
| 38 if (!frame->isLocalFrame()) | 63 paintLayers(*layer, displayList); |
| 39 continue; | |
| 40 PaintLayer* layer = toLocalFrame(frame)->view()->layoutViewItem().layer( ); | |
| 41 paintLayers(*layer, displayList); | |
| 42 } | |
| 43 } | 64 } |
| 44 | 65 |
| 45 SimCompositor::SimCompositor() | 66 SimCompositor::SimCompositor() |
| 46 : m_needsAnimate(false) | 67 : m_needsAnimate(false) |
| 47 , m_deferCommits(true) | 68 , m_deferCommits(true) |
| 48 , m_hasSelection(false) | 69 , m_hasSelection(false) |
| 49 , m_webViewImpl(0) | 70 , m_webViewImpl(0) |
| 50 , m_lastFrameTimeMonotonic(0) | 71 , m_lastFrameTimeMonotonic(0) |
| 51 { | 72 { |
| 52 FrameView::setInitialTracksPaintInvalidationsForTesting(true); | 73 FrameView::setInitialTracksPaintInvalidationsForTesting(true); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 | 118 |
| 98 LocalFrame* root = m_webViewImpl->mainFrameImpl()->frame(); | 119 LocalFrame* root = m_webViewImpl->mainFrameImpl()->frame(); |
| 99 | 120 |
| 100 SimDisplayItemList displayList; | 121 SimDisplayItemList displayList; |
| 101 paintFrames(*root, displayList); | 122 paintFrames(*root, displayList); |
| 102 | 123 |
| 103 return displayList; | 124 return displayList; |
| 104 } | 125 } |
| 105 | 126 |
| 106 } // namespace blink | 127 } // namespace blink |
| OLD | NEW |