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

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

Issue 2665823002: Invalidate caret during paint invalidation (Closed)
Patch Set: Rebaseline Created 3 years, 10 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 #include "core/loader/FrameLoader.h" 86 #include "core/loader/FrameLoader.h"
87 #include "core/loader/FrameLoaderClient.h" 87 #include "core/loader/FrameLoaderClient.h"
88 #include "core/page/AutoscrollController.h" 88 #include "core/page/AutoscrollController.h"
89 #include "core/page/ChromeClient.h" 89 #include "core/page/ChromeClient.h"
90 #include "core/page/FocusController.h" 90 #include "core/page/FocusController.h"
91 #include "core/page/FrameTree.h" 91 #include "core/page/FrameTree.h"
92 #include "core/page/Page.h" 92 #include "core/page/Page.h"
93 #include "core/page/scrolling/RootScrollerUtil.h" 93 #include "core/page/scrolling/RootScrollerUtil.h"
94 #include "core/page/scrolling/ScrollingCoordinator.h" 94 #include "core/page/scrolling/ScrollingCoordinator.h"
95 #include "core/page/scrolling/TopDocumentRootScrollerController.h" 95 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
96 #include "core/paint/BlockPaintInvalidator.h"
96 #include "core/paint/FramePainter.h" 97 #include "core/paint/FramePainter.h"
97 #include "core/paint/PaintLayer.h" 98 #include "core/paint/PaintLayer.h"
98 #include "core/paint/PaintTiming.h" 99 #include "core/paint/PaintTiming.h"
99 #include "core/paint/PrePaintTreeWalk.h" 100 #include "core/paint/PrePaintTreeWalk.h"
100 #include "core/plugins/PluginView.h" 101 #include "core/plugins/PluginView.h"
101 #include "core/style/ComputedStyle.h" 102 #include "core/style/ComputedStyle.h"
102 #include "core/svg/SVGDocumentExtensions.h" 103 #include "core/svg/SVGDocumentExtensions.h"
103 #include "core/svg/SVGSVGElement.h" 104 #include "core/svg/SVGSVGElement.h"
104 #include "platform/Histogram.h" 105 #include "platform/Histogram.h"
105 #include "platform/HostWindow.h" 106 #include "platform/HostWindow.h"
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 #endif 1334 #endif
1334 1335
1335 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); 1336 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean);
1336 } 1337 }
1337 1338
1338 void FrameView::invalidatePaintIfNeeded( 1339 void FrameView::invalidatePaintIfNeeded(
1339 const PaintInvalidationState& paintInvalidationState) { 1340 const PaintInvalidationState& paintInvalidationState) {
1340 RELEASE_ASSERT(!layoutViewItem().isNull()); 1341 RELEASE_ASSERT(!layoutViewItem().isNull());
1341 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 1342 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled())
1342 invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState); 1343 invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState);
1343
1344 m_frame->selection().invalidateCaretRect();
1345 } 1344 }
1346 1345
1347 void FrameView::setNeedsPaintPropertyUpdate() { 1346 void FrameView::setNeedsPaintPropertyUpdate() {
1348 m_needsPaintPropertyUpdate = true; 1347 m_needsPaintPropertyUpdate = true;
1349 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 1348 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
1350 if (auto* layoutView = this->layoutView()) { 1349 if (auto* layoutView = this->layoutView()) {
1351 layoutView->setNeedsPaintPropertyUpdate(); 1350 layoutView->setNeedsPaintPropertyUpdate();
1352 return; 1351 return;
1353 } 1352 }
1354 } 1353 }
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after
3020 scroller->scrollAnchor()->adjust(); 3019 scroller->scrollAnchor()->adjust();
3021 } 3020 }
3022 } 3021 }
3023 m_anchoringAdjustmentQueue.clear(); 3022 m_anchoringAdjustmentQueue.clear();
3024 } 3023 }
3025 3024
3026 void FrameView::prePaint() { 3025 void FrameView::prePaint() {
3027 TRACE_EVENT0("blink", "FrameView::prePaint"); 3026 TRACE_EVENT0("blink", "FrameView::prePaint");
3028 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime"); 3027 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime");
3029 3028
3029 BlockPaintInvalidator::setMayNeedPaintInvalidationForCaretsIfNeeded(frame());
chrishtr 2017/01/31 22:51:04 Why is this needed?
3030
3030 if (!m_paintController) 3031 if (!m_paintController)
3031 m_paintController = PaintController::create(); 3032 m_paintController = PaintController::create();
3032 3033
3033 if (!m_geometryMapper) 3034 if (!m_geometryMapper)
3034 m_geometryMapper.reset(new GeometryMapper()); 3035 m_geometryMapper.reset(new GeometryMapper());
3035 // TODO(chrishtr): the cache only needs to be invalidated if one or more of 3036 // TODO(chrishtr): the cache only needs to be invalidated if one or more of
3036 // the property tree nodes changed. 3037 // the property tree nodes changed.
3037 m_geometryMapper->clearCache(); 3038 m_geometryMapper->clearCache();
3038 3039
3039 forAllNonThrottledFrameViews([](FrameView& frameView) { 3040 forAllNonThrottledFrameViews([](FrameView& frameView) {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
3245 if (frame().document()->hasFinishedParsing() && 3246 if (frame().document()->hasFinishedParsing() &&
3246 frame().loader().stateMachine()->committedFirstRealDocumentLoad()) 3247 frame().loader().stateMachine()->committedFirstRealDocumentLoad())
3247 m_isVisuallyNonEmpty = true; 3248 m_isVisuallyNonEmpty = true;
3248 } 3249 }
3249 3250
3250 void FrameView::invalidateTreeIfNeededRecursive() { 3251 void FrameView::invalidateTreeIfNeededRecursive() {
3251 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PaintInvalidation.UpdateTime"); 3252 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PaintInvalidation.UpdateTime");
3252 { 3253 {
3253 // For comparison to SlimmingPaintInvalidation. 3254 // For comparison to SlimmingPaintInvalidation.
3254 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime"); 3255 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime");
3256 BlockPaintInvalidator::setMayNeedPaintInvalidationForCaretsIfNeeded(
chrishtr 2017/01/31 22:51:04 Same quesiton.
3257 frame());
3255 invalidateTreeIfNeededRecursiveInternal(); 3258 invalidateTreeIfNeededRecursiveInternal();
3256 } 3259 }
3257 } 3260 }
3258 3261
3259 void FrameView::invalidateTreeIfNeededRecursiveInternal() { 3262 void FrameView::invalidateTreeIfNeededRecursiveInternal() {
3260 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); 3263 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
3261 CHECK(layoutView()); 3264 CHECK(layoutView());
3262 3265
3263 // We need to stop recursing here since a child frame view might not be 3266 // We need to stop recursing here since a child frame view might not be
3264 // throttled even though we are (e.g., it didn't compute its visibility yet). 3267 // throttled even though we are (e.g., it didn't compute its visibility yet).
3265 if (shouldThrottleRendering()) 3268 if (shouldThrottleRendering())
3266 return; 3269 return;
3267 TRACE_EVENT1("blink", "FrameView::invalidateTreeIfNeededRecursive", "root", 3270 TRACE_EVENT0("blink", "FrameView::invalidateTreeIfNeededRecursiveInternal");
3268 layoutView()->debugName().ascii());
3269 3271
3270 Vector<const LayoutObject*> pendingDelayedPaintInvalidations; 3272 Vector<const LayoutObject*> pendingDelayedPaintInvalidations;
3271 PaintInvalidationState rootPaintInvalidationState( 3273 PaintInvalidationState rootPaintInvalidationState(
3272 *layoutView(), pendingDelayedPaintInvalidations); 3274 *layoutView(), pendingDelayedPaintInvalidations);
3273 3275
3274 if (lifecycle().state() < DocumentLifecycle::PaintInvalidationClean) 3276 if (lifecycle().state() < DocumentLifecycle::PaintInvalidationClean)
3275 invalidateTreeIfNeeded(rootPaintInvalidationState); 3277 invalidateTreeIfNeeded(rootPaintInvalidationState);
3276 3278
3277 // Some frames may be not reached during the above invalidateTreeIfNeeded 3279 // Some frames may be not reached during the above invalidateTreeIfNeeded
3278 // because 3280 // because
3279 // - the frame is a detached frame; or 3281 // - the frame is a detached frame; or
3280 // - it didn't need paint invalidation. 3282 // - it didn't need paint invalidation.
3281 // We need to call invalidateTreeIfNeededRecursive() for such frames to finish 3283 // We need to call invalidateTreeIfNeededRecursiveInternal() for such frames
3282 // required paint invalidation and advance their life cycle state. 3284 // to finish required paint invalidation and advance their life cycle state.
3283 for (Frame* child = m_frame->tree().firstChild(); child; 3285 for (Frame* child = m_frame->tree().firstChild(); child;
3284 child = child->tree().nextSibling()) { 3286 child = child->tree().nextSibling()) {
3285 if (child->isLocalFrame()) { 3287 if (child->isLocalFrame()) {
3286 FrameView& childFrameView = *toLocalFrame(child)->view(); 3288 FrameView& childFrameView = *toLocalFrame(child)->view();
3287 // The children frames can be in any state, including stopping. 3289 // The children frames can be in any state, including stopping.
3288 // Thus we have to check that it makes sense to do paint 3290 // Thus we have to check that it makes sense to do paint
3289 // invalidation onto them here. 3291 // invalidation onto them here.
3290 if (!childFrameView.layoutView()) 3292 if (!childFrameView.layoutView())
3291 continue; 3293 continue;
3292 childFrameView.invalidateTreeIfNeededRecursiveInternal(); 3294 childFrameView.invalidateTreeIfNeededRecursiveInternal();
(...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after
5086 std::unique_ptr<CompositorAnimationTimeline> timeline) { 5088 std::unique_ptr<CompositorAnimationTimeline> timeline) {
5087 m_animationTimeline = std::move(timeline); 5089 m_animationTimeline = std::move(timeline);
5088 } 5090 }
5089 5091
5090 void FrameView::setAnimationHost( 5092 void FrameView::setAnimationHost(
5091 std::unique_ptr<CompositorAnimationHost> host) { 5093 std::unique_ptr<CompositorAnimationHost> host) {
5092 m_animationHost = std::move(host); 5094 m_animationHost = std::move(host);
5093 } 5095 }
5094 5096
5095 } // namespace blink 5097 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698