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

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

Issue 2204503002: ResizeObserver pt6: integration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 20 matching lines...) Expand all
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 17 matching lines...) Expand all
68 #include "core/layout/api/LayoutItem.h" 69 #include "core/layout/api/LayoutItem.h"
69 #include "core/layout/api/LayoutPartItem.h" 70 #include "core/layout/api/LayoutPartItem.h"
70 #include "core/layout/api/LayoutViewItem.h" 71 #include "core/layout/api/LayoutViewItem.h"
71 #include "core/layout/compositing/CompositedLayerMapping.h" 72 #include "core/layout/compositing/CompositedLayerMapping.h"
72 #include "core/layout/compositing/CompositedSelection.h" 73 #include "core/layout/compositing/CompositedSelection.h"
73 #include "core/layout/compositing/PaintLayerCompositor.h" 74 #include "core/layout/compositing/PaintLayerCompositor.h"
74 #include "core/layout/svg/LayoutSVGRoot.h" 75 #include "core/layout/svg/LayoutSVGRoot.h"
75 #include "core/loader/DocumentLoader.h" 76 #include "core/loader/DocumentLoader.h"
76 #include "core/loader/FrameLoader.h" 77 #include "core/loader/FrameLoader.h"
77 #include "core/loader/FrameLoaderClient.h" 78 #include "core/loader/FrameLoaderClient.h"
79 #include "core/observer/ResizeObserverController.h"
78 #include "core/page/AutoscrollController.h" 80 #include "core/page/AutoscrollController.h"
79 #include "core/page/ChromeClient.h" 81 #include "core/page/ChromeClient.h"
80 #include "core/page/FocusController.h" 82 #include "core/page/FocusController.h"
81 #include "core/page/FrameTree.h" 83 #include "core/page/FrameTree.h"
82 #include "core/page/Page.h" 84 #include "core/page/Page.h"
83 #include "core/page/scrolling/ChildViewportScrollCallback.h" 85 #include "core/page/scrolling/ChildViewportScrollCallback.h"
84 #include "core/page/scrolling/RootScrollerController.h" 86 #include "core/page/scrolling/RootScrollerController.h"
85 #include "core/page/scrolling/RootViewportScrollCallback.h" 87 #include "core/page/scrolling/RootViewportScrollCallback.h"
86 #include "core/page/scrolling/ScrollingCoordinator.h" 88 #include "core/page/scrolling/ScrollingCoordinator.h"
87 #include "core/paint/FramePainter.h" 89 #include "core/paint/FramePainter.h"
(...skipping 2415 matching lines...) Expand 10 before | Expand all | Expand 10 after
2503 { 2505 {
2504 LocalFrame* localFrameRoot = frame().localFrameRoot(); 2506 LocalFrame* localFrameRoot = frame().localFrameRoot();
2505 if (localFrameRoot->view()->m_currentUpdateLifecyclePhasesTargetState < Docu mentLifecycle::PaintInvalidationClean 2507 if (localFrameRoot->view()->m_currentUpdateLifecyclePhasesTargetState < Docu mentLifecycle::PaintInvalidationClean
2506 || lifecycle().state() >= DocumentLifecycle::PrePaintClean) { 2508 || lifecycle().state() >= DocumentLifecycle::PrePaintClean) {
2507 // Schedule visual update to process the paint invalidation in the next cycle. 2509 // Schedule visual update to process the paint invalidation in the next cycle.
2508 localFrameRoot->scheduleVisualUpdateUnlessThrottled(); 2510 localFrameRoot->scheduleVisualUpdateUnlessThrottled();
2509 } 2511 }
2510 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle. 2512 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle.
2511 } 2513 }
2512 2514
2515 void FrameView::notifyResizeObserver()
2516 {
2517 // Controller exists only if ResizeObserver was created.
2518 if (!m_frame->document()->resizeObserverController())
eae 2016/08/01 22:30:40 Use frame().document() instead (as the method is g
atotic1 2016/08/02 23:29:08 Done.
2519 return;
2520
2521 ResizeObserverController& resizeController = m_frame->document()->ensureResi zeObserverController();
2522
2523 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean);
2524
2525 size_t minDepth = 0;
2526 for (minDepth = resizeController.gatherObservations(0);
2527 minDepth != ResizeObserverController::kDepthBottom;
2528 minDepth = resizeController.gatherObservations(minDepth)) {
2529 resizeController.deliverObservations();
2530 if (lifecycle().state() < DocumentLifecycle::LayoutClean || layoutView() ->needsLayout())
2531 updateStyleAndLayoutIfNeededRecursive();
2532 }
2533
2534 if (resizeController.skippedObservations()) {
2535 resizeController.clearObservations();
2536 ErrorEvent * error = ErrorEvent::create("ResizeObserver loop limit excee ded", SourceLocation::capture(m_frame->document()), nullptr);
2537 m_frame->document()->reportException(error, NotSharableCrossOrigin);
2538 // Ensure notifications will get delivered in next cycle.
2539 if (FrameView* frameView = m_frame->view())
2540 frameView->scheduleAnimation();
2541 }
2542
2543 DCHECK(!layoutView()->needsLayout());
2544 }
2545
2513 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews. 2546 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews.
2514 void FrameView::updateLifecyclePhasesInternal(DocumentLifecycle::LifecycleState targetState) 2547 void FrameView::updateLifecyclePhasesInternal(DocumentLifecycle::LifecycleState targetState)
2515 { 2548 {
2516 // This must be called from the root frame, since it recurses down, not up. 2549 // This must be called from the root frame, since it recurses down, not up.
2517 // Otherwise the lifecycles of the frames might be out of sync. 2550 // Otherwise the lifecycles of the frames might be out of sync.
2518 DCHECK(m_frame->isLocalRoot()); 2551 DCHECK(m_frame->isLocalRoot());
2519 2552
2520 // Only the following target states are supported. 2553 // Only the following target states are supported.
2521 DCHECK(targetState == DocumentLifecycle::LayoutClean 2554 DCHECK(targetState == DocumentLifecycle::LayoutClean
2522 || targetState == DocumentLifecycle::CompositingClean 2555 || targetState == DocumentLifecycle::CompositingClean
(...skipping 11 matching lines...) Expand all
2534 } 2567 }
2535 2568
2536 updateStyleAndLayoutIfNeededRecursive(); 2569 updateStyleAndLayoutIfNeededRecursive();
2537 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean); 2570 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean);
2538 2571
2539 if (targetState == DocumentLifecycle::LayoutClean) { 2572 if (targetState == DocumentLifecycle::LayoutClean) {
2540 updateViewportIntersectionsForSubtree(targetState); 2573 updateViewportIntersectionsForSubtree(targetState);
2541 return; 2574 return;
2542 } 2575 }
2543 2576
2577 notifyResizeObserver();
2578
2544 if (LayoutViewItem view = layoutViewItem()) { 2579 if (LayoutViewItem view = layoutViewItem()) {
2545 forAllNonThrottledFrameViews([](FrameView& frameView) { 2580 forAllNonThrottledFrameViews([](FrameView& frameView) {
2546 frameView.checkDoesNotNeedLayout(); 2581 frameView.checkDoesNotNeedLayout();
2547 frameView.m_allowsLayoutInvalidationAfterLayoutClean = false; 2582 frameView.m_allowsLayoutInvalidationAfterLayoutClean = false;
2548 }); 2583 });
2549 2584
2550 { 2585 {
2551 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get())); 2586 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get()));
2552 2587
2553 // This was required for slimming paint v1 but is only temporarily 2588 // This was required for slimming paint v1 but is only temporarily
(...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after
4276 } 4311 }
4277 4312
4278 bool FrameView::canThrottleRendering() const 4313 bool FrameView::canThrottleRendering() const
4279 { 4314 {
4280 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4315 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4281 return false; 4316 return false;
4282 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); 4317 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling);
4283 } 4318 }
4284 4319
4285 } // namespace blink 4320 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698