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 20 matching lines...) Expand all Loading... | |
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/DOMNodeIds.h" | 34 #include "core/dom/DOMNodeIds.h" |
35 #include "core/dom/Fullscreen.h" | 35 #include "core/dom/Fullscreen.h" |
36 #include "core/dom/IntersectionObserverController.h" | 36 #include "core/dom/IntersectionObserverController.h" |
37 #include "core/editing/EditingUtilities.h" | 37 #include "core/editing/EditingUtilities.h" |
38 #include "core/editing/FrameSelection.h" | 38 #include "core/editing/FrameSelection.h" |
39 #include "core/editing/RenderedPosition.h" | 39 #include "core/editing/RenderedPosition.h" |
40 #include "core/editing/markers/DocumentMarkerController.h" | 40 #include "core/editing/markers/DocumentMarkerController.h" |
41 #include "core/events/ErrorEvent.h" | |
41 #include "core/fetch/ResourceFetcher.h" | 42 #include "core/fetch/ResourceFetcher.h" |
42 #include "core/frame/EventHandlerRegistry.h" | 43 #include "core/frame/EventHandlerRegistry.h" |
43 #include "core/frame/FrameHost.h" | 44 #include "core/frame/FrameHost.h" |
44 #include "core/frame/LocalFrame.h" | 45 #include "core/frame/LocalFrame.h" |
45 #include "core/frame/Location.h" | 46 #include "core/frame/Location.h" |
46 #include "core/frame/PageScaleConstraintsSet.h" | 47 #include "core/frame/PageScaleConstraintsSet.h" |
47 #include "core/frame/Settings.h" | 48 #include "core/frame/Settings.h" |
48 #include "core/frame/TopControls.h" | 49 #include "core/frame/TopControls.h" |
49 #include "core/frame/VisualViewport.h" | 50 #include "core/frame/VisualViewport.h" |
50 #include "core/html/HTMLFrameElement.h" | 51 #include "core/html/HTMLFrameElement.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
66 #include "core/layout/TracedLayoutObject.h" | 67 #include "core/layout/TracedLayoutObject.h" |
67 #include "core/layout/api/LayoutBoxModel.h" | 68 #include "core/layout/api/LayoutBoxModel.h" |
68 #include "core/layout/api/LayoutItem.h" | 69 #include "core/layout/api/LayoutItem.h" |
69 #include "core/layout/api/LayoutViewItem.h" | 70 #include "core/layout/api/LayoutViewItem.h" |
70 #include "core/layout/compositing/CompositedLayerMapping.h" | 71 #include "core/layout/compositing/CompositedLayerMapping.h" |
71 #include "core/layout/compositing/CompositedSelection.h" | 72 #include "core/layout/compositing/CompositedSelection.h" |
72 #include "core/layout/compositing/PaintLayerCompositor.h" | 73 #include "core/layout/compositing/PaintLayerCompositor.h" |
73 #include "core/layout/svg/LayoutSVGRoot.h" | 74 #include "core/layout/svg/LayoutSVGRoot.h" |
74 #include "core/loader/FrameLoader.h" | 75 #include "core/loader/FrameLoader.h" |
75 #include "core/loader/FrameLoaderClient.h" | 76 #include "core/loader/FrameLoaderClient.h" |
77 #include "core/observer/ResizeObserverController.h" | |
76 #include "core/page/AutoscrollController.h" | 78 #include "core/page/AutoscrollController.h" |
77 #include "core/page/ChromeClient.h" | 79 #include "core/page/ChromeClient.h" |
78 #include "core/page/FocusController.h" | 80 #include "core/page/FocusController.h" |
79 #include "core/page/FrameTree.h" | 81 #include "core/page/FrameTree.h" |
80 #include "core/page/Page.h" | 82 #include "core/page/Page.h" |
81 #include "core/page/scrolling/ChildViewportScrollCallback.h" | 83 #include "core/page/scrolling/ChildViewportScrollCallback.h" |
82 #include "core/page/scrolling/RootViewportScrollCallback.h" | 84 #include "core/page/scrolling/RootViewportScrollCallback.h" |
83 #include "core/page/scrolling/ScrollingCoordinator.h" | 85 #include "core/page/scrolling/ScrollingCoordinator.h" |
84 #include "core/paint/FramePainter.h" | 86 #include "core/paint/FramePainter.h" |
85 #include "core/paint/PaintLayer.h" | 87 #include "core/paint/PaintLayer.h" |
(...skipping 2412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2498 { | 2500 { |
2499 LocalFrame* localFrameRoot = frame().localFrameRoot(); | 2501 LocalFrame* localFrameRoot = frame().localFrameRoot(); |
2500 if (localFrameRoot->view()->m_currentUpdateLifecyclePhasesTargetState < Docu mentLifecycle::PaintInvalidationClean | 2502 if (localFrameRoot->view()->m_currentUpdateLifecyclePhasesTargetState < Docu mentLifecycle::PaintInvalidationClean |
2501 || lifecycle().state() >= DocumentLifecycle::PrePaintClean) { | 2503 || lifecycle().state() >= DocumentLifecycle::PrePaintClean) { |
2502 // Schedule visual update to process the paint invalidation in the next cycle. | 2504 // Schedule visual update to process the paint invalidation in the next cycle. |
2503 localFrameRoot->scheduleVisualUpdateUnlessThrottled(); | 2505 localFrameRoot->scheduleVisualUpdateUnlessThrottled(); |
2504 } | 2506 } |
2505 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle. | 2507 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle. |
2506 } | 2508 } |
2507 | 2509 |
2510 void FrameView::notifyResizeObserver() | |
2511 { | |
2512 if (!m_frame->document()->resizeObserverController()) | |
eae
2016/07/13 23:39:47
When would notifyResizeObserver ever be called if
atotic1
2016/07/15 01:43:17
Controller is allocated only if ResizeObserver is
| |
2513 return; | |
2514 | |
2515 ResizeObserverController& resizeController = m_frame->document()->ensureResi zeObserverController(); | |
2516 | |
2517 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean); | |
2518 | |
2519 size_t resizeNotifyCount = 0; | |
2520 | |
2521 while (resizeController.gatherObservations()) { | |
2522 if (++resizeNotifyCount > ResizeObserverController::kRenderLoopLimit) { | |
2523 resizeController.clearObservations(); | |
2524 // Report the error. | |
eae
2016/07/13 23:39:47
Please remove redundant comment.
atotic1
2016/07/15 01:43:17
Done.
| |
2525 ErrorEvent * error = ErrorEvent::create("ResizeObserver loop limit e xceeded", SourceLocation::capture(m_frame->document()), nullptr); | |
2526 m_frame->document()->reportException(error, NotSharableCrossOrigin); | |
2527 // Ensure notifications will get delivered in next cycle. | |
2528 if (FrameView* frameView = m_frame->view()) | |
2529 frameView->scheduleAnimation(); | |
2530 break; | |
2531 } | |
2532 | |
2533 resizeController.deliverObservations(); | |
2534 | |
2535 if (lifecycle().state() < DocumentLifecycle::LayoutClean || layoutView() ->needsLayout()) | |
2536 updateStyleAndLayoutIfNeededRecursive(); | |
2537 } | |
2538 | |
2539 DCHECK(!layoutView()->needsLayout()); | |
2540 } | |
2541 | |
2508 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews. | 2542 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews. |
2509 void FrameView::updateLifecyclePhasesInternal(DocumentLifecycle::LifecycleState targetState) | 2543 void FrameView::updateLifecyclePhasesInternal(DocumentLifecycle::LifecycleState targetState) |
2510 { | 2544 { |
2511 // This must be called from the root frame, since it recurses down, not up. | 2545 // This must be called from the root frame, since it recurses down, not up. |
2512 // Otherwise the lifecycles of the frames might be out of sync. | 2546 // Otherwise the lifecycles of the frames might be out of sync. |
2513 DCHECK(m_frame->isLocalRoot()); | 2547 DCHECK(m_frame->isLocalRoot()); |
2514 | 2548 |
2515 // Only the following target states are supported. | 2549 // Only the following target states are supported. |
2516 DCHECK(targetState == DocumentLifecycle::LayoutClean | 2550 DCHECK(targetState == DocumentLifecycle::LayoutClean |
2517 || targetState == DocumentLifecycle::CompositingClean | 2551 || targetState == DocumentLifecycle::CompositingClean |
2518 || targetState == DocumentLifecycle::PrePaintClean | 2552 || targetState == DocumentLifecycle::PrePaintClean |
2519 || targetState == DocumentLifecycle::PaintClean); | 2553 || targetState == DocumentLifecycle::PaintClean); |
2520 | 2554 |
2521 TemporaryChange<DocumentLifecycle::LifecycleState> targetStateScope(m_curren tUpdateLifecyclePhasesTargetState, targetState); | 2555 TemporaryChange<DocumentLifecycle::LifecycleState> targetStateScope(m_curren tUpdateLifecyclePhasesTargetState, targetState); |
2522 | 2556 |
2523 if (shouldThrottleRendering()) { | 2557 if (shouldThrottleRendering()) { |
2524 updateViewportIntersectionsForSubtree(std::min(targetState, DocumentLife cycle::CompositingClean)); | 2558 updateViewportIntersectionsForSubtree(std::min(targetState, DocumentLife cycle::CompositingClean)); |
2525 return; | 2559 return; |
2526 } | 2560 } |
2527 | 2561 |
2528 updateStyleAndLayoutIfNeededRecursive(); | 2562 updateStyleAndLayoutIfNeededRecursive(); |
2529 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean); | 2563 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean); |
2530 | 2564 |
2531 if (targetState == DocumentLifecycle::LayoutClean) { | 2565 if (targetState == DocumentLifecycle::LayoutClean) { |
2532 updateViewportIntersectionsForSubtree(targetState); | 2566 updateViewportIntersectionsForSubtree(targetState); |
2533 return; | 2567 return; |
2534 } | 2568 } |
2535 | 2569 |
2570 notifyResizeObserver(); | |
2571 | |
2536 if (LayoutViewItem view = layoutViewItem()) { | 2572 if (LayoutViewItem view = layoutViewItem()) { |
2537 forAllNonThrottledFrameViews([](FrameView& frameView) { | 2573 forAllNonThrottledFrameViews([](FrameView& frameView) { |
2538 frameView.checkDoesNotNeedLayout(); | 2574 frameView.checkDoesNotNeedLayout(); |
2539 frameView.m_allowsLayoutInvalidationAfterLayoutClean = false; | 2575 frameView.m_allowsLayoutInvalidationAfterLayoutClean = false; |
2540 }); | 2576 }); |
2541 | 2577 |
2542 { | 2578 { |
2543 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get())); | 2579 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get())); |
2544 | 2580 |
2545 // This was required for slimming paint v1 but is only temporarily | 2581 // This was required for slimming paint v1 but is only temporarily |
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4258 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); | 4294 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); |
4259 } | 4295 } |
4260 | 4296 |
4261 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4297 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
4262 { | 4298 { |
4263 ASSERT(!layoutViewItem().isNull()); | 4299 ASSERT(!layoutViewItem().isNull()); |
4264 return *layoutView(); | 4300 return *layoutView(); |
4265 } | 4301 } |
4266 | 4302 |
4267 } // namespace blink | 4303 } // namespace blink |
OLD | NEW |