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

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

Issue 2872793002: Notify paint for each frame (Closed)
Patch Set: review fix 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 3224 matching lines...) Expand 10 before | Expand all | Expand 10 after
3235 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { 3235 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) {
3236 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime"); 3236 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime");
3237 PrePaintTreeWalk().Walk(*this); 3237 PrePaintTreeWalk().Walk(*this);
3238 } 3238 }
3239 3239
3240 ForAllNonThrottledFrameViews([](FrameView& frame_view) { 3240 ForAllNonThrottledFrameViews([](FrameView& frame_view) {
3241 frame_view.Lifecycle().AdvanceTo(DocumentLifecycle::kPrePaintClean); 3241 frame_view.Lifecycle().AdvanceTo(DocumentLifecycle::kPrePaintClean);
3242 }); 3242 });
3243 } 3243 }
3244 3244
3245 void FrameView::NotifyPaint(const PaintController& paint_controller) const {
3246 DCHECK(frame_->GetDocument());
3247 PaintTiming::From(*frame_->GetDocument())
3248 .NotifyPaint(paint_controller.FirstPainted(),
3249 paint_controller.TextPainted(),
3250 paint_controller.ImagePainted());
3251 }
3252
3253 void FrameView::PaintTree() { 3245 void FrameView::PaintTree() {
3254 TRACE_EVENT0("blink", "FrameView::paintTree"); 3246 TRACE_EVENT0("blink", "FrameView::paintTree");
3255 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime"); 3247 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime");
3256 3248
3257 ASSERT(GetFrame() == GetPage()->MainFrame() || 3249 ASSERT(GetFrame() == GetPage()->MainFrame() ||
3258 (!GetFrame().Tree().Parent()->IsLocalFrame())); 3250 (!GetFrame().Tree().Parent()->IsLocalFrame()));
3259 3251
3260 LayoutViewItem view = GetLayoutViewItem(); 3252 LayoutViewItem view = GetLayoutViewItem();
3261 ASSERT(!view.IsNull()); 3253 ASSERT(!view.IsNull());
3262 ForAllNonThrottledFrameViews([](FrameView& frame_view) { 3254 ForAllNonThrottledFrameViews([](FrameView& frame_view) {
3263 frame_view.Lifecycle().AdvanceTo(DocumentLifecycle::kInPaint); 3255 frame_view.Lifecycle().AdvanceTo(DocumentLifecycle::kInPaint);
3264 }); 3256 });
3265 3257
3266 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 3258 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
3267 if (GetLayoutView()->Layer()->NeedsRepaint()) { 3259 if (GetLayoutView()->Layer()->NeedsRepaint()) {
3268 GraphicsContext graphics_context(*paint_controller_); 3260 GraphicsContext graphics_context(*paint_controller_);
3269 if (RuntimeEnabledFeatures::printBrowserEnabled()) 3261 if (RuntimeEnabledFeatures::printBrowserEnabled())
3270 graphics_context.SetPrinting(true); 3262 graphics_context.SetPrinting(true);
3271 Paint(graphics_context, CullRect(LayoutRect::InfiniteIntRect())); 3263 Paint(graphics_context, CullRect(LayoutRect::InfiniteIntRect()));
3272 paint_controller_->CommitNewDisplayItems(LayoutSize()); 3264 paint_controller_->CommitNewDisplayItems(LayoutSize());
3273 NotifyPaint(*paint_controller_);
3274 } 3265 }
3275 } else { 3266 } else {
3276 // A null graphics layer can occur for painting of SVG images that are not 3267 // A null graphics layer can occur for painting of SVG images that are not
3277 // parented into the main frame tree, or when the FrameView is the main 3268 // parented into the main frame tree, or when the FrameView is the main
3278 // frame view of a page overlay. The page overlay is in the layer tree of 3269 // frame view of a page overlay. The page overlay is in the layer tree of
3279 // the host page and will be painted during painting of the host page. 3270 // the host page and will be painted during painting of the host page.
3280 if (GraphicsLayer* root_graphics_layer = 3271 if (GraphicsLayer* root_graphics_layer =
3281 view.Compositor()->RootGraphicsLayer()) { 3272 view.Compositor()->RootGraphicsLayer()) {
3282 PaintGraphicsLayerRecursively(root_graphics_layer); 3273 PaintGraphicsLayerRecursively(root_graphics_layer);
3283 } 3274 }
(...skipping 21 matching lines...) Expand all
3305 LayoutViewItem layout_view_item = frame_view.GetLayoutViewItem(); 3296 LayoutViewItem layout_view_item = frame_view.GetLayoutViewItem();
3306 if (!layout_view_item.IsNull()) 3297 if (!layout_view_item.IsNull())
3307 layout_view_item.Layer()->ClearNeedsRepaintRecursively(); 3298 layout_view_item.Layer()->ClearNeedsRepaintRecursively();
3308 }); 3299 });
3309 } 3300 }
3310 3301
3311 void FrameView::PaintGraphicsLayerRecursively(GraphicsLayer* graphics_layer) { 3302 void FrameView::PaintGraphicsLayerRecursively(GraphicsLayer* graphics_layer) {
3312 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 3303 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
3313 if (graphics_layer->DrawsContent()) { 3304 if (graphics_layer->DrawsContent()) {
3314 graphics_layer->Paint(nullptr); 3305 graphics_layer->Paint(nullptr);
3315 NotifyPaint(graphics_layer->GetPaintController());
3316 } 3306 }
3317 3307
3318 if (GraphicsLayer* mask_layer = graphics_layer->MaskLayer()) 3308 if (GraphicsLayer* mask_layer = graphics_layer->MaskLayer())
3319 PaintGraphicsLayerRecursively(mask_layer); 3309 PaintGraphicsLayerRecursively(mask_layer);
3320 if (GraphicsLayer* contents_clipping_mask_layer = 3310 if (GraphicsLayer* contents_clipping_mask_layer =
3321 graphics_layer->ContentsClippingMaskLayer()) 3311 graphics_layer->ContentsClippingMaskLayer())
3322 PaintGraphicsLayerRecursively(contents_clipping_mask_layer); 3312 PaintGraphicsLayerRecursively(contents_clipping_mask_layer);
3323 3313
3324 for (auto& child : graphics_layer->Children()) 3314 for (auto& child : graphics_layer->Children())
3325 PaintGraphicsLayerRecursively(child); 3315 PaintGraphicsLayerRecursively(child);
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
4689 } 4679 }
4690 4680
4691 void FrameView::Paint(GraphicsContext& context, 4681 void FrameView::Paint(GraphicsContext& context,
4692 const CullRect& cull_rect) const { 4682 const CullRect& cull_rect) const {
4693 Paint(context, kGlobalPaintNormalPhase, cull_rect); 4683 Paint(context, kGlobalPaintNormalPhase, cull_rect);
4694 } 4684 }
4695 4685
4696 void FrameView::Paint(GraphicsContext& context, 4686 void FrameView::Paint(GraphicsContext& context,
4697 const GlobalPaintFlags global_paint_flags, 4687 const GlobalPaintFlags global_paint_flags,
4698 const CullRect& cull_rect) const { 4688 const CullRect& cull_rect) const {
4699 FramePainter(*this).Paint(context, global_paint_flags, cull_rect); 4689 FramePainter(context, *this).Paint(global_paint_flags, cull_rect);
4700 } 4690 }
4701 4691
4702 void FrameView::PaintContents(GraphicsContext& context, 4692 void FrameView::PaintContents(GraphicsContext& context,
4703 const GlobalPaintFlags global_paint_flags, 4693 const GlobalPaintFlags global_paint_flags,
4704 const IntRect& damage_rect) const { 4694 const IntRect& damage_rect) const {
4705 FramePainter(*this).PaintContents(context, global_paint_flags, damage_rect); 4695 FramePainter(context, *this).PaintContents(global_paint_flags, damage_rect);
4706 } 4696 }
4707 4697
4708 bool FrameView::IsPointInScrollbarCorner(const IntPoint& point_in_root_frame) { 4698 bool FrameView::IsPointInScrollbarCorner(const IntPoint& point_in_root_frame) {
4709 if (!ScrollbarCornerPresent()) 4699 if (!ScrollbarCornerPresent())
4710 return false; 4700 return false;
4711 4701
4712 IntPoint frame_point = ConvertFromRootFrame(point_in_root_frame); 4702 IntPoint frame_point = ConvertFromRootFrame(point_in_root_frame);
4713 4703
4714 if (HorizontalScrollbar()) { 4704 if (HorizontalScrollbar()) {
4715 int horizontal_scrollbar_y_min = HorizontalScrollbar()->FrameRect().Y(); 4705 int horizontal_scrollbar_y_min = HorizontalScrollbar()->FrameRect().Y();
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
5383 void FrameView::SetAnimationHost( 5373 void FrameView::SetAnimationHost(
5384 std::unique_ptr<CompositorAnimationHost> host) { 5374 std::unique_ptr<CompositorAnimationHost> host) {
5385 animation_host_ = std::move(host); 5375 animation_host_ = std::move(host);
5386 } 5376 }
5387 5377
5388 LayoutUnit FrameView::CaretWidth() const { 5378 LayoutUnit FrameView::CaretWidth() const {
5389 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); 5379 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1));
5390 } 5380 }
5391 5381
5392 } // namespace blink 5382 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698