OLD | NEW |
---|---|
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 22 matching lines...) Expand all Loading... | |
33 #include "core/dom/AXObjectCache.h" | 33 #include "core/dom/AXObjectCache.h" |
34 #include "core/dom/DOMNodeIds.h" | 34 #include "core/dom/DOMNodeIds.h" |
35 #include "core/dom/ElementVisibilityObserver.h" | 35 #include "core/dom/ElementVisibilityObserver.h" |
36 #include "core/dom/Fullscreen.h" | 36 #include "core/dom/Fullscreen.h" |
37 #include "core/dom/IntersectionObserverCallback.h" | 37 #include "core/dom/IntersectionObserverCallback.h" |
38 #include "core/dom/IntersectionObserverController.h" | 38 #include "core/dom/IntersectionObserverController.h" |
39 #include "core/dom/IntersectionObserverInit.h" | 39 #include "core/dom/IntersectionObserverInit.h" |
40 #include "core/dom/ResizeObserverController.h" | 40 #include "core/dom/ResizeObserverController.h" |
41 #include "core/dom/StyleChangeReason.h" | 41 #include "core/dom/StyleChangeReason.h" |
42 #include "core/dom/TaskRunnerHelper.h" | 42 #include "core/dom/TaskRunnerHelper.h" |
43 #include "core/editing/DragCaret.h" | |
43 #include "core/editing/EditingUtilities.h" | 44 #include "core/editing/EditingUtilities.h" |
44 #include "core/editing/FrameSelection.h" | 45 #include "core/editing/FrameSelection.h" |
45 #include "core/editing/RenderedPosition.h" | 46 #include "core/editing/RenderedPosition.h" |
46 #include "core/editing/markers/DocumentMarkerController.h" | 47 #include "core/editing/markers/DocumentMarkerController.h" |
47 #include "core/events/ErrorEvent.h" | 48 #include "core/events/ErrorEvent.h" |
48 #include "core/frame/BrowserControls.h" | 49 #include "core/frame/BrowserControls.h" |
49 #include "core/frame/EventHandlerRegistry.h" | 50 #include "core/frame/EventHandlerRegistry.h" |
50 #include "core/frame/FrameHost.h" | 51 #include "core/frame/FrameHost.h" |
51 #include "core/frame/LocalFrame.h" | 52 #include "core/frame/LocalFrame.h" |
52 #include "core/frame/Location.h" | 53 #include "core/frame/Location.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 #include "core/loader/FrameLoader.h" | 87 #include "core/loader/FrameLoader.h" |
87 #include "core/loader/FrameLoaderClient.h" | 88 #include "core/loader/FrameLoaderClient.h" |
88 #include "core/page/AutoscrollController.h" | 89 #include "core/page/AutoscrollController.h" |
89 #include "core/page/ChromeClient.h" | 90 #include "core/page/ChromeClient.h" |
90 #include "core/page/FocusController.h" | 91 #include "core/page/FocusController.h" |
91 #include "core/page/FrameTree.h" | 92 #include "core/page/FrameTree.h" |
92 #include "core/page/Page.h" | 93 #include "core/page/Page.h" |
93 #include "core/page/scrolling/RootScrollerUtil.h" | 94 #include "core/page/scrolling/RootScrollerUtil.h" |
94 #include "core/page/scrolling/ScrollingCoordinator.h" | 95 #include "core/page/scrolling/ScrollingCoordinator.h" |
95 #include "core/page/scrolling/TopDocumentRootScrollerController.h" | 96 #include "core/page/scrolling/TopDocumentRootScrollerController.h" |
97 #include "core/paint/BlockPaintInvalidator.h" | |
96 #include "core/paint/FramePainter.h" | 98 #include "core/paint/FramePainter.h" |
97 #include "core/paint/PaintLayer.h" | 99 #include "core/paint/PaintLayer.h" |
98 #include "core/paint/PaintTiming.h" | 100 #include "core/paint/PaintTiming.h" |
99 #include "core/paint/PrePaintTreeWalk.h" | 101 #include "core/paint/PrePaintTreeWalk.h" |
100 #include "core/plugins/PluginView.h" | 102 #include "core/plugins/PluginView.h" |
101 #include "core/style/ComputedStyle.h" | 103 #include "core/style/ComputedStyle.h" |
102 #include "core/svg/SVGDocumentExtensions.h" | 104 #include "core/svg/SVGDocumentExtensions.h" |
103 #include "core/svg/SVGSVGElement.h" | 105 #include "core/svg/SVGSVGElement.h" |
104 #include "platform/Histogram.h" | 106 #include "platform/Histogram.h" |
105 #include "platform/HostWindow.h" | 107 #include "platform/HostWindow.h" |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3034 m_paintController = PaintController::create(); | 3034 m_paintController = PaintController::create(); |
3035 | 3035 |
3036 if (!m_geometryMapper) | 3036 if (!m_geometryMapper) |
3037 m_geometryMapper.reset(new GeometryMapper()); | 3037 m_geometryMapper.reset(new GeometryMapper()); |
3038 // TODO(chrishtr): the cache only needs to be invalidated if one or more of | 3038 // TODO(chrishtr): the cache only needs to be invalidated if one or more of |
3039 // the property tree nodes changed. | 3039 // the property tree nodes changed. |
3040 m_geometryMapper->clearCache(); | 3040 m_geometryMapper->clearCache(); |
3041 | 3041 |
3042 forAllNonThrottledFrameViews([](FrameView& frameView) { | 3042 forAllNonThrottledFrameViews([](FrameView& frameView) { |
3043 frameView.lifecycle().advanceTo(DocumentLifecycle::InPrePaint); | 3043 frameView.lifecycle().advanceTo(DocumentLifecycle::InPrePaint); |
3044 frameView.m_frame->selection().updateForPaintInvalidation(); | |
3045 frameView.m_frame->page()->dragCaret().updateForPaintInvalidation(); | |
chrishtr
2017/02/07 05:29:12
How about conceptually adding this at the end of l
Xianzhu
2017/02/07 20:00:14
Done, with the functions renamed to updateStyleAnd
| |
3044 if (frameView.canThrottleRendering()) { | 3046 if (frameView.canThrottleRendering()) { |
3045 // This frame can be throttled but not throttled, meaning we are not in an | 3047 // This frame can be throttled but not throttled, meaning we are not in an |
3046 // AllowThrottlingScope. Now this frame may contain dirty paint flags, and | 3048 // AllowThrottlingScope. Now this frame may contain dirty paint flags, and |
3047 // we need to propagate the flags into the ancestor chain so that | 3049 // we need to propagate the flags into the ancestor chain so that |
3048 // PrePaintTreeWalk can reach this frame. | 3050 // PrePaintTreeWalk can reach this frame. |
3049 frameView.setNeedsPaintPropertyUpdate(); | 3051 frameView.setNeedsPaintPropertyUpdate(); |
3050 } | 3052 } |
3051 }); | 3053 }); |
3052 | 3054 |
3053 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) | 3055 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3248 if (frame().document()->hasFinishedParsing() && | 3250 if (frame().document()->hasFinishedParsing() && |
3249 frame().loader().stateMachine()->committedFirstRealDocumentLoad()) | 3251 frame().loader().stateMachine()->committedFirstRealDocumentLoad()) |
3250 m_isVisuallyNonEmpty = true; | 3252 m_isVisuallyNonEmpty = true; |
3251 } | 3253 } |
3252 | 3254 |
3253 void FrameView::invalidateTreeIfNeededRecursive() { | 3255 void FrameView::invalidateTreeIfNeededRecursive() { |
3254 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PaintInvalidation.UpdateTime"); | 3256 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PaintInvalidation.UpdateTime"); |
3255 { | 3257 { |
3256 // For comparison to SlimmingPaintInvalidation. | 3258 // For comparison to SlimmingPaintInvalidation. |
3257 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime"); | 3259 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime"); |
3260 forAllNonThrottledFrameViews([](FrameView& frameView) { | |
3261 frameView.m_frame->selection().updateForPaintInvalidation(); | |
3262 frameView.m_frame->page()->dragCaret().updateForPaintInvalidation(); | |
3263 }); | |
3258 invalidateTreeIfNeededRecursiveInternal(); | 3264 invalidateTreeIfNeededRecursiveInternal(); |
3259 } | 3265 } |
3260 } | 3266 } |
3261 | 3267 |
3262 void FrameView::invalidateTreeIfNeededRecursiveInternal() { | 3268 void FrameView::invalidateTreeIfNeededRecursiveInternal() { |
3263 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); | 3269 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
3264 CHECK(layoutView()); | 3270 CHECK(layoutView()); |
3265 | 3271 |
3266 // We need to stop recursing here since a child frame view might not be | 3272 // We need to stop recursing here since a child frame view might not be |
3267 // throttled even though we are (e.g., it didn't compute its visibility yet). | 3273 // throttled even though we are (e.g., it didn't compute its visibility yet). |
3268 if (shouldThrottleRendering()) | 3274 if (shouldThrottleRendering()) |
3269 return; | 3275 return; |
3270 TRACE_EVENT1("blink", "FrameView::invalidateTreeIfNeededRecursive", "root", | 3276 TRACE_EVENT0("blink", "FrameView::invalidateTreeIfNeededRecursiveInternal"); |
3271 layoutView()->debugName().ascii()); | |
3272 | 3277 |
3273 Vector<const LayoutObject*> pendingDelayedPaintInvalidations; | 3278 Vector<const LayoutObject*> pendingDelayedPaintInvalidations; |
3274 PaintInvalidationState rootPaintInvalidationState( | 3279 PaintInvalidationState rootPaintInvalidationState( |
3275 *layoutView(), pendingDelayedPaintInvalidations); | 3280 *layoutView(), pendingDelayedPaintInvalidations); |
3276 | 3281 |
3277 if (lifecycle().state() < DocumentLifecycle::PaintInvalidationClean) | 3282 if (lifecycle().state() < DocumentLifecycle::PaintInvalidationClean) |
3278 invalidateTreeIfNeeded(rootPaintInvalidationState); | 3283 invalidateTreeIfNeeded(rootPaintInvalidationState); |
3279 | 3284 |
3280 // Some frames may be not reached during the above invalidateTreeIfNeeded | 3285 // Some frames may be not reached during the above invalidateTreeIfNeeded |
3281 // because | 3286 // because |
3282 // - the frame is a detached frame; or | 3287 // - the frame is a detached frame; or |
3283 // - it didn't need paint invalidation. | 3288 // - it didn't need paint invalidation. |
3284 // We need to call invalidateTreeIfNeededRecursive() for such frames to finish | 3289 // We need to call invalidateTreeIfNeededRecursiveInternal() for such frames |
3285 // required paint invalidation and advance their life cycle state. | 3290 // to finish required paint invalidation and advance their life cycle state. |
3286 for (Frame* child = m_frame->tree().firstChild(); child; | 3291 for (Frame* child = m_frame->tree().firstChild(); child; |
3287 child = child->tree().nextSibling()) { | 3292 child = child->tree().nextSibling()) { |
3288 if (child->isLocalFrame()) { | 3293 if (child->isLocalFrame()) { |
3289 FrameView& childFrameView = *toLocalFrame(child)->view(); | 3294 FrameView& childFrameView = *toLocalFrame(child)->view(); |
3290 // The children frames can be in any state, including stopping. | 3295 // The children frames can be in any state, including stopping. |
3291 // Thus we have to check that it makes sense to do paint | 3296 // Thus we have to check that it makes sense to do paint |
3292 // invalidation onto them here. | 3297 // invalidation onto them here. |
3293 if (!childFrameView.layoutView()) | 3298 if (!childFrameView.layoutView()) |
3294 continue; | 3299 continue; |
3295 childFrameView.invalidateTreeIfNeededRecursiveInternal(); | 3300 childFrameView.invalidateTreeIfNeededRecursiveInternal(); |
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5095 std::unique_ptr<CompositorAnimationTimeline> timeline) { | 5100 std::unique_ptr<CompositorAnimationTimeline> timeline) { |
5096 m_animationTimeline = std::move(timeline); | 5101 m_animationTimeline = std::move(timeline); |
5097 } | 5102 } |
5098 | 5103 |
5099 void FrameView::setAnimationHost( | 5104 void FrameView::setAnimationHost( |
5100 std::unique_ptr<CompositorAnimationHost> host) { | 5105 std::unique_ptr<CompositorAnimationHost> host) { |
5101 m_animationHost = std::move(host); | 5106 m_animationHost = std::move(host); |
5102 } | 5107 } |
5103 | 5108 |
5104 } // namespace blink | 5109 } // namespace blink |
OLD | NEW |