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

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

Issue 2665823002: Invalidate caret during paint invalidation (Closed)
Patch Set: NeedsRebaseline 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 *
11 * This library is free software; you can redistribute it and/or 11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public 12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either 13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version. 14 * version 2 of the License, or (at your option) any later version.
15 * 15 *
16 * This library is distributed in the hope that it will be useful, 16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details. 19 * Library General Public License for more details.
20 * 20 *
21 * You should have received a copy of the GNU Library General Public License 21 * You should have received a copy of the GNU Library General Public License
22 * along with this library; see the file COPYING.LIB. If not, write to 22 * along with this library; see the file COPYING.LIB. If not, write to
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA. 24 * Boston, MA 02110-1301, USA.
25 */ 25 */
26 26
27 #include "core/frame/FrameView.h" 27 #include "core/frame/FrameView.h"
28 28
29 #include <memory>
29 #include "core/HTMLNames.h" 30 #include "core/HTMLNames.h"
30 #include "core/MediaTypeNames.h" 31 #include "core/MediaTypeNames.h"
31 #include "core/animation/DocumentAnimations.h" 32 #include "core/animation/DocumentAnimations.h"
32 #include "core/css/FontFaceSet.h" 33 #include "core/css/FontFaceSet.h"
33 #include "core/dom/AXObjectCache.h" 34 #include "core/dom/AXObjectCache.h"
34 #include "core/dom/DOMNodeIds.h" 35 #include "core/dom/DOMNodeIds.h"
35 #include "core/dom/ElementVisibilityObserver.h" 36 #include "core/dom/ElementVisibilityObserver.h"
36 #include "core/dom/Fullscreen.h" 37 #include "core/dom/Fullscreen.h"
37 #include "core/dom/IntersectionObserverCallback.h" 38 #include "core/dom/IntersectionObserverCallback.h"
38 #include "core/dom/IntersectionObserverController.h" 39 #include "core/dom/IntersectionObserverController.h"
39 #include "core/dom/IntersectionObserverInit.h" 40 #include "core/dom/IntersectionObserverInit.h"
40 #include "core/dom/ResizeObserverController.h" 41 #include "core/dom/ResizeObserverController.h"
41 #include "core/dom/StyleChangeReason.h" 42 #include "core/dom/StyleChangeReason.h"
42 #include "core/dom/TaskRunnerHelper.h" 43 #include "core/dom/TaskRunnerHelper.h"
44 #include "core/editing/DragCaret.h"
43 #include "core/editing/EditingUtilities.h" 45 #include "core/editing/EditingUtilities.h"
44 #include "core/editing/FrameSelection.h" 46 #include "core/editing/FrameSelection.h"
45 #include "core/editing/RenderedPosition.h" 47 #include "core/editing/RenderedPosition.h"
46 #include "core/editing/markers/DocumentMarkerController.h" 48 #include "core/editing/markers/DocumentMarkerController.h"
47 #include "core/events/ErrorEvent.h" 49 #include "core/events/ErrorEvent.h"
48 #include "core/frame/BrowserControls.h" 50 #include "core/frame/BrowserControls.h"
49 #include "core/frame/EventHandlerRegistry.h" 51 #include "core/frame/EventHandlerRegistry.h"
50 #include "core/frame/FrameHost.h" 52 #include "core/frame/FrameHost.h"
51 #include "core/frame/LocalFrame.h" 53 #include "core/frame/LocalFrame.h"
52 #include "core/frame/Location.h" 54 #include "core/frame/Location.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 #include "core/loader/FrameLoader.h" 88 #include "core/loader/FrameLoader.h"
87 #include "core/loader/FrameLoaderClient.h" 89 #include "core/loader/FrameLoaderClient.h"
88 #include "core/page/AutoscrollController.h" 90 #include "core/page/AutoscrollController.h"
89 #include "core/page/ChromeClient.h" 91 #include "core/page/ChromeClient.h"
90 #include "core/page/FocusController.h" 92 #include "core/page/FocusController.h"
91 #include "core/page/FrameTree.h" 93 #include "core/page/FrameTree.h"
92 #include "core/page/Page.h" 94 #include "core/page/Page.h"
93 #include "core/page/scrolling/RootScrollerUtil.h" 95 #include "core/page/scrolling/RootScrollerUtil.h"
94 #include "core/page/scrolling/ScrollingCoordinator.h" 96 #include "core/page/scrolling/ScrollingCoordinator.h"
95 #include "core/page/scrolling/TopDocumentRootScrollerController.h" 97 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
98 #include "core/paint/BlockPaintInvalidator.h"
96 #include "core/paint/FramePainter.h" 99 #include "core/paint/FramePainter.h"
97 #include "core/paint/PaintLayer.h" 100 #include "core/paint/PaintLayer.h"
98 #include "core/paint/PaintTiming.h" 101 #include "core/paint/PaintTiming.h"
99 #include "core/paint/PrePaintTreeWalk.h" 102 #include "core/paint/PrePaintTreeWalk.h"
100 #include "core/plugins/PluginView.h" 103 #include "core/plugins/PluginView.h"
101 #include "core/style/ComputedStyle.h" 104 #include "core/style/ComputedStyle.h"
102 #include "core/svg/SVGDocumentExtensions.h" 105 #include "core/svg/SVGDocumentExtensions.h"
103 #include "core/svg/SVGSVGElement.h" 106 #include "core/svg/SVGSVGElement.h"
104 #include "platform/Histogram.h" 107 #include "platform/Histogram.h"
105 #include "platform/HostWindow.h" 108 #include "platform/HostWindow.h"
(...skipping 16 matching lines...) Expand all
122 #include "platform/instrumentation/tracing/TracedValue.h" 125 #include "platform/instrumentation/tracing/TracedValue.h"
123 #include "platform/json/JSONValues.h" 126 #include "platform/json/JSONValues.h"
124 #include "platform/loader/fetch/ResourceFetcher.h" 127 #include "platform/loader/fetch/ResourceFetcher.h"
125 #include "platform/scroll/ScrollAnimatorBase.h" 128 #include "platform/scroll/ScrollAnimatorBase.h"
126 #include "platform/scroll/ScrollbarTheme.h" 129 #include "platform/scroll/ScrollbarTheme.h"
127 #include "platform/text/TextStream.h" 130 #include "platform/text/TextStream.h"
128 #include "public/platform/WebDisplayItemList.h" 131 #include "public/platform/WebDisplayItemList.h"
129 #include "wtf/CurrentTime.h" 132 #include "wtf/CurrentTime.h"
130 #include "wtf/PtrUtil.h" 133 #include "wtf/PtrUtil.h"
131 #include "wtf/StdLibExtras.h" 134 #include "wtf/StdLibExtras.h"
132 #include <memory>
133 135
134 // Used to check for dirty layouts violating document lifecycle rules. 136 // Used to check for dirty layouts violating document lifecycle rules.
135 // If arg evaluates to true, the program will continue. If arg evaluates to 137 // If arg evaluates to true, the program will continue. If arg evaluates to
136 // false, program will crash if DCHECK_IS_ON() or return false from the current 138 // false, program will crash if DCHECK_IS_ON() or return false from the current
137 // function. 139 // function.
138 #define CHECK_FOR_DIRTY_LAYOUT(arg) \ 140 #define CHECK_FOR_DIRTY_LAYOUT(arg) \
139 do { \ 141 do { \
140 if (!(arg)) { \ 142 if (!(arg)) { \
141 NOTREACHED(); \ 143 NOTREACHED(); \
142 return false; \ 144 return false; \
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 #endif 1335 #endif
1334 1336
1335 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); 1337 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean);
1336 } 1338 }
1337 1339
1338 void FrameView::invalidatePaintIfNeeded( 1340 void FrameView::invalidatePaintIfNeeded(
1339 const PaintInvalidationState& paintInvalidationState) { 1341 const PaintInvalidationState& paintInvalidationState) {
1340 RELEASE_ASSERT(!layoutViewItem().isNull()); 1342 RELEASE_ASSERT(!layoutViewItem().isNull());
1341 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 1343 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled())
1342 invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState); 1344 invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState);
1343
1344 m_frame->selection().invalidateCaretRect();
1345 } 1345 }
1346 1346
1347 void FrameView::setNeedsPaintPropertyUpdate() { 1347 void FrameView::setNeedsPaintPropertyUpdate() {
1348 m_needsPaintPropertyUpdate = true; 1348 m_needsPaintPropertyUpdate = true;
1349 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 1349 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
1350 if (auto* layoutView = this->layoutView()) { 1350 if (auto* layoutView = this->layoutView()) {
1351 layoutView->setNeedsPaintPropertyUpdate(); 1351 layoutView->setNeedsPaintPropertyUpdate();
1352 return; 1352 return;
1353 } 1353 }
1354 } 1354 }
(...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after
3242 updateWidgetGeometriesIfNeeded(); 3242 updateWidgetGeometriesIfNeeded();
3243 3243
3244 if (lifecycle().state() < DocumentLifecycle::LayoutClean) 3244 if (lifecycle().state() < DocumentLifecycle::LayoutClean)
3245 lifecycle().advanceTo(DocumentLifecycle::LayoutClean); 3245 lifecycle().advanceTo(DocumentLifecycle::LayoutClean);
3246 3246
3247 // Ensure that we become visually non-empty eventually. 3247 // Ensure that we become visually non-empty eventually.
3248 // TODO(esprehn): This should check isRenderingReady() instead. 3248 // TODO(esprehn): This should check isRenderingReady() instead.
3249 if (frame().document()->hasFinishedParsing() && 3249 if (frame().document()->hasFinishedParsing() &&
3250 frame().loader().stateMachine()->committedFirstRealDocumentLoad()) 3250 frame().loader().stateMachine()->committedFirstRealDocumentLoad())
3251 m_isVisuallyNonEmpty = true; 3251 m_isVisuallyNonEmpty = true;
3252
3253 frame().selection().updateStyleAndLayoutIfNeeded();
3254 frame().page()->dragCaret().updateStyleAndLayoutIfNeeded();
3252 } 3255 }
3253 3256
3254 void FrameView::invalidateTreeIfNeededRecursive() { 3257 void FrameView::invalidateTreeIfNeededRecursive() {
3255 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PaintInvalidation.UpdateTime"); 3258 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PaintInvalidation.UpdateTime");
3256 { 3259 {
3257 // For comparison to SlimmingPaintInvalidation. 3260 // For comparison to SlimmingPaintInvalidation.
3258 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime"); 3261 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime");
3259 invalidateTreeIfNeededRecursiveInternal(); 3262 invalidateTreeIfNeededRecursiveInternal();
3260 } 3263 }
3261 } 3264 }
3262 3265
3263 void FrameView::invalidateTreeIfNeededRecursiveInternal() { 3266 void FrameView::invalidateTreeIfNeededRecursiveInternal() {
3264 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); 3267 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
3265 CHECK(layoutView()); 3268 CHECK(layoutView());
3266 3269
3267 // We need to stop recursing here since a child frame view might not be 3270 // We need to stop recursing here since a child frame view might not be
3268 // throttled even though we are (e.g., it didn't compute its visibility yet). 3271 // throttled even though we are (e.g., it didn't compute its visibility yet).
3269 if (shouldThrottleRendering()) 3272 if (shouldThrottleRendering())
3270 return; 3273 return;
3271 TRACE_EVENT1("blink", "FrameView::invalidateTreeIfNeededRecursive", "root", 3274 TRACE_EVENT0("blink", "FrameView::invalidateTreeIfNeededRecursiveInternal");
3272 layoutView()->debugName().ascii());
3273 3275
3274 Vector<const LayoutObject*> pendingDelayedPaintInvalidations; 3276 Vector<const LayoutObject*> pendingDelayedPaintInvalidations;
3275 PaintInvalidationState rootPaintInvalidationState( 3277 PaintInvalidationState rootPaintInvalidationState(
3276 *layoutView(), pendingDelayedPaintInvalidations); 3278 *layoutView(), pendingDelayedPaintInvalidations);
3277 3279
3278 if (lifecycle().state() < DocumentLifecycle::PaintInvalidationClean) 3280 if (lifecycle().state() < DocumentLifecycle::PaintInvalidationClean)
3279 invalidateTreeIfNeeded(rootPaintInvalidationState); 3281 invalidateTreeIfNeeded(rootPaintInvalidationState);
3280 3282
3281 // Some frames may be not reached during the above invalidateTreeIfNeeded 3283 // Some frames may be not reached during the above invalidateTreeIfNeeded
3282 // because 3284 // because
3283 // - the frame is a detached frame; or 3285 // - the frame is a detached frame; or
3284 // - it didn't need paint invalidation. 3286 // - it didn't need paint invalidation.
3285 // We need to call invalidateTreeIfNeededRecursive() for such frames to finish 3287 // We need to call invalidateTreeIfNeededRecursiveInternal() for such frames
3286 // required paint invalidation and advance their life cycle state. 3288 // to finish required paint invalidation and advance their life cycle state.
3287 for (Frame* child = m_frame->tree().firstChild(); child; 3289 for (Frame* child = m_frame->tree().firstChild(); child;
3288 child = child->tree().nextSibling()) { 3290 child = child->tree().nextSibling()) {
3289 if (child->isLocalFrame()) { 3291 if (child->isLocalFrame()) {
3290 FrameView& childFrameView = *toLocalFrame(child)->view(); 3292 FrameView& childFrameView = *toLocalFrame(child)->view();
3291 // The children frames can be in any state, including stopping. 3293 // The children frames can be in any state, including stopping.
3292 // Thus we have to check that it makes sense to do paint 3294 // Thus we have to check that it makes sense to do paint
3293 // invalidation onto them here. 3295 // invalidation onto them here.
3294 if (!childFrameView.layoutView()) 3296 if (!childFrameView.layoutView())
3295 continue; 3297 continue;
3296 childFrameView.invalidateTreeIfNeededRecursiveInternal(); 3298 childFrameView.invalidateTreeIfNeededRecursiveInternal();
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after
5099 std::unique_ptr<CompositorAnimationTimeline> timeline) { 5101 std::unique_ptr<CompositorAnimationTimeline> timeline) {
5100 m_animationTimeline = std::move(timeline); 5102 m_animationTimeline = std::move(timeline);
5101 } 5103 }
5102 5104
5103 void FrameView::setAnimationHost( 5105 void FrameView::setAnimationHost(
5104 std::unique_ptr<CompositorAnimationHost> host) { 5106 std::unique_ptr<CompositorAnimationHost> host) {
5105 m_animationHost = std::move(host); 5107 m_animationHost = std::move(host);
5106 } 5108 }
5107 5109
5108 } // namespace blink 5110 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBlock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698