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

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: Restore missing code that was blown away by rebase 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 2423 matching lines...) Expand 10 before | Expand all | Expand 10 after
2511 { 2513 {
2512 LocalFrame* localFrameRoot = frame().localFrameRoot(); 2514 LocalFrame* localFrameRoot = frame().localFrameRoot();
2513 if (localFrameRoot->view()->m_currentUpdateLifecyclePhasesTargetState < Docu mentLifecycle::PaintInvalidationClean 2515 if (localFrameRoot->view()->m_currentUpdateLifecyclePhasesTargetState < Docu mentLifecycle::PaintInvalidationClean
2514 || lifecycle().state() >= DocumentLifecycle::PrePaintClean) { 2516 || lifecycle().state() >= DocumentLifecycle::PrePaintClean) {
2515 // Schedule visual update to process the paint invalidation in the next cycle. 2517 // Schedule visual update to process the paint invalidation in the next cycle.
2516 localFrameRoot->scheduleVisualUpdateUnlessThrottled(); 2518 localFrameRoot->scheduleVisualUpdateUnlessThrottled();
2517 } 2519 }
2518 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle. 2520 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle.
2519 } 2521 }
2520 2522
2523 void FrameView::notifyResizeObservers()
2524 {
2525 // Controller exists only if ResizeObserver was created.
2526 if (!frame().document()->resizeObserverController())
2527 return;
2528
2529 ResizeObserverController& resizeController = m_frame->document()->ensureResi zeObserverController();
2530
2531 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean);
2532
2533 size_t minDepth = 0;
2534 for (minDepth = resizeController.gatherObservations(0);
2535 minDepth != ResizeObserverController::kDepthBottom;
2536 minDepth = resizeController.gatherObservations(minDepth)) {
2537 resizeController.deliverObservations();
2538 frame().document()->updateStyleAndLayout();
2539 }
2540
2541 if (resizeController.skippedObservations()) {
2542 resizeController.clearObservations();
2543 ErrorEvent * error = ErrorEvent::create("ResizeObserver loop limit excee ded", SourceLocation::capture(m_frame->document()), nullptr);
2544 m_frame->document()->reportException(error, NotSharableCrossOrigin);
2545 // Ensure notifications will get delivered in next cycle.
2546 if (FrameView* frameView = m_frame->view())
2547 frameView->scheduleAnimation();
2548 }
2549
2550 DCHECK(!layoutView()->needsLayout());
2551 }
2552
2521 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews. 2553 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews.
2522 void FrameView::updateLifecyclePhasesInternal(DocumentLifecycle::LifecycleState targetState) 2554 void FrameView::updateLifecyclePhasesInternal(DocumentLifecycle::LifecycleState targetState)
2523 { 2555 {
2524 // This must be called from the root frame, since it recurses down, not up. 2556 // This must be called from the root frame, since it recurses down, not up.
2525 // Otherwise the lifecycles of the frames might be out of sync. 2557 // Otherwise the lifecycles of the frames might be out of sync.
2526 DCHECK(m_frame->isLocalRoot()); 2558 DCHECK(m_frame->isLocalRoot());
2527 2559
2528 // Only the following target states are supported. 2560 // Only the following target states are supported.
2529 DCHECK(targetState == DocumentLifecycle::LayoutClean 2561 DCHECK(targetState == DocumentLifecycle::LayoutClean
2530 || targetState == DocumentLifecycle::CompositingClean 2562 || targetState == DocumentLifecycle::CompositingClean
(...skipping 11 matching lines...) Expand all
2542 } 2574 }
2543 2575
2544 updateStyleAndLayoutIfNeededRecursive(); 2576 updateStyleAndLayoutIfNeededRecursive();
2545 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean); 2577 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean);
2546 2578
2547 if (targetState == DocumentLifecycle::LayoutClean) { 2579 if (targetState == DocumentLifecycle::LayoutClean) {
2548 updateViewportIntersectionsForSubtree(targetState); 2580 updateViewportIntersectionsForSubtree(targetState);
2549 return; 2581 return;
2550 } 2582 }
2551 2583
2584 if (targetState == DocumentLifecycle::PaintClean) {
2585 forAllNonThrottledFrameViews([](FrameView& frameView) {
2586 frameView.notifyResizeObservers();
2587 });
2588 }
2589
2552 if (LayoutViewItem view = layoutViewItem()) { 2590 if (LayoutViewItem view = layoutViewItem()) {
2553 forAllNonThrottledFrameViews([](FrameView& frameView) { 2591 forAllNonThrottledFrameViews([](FrameView& frameView) {
2554 frameView.checkDoesNotNeedLayout(); 2592 frameView.checkDoesNotNeedLayout();
2555 frameView.m_allowsLayoutInvalidationAfterLayoutClean = false; 2593 frameView.m_allowsLayoutInvalidationAfterLayoutClean = false;
2556 }); 2594 });
2557 2595
2558 { 2596 {
2559 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get())); 2597 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get()));
2560 2598
2561 // This was required for slimming paint v1 but is only temporarily 2599 // This was required for slimming paint v1 but is only temporarily
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
4270 } 4308 }
4271 4309
4272 bool FrameView::canThrottleRendering() const 4310 bool FrameView::canThrottleRendering() const
4273 { 4311 {
4274 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4312 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4275 return false; 4313 return false;
4276 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); 4314 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling);
4277 } 4315 }
4278 4316
4279 } // namespace blink 4317 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/layout/LayoutBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698