| 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/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
| 9 #include "core/layout/compositing/CompositedLayerMapping.h" | 9 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 10 #include "core/paint/PaintLayer.h" | 10 #include "core/paint/PaintLayer.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 if (!frame->isLocalFrame()) | 38 if (!frame->isLocalFrame()) |
| 39 continue; | 39 continue; |
| 40 PaintLayer* layer = toLocalFrame(frame)->view()->layoutView()->layer(); | 40 PaintLayer* layer = toLocalFrame(frame)->view()->layoutView()->layer(); |
| 41 paintLayers(*layer, displayList); | 41 paintLayers(*layer, displayList); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 SimCompositor::SimCompositor() | 45 SimCompositor::SimCompositor() |
| 46 : m_needsAnimate(false) | 46 : m_needsAnimate(false) |
| 47 , m_deferCommits(true) | 47 , m_deferCommits(true) |
| 48 , m_hasSelection(false) |
| 48 , m_webViewImpl(0) | 49 , m_webViewImpl(0) |
| 49 , m_lastFrameTimeMonotonic(0) | 50 , m_lastFrameTimeMonotonic(0) |
| 50 { | 51 { |
| 51 FrameView::setInitialTracksPaintInvalidationsForTesting(true); | 52 FrameView::setInitialTracksPaintInvalidationsForTesting(true); |
| 52 // Disable the debug red fill so the output display list doesn't differ in | 53 // Disable the debug red fill so the output display list doesn't differ in |
| 53 // size in Release vs Debug builds. | 54 // size in Release vs Debug builds. |
| 54 GraphicsLayer::setDrawDebugRedFillForTesting(false); | 55 GraphicsLayer::setDrawDebugRedFillForTesting(false); |
| 55 } | 56 } |
| 56 | 57 |
| 57 SimCompositor::~SimCompositor() | 58 SimCompositor::~SimCompositor() |
| (...skipping 10 matching lines...) Expand all Loading... |
| 68 void SimCompositor::setNeedsAnimate() | 69 void SimCompositor::setNeedsAnimate() |
| 69 { | 70 { |
| 70 m_needsAnimate = true; | 71 m_needsAnimate = true; |
| 71 } | 72 } |
| 72 | 73 |
| 73 void SimCompositor::setDeferCommits(bool deferCommits) | 74 void SimCompositor::setDeferCommits(bool deferCommits) |
| 74 { | 75 { |
| 75 m_deferCommits = deferCommits; | 76 m_deferCommits = deferCommits; |
| 76 } | 77 } |
| 77 | 78 |
| 79 void SimCompositor::registerSelection(const WebSelection&) |
| 80 { |
| 81 m_hasSelection = true; |
| 82 } |
| 83 |
| 84 void SimCompositor::clearSelection() |
| 85 { |
| 86 m_hasSelection = false; |
| 87 } |
| 88 |
| 78 SimDisplayItemList SimCompositor::beginFrame() | 89 SimDisplayItemList SimCompositor::beginFrame() |
| 79 { | 90 { |
| 80 DCHECK(m_webViewImpl); | 91 DCHECK(m_webViewImpl); |
| 81 DCHECK(!m_deferCommits); | 92 DCHECK(!m_deferCommits); |
| 82 DCHECK(m_needsAnimate); | 93 DCHECK(m_needsAnimate); |
| 83 m_needsAnimate = false; | 94 m_needsAnimate = false; |
| 84 | 95 |
| 85 // Always advance the time as if the compositor was running at 60fps. | 96 // Always advance the time as if the compositor was running at 60fps. |
| 86 m_lastFrameTimeMonotonic = monotonicallyIncreasingTime() + 0.016; | 97 m_lastFrameTimeMonotonic = monotonicallyIncreasingTime() + 0.016; |
| 87 | 98 |
| 88 m_webViewImpl->beginFrame(m_lastFrameTimeMonotonic); | 99 m_webViewImpl->beginFrame(m_lastFrameTimeMonotonic); |
| 89 m_webViewImpl->updateAllLifecyclePhases(); | 100 m_webViewImpl->updateAllLifecyclePhases(); |
| 90 | 101 |
| 91 LocalFrame* root = m_webViewImpl->mainFrameImpl()->frame(); | 102 LocalFrame* root = m_webViewImpl->mainFrameImpl()->frame(); |
| 92 | 103 |
| 93 SimDisplayItemList displayList; | 104 SimDisplayItemList displayList; |
| 94 paintFrames(*root, displayList); | 105 paintFrames(*root, displayList); |
| 95 | 106 |
| 96 return displayList; | 107 return displayList; |
| 97 } | 108 } |
| 98 | 109 |
| 99 } // namespace blink | 110 } // namespace blink |
| OLD | NEW |