| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layout
View(), DisplayItem::DebugRedFill, contentRect, LayoutPoint()); | 104 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layout
View(), DisplayItem::DebugRedFill, contentRect, LayoutPoint()); |
| 105 } | 105 } |
| 106 #endif | 106 #endif |
| 107 | 107 |
| 108 LayoutView* layoutView = frameView().layoutView(); | 108 LayoutView* layoutView = frameView().layoutView(); |
| 109 if (!layoutView) { | 109 if (!layoutView) { |
| 110 WTF_LOG_ERROR("called FramePainter::paint with nil layoutObject"); | 110 WTF_LOG_ERROR("called FramePainter::paint with nil layoutObject"); |
| 111 return; | 111 return; |
| 112 } | 112 } |
| 113 | 113 |
| 114 RELEASE_ASSERT(!frameView().needsLayout()); | 114 if (!frameView().shouldThrottleRendering()) { |
| 115 ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingClean)
; | 115 RELEASE_ASSERT(!frameView().needsLayout()); |
| 116 ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingCl
ean); |
| 117 } |
| 116 | 118 |
| 117 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data
(layoutView, LayoutRect(rect), 0)); | 119 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data
(layoutView, LayoutRect(rect), 0)); |
| 118 | 120 |
| 119 bool isTopLevelPainter = !s_inPaintContents; | 121 bool isTopLevelPainter = !s_inPaintContents; |
| 120 s_inPaintContents = true; | 122 s_inPaintContents = true; |
| 121 | 123 |
| 122 FontCachePurgePreventer fontCachePurgePreventer; | 124 FontCachePurgePreventer fontCachePurgePreventer; |
| 123 | 125 |
| 124 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint | 126 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint |
| 125 // phase. Thus we should set this flag upfront (crbug.com/510280). | 127 // phase. Thus we should set this flag upfront (crbug.com/510280). |
| 126 GlobalPaintFlags localPaintFlags = globalPaintFlags; | 128 GlobalPaintFlags localPaintFlags = globalPaintFlags; |
| 127 if (document->printing()) | 129 if (document->printing()) |
| 128 localPaintFlags |= GlobalPaintFlattenCompositingLayers | GlobalPaintPrin
ting; | 130 localPaintFlags |= GlobalPaintFlattenCompositingLayers | GlobalPaintPrin
ting; |
| 129 | 131 |
| 130 ASSERT(!frameView().isPainting()); | 132 ASSERT(!frameView().isPainting()); |
| 131 frameView().setIsPainting(true); | 133 frameView().setIsPainting(true); |
| 132 | 134 |
| 133 PaintLayer* rootLayer = layoutView->layer(); | 135 PaintLayer* rootLayer = layoutView->layer(); |
| 134 | 136 |
| 135 #if ENABLE(ASSERT) | 137 #if ENABLE(ASSERT) |
| 136 layoutView->assertSubtreeIsLaidOut(); | 138 if (!frameView().shouldThrottleRendering()) |
| 139 layoutView->assertSubtreeIsLaidOut(); |
| 137 LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer-
>layoutObject()); | 140 LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer-
>layoutObject()); |
| 138 #endif | 141 #endif |
| 139 | 142 |
| 140 PaintLayerPainter layerPainter(*rootLayer); | 143 PaintLayerPainter layerPainter(*rootLayer); |
| 141 | 144 |
| 142 float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject()
->frame()); | 145 float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject()
->frame()); |
| 143 context.setDeviceScaleFactor(deviceScaleFactor); | 146 context.setDeviceScaleFactor(deviceScaleFactor); |
| 144 | 147 |
| 145 layerPainter.paint(context, LayoutRect(rect), localPaintFlags); | 148 layerPainter.paint(context, LayoutRect(rect), localPaintFlags); |
| 146 | 149 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 bar.paint(context, CullRect(rect)); | 207 bar.paint(context, CullRect(rect)); |
| 205 } | 208 } |
| 206 | 209 |
| 207 const FrameView& FramePainter::frameView() | 210 const FrameView& FramePainter::frameView() |
| 208 { | 211 { |
| 209 ASSERT(m_frameView); | 212 ASSERT(m_frameView); |
| 210 return *m_frameView; | 213 return *m_frameView; |
| 211 } | 214 } |
| 212 | 215 |
| 213 } // namespace blink | 216 } // namespace blink |
| OLD | NEW |