Chromium Code Reviews| Index: third_party/WebKit/Source/core/frame/FrameView.cpp |
| diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp |
| index cff7ed8b8b6b51103211afe344474fb759590101..bc4b3d58da4f1174dd4cab5cd48058e3cb44a6bc 100644 |
| --- a/third_party/WebKit/Source/core/frame/FrameView.cpp |
| +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp |
| @@ -26,6 +26,7 @@ |
| #include "core/frame/FrameView.h" |
| +#include "bindings/core/v8/ScriptCallStack.h" |
|
szager1
2016/06/02 20:52:41
There should be a way to eliminate this. I still
atotic1
2016/06/08 18:59:21
Done. I've just pulled master, and the new API no
|
| #include "core/HTMLNames.h" |
| #include "core/MediaTypeNames.h" |
| #include "core/css/FontFaceSet.h" |
| @@ -37,6 +38,7 @@ |
| #include "core/editing/FrameSelection.h" |
| #include "core/editing/RenderedPosition.h" |
| #include "core/editing/markers/DocumentMarkerController.h" |
| +#include "core/events/ErrorEvent.h" |
| #include "core/fetch/ResourceFetcher.h" |
| #include "core/frame/EventHandlerRegistry.h" |
| #include "core/frame/FrameHost.h" |
| @@ -71,6 +73,7 @@ |
| #include "core/layout/svg/LayoutSVGRoot.h" |
| #include "core/loader/FrameLoader.h" |
| #include "core/loader/FrameLoaderClient.h" |
| +#include "core/observer/ResizeObserverController.h" |
| #include "core/page/AutoscrollController.h" |
| #include "core/page/ChromeClient.h" |
| #include "core/page/FocusController.h" |
| @@ -2408,6 +2411,35 @@ void FrameView::scheduleVisualUpdateForPaintInvalidationIfNeeded() |
| // Otherwise the paint invalidation will be handled in paint invalidation phase of this cycle. |
| } |
| +void FrameView::notifyResizeObserver() |
| +{ |
| + if (!m_frame->document()->resizeObserverController()) |
| + return; |
| + |
| + ResizeObserverController& resizeController = m_frame->document()->ensureResizeObserverController(); |
| + |
| + if (lifecycle().state() < DocumentLifecycle::LayoutClean) |
|
szager1
2016/06/02 20:52:41
This makes me uneasy. If you're going to call upd
atotic1
2016/06/08 18:59:21
Done.
|
| + updateStyleAndLayoutIfNeededRecursive(); |
| + |
| + size_t resizeNotifyCount = 0; |
| + |
| + while (resizeController.gatherObservations()) { |
|
szager1
2016/06/02 20:52:41
This still doesn't seem right. What happens to th
atotic1
2016/06/08 18:59:21
Done. I've added a clearObservations().
I was cle
|
| + if (++resizeNotifyCount > ResizeObserverController::kRenderLoopLimit) { |
| + // report the error and break |
| + ErrorEvent * error = ErrorEvent::create("ResizeObserver loop limit exceeded.", "", 0, 0, nullptr); |
| + m_frame->document()->reportException(error, 0, nullptr, NotSharableCrossOrigin); |
| + break; |
| + } |
| + |
| + resizeController.deliverObservations(); |
| + |
| + if (lifecycle().state() < DocumentLifecycle::LayoutClean || layoutView()->needsLayout()) |
| + updateStyleAndLayoutIfNeededRecursive(); |
| + } |
| + |
| + DCHECK(!layoutView()->needsLayout()); |
| +} |
| + |
| // TODO(leviw): We don't assert lifecycle information from documents in child PluginViews. |
| void FrameView::updateLifecyclePhasesInternal(LifeCycleUpdateOption phases) |
| { |
| @@ -2425,6 +2457,9 @@ void FrameView::updateLifecyclePhasesInternal(LifeCycleUpdateOption phases) |
| } |
| updateStyleAndLayoutIfNeededRecursive(); |
| + |
| + notifyResizeObserver(); |
| + |
| ASSERT(lifecycle().state() >= DocumentLifecycle::LayoutClean); |
| if (phases == OnlyUpToLayoutClean) { |