| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layout
View(), DisplayItem::DebugRedFill, contentRect, LayoutPoint()); | 84 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layout
View(), DisplayItem::DebugRedFill, contentRect, LayoutPoint()); |
| 85 } | 85 } |
| 86 #endif | 86 #endif |
| 87 | 87 |
| 88 LayoutView* layoutView = frameView().layoutView(); | 88 LayoutView* layoutView = frameView().layoutView(); |
| 89 if (!layoutView) { | 89 if (!layoutView) { |
| 90 WTF_LOG_ERROR("called FramePainter::paint with nil layoutObject"); | 90 WTF_LOG_ERROR("called FramePainter::paint with nil layoutObject"); |
| 91 return; | 91 return; |
| 92 } | 92 } |
| 93 | 93 |
| 94 RELEASE_ASSERT(!frameView().needsLayout()); | 94 if (!frameView().shouldThrottleRendering()) { |
| 95 ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingClean)
; | 95 RELEASE_ASSERT(!frameView().needsLayout()); |
| 96 ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingCl
ean); |
| 97 } |
| 96 | 98 |
| 97 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data
(layoutView, LayoutRect(rect), 0)); | 99 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data
(layoutView, LayoutRect(rect), 0)); |
| 98 | 100 |
| 99 bool isTopLevelPainter = !s_inPaintContents; | 101 bool isTopLevelPainter = !s_inPaintContents; |
| 100 s_inPaintContents = true; | 102 s_inPaintContents = true; |
| 101 | 103 |
| 102 FontCachePurgePreventer fontCachePurgePreventer; | 104 FontCachePurgePreventer fontCachePurgePreventer; |
| 103 | 105 |
| 104 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint | 106 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint |
| 105 // phase. Thus we should set this flag upfront (crbug.com/510280). | 107 // phase. Thus we should set this flag upfront (crbug.com/510280). |
| 106 GlobalPaintFlags localPaintFlags = globalPaintFlags; | 108 GlobalPaintFlags localPaintFlags = globalPaintFlags; |
| 107 if (document->printing()) | 109 if (document->printing()) |
| 108 localPaintFlags |= GlobalPaintFlattenCompositingLayers | GlobalPaintPrin
ting; | 110 localPaintFlags |= GlobalPaintFlattenCompositingLayers | GlobalPaintPrin
ting; |
| 109 | 111 |
| 110 ASSERT(!frameView().isPainting()); | 112 ASSERT(!frameView().isPainting()); |
| 111 frameView().setIsPainting(true); | 113 frameView().setIsPainting(true); |
| 112 | 114 |
| 113 // frameView().nodeToDraw() is used to draw only one element (and its descen
dants) | 115 // frameView().nodeToDraw() is used to draw only one element (and its descen
dants) |
| 114 LayoutObject* layoutObject = frameView().nodeToDraw() ? frameView().nodeToDr
aw()->layoutObject() : 0; | 116 LayoutObject* layoutObject = frameView().nodeToDraw() ? frameView().nodeToDr
aw()->layoutObject() : 0; |
| 115 PaintLayer* rootLayer = layoutView->layer(); | 117 PaintLayer* rootLayer = layoutView->layer(); |
| 116 | 118 |
| 117 #if ENABLE(ASSERT) | 119 #if ENABLE(ASSERT) |
| 118 layoutView->assertSubtreeIsLaidOut(); | 120 if (!frameView().shouldThrottleRendering()) |
| 121 layoutView->assertSubtreeIsLaidOut(); |
| 119 LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer-
>layoutObject()); | 122 LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer-
>layoutObject()); |
| 120 #endif | 123 #endif |
| 121 | 124 |
| 122 PaintLayerPainter layerPainter(*rootLayer); | 125 PaintLayerPainter layerPainter(*rootLayer); |
| 123 | 126 |
| 124 float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject()
->frame()); | 127 float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject()
->frame()); |
| 125 context.setDeviceScaleFactor(deviceScaleFactor); | 128 context.setDeviceScaleFactor(deviceScaleFactor); |
| 126 | 129 |
| 127 layerPainter.paint(context, LayoutRect(rect), localPaintFlags, layoutObject)
; | 130 layerPainter.paint(context, LayoutRect(rect), localPaintFlags, layoutObject)
; |
| 128 | 131 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 bar.paint(context, CullRect(rect)); | 189 bar.paint(context, CullRect(rect)); |
| 187 } | 190 } |
| 188 | 191 |
| 189 const FrameView& FramePainter::frameView() | 192 const FrameView& FramePainter::frameView() |
| 190 { | 193 { |
| 191 ASSERT(m_frameView); | 194 ASSERT(m_frameView); |
| 192 return *m_frameView; | 195 return *m_frameView; |
| 193 } | 196 } |
| 194 | 197 |
| 195 } // namespace blink | 198 } // namespace blink |
| OLD | NEW |