Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp

Issue 2893803002: Fix DCHECK failure when PaintLayerContents() paints layer in throttled frame (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/PaintLayerPainter.h" 5 #include "core/paint/PaintLayerPainter.h"
6 6
7 #include "core/frame/LocalFrame.h" 7 #include "core/frame/FrameView.h"
8 #include "core/layout/LayoutView.h" 8 #include "core/layout/LayoutView.h"
9 #include "core/paint/ClipPathClipper.h" 9 #include "core/paint/ClipPathClipper.h"
10 #include "core/paint/FilterPainter.h" 10 #include "core/paint/FilterPainter.h"
11 #include "core/paint/LayerClipRecorder.h" 11 #include "core/paint/LayerClipRecorder.h"
12 #include "core/paint/LayoutObjectDrawingRecorder.h" 12 #include "core/paint/LayoutObjectDrawingRecorder.h"
13 #include "core/paint/ObjectPaintProperties.h" 13 #include "core/paint/ObjectPaintProperties.h"
14 #include "core/paint/PaintInfo.h" 14 #include "core/paint/PaintInfo.h"
15 #include "core/paint/PaintLayer.h" 15 #include "core/paint/PaintLayer.h"
16 #include "core/paint/ScrollRecorder.h" 16 #include "core/paint/ScrollRecorder.h"
17 #include "core/paint/ScrollableAreaPainter.h" 17 #include "core/paint/ScrollableAreaPainter.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return true; 98 return true;
99 } 99 }
100 } 100 }
101 return false; 101 return false;
102 } 102 }
103 103
104 PaintResult PaintLayerPainter::Paint( 104 PaintResult PaintLayerPainter::Paint(
105 GraphicsContext& context, 105 GraphicsContext& context,
106 const PaintLayerPaintingInfo& painting_info, 106 const PaintLayerPaintingInfo& painting_info,
107 PaintLayerFlags paint_flags) { 107 PaintLayerFlags paint_flags) {
108 if (paint_layer_.GetLayoutObject().GetFrameView()->ShouldThrottleRendering())
109 return kFullyPainted;
110
108 // https://code.google.com/p/chromium/issues/detail?id=343772 111 // https://code.google.com/p/chromium/issues/detail?id=343772
109 DisableCompositingQueryAsserts disabler; 112 DisableCompositingQueryAsserts disabler;
110 113
111 if (paint_layer_.GetCompositingState() != kNotComposited) { 114 if (paint_layer_.GetCompositingState() != kNotComposited) {
112 if (painting_info.GetGlobalPaintFlags() & 115 if (painting_info.GetGlobalPaintFlags() &
113 kGlobalPaintFlattenCompositingLayers) { 116 kGlobalPaintFlattenCompositingLayers) {
114 // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? That's 117 // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? That's
115 // for printing and drag-image. 118 // for printing and drag-image.
116 // FIXME: why isn't the code here global, as opposed to being set on each 119 // FIXME: why isn't the code here global, as opposed to being set on each
117 // paint() call? 120 // paint() call?
118 paint_flags |= kPaintLayerUncachedClipRects; 121 paint_flags |= kPaintLayerUncachedClipRects;
119 } 122 }
120 } 123 }
121 124
122 // Non self-painting layers without self-painting descendants don't need to be 125 // Non self-painting layers without self-painting descendants don't need to be
123 // painted as their layoutObject() should properly paint itself. 126 // painted as their layoutObject() should properly paint itself.
124 if (!paint_layer_.IsSelfPaintingLayer() && 127 if (!paint_layer_.IsSelfPaintingLayer() &&
125 !paint_layer_.HasSelfPaintingLayerDescendant()) 128 !paint_layer_.HasSelfPaintingLayerDescendant())
126 return kFullyPainted; 129 return kFullyPainted;
127 130
128 if (ShouldSuppressPaintingLayer(paint_layer_)) 131 if (ShouldSuppressPaintingLayer(paint_layer_))
129 return kFullyPainted; 132 return kFullyPainted;
130 133
131 if (paint_layer_.GetLayoutObject().View()->GetFrame() &&
132 paint_layer_.GetLayoutObject()
133 .View()
134 ->GetFrame()
135 ->ShouldThrottleRendering())
136 return kFullyPainted;
137
138 // If this layer is totally invisible then there is nothing to paint. In SPv2 134 // If this layer is totally invisible then there is nothing to paint. In SPv2
139 // we simplify this optimization by painting even when effectively invisible 135 // we simplify this optimization by painting even when effectively invisible
140 // but skipping the painted content during layerization in 136 // but skipping the painted content during layerization in
141 // PaintArtifactCompositor. 137 // PaintArtifactCompositor.
142 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && 138 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() &&
143 PaintedOutputInvisible(painting_info)) { 139 PaintedOutputInvisible(painting_info)) {
144 return kFullyPainted; 140 return kFullyPainted;
145 } 141 }
146 142
147 if (paint_layer_.PaintsWithTransparency(painting_info.GetGlobalPaintFlags())) 143 if (paint_layer_.PaintsWithTransparency(painting_info.GetGlobalPaintFlags()))
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 painting_info.scroll_offset_accumulation); 261 painting_info.scroll_offset_accumulation);
266 262
267 return needs_repaint; 263 return needs_repaint;
268 } 264 }
269 265
270 PaintResult PaintLayerPainter::PaintLayerContents( 266 PaintResult PaintLayerPainter::PaintLayerContents(
271 GraphicsContext& context, 267 GraphicsContext& context,
272 const PaintLayerPaintingInfo& painting_info_arg, 268 const PaintLayerPaintingInfo& painting_info_arg,
273 PaintLayerFlags paint_flags, 269 PaintLayerFlags paint_flags,
274 FragmentPolicy fragment_policy) { 270 FragmentPolicy fragment_policy) {
271 PaintResult result = kFullyPainted;
272
273 if (paint_layer_.GetLayoutObject().GetFrameView()->ShouldThrottleRendering())
274 return result;
275
275 Optional<ScopedPaintChunkProperties> scoped_paint_chunk_properties; 276 Optional<ScopedPaintChunkProperties> scoped_paint_chunk_properties;
276 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && 277 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() &&
277 RuntimeEnabledFeatures::rootLayerScrollingEnabled() && 278 RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
278 paint_layer_.GetLayoutObject().IsLayoutView()) { 279 paint_layer_.GetLayoutObject().IsLayoutView()) {
279 const auto* local_border_box_properties = 280 const auto* local_border_box_properties =
280 paint_layer_.GetLayoutObject().LocalBorderBoxProperties(); 281 paint_layer_.GetLayoutObject().LocalBorderBoxProperties();
281 DCHECK(local_border_box_properties); 282 DCHECK(local_border_box_properties);
282 PaintChunkProperties properties( 283 PaintChunkProperties properties(
283 context.GetPaintController().CurrentPaintChunkProperties()); 284 context.GetPaintController().CurrentPaintChunkProperties());
284 properties.property_tree_state = *local_border_box_properties; 285 properties.property_tree_state = *local_border_box_properties;
(...skipping 21 matching lines...) Expand all
306 bool is_painting_overflow_contents = 307 bool is_painting_overflow_contents =
307 paint_flags & kPaintLayerPaintingOverflowContents; 308 paint_flags & kPaintLayerPaintingOverflowContents;
308 // Outline always needs to be painted even if we have no visible content. 309 // Outline always needs to be painted even if we have no visible content.
309 // It is painted as part of the decoration phase which paints content that 310 // It is painted as part of the decoration phase which paints content that
310 // is not scrolled and should be above scrolled content. 311 // is not scrolled and should be above scrolled content.
311 bool should_paint_self_outline = 312 bool should_paint_self_outline =
312 is_self_painting_layer && !is_painting_overlay_scrollbars && 313 is_self_painting_layer && !is_painting_overlay_scrollbars &&
313 (is_painting_composited_decoration || !is_painting_scrolling_content) && 314 (is_painting_composited_decoration || !is_painting_scrolling_content) &&
314 paint_layer_.GetLayoutObject().StyleRef().HasOutline(); 315 paint_layer_.GetLayoutObject().StyleRef().HasOutline();
315 316
316 PaintResult result = kFullyPainted;
317
318 if (paint_flags & kPaintLayerPaintingRootBackgroundOnly && 317 if (paint_flags & kPaintLayerPaintingRootBackgroundOnly &&
319 !paint_layer_.GetLayoutObject().IsLayoutView()) 318 !paint_layer_.GetLayoutObject().IsLayoutView())
320 return result; 319 return result;
321 320
322 if (paint_layer_.GetLayoutObject().View()->GetFrame() &&
323 paint_layer_.GetLayoutObject()
324 .View()
325 ->GetFrame()
326 ->ShouldThrottleRendering())
327 return result;
328
329 // Ensure our lists are up to date. 321 // Ensure our lists are up to date.
330 paint_layer_.StackingNode()->UpdateLayerListsIfNeeded(); 322 paint_layer_.StackingNode()->UpdateLayerListsIfNeeded();
331 323
332 LayoutSize subpixel_accumulation = 324 LayoutSize subpixel_accumulation =
333 paint_layer_.GetCompositingState() == kPaintsIntoOwnBacking 325 paint_layer_.GetCompositingState() == kPaintsIntoOwnBacking
334 ? paint_layer_.SubpixelAccumulation() 326 ? paint_layer_.SubpixelAccumulation()
335 : painting_info_arg.sub_pixel_accumulation; 327 : painting_info_arg.sub_pixel_accumulation;
336 ShouldRespectOverflowClipType respect_overflow_clip = 328 ShouldRespectOverflowClipType respect_overflow_clip =
337 ShouldRespectOverflowClip(paint_flags, paint_layer_.GetLayoutObject()); 329 ShouldRespectOverflowClip(paint_flags, paint_layer_.GetLayoutObject());
338 330
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 context, layout_object, kPaintPhaseClippingMask)) 1254 context, layout_object, kPaintPhaseClippingMask))
1263 return; 1255 return;
1264 1256
1265 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); 1257 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect());
1266 LayoutObjectDrawingRecorder drawing_recorder( 1258 LayoutObjectDrawingRecorder drawing_recorder(
1267 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect); 1259 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect);
1268 context.FillRect(snapped_clip_rect, Color::kBlack); 1260 context.FillRect(snapped_clip_rect, Color::kBlack);
1269 } 1261 }
1270 1262
1271 } // namespace blink 1263 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698