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 19 matching lines...) Expand all Loading... | |
30 #include "core/MediaTypeNames.h" | 30 #include "core/MediaTypeNames.h" |
31 #include "core/css/FontFaceSet.h" | 31 #include "core/css/FontFaceSet.h" |
32 #include "core/css/resolver/StyleResolver.h" | 32 #include "core/css/resolver/StyleResolver.h" |
33 #include "core/dom/AXObjectCache.h" | 33 #include "core/dom/AXObjectCache.h" |
34 #include "core/dom/Fullscreen.h" | 34 #include "core/dom/Fullscreen.h" |
35 #include "core/dom/IntersectionObserverController.h" | 35 #include "core/dom/IntersectionObserverController.h" |
36 #include "core/editing/EditingUtilities.h" | 36 #include "core/editing/EditingUtilities.h" |
37 #include "core/editing/FrameSelection.h" | 37 #include "core/editing/FrameSelection.h" |
38 #include "core/editing/RenderedPosition.h" | 38 #include "core/editing/RenderedPosition.h" |
39 #include "core/editing/markers/DocumentMarkerController.h" | 39 #include "core/editing/markers/DocumentMarkerController.h" |
40 #include "core/events/ErrorEvent.h" | |
40 #include "core/fetch/ResourceFetcher.h" | 41 #include "core/fetch/ResourceFetcher.h" |
41 #include "core/frame/EventHandlerRegistry.h" | 42 #include "core/frame/EventHandlerRegistry.h" |
42 #include "core/frame/FrameHost.h" | 43 #include "core/frame/FrameHost.h" |
43 #include "core/frame/LocalFrame.h" | 44 #include "core/frame/LocalFrame.h" |
44 #include "core/frame/Location.h" | 45 #include "core/frame/Location.h" |
45 #include "core/frame/PageScaleConstraintsSet.h" | 46 #include "core/frame/PageScaleConstraintsSet.h" |
46 #include "core/frame/Settings.h" | 47 #include "core/frame/Settings.h" |
47 #include "core/frame/TopControls.h" | 48 #include "core/frame/TopControls.h" |
48 #include "core/frame/VisualViewport.h" | 49 #include "core/frame/VisualViewport.h" |
49 #include "core/html/HTMLFrameElement.h" | 50 #include "core/html/HTMLFrameElement.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
65 #include "core/layout/TracedLayoutObject.h" | 66 #include "core/layout/TracedLayoutObject.h" |
66 #include "core/layout/api/LayoutBoxModel.h" | 67 #include "core/layout/api/LayoutBoxModel.h" |
67 #include "core/layout/api/LayoutItem.h" | 68 #include "core/layout/api/LayoutItem.h" |
68 #include "core/layout/api/LayoutViewItem.h" | 69 #include "core/layout/api/LayoutViewItem.h" |
69 #include "core/layout/compositing/CompositedLayerMapping.h" | 70 #include "core/layout/compositing/CompositedLayerMapping.h" |
70 #include "core/layout/compositing/CompositedSelection.h" | 71 #include "core/layout/compositing/CompositedSelection.h" |
71 #include "core/layout/compositing/PaintLayerCompositor.h" | 72 #include "core/layout/compositing/PaintLayerCompositor.h" |
72 #include "core/layout/svg/LayoutSVGRoot.h" | 73 #include "core/layout/svg/LayoutSVGRoot.h" |
73 #include "core/loader/FrameLoader.h" | 74 #include "core/loader/FrameLoader.h" |
74 #include "core/loader/FrameLoaderClient.h" | 75 #include "core/loader/FrameLoaderClient.h" |
76 #include "core/observer/ResizeObserverController.h" | |
75 #include "core/page/AutoscrollController.h" | 77 #include "core/page/AutoscrollController.h" |
76 #include "core/page/ChromeClient.h" | 78 #include "core/page/ChromeClient.h" |
77 #include "core/page/FocusController.h" | 79 #include "core/page/FocusController.h" |
78 #include "core/page/FrameTree.h" | 80 #include "core/page/FrameTree.h" |
79 #include "core/page/Page.h" | 81 #include "core/page/Page.h" |
80 #include "core/page/scrolling/ScrollingCoordinator.h" | 82 #include "core/page/scrolling/ScrollingCoordinator.h" |
81 #include "core/paint/FramePainter.h" | 83 #include "core/paint/FramePainter.h" |
82 #include "core/paint/PaintLayer.h" | 84 #include "core/paint/PaintLayer.h" |
83 #include "core/paint/PrePaintTreeWalk.h" | 85 #include "core/paint/PrePaintTreeWalk.h" |
84 #include "core/plugins/PluginView.h" | 86 #include "core/plugins/PluginView.h" |
(...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2438 void FrameView::scheduleVisualUpdateForPaintInvalidationIfNeeded() | 2440 void FrameView::scheduleVisualUpdateForPaintInvalidationIfNeeded() |
2439 { | 2441 { |
2440 LocalFrame* localFrameRoot = frame().localFrameRoot(); | 2442 LocalFrame* localFrameRoot = frame().localFrameRoot(); |
2441 if (!localFrameRoot->view()->m_isUpdatingAllLifecyclePhases || lifecycle().s tate() >= DocumentLifecycle::PrePaintClean) { | 2443 if (!localFrameRoot->view()->m_isUpdatingAllLifecyclePhases || lifecycle().s tate() >= DocumentLifecycle::PrePaintClean) { |
2442 // Schedule visual update to process the paint invalidation in the next cycle. | 2444 // Schedule visual update to process the paint invalidation in the next cycle. |
2443 localFrameRoot->scheduleVisualUpdateUnlessThrottled(); | 2445 localFrameRoot->scheduleVisualUpdateUnlessThrottled(); |
2444 } | 2446 } |
2445 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle. | 2447 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle. |
2446 } | 2448 } |
2447 | 2449 |
2450 void FrameView::notifyResizeObserver() | |
2451 { | |
2452 if (!m_frame->document()->resizeObserverController()) | |
2453 return; | |
2454 | |
2455 ResizeObserverController& resizeController = m_frame->document()->ensureResi zeObserverController(); | |
2456 | |
2457 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean); | |
2458 | |
2459 size_t resizeNotifyCount = 0; | |
2460 | |
2461 while (resizeController.gatherObservations()) { | |
szager1
2016/07/11 18:33:47
This is a much clearer organization of the loop, t
atotic1
2016/07/11 23:18:57
Done.
| |
2462 if (++resizeNotifyCount > ResizeObserverController::kRenderLoopLimit) { | |
2463 resizeController.clearObservations(); | |
2464 // Report the error. | |
2465 ErrorEvent * error = ErrorEvent::create("ResizeObserver loop limit e xceeded", SourceLocation::capture(m_frame->document()), nullptr); | |
2466 m_frame->document()->reportException(error, NotSharableCrossOrigin); | |
2467 // Ensure notifications will get delivered in next cycle. | |
szager1
2016/07/11 18:33:47
This comment is obsolete, I think. Maybe just som
atotic1
2016/07/11 23:18:58
The comment is meaningful. Without scheduleAnimati
szager1
2016/07/11 23:33:34
But just a few lines up, you call resizeController
| |
2468 if (FrameView* frameView = m_frame->view()) | |
2469 frameView->scheduleAnimation(); | |
2470 break; | |
2471 } | |
2472 | |
2473 resizeController.deliverObservations(); | |
2474 | |
2475 if (lifecycle().state() < DocumentLifecycle::LayoutClean || layoutView() ->needsLayout()) | |
2476 updateStyleAndLayoutIfNeededRecursive(); | |
2477 } | |
2478 | |
2479 DCHECK(!layoutView()->needsLayout()); | |
2480 } | |
2481 | |
2448 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews. | 2482 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews. |
2449 void FrameView::updateLifecyclePhasesInternal(LifeCycleUpdateOption phases) | 2483 void FrameView::updateLifecyclePhasesInternal(LifeCycleUpdateOption phases) |
2450 { | 2484 { |
2451 Optional<TemporaryChange<bool>> isUpdatingAllLifecyclePhasesScope; | 2485 Optional<TemporaryChange<bool>> isUpdatingAllLifecyclePhasesScope; |
2452 if (phases == AllPhases) | 2486 if (phases == AllPhases) |
2453 isUpdatingAllLifecyclePhasesScope.emplace(m_isUpdatingAllLifecyclePhases , true); | 2487 isUpdatingAllLifecyclePhasesScope.emplace(m_isUpdatingAllLifecyclePhases , true); |
2454 | 2488 |
2455 // This must be called from the root frame, since it recurses down, not up. | 2489 // This must be called from the root frame, since it recurses down, not up. |
2456 // Otherwise the lifecycles of the frames might be out of sync. | 2490 // Otherwise the lifecycles of the frames might be out of sync. |
2457 ASSERT(m_frame->isLocalRoot()); | 2491 ASSERT(m_frame->isLocalRoot()); |
2458 | 2492 |
2459 if (shouldThrottleRendering()) { | 2493 if (shouldThrottleRendering()) { |
2460 updateViewportIntersectionsForSubtree(std::min(phases, OnlyUpToCompositi ngCleanPlusScrolling)); | 2494 updateViewportIntersectionsForSubtree(std::min(phases, OnlyUpToCompositi ngCleanPlusScrolling)); |
2461 return; | 2495 return; |
2462 } | 2496 } |
2463 | 2497 |
2464 updateStyleAndLayoutIfNeededRecursive(); | 2498 updateStyleAndLayoutIfNeededRecursive(); |
2465 ASSERT(lifecycle().state() >= DocumentLifecycle::LayoutClean); | |
2466 | 2499 |
2467 if (phases == OnlyUpToLayoutClean) { | 2500 if (phases == OnlyUpToLayoutClean) { |
2468 updateViewportIntersectionsForSubtree(phases); | 2501 updateViewportIntersectionsForSubtree(phases); |
2469 return; | 2502 return; |
2470 } | 2503 } |
2471 | 2504 |
2505 notifyResizeObserver(); | |
szager1
2016/07/11 18:33:47
Are you sure we don't want to run this when (phase
atotic1
2016/07/11 23:18:57
I believe that ResizeObserver should not run if ph
szager1
2016/07/11 23:33:34
Good enough for me, I just wanted to make sure you
| |
2506 | |
2507 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean); | |
2508 | |
2472 if (LayoutViewItem view = layoutViewItem()) { | 2509 if (LayoutViewItem view = layoutViewItem()) { |
2473 { | 2510 { |
2474 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get())); | 2511 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get())); |
2475 | 2512 |
2476 // This was required for slimming paint v1 but is only temporarily | 2513 // This was required for slimming paint v1 but is only temporarily |
2477 // needed for slimming paint v2. | 2514 // needed for slimming paint v2. |
2478 view.compositor()->updateIfNeededRecursive(); | 2515 view.compositor()->updateIfNeededRecursive(); |
2479 scrollContentsIfNeededRecursive(); | 2516 scrollContentsIfNeededRecursive(); |
2480 | 2517 |
2481 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); | 2518 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); |
(...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4177 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); | 4214 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); |
4178 } | 4215 } |
4179 | 4216 |
4180 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4217 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
4181 { | 4218 { |
4182 ASSERT(!layoutViewItem().isNull()); | 4219 ASSERT(!layoutViewItem().isNull()); |
4183 return *layoutView(); | 4220 return *layoutView(); |
4184 } | 4221 } |
4185 | 4222 |
4186 } // namespace blink | 4223 } // namespace blink |
OLD | NEW |