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

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: Added test for moving dom inside eventloop 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 2420 matching lines...) Expand 10 before | Expand all | Expand 10 after
2508 { 2510 {
2509 LocalFrame* localFrameRoot = frame().localFrameRoot(); 2511 LocalFrame* localFrameRoot = frame().localFrameRoot();
2510 if (localFrameRoot->view()->m_currentUpdateLifecyclePhasesTargetState < Docu mentLifecycle::PaintInvalidationClean 2512 if (localFrameRoot->view()->m_currentUpdateLifecyclePhasesTargetState < Docu mentLifecycle::PaintInvalidationClean
2511 || lifecycle().state() >= DocumentLifecycle::PrePaintClean) { 2513 || lifecycle().state() >= DocumentLifecycle::PrePaintClean) {
2512 // Schedule visual update to process the paint invalidation in the next cycle. 2514 // Schedule visual update to process the paint invalidation in the next cycle.
2513 localFrameRoot->scheduleVisualUpdateUnlessThrottled(); 2515 localFrameRoot->scheduleVisualUpdateUnlessThrottled();
2514 } 2516 }
2515 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle. 2517 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle.
2516 } 2518 }
2517 2519
2520 void FrameView::notifyResizeObserver()
esprehn 2016/08/10 04:27:09 Observers() I think you want plural?
atotic1 2016/08/10 18:25:33 Done. I usually keep everything singular for simp
2521 {
2522 // Controller exists only if ResizeObserver was created.
2523 if (!frame().document()->resizeObserverController())
2524 return;
2525
2526 ResizeObserverController& resizeController = m_frame->document()->ensureResi zeObserverController();
2527
2528 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean);
2529
2530 size_t minDepth = 0;
2531 for (minDepth = resizeController.gatherObservations(0);
2532 minDepth != ResizeObserverController::kDepthBottom;
2533 minDepth = resizeController.gatherObservations(minDepth)) {
2534 resizeController.deliverObservations();
2535 frame().document()->updateStyleAndLayout();
2536 }
2537
2538 if (resizeController.skippedObservations()) {
2539 resizeController.clearObservations();
esprehn 2016/08/10 04:27:09 Hmm, if we clear the observations how does schedul
atotic1 2016/08/10 18:25:33 This is non-obvious. ResizeObserver has a set of
2540 ErrorEvent * error = ErrorEvent::create("ResizeObserver loop limit excee ded", SourceLocation::capture(m_frame->document()), nullptr);
2541 m_frame->document()->reportException(error, NotSharableCrossOrigin);
2542 // Ensure notifications will get delivered in next cycle.
2543 if (FrameView* frameView = m_frame->view())
2544 frameView->scheduleAnimation();
2545 }
2546
2547 DCHECK(!layoutView()->needsLayout());
2548 }
2549
2518 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews. 2550 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews.
2519 void FrameView::updateLifecyclePhasesInternal(DocumentLifecycle::LifecycleState targetState) 2551 void FrameView::updateLifecyclePhasesInternal(DocumentLifecycle::LifecycleState targetState)
2520 { 2552 {
2521 // This must be called from the root frame, since it recurses down, not up. 2553 // This must be called from the root frame, since it recurses down, not up.
2522 // Otherwise the lifecycles of the frames might be out of sync. 2554 // Otherwise the lifecycles of the frames might be out of sync.
2523 DCHECK(m_frame->isLocalRoot()); 2555 DCHECK(m_frame->isLocalRoot());
2524 2556
2525 // Only the following target states are supported. 2557 // Only the following target states are supported.
2526 DCHECK(targetState == DocumentLifecycle::LayoutClean 2558 DCHECK(targetState == DocumentLifecycle::LayoutClean
2527 || targetState == DocumentLifecycle::CompositingClean 2559 || targetState == DocumentLifecycle::CompositingClean
(...skipping 11 matching lines...) Expand all
2539 } 2571 }
2540 2572
2541 updateStyleAndLayoutIfNeededRecursive(); 2573 updateStyleAndLayoutIfNeededRecursive();
2542 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean); 2574 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean);
2543 2575
2544 if (targetState == DocumentLifecycle::LayoutClean) { 2576 if (targetState == DocumentLifecycle::LayoutClean) {
2545 updateViewportIntersectionsForSubtree(targetState); 2577 updateViewportIntersectionsForSubtree(targetState);
2546 return; 2578 return;
2547 } 2579 }
2548 2580
2581 forAllNonThrottledFrameViews([](FrameView& frameView) {
2582 frameView.notifyResizeObserver();
esprehn 2016/08/10 04:27:09 Did you add some iframe tests where the new Resize
atotic1 2016/08/10 18:25:33 observer.html, test6()
2583 });
2584
2549 if (LayoutViewItem view = layoutViewItem()) { 2585 if (LayoutViewItem view = layoutViewItem()) {
2550 forAllNonThrottledFrameViews([](FrameView& frameView) { 2586 forAllNonThrottledFrameViews([](FrameView& frameView) {
2551 frameView.checkDoesNotNeedLayout(); 2587 frameView.checkDoesNotNeedLayout();
2552 frameView.m_allowsLayoutInvalidationAfterLayoutClean = false; 2588 frameView.m_allowsLayoutInvalidationAfterLayoutClean = false;
2553 }); 2589 });
2554 2590
2555 { 2591 {
2556 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get())); 2592 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get()));
2557 2593
2558 // This was required for slimming paint v1 but is only temporarily 2594 // This was required for slimming paint v1 but is only temporarily
(...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after
4281 } 4317 }
4282 4318
4283 bool FrameView::canThrottleRendering() const 4319 bool FrameView::canThrottleRendering() const
4284 { 4320 {
4285 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4321 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4286 return false; 4322 return false;
4287 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); 4323 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling);
4288 } 4324 }
4289 4325
4290 } // namespace blink 4326 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698