| 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 |
| 20 static void paintLayers(PaintLayer& layer, SimDisplayItemList& displayList) | 22 static void paintLayers(GraphicsLayer& layer, SimDisplayItemList& displayList) |
| 21 { | 23 { |
| 22 if (layer.isAllowedToQueryCompositingState() && layer.compositingState() ==
PaintsIntoOwnBacking) { | 24 if (layer.drawsContent() && layer.hasTrackedPaintInvalidations()) { |
| 23 CompositedLayerMapping* mapping = layer.compositedLayerMapping(); | 25 ContentLayerDelegate* delegate = layer.contentLayerDelegateForTesting(); |
| 24 GraphicsLayer* graphicsLayer = mapping->mainGraphicsLayer(); | 26 delegate->paintContents(&displayList); |
| 25 if (graphicsLayer->hasTrackedPaintInvalidations()) { | 27 layer.resetTrackedPaintInvalidations(); |
| 26 ContentLayerDelegate* delegate = graphicsLayer->contentLayerDelegate
ForTesting(); | |
| 27 delegate->paintContents(&displayList); | |
| 28 graphicsLayer->resetTrackedPaintInvalidations(); | |
| 29 } | |
| 30 } | 28 } |
| 31 for (PaintLayer* child = layer.firstChild(); child; child = child->nextSibli
ng()) | 29 |
| 30 if (GraphicsLayer* maskLayer = layer.maskLayer()) |
| 31 paintLayers(*maskLayer, displayList); |
| 32 if (GraphicsLayer* contentsClippingMaskLayer = layer.contentsClippingMaskLay
er()) |
| 33 paintLayers(*contentsClippingMaskLayer, displayList); |
| 34 if (GraphicsLayer* replicaLayer = layer.replicaLayer()) |
| 35 paintLayers(*replicaLayer, displayList); |
| 36 |
| 37 for (auto child : layer.children()) |
| 32 paintLayers(*child, displayList); | 38 paintLayers(*child, displayList); |
| 33 } | 39 } |
| 34 | 40 |
| 35 static void paintFrames(LocalFrame& root, SimDisplayItemList& displayList) | 41 static void paintFrames(LocalFrame& root, SimDisplayItemList& displayList) |
| 36 { | 42 { |
| 37 for (Frame* frame = &root; frame; frame = frame->tree().traverseNext(&root))
{ | 43 GraphicsLayer* layer = root.view()->layoutViewItem().compositor()->rootGraph
icsLayer(); |
| 38 if (!frame->isLocalFrame()) | 44 paintLayers(*layer, displayList); |
| 39 continue; | |
| 40 PaintLayer* layer = toLocalFrame(frame)->view()->layoutViewItem().layer(
); | |
| 41 paintLayers(*layer, displayList); | |
| 42 } | |
| 43 } | 45 } |
| 44 | 46 |
| 45 SimCompositor::SimCompositor() | 47 SimCompositor::SimCompositor() |
| 46 : m_needsAnimate(false) | 48 : m_needsAnimate(false) |
| 47 , m_deferCommits(true) | 49 , m_deferCommits(true) |
| 48 , m_hasSelection(false) | 50 , m_hasSelection(false) |
| 49 , m_webViewImpl(0) | 51 , m_webViewImpl(0) |
| 50 , m_lastFrameTimeMonotonic(0) | 52 , m_lastFrameTimeMonotonic(0) |
| 51 { | 53 { |
| 52 FrameView::setInitialTracksPaintInvalidationsForTesting(true); | 54 FrameView::setInitialTracksPaintInvalidationsForTesting(true); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 99 |
| 98 LocalFrame* root = m_webViewImpl->mainFrameImpl()->frame(); | 100 LocalFrame* root = m_webViewImpl->mainFrameImpl()->frame(); |
| 99 | 101 |
| 100 SimDisplayItemList displayList; | 102 SimDisplayItemList displayList; |
| 101 paintFrames(*root, displayList); | 103 paintFrames(*root, displayList); |
| 102 | 104 |
| 103 return displayList; | 105 return displayList; |
| 104 } | 106 } |
| 105 | 107 |
| 106 } // namespace blink | 108 } // namespace blink |
| OLD | NEW |