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 * |
11 * This library is free software; you can redistribute it and/or | 11 * This library is free software; you can redistribute it and/or |
12 * modify it under the terms of the GNU Library General Public | 12 * modify it under the terms of the GNU Library General Public |
13 * License as published by the Free Software Foundation; either | 13 * License as published by the Free Software Foundation; either |
14 * version 2 of the License, or (at your option) any later version. | 14 * version 2 of the License, or (at your option) any later version. |
15 * | 15 * |
16 * This library is distributed in the hope that it will be useful, | 16 * This library is distributed in the hope that it will be useful, |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 * Library General Public License for more details. | 19 * Library General Public License for more details. |
20 * | 20 * |
21 * You should have received a copy of the GNU Library General Public License | 21 * You should have received a copy of the GNU Library General Public License |
22 * along with this library; see the file COPYING.LIB. If not, write to | 22 * along with this library; see the file COPYING.LIB. If not, write to |
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 * Boston, MA 02110-1301, USA. | 24 * Boston, MA 02110-1301, USA. |
25 */ | 25 */ |
26 | 26 |
27 #include "core/frame/FrameView.h" | 27 #include "core/frame/FrameView.h" |
28 | 28 |
29 #include "bindings/core/v8/ScriptCallStack.h" | |
szager1
2016/05/23 19:49:10
I don't think you use this.
atotic1
2016/05/25 00:15:52
I am using it, through magic of templates. Won't c
| |
29 #include "core/HTMLNames.h" | 30 #include "core/HTMLNames.h" |
30 #include "core/MediaTypeNames.h" | 31 #include "core/MediaTypeNames.h" |
31 #include "core/css/FontFaceSet.h" | 32 #include "core/css/FontFaceSet.h" |
32 #include "core/css/resolver/StyleResolver.h" | 33 #include "core/css/resolver/StyleResolver.h" |
33 #include "core/dom/AXObjectCache.h" | 34 #include "core/dom/AXObjectCache.h" |
34 #include "core/dom/Fullscreen.h" | 35 #include "core/dom/Fullscreen.h" |
35 #include "core/dom/IntersectionObserverController.h" | 36 #include "core/dom/IntersectionObserverController.h" |
36 #include "core/editing/EditingUtilities.h" | 37 #include "core/editing/EditingUtilities.h" |
37 #include "core/editing/FrameSelection.h" | 38 #include "core/editing/FrameSelection.h" |
38 #include "core/editing/RenderedPosition.h" | 39 #include "core/editing/RenderedPosition.h" |
39 #include "core/editing/markers/DocumentMarkerController.h" | 40 #include "core/editing/markers/DocumentMarkerController.h" |
41 #include "core/events/ErrorEvent.h" | |
40 #include "core/fetch/ResourceFetcher.h" | 42 #include "core/fetch/ResourceFetcher.h" |
41 #include "core/frame/EventHandlerRegistry.h" | 43 #include "core/frame/EventHandlerRegistry.h" |
42 #include "core/frame/FrameHost.h" | 44 #include "core/frame/FrameHost.h" |
43 #include "core/frame/LocalFrame.h" | 45 #include "core/frame/LocalFrame.h" |
44 #include "core/frame/Location.h" | 46 #include "core/frame/Location.h" |
45 #include "core/frame/PageScaleConstraintsSet.h" | 47 #include "core/frame/PageScaleConstraintsSet.h" |
46 #include "core/frame/Settings.h" | 48 #include "core/frame/Settings.h" |
47 #include "core/frame/TopControls.h" | 49 #include "core/frame/TopControls.h" |
48 #include "core/html/HTMLFrameElement.h" | 50 #include "core/html/HTMLFrameElement.h" |
49 #include "core/html/HTMLPlugInElement.h" | 51 #include "core/html/HTMLPlugInElement.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
68 #include "core/layout/TracedLayoutObject.h" | 70 #include "core/layout/TracedLayoutObject.h" |
69 #include "core/layout/api/LayoutBoxModel.h" | 71 #include "core/layout/api/LayoutBoxModel.h" |
70 #include "core/layout/api/LayoutItem.h" | 72 #include "core/layout/api/LayoutItem.h" |
71 #include "core/layout/api/LayoutViewItem.h" | 73 #include "core/layout/api/LayoutViewItem.h" |
72 #include "core/layout/compositing/CompositedLayerMapping.h" | 74 #include "core/layout/compositing/CompositedLayerMapping.h" |
73 #include "core/layout/compositing/CompositedSelection.h" | 75 #include "core/layout/compositing/CompositedSelection.h" |
74 #include "core/layout/compositing/PaintLayerCompositor.h" | 76 #include "core/layout/compositing/PaintLayerCompositor.h" |
75 #include "core/layout/svg/LayoutSVGRoot.h" | 77 #include "core/layout/svg/LayoutSVGRoot.h" |
76 #include "core/loader/FrameLoader.h" | 78 #include "core/loader/FrameLoader.h" |
77 #include "core/loader/FrameLoaderClient.h" | 79 #include "core/loader/FrameLoaderClient.h" |
80 #include "core/observer/ResizeObserverController.h" | |
78 #include "core/page/AutoscrollController.h" | 81 #include "core/page/AutoscrollController.h" |
79 #include "core/page/ChromeClient.h" | 82 #include "core/page/ChromeClient.h" |
80 #include "core/page/FocusController.h" | 83 #include "core/page/FocusController.h" |
81 #include "core/page/FrameTree.h" | 84 #include "core/page/FrameTree.h" |
82 #include "core/page/Page.h" | 85 #include "core/page/Page.h" |
83 #include "core/page/scrolling/ScrollingCoordinator.h" | 86 #include "core/page/scrolling/ScrollingCoordinator.h" |
84 #include "core/paint/FramePainter.h" | 87 #include "core/paint/FramePainter.h" |
85 #include "core/paint/PaintLayer.h" | 88 #include "core/paint/PaintLayer.h" |
86 #include "core/paint/PaintPropertyTreeBuilder.h" | 89 #include "core/paint/PaintPropertyTreeBuilder.h" |
87 #include "core/plugins/PluginView.h" | 90 #include "core/plugins/PluginView.h" |
(...skipping 2316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2404 void FrameView::scheduleVisualUpdateForPaintInvalidationIfNeeded() | 2407 void FrameView::scheduleVisualUpdateForPaintInvalidationIfNeeded() |
2405 { | 2408 { |
2406 LocalFrame* localFrameRoot = frame().localFrameRoot(); | 2409 LocalFrame* localFrameRoot = frame().localFrameRoot(); |
2407 if (!localFrameRoot->view()->m_isUpdatingAllLifecyclePhases || lifecycle().s tate() >= DocumentLifecycle::PaintInvalidationClean) { | 2410 if (!localFrameRoot->view()->m_isUpdatingAllLifecyclePhases || lifecycle().s tate() >= DocumentLifecycle::PaintInvalidationClean) { |
2408 // Schedule visual update to process the paint invalidation in the next cycle. | 2411 // Schedule visual update to process the paint invalidation in the next cycle. |
2409 localFrameRoot->scheduleVisualUpdateUnlessThrottled(); | 2412 localFrameRoot->scheduleVisualUpdateUnlessThrottled(); |
2410 } | 2413 } |
2411 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle. | 2414 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle. |
2412 } | 2415 } |
2413 | 2416 |
2417 void FrameView::notifyResizeObserver() | |
2418 { | |
2419 if (!m_frame->document()->hasResizeObserverController()) | |
2420 return; | |
2421 | |
2422 ResizeObserverController& resizeController = m_frame->document()->ensureResi zeObserverController(); | |
2423 | |
2424 // Messy looping logic: | |
2425 // Loop until : | |
2426 // - no notifications were delivered, or | |
2427 // - more than kRenderLoopLimit resizeObservations were processed | |
2428 // DocumentLifecycle should be LayoutClean before and after processing all n otifications. | |
2429 | |
2430 size_t resizeNotifyCount = 0; | |
2431 bool done = false; | |
2432 | |
2433 while (!done) { | |
szager1
2016/05/23 19:49:10
I think this loop might read better as:
do {
re
atotic1
2016/05/25 00:15:52
I reworked the loop into something more understand
| |
2434 | |
2435 // This does not work because lifecycle does not roll back. | |
2436 // if (lifecycle().state() < DocumentLifecycle::LayoutClean) | |
2437 | |
2438 // This causes the bug too. | |
2439 // if (m_frame->document()->needsLayoutTreeUpdate()) | |
2440 // updateStyleAndLayoutIfNeededRecursive(); | |
2441 | |
2442 // FIXME(atotic) -- unsure if this is the right way to | |
2443 // loop over layout pipeline. | |
2444 if (lifecycle().state() < DocumentLifecycle::LayoutClean | |
2445 || layoutView()->needsLayout()) | |
2446 updateStyleAndLayoutIfNeededRecursive(); | |
2447 | |
2448 resizeController.gatherObservations(); | |
2449 if (!resizeController.hasObservations()) { | |
2450 // No resize entries delivered, we are done. | |
2451 done = true; | |
2452 } else { | |
2453 resizeController.deliverObservations(); | |
2454 resizeNotifyCount++; | |
2455 if (resizeNotifyCount == ResizeObserverController::kRenderLoopLimit) { | |
szager1
2016/05/23 19:49:10
If you're going to generate an error, you should d
atotic1
2016/05/25 00:15:52
Acknowledged.
| |
2456 // report the error | |
2457 ErrorEvent * error = ErrorEvent::create("ResizeObserver loop lim it exceeded.", "", 0, 0, nullptr); | |
2458 m_frame->document()->reportException(error, 0, nullptr, NotShara bleCrossOrigin); | |
2459 done = true; | |
2460 } | |
2461 } | |
2462 } | |
2463 | |
2464 if (layoutView()->needsLayout()) | |
2465 updateStyleAndLayoutIfNeededRecursive(); | |
2466 } | |
2467 | |
2414 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews. | 2468 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews. |
2415 void FrameView::updateLifecyclePhasesInternal(LifeCycleUpdateOption phases) | 2469 void FrameView::updateLifecyclePhasesInternal(LifeCycleUpdateOption phases) |
2416 { | 2470 { |
2417 Optional<TemporaryChange<bool>> isUpdatingAllLifecyclePhasesScope; | 2471 Optional<TemporaryChange<bool>> isUpdatingAllLifecyclePhasesScope; |
2418 if (phases == AllPhases) | 2472 if (phases == AllPhases) |
2419 isUpdatingAllLifecyclePhasesScope.emplace(m_isUpdatingAllLifecyclePhases , true); | 2473 isUpdatingAllLifecyclePhasesScope.emplace(m_isUpdatingAllLifecyclePhases , true); |
2420 | 2474 |
2421 // This must be called from the root frame, since it recurses down, not up. | 2475 // This must be called from the root frame, since it recurses down, not up. |
2422 // Otherwise the lifecycles of the frames might be out of sync. | 2476 // Otherwise the lifecycles of the frames might be out of sync. |
2423 ASSERT(m_frame->isLocalRoot()); | 2477 ASSERT(m_frame->isLocalRoot()); |
2424 | 2478 |
2425 if (shouldThrottleRendering()) { | 2479 if (shouldThrottleRendering()) { |
2426 updateViewportIntersectionsForSubtree(std::min(phases, OnlyUpToCompositi ngCleanPlusScrolling)); | 2480 updateViewportIntersectionsForSubtree(std::min(phases, OnlyUpToCompositi ngCleanPlusScrolling)); |
2427 return; | 2481 return; |
2428 } | 2482 } |
2429 | 2483 |
2430 updateStyleAndLayoutIfNeededRecursive(); | 2484 updateStyleAndLayoutIfNeededRecursive(); |
2485 | |
2486 notifyResizeObserver(); | |
szager1
2016/05/23 19:49:10
Maybe rename this to runUpdateNotifyLoop(), and re
atotic1
2016/05/25 00:15:52
I'd prefer not to rename it until it does somethin
| |
2487 | |
2431 ASSERT(lifecycle().state() >= DocumentLifecycle::LayoutClean); | 2488 ASSERT(lifecycle().state() >= DocumentLifecycle::LayoutClean); |
2432 | 2489 |
2433 if (phases == OnlyUpToLayoutClean) { | 2490 if (phases == OnlyUpToLayoutClean) { |
2434 updateViewportIntersectionsForSubtree(phases); | 2491 updateViewportIntersectionsForSubtree(phases); |
2435 return; | 2492 return; |
2436 } | 2493 } |
2437 | 2494 |
2438 if (LayoutViewItem view = layoutViewItem()) { | 2495 if (LayoutViewItem view = layoutViewItem()) { |
2439 { | 2496 { |
2440 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get())); | 2497 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get())); |
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4107 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); | 4164 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); |
4108 } | 4165 } |
4109 | 4166 |
4110 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4167 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
4111 { | 4168 { |
4112 ASSERT(layoutView()); | 4169 ASSERT(layoutView()); |
4113 return *layoutView(); | 4170 return *layoutView(); |
4114 } | 4171 } |
4115 | 4172 |
4116 } // namespace blink | 4173 } // namespace blink |
OLD | NEW |