OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "core/paint/FramePainter.h" | 5 #include "core/paint/FramePainter.h" |
6 | 6 |
7 #include "core/editing/markers/DocumentMarkerController.h" | 7 #include "core/editing/markers/DocumentMarkerController.h" |
8 #include "core/fetch/MemoryCache.h" | 8 #include "core/fetch/MemoryCache.h" |
9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
10 #include "core/inspector/InspectorInstrumentation.h" | 10 #include "core/inspector/InspectorInstrumentation.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layout
View(), DisplayItem::DebugRedFill, contentRect, LayoutPoint()); | 82 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layout
View(), DisplayItem::DebugRedFill, contentRect, LayoutPoint()); |
83 } | 83 } |
84 #endif | 84 #endif |
85 | 85 |
86 LayoutView* layoutView = frameView().layoutView(); | 86 LayoutView* layoutView = frameView().layoutView(); |
87 if (!layoutView) { | 87 if (!layoutView) { |
88 WTF_LOG_ERROR("called FramePainter::paint with nil layoutObject"); | 88 WTF_LOG_ERROR("called FramePainter::paint with nil layoutObject"); |
89 return; | 89 return; |
90 } | 90 } |
91 | 91 |
92 RELEASE_ASSERT(!frameView().needsLayout()); | 92 if (!frameView().shouldThrottleRendering()) { |
93 ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingClean)
; | 93 RELEASE_ASSERT(!frameView().needsLayout()); |
| 94 ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingCl
ean); |
| 95 } |
94 | 96 |
95 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data
(layoutView, LayoutRect(rect), 0)); | 97 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data
(layoutView, LayoutRect(rect), 0)); |
96 | 98 |
97 bool isTopLevelPainter = !s_inPaintContents; | 99 bool isTopLevelPainter = !s_inPaintContents; |
98 s_inPaintContents = true; | 100 s_inPaintContents = true; |
99 | 101 |
100 FontCachePurgePreventer fontCachePurgePreventer; | 102 FontCachePurgePreventer fontCachePurgePreventer; |
101 | 103 |
102 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint | 104 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint |
103 // phase. Thus we should set this flag upfront (crbug.com/510280). | 105 // phase. Thus we should set this flag upfront (crbug.com/510280). |
104 GlobalPaintFlags localPaintFlags = globalPaintFlags; | 106 GlobalPaintFlags localPaintFlags = globalPaintFlags; |
105 if (document->printing()) | 107 if (document->printing()) |
106 localPaintFlags |= GlobalPaintFlattenCompositingLayers | GlobalPaintPrin
ting; | 108 localPaintFlags |= GlobalPaintFlattenCompositingLayers | GlobalPaintPrin
ting; |
107 | 109 |
108 ASSERT(!frameView().isPainting()); | 110 ASSERT(!frameView().isPainting()); |
109 frameView().setIsPainting(true); | 111 frameView().setIsPainting(true); |
110 | 112 |
111 PaintLayer* rootLayer = layoutView->layer(); | 113 PaintLayer* rootLayer = layoutView->layer(); |
112 | 114 |
113 #if ENABLE(ASSERT) | 115 #if ENABLE(ASSERT) |
114 layoutView->assertSubtreeIsLaidOut(); | 116 if (!frameView().shouldThrottleRendering()) |
| 117 layoutView->assertSubtreeIsLaidOut(); |
115 LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer-
>layoutObject()); | 118 LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer-
>layoutObject()); |
116 #endif | 119 #endif |
117 | 120 |
118 PaintLayerPainter layerPainter(*rootLayer); | 121 PaintLayerPainter layerPainter(*rootLayer); |
119 | 122 |
120 float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject()
->frame()); | 123 float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject()
->frame()); |
121 context.setDeviceScaleFactor(deviceScaleFactor); | 124 context.setDeviceScaleFactor(deviceScaleFactor); |
122 | 125 |
123 layerPainter.paint(context, LayoutRect(rect), localPaintFlags); | 126 layerPainter.paint(context, LayoutRect(rect), localPaintFlags); |
124 | 127 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 bar.paint(context, CullRect(rect)); | 185 bar.paint(context, CullRect(rect)); |
183 } | 186 } |
184 | 187 |
185 const FrameView& FramePainter::frameView() | 188 const FrameView& FramePainter::frameView() |
186 { | 189 { |
187 ASSERT(m_frameView); | 190 ASSERT(m_frameView); |
188 return *m_frameView; | 191 return *m_frameView; |
189 } | 192 } |
190 | 193 |
191 } // namespace blink | 194 } // namespace blink |
OLD | NEW |