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 15ae442e9a9fb3ac1d7ab4b34e0fade56b777386..83a4f3af39da8944b1bf8457fc1de0a72aef06d0 100644 |
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp |
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp |
@@ -38,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" |
@@ -75,6 +76,7 @@ |
#include "core/loader/DocumentLoader.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" |
@@ -2510,6 +2512,37 @@ void FrameView::scheduleVisualUpdateForPaintInvalidationIfNeeded() |
// Otherwise the paint invalidation will be handled in paint invalidation phase of this cycle. |
} |
+void FrameView::notifyResizeObserver() |
esprehn
2016/08/03 18:06:51
Hmm, you're calling this in updateLifecyclePhasesI
atotic1
2016/08/04 23:59:40
Done.
I added forAllNonThrottledFrameViews loop t
|
+{ |
+ // Controller exists only if ResizeObserver was created. |
+ if (!frame().document()->resizeObserverController()) |
+ return; |
+ |
+ ResizeObserverController& resizeController = m_frame->document()->ensureResizeObserverController(); |
+ |
+ DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean); |
+ |
+ size_t minDepth = 0; |
+ for (minDepth = resizeController.gatherObservations(0); |
+ minDepth != ResizeObserverController::kDepthBottom; |
+ minDepth = resizeController.gatherObservations(minDepth)) { |
+ resizeController.deliverObservations(); |
+ if (lifecycle().state() < DocumentLifecycle::LayoutClean || layoutView()->needsLayout()) |
esprehn
2016/08/03 18:06:51
don't check the lifecycle or dirty bits manually
atotic1
2016/08/04 23:59:40
Done.
|
+ updateStyleAndLayoutIfNeededRecursive(); |
esprehn
2016/08/03 18:06:51
You don't want to do this, it walks the entire fra
atotic1
2016/08/04 23:59:40
My fix: frame().document()->updateStyleAndLayout()
|
+ } |
+ |
+ if (resizeController.skippedObservations()) { |
+ resizeController.clearObservations(); |
+ ErrorEvent * error = ErrorEvent::create("ResizeObserver loop limit exceeded", SourceLocation::capture(m_frame->document()), nullptr); |
+ m_frame->document()->reportException(error, NotSharableCrossOrigin); |
+ // Ensure notifications will get delivered in next cycle. |
+ if (FrameView* frameView = m_frame->view()) |
+ frameView->scheduleAnimation(); |
+ } |
+ |
+ DCHECK(!layoutView()->needsLayout()); |
+} |
+ |
// TODO(leviw): We don't assert lifecycle information from documents in child PluginViews. |
void FrameView::updateLifecyclePhasesInternal(DocumentLifecycle::LifecycleState targetState) |
{ |
@@ -2541,6 +2574,8 @@ void FrameView::updateLifecyclePhasesInternal(DocumentLifecycle::LifecycleState |
return; |
} |
+ notifyResizeObserver(); |
+ |
if (LayoutViewItem view = layoutViewItem()) { |
forAllNonThrottledFrameViews([](FrameView& frameView) { |
frameView.checkDoesNotNeedLayout(); |