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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 if (frameView().shouldThrottleRendering() || !document->isActive()) | 119 if (frameView().shouldThrottleRendering() || !document->isActive()) |
120 return; | 120 return; |
121 | 121 |
122 LayoutView* layoutView = frameView().layoutView(); | 122 LayoutView* layoutView = frameView().layoutView(); |
123 if (!layoutView) { | 123 if (!layoutView) { |
124 DLOG(ERROR) << "called FramePainter::paint with nil layoutObject"; | 124 DLOG(ERROR) << "called FramePainter::paint with nil layoutObject"; |
125 return; | 125 return; |
126 } | 126 } |
127 | 127 |
128 // TODO(crbug.com/590856): It's still broken when we choose not to crash when
the check fails. | 128 // TODO(crbug.com/590856): It's still broken when we choose not to crash when |
| 129 // the check fails. |
129 if (!frameView().checkDoesNotNeedLayout()) | 130 if (!frameView().checkDoesNotNeedLayout()) |
130 return; | 131 return; |
131 | 132 |
132 // TODO(wangxianzhu): The following check should be stricter, but currently th
is is blocked | 133 // TODO(wangxianzhu): The following check should be stricter, but currently |
133 // by the svg root issue (crbug.com/442939). | 134 // this is blocked by the svg root issue (crbug.com/442939). |
134 DCHECK(document->lifecycle().state() >= DocumentLifecycle::CompositingClean); | 135 DCHECK(document->lifecycle().state() >= DocumentLifecycle::CompositingClean); |
135 | 136 |
136 TRACE_EVENT1("devtools.timeline,rail", "Paint", "data", | 137 TRACE_EVENT1("devtools.timeline,rail", "Paint", "data", |
137 InspectorPaintEvent::data(layoutView, LayoutRect(rect), 0)); | 138 InspectorPaintEvent::data(layoutView, LayoutRect(rect), 0)); |
138 | 139 |
139 bool isTopLevelPainter = !s_inPaintContents; | 140 bool isTopLevelPainter = !s_inPaintContents; |
140 s_inPaintContents = true; | 141 s_inPaintContents = true; |
141 | 142 |
142 FontCachePurgePreventer fontCachePurgePreventer; | 143 FontCachePurgePreventer fontCachePurgePreventer; |
143 | 144 |
(...skipping 17 matching lines...) Expand all Loading... |
161 float deviceScaleFactor = | 162 float deviceScaleFactor = |
162 blink::deviceScaleFactor(rootLayer->layoutObject()->frame()); | 163 blink::deviceScaleFactor(rootLayer->layoutObject()->frame()); |
163 context.setDeviceScaleFactor(deviceScaleFactor); | 164 context.setDeviceScaleFactor(deviceScaleFactor); |
164 | 165 |
165 layerPainter.paint(context, LayoutRect(rect), localPaintFlags); | 166 layerPainter.paint(context, LayoutRect(rect), localPaintFlags); |
166 | 167 |
167 if (rootLayer->containsDirtyOverlayScrollbars()) | 168 if (rootLayer->containsDirtyOverlayScrollbars()) |
168 layerPainter.paintOverlayScrollbars(context, LayoutRect(rect), | 169 layerPainter.paintOverlayScrollbars(context, LayoutRect(rect), |
169 localPaintFlags); | 170 localPaintFlags); |
170 | 171 |
171 // Regions may have changed as a result of the visibility/z-index of element c
hanging. | 172 // Regions may have changed as a result of the visibility/z-index of element |
| 173 // changing. |
172 if (document->annotatedRegionsDirty()) | 174 if (document->annotatedRegionsDirty()) |
173 frameView().updateDocumentAnnotatedRegions(); | 175 frameView().updateDocumentAnnotatedRegions(); |
174 | 176 |
175 if (isTopLevelPainter) { | 177 if (isTopLevelPainter) { |
176 // Everything that happens after paintContents completions is considered | 178 // Everything that happens after paintContents completions is considered |
177 // to be part of the next frame. | 179 // to be part of the next frame. |
178 memoryCache()->updateFramePaintTimestamp(); | 180 memoryCache()->updateFramePaintTimestamp(); |
179 s_inPaintContents = false; | 181 s_inPaintContents = false; |
180 } | 182 } |
181 | 183 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 236 |
235 bar.paint(context, CullRect(rect)); | 237 bar.paint(context, CullRect(rect)); |
236 } | 238 } |
237 | 239 |
238 const FrameView& FramePainter::frameView() { | 240 const FrameView& FramePainter::frameView() { |
239 ASSERT(m_frameView); | 241 ASSERT(m_frameView); |
240 return *m_frameView; | 242 return *m_frameView; |
241 } | 243 } |
242 | 244 |
243 } // namespace blink | 245 } // namespace blink |
OLD | NEW |