Index: third_party/WebKit/Source/core/dom/Document.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
index a6bc05b6a25ebf04bf9d4d3ceab14e74b4840986..a90eed34006871a32ea09f6b1d5115803a90a566 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -1531,7 +1531,8 @@ void Document::scheduleLayoutTreeUpdate() |
ASSERT(shouldScheduleLayoutTreeUpdate()); |
ASSERT(needsLayoutTreeUpdate()); |
- page()->animator().scheduleVisualUpdate(); |
+ if (!view() || !view()->shouldThrottleRendering()) |
esprehn
2015/10/14 22:09:46
we shouldn't be able to get here without a view(),
Sami
2015/10/16 16:48:08
Thanks, I didn't realize isActive() implies view()
|
+ page()->animator().scheduleVisualUpdate(); |
m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending); |
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ScheduleStyleRecalculation", TRACE_EVENT_SCOPE_THREAD, "data", InspectorRecalculateStylesEvent::data(frame())); |
@@ -1721,6 +1722,9 @@ void Document::updateLayoutTree(StyleRecalcChange change) |
if (!view() || !isActive()) |
return; |
+ if (view()->shouldThrottleRenderingIfAllowed()) |
+ return; |
+ |
if (change != Force && !needsLayoutTreeUpdate()) { |
ASSERT(lifecycle().state() != DocumentLifecycle::VisualUpdatePending); |
return; |
@@ -1788,6 +1792,9 @@ void Document::updateLayoutTree(StyleRecalcChange change) |
void Document::updateStyle(StyleRecalcChange change) |
{ |
+ if (view() && view()->shouldThrottleRenderingIfAllowed()) |
esprehn
2015/10/14 22:09:46
you must have a view here, no need to null check,
Sami
2015/10/16 16:48:08
Done.
|
+ return; |
+ |
TRACE_EVENT_BEGIN0("blink,blink_style", "Document::updateStyle"); |
unsigned initialResolverAccessCount = styleEngine().resolverAccessCount(); |
@@ -1905,16 +1912,18 @@ void Document::updateLayout() |
if (HTMLFrameOwnerElement* owner = ownerElement()) |
owner->document().updateLayout(); |
+ lifecycle().setThrottlingMode(DocumentLifecycle::ThrottlingMode::Disallow); |
esprehn
2015/10/14 22:09:45
Lets add a scope object for this instead of manual
Sami
2015/10/16 16:48:08
Much cleaner, done. In case it isn't obvious, I ma
|
updateLayoutTreeIfNeeded(); |
- if (!isActive()) |
- return; |
+ if (isActive()) { |
+ if (frameView->needsLayout()) |
+ frameView->layout(); |
- if (frameView->needsLayout()) |
- frameView->layout(); |
+ if (lifecycle().state() < DocumentLifecycle::LayoutClean) |
+ lifecycle().advanceTo(DocumentLifecycle::LayoutClean); |
+ } |
- if (lifecycle().state() < DocumentLifecycle::LayoutClean) |
- lifecycle().advanceTo(DocumentLifecycle::LayoutClean); |
+ lifecycle().setThrottlingMode(DocumentLifecycle::ThrottlingMode::Allow); |
} |
void Document::layoutUpdated() |