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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2872793002: Notify paint for each frame (Closed)
Patch Set: Update PageLoadMetrics tests 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 3218 matching lines...) Expand 10 before | Expand all | Expand 10 after
3229 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { 3229 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) {
3230 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime"); 3230 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime");
3231 PrePaintTreeWalk().Walk(*this); 3231 PrePaintTreeWalk().Walk(*this);
3232 } 3232 }
3233 3233
3234 ForAllNonThrottledFrameViews([](FrameView& frame_view) { 3234 ForAllNonThrottledFrameViews([](FrameView& frame_view) {
3235 frame_view.Lifecycle().AdvanceTo(DocumentLifecycle::kPrePaintClean); 3235 frame_view.Lifecycle().AdvanceTo(DocumentLifecycle::kPrePaintClean);
3236 }); 3236 });
3237 } 3237 }
3238 3238
3239 void FrameView::NotifyPaint(const PaintController& paint_controller) const {
3240 DCHECK(frame_->GetDocument());
3241 PaintTiming::From(*frame_->GetDocument())
3242 .NotifyPaint(paint_controller.FirstPainted(),
3243 paint_controller.TextPainted(),
3244 paint_controller.ImagePainted());
3245 }
3246
3247 void FrameView::PaintTree() { 3239 void FrameView::PaintTree() {
3248 TRACE_EVENT0("blink", "FrameView::paintTree"); 3240 TRACE_EVENT0("blink", "FrameView::paintTree");
3249 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime"); 3241 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime");
3250 3242
3251 ASSERT(GetFrame() == GetPage()->MainFrame() || 3243 ASSERT(GetFrame() == GetPage()->MainFrame() ||
3252 (!GetFrame().Tree().Parent()->IsLocalFrame())); 3244 (!GetFrame().Tree().Parent()->IsLocalFrame()));
3253 3245
3254 LayoutViewItem view = GetLayoutViewItem(); 3246 LayoutViewItem view = GetLayoutViewItem();
3255 DCHECK(!view.IsNull()); 3247 DCHECK(!view.IsNull());
3256 ForAllNonThrottledFrameViews([](FrameView& frame_view) { 3248 ForAllNonThrottledFrameViews([](FrameView& frame_view) {
3257 frame_view.Lifecycle().AdvanceTo(DocumentLifecycle::kInPaint); 3249 frame_view.Lifecycle().AdvanceTo(DocumentLifecycle::kInPaint);
3258 }); 3250 });
3259 3251
3260 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 3252 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
3261 if (GetLayoutView()->Layer()->NeedsRepaint()) { 3253 if (GetLayoutView()->Layer()->NeedsRepaint()) {
3262 GraphicsContext graphics_context(*paint_controller_); 3254 GraphicsContext graphics_context(*paint_controller_);
3263 if (RuntimeEnabledFeatures::printBrowserEnabled()) 3255 if (RuntimeEnabledFeatures::printBrowserEnabled())
3264 graphics_context.SetPrinting(true); 3256 graphics_context.SetPrinting(true);
3265 Paint(graphics_context, CullRect(LayoutRect::InfiniteIntRect())); 3257 Paint(graphics_context, CullRect(LayoutRect::InfiniteIntRect()));
3266 paint_controller_->CommitNewDisplayItems(LayoutSize()); 3258 paint_controller_->CommitNewDisplayItems(LayoutSize());
3267 NotifyPaint(*paint_controller_);
3268 } 3259 }
3269 } else { 3260 } else {
3270 // A null graphics layer can occur for painting of SVG images that are not 3261 // A null graphics layer can occur for painting of SVG images that are not
3271 // parented into the main frame tree, or when the FrameView is the main 3262 // parented into the main frame tree, or when the FrameView is the main
3272 // frame view of a page overlay. The page overlay is in the layer tree of 3263 // frame view of a page overlay. The page overlay is in the layer tree of
3273 // the host page and will be painted during painting of the host page. 3264 // the host page and will be painted during painting of the host page.
3274 if (GraphicsLayer* root_graphics_layer = 3265 if (GraphicsLayer* root_graphics_layer =
3275 view.Compositor()->RootGraphicsLayer()) { 3266 view.Compositor()->RootGraphicsLayer()) {
3276 PaintGraphicsLayerRecursively(root_graphics_layer); 3267 PaintGraphicsLayerRecursively(root_graphics_layer);
3277 } 3268 }
(...skipping 21 matching lines...) Expand all
3299 LayoutViewItem layout_view_item = frame_view.GetLayoutViewItem(); 3290 LayoutViewItem layout_view_item = frame_view.GetLayoutViewItem();
3300 if (!layout_view_item.IsNull()) 3291 if (!layout_view_item.IsNull())
3301 layout_view_item.Layer()->ClearNeedsRepaintRecursively(); 3292 layout_view_item.Layer()->ClearNeedsRepaintRecursively();
3302 }); 3293 });
3303 } 3294 }
3304 3295
3305 void FrameView::PaintGraphicsLayerRecursively(GraphicsLayer* graphics_layer) { 3296 void FrameView::PaintGraphicsLayerRecursively(GraphicsLayer* graphics_layer) {
3306 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 3297 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
3307 if (graphics_layer->DrawsContent()) { 3298 if (graphics_layer->DrawsContent()) {
3308 graphics_layer->Paint(nullptr); 3299 graphics_layer->Paint(nullptr);
3309 NotifyPaint(graphics_layer->GetPaintController());
3310 } 3300 }
3311 3301
3312 if (GraphicsLayer* mask_layer = graphics_layer->MaskLayer()) 3302 if (GraphicsLayer* mask_layer = graphics_layer->MaskLayer())
3313 PaintGraphicsLayerRecursively(mask_layer); 3303 PaintGraphicsLayerRecursively(mask_layer);
3314 if (GraphicsLayer* contents_clipping_mask_layer = 3304 if (GraphicsLayer* contents_clipping_mask_layer =
3315 graphics_layer->ContentsClippingMaskLayer()) 3305 graphics_layer->ContentsClippingMaskLayer())
3316 PaintGraphicsLayerRecursively(contents_clipping_mask_layer); 3306 PaintGraphicsLayerRecursively(contents_clipping_mask_layer);
3317 3307
3318 for (auto& child : graphics_layer->Children()) 3308 for (auto& child : graphics_layer->Children())
3319 PaintGraphicsLayerRecursively(child); 3309 PaintGraphicsLayerRecursively(child);
(...skipping 2079 matching lines...) Expand 10 before | Expand all | Expand 10 after
5399 void FrameView::SetAnimationHost( 5389 void FrameView::SetAnimationHost(
5400 std::unique_ptr<CompositorAnimationHost> host) { 5390 std::unique_ptr<CompositorAnimationHost> host) {
5401 animation_host_ = std::move(host); 5391 animation_host_ = std::move(host);
5402 } 5392 }
5403 5393
5404 LayoutUnit FrameView::CaretWidth() const { 5394 LayoutUnit FrameView::CaretWidth() const {
5405 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); 5395 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1));
5406 } 5396 }
5407 5397
5408 } // namespace blink 5398 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698