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

Unified Diff: Source/core/rendering/compositing/RenderLayerCompositor.cpp

Issue 232013002: Rewind the DocumentLifecycle when dirtying state (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address Ojan's comments Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/frame/LocalFrame.cpp ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/compositing/RenderLayerCompositor.cpp
diff --git a/Source/core/rendering/compositing/RenderLayerCompositor.cpp b/Source/core/rendering/compositing/RenderLayerCompositor.cpp
index 64df81d2b4c215ae7469d759b33ef69c73e40ba9..07867c9eca35fbb5b72bb576a7fb4ad29ec5ec6a 100644
--- a/Source/core/rendering/compositing/RenderLayerCompositor.cpp
+++ b/Source/core/rendering/compositing/RenderLayerCompositor.cpp
@@ -76,6 +76,34 @@ namespace WebCore {
using namespace HTMLNames;
+class DeprecatedDirtyCompositingDuringCompositingUpdate {
+ WTF_MAKE_NONCOPYABLE(DeprecatedDirtyCompositingDuringCompositingUpdate);
+public:
+ DeprecatedDirtyCompositingDuringCompositingUpdate(DocumentLifecycle& lifecycle)
+ : m_lifecycle(lifecycle)
+ , m_deprecatedTransition(lifecycle.state(), DocumentLifecycle::LayoutClean)
+ , m_originalState(lifecycle.state())
+ {
+ }
+
+ ~DeprecatedDirtyCompositingDuringCompositingUpdate()
+ {
+ if (m_originalState != DocumentLifecycle::InCompositingUpdate)
+ return;
+ if (m_lifecycle.state() != m_originalState) {
+ // FIXME: It's crazy that we can trigger a style recalc from inside
+ // the compositing update, but that happens in compositing/visibility/hidden-iframe.html.
+ ASSERT(m_lifecycle.state() == DocumentLifecycle::LayoutClean || m_lifecycle.state() == DocumentLifecycle::VisualUpdatePending);
+ m_lifecycle.advanceTo(m_originalState);
+ }
+ }
+
+private:
+ DocumentLifecycle& m_lifecycle;
+ DocumentLifecycle::DeprecatedTransition m_deprecatedTransition;
+ DocumentLifecycle::State m_originalState;
+};
+
RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView)
: m_renderView(renderView)
, m_compositingReasonFinder(renderView)
@@ -180,7 +208,10 @@ void RenderLayerCompositor::setCompositingLayersNeedRebuild()
// FIXME: crbug,com/332248 ideally this could be merged with setNeedsCompositingUpdate().
if (inCompositingMode())
m_compositingLayersNeedRebuild = true;
+ if (!lifecycle().isActive())
+ return;
page()->animator().scheduleVisualUpdate();
+ lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean);
}
void RenderLayerCompositor::updateCompositingRequirementsState()
@@ -264,7 +295,9 @@ void RenderLayerCompositor::setNeedsCompositingUpdate(CompositingUpdateType upda
return;
m_pendingUpdateType = std::max(m_pendingUpdateType, updateType);
+
page()->animator().scheduleVisualUpdate();
+ lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean);
}
void RenderLayerCompositor::scheduleAnimationIfNeeded()
@@ -433,7 +466,10 @@ bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* l
switch (compositedLayerUpdate) {
case AllocateOwnCompositedLayerMapping:
ASSERT(!layer->hasCompositedLayerMapping());
- enableCompositingMode();
+ {
+ DeprecatedDirtyCompositingDuringCompositingUpdate marker(lifecycle());
+ enableCompositingMode();
+ }
// If we need to repaint, do so before allocating the compositedLayerMapping
repaintOnCompositingChange(layer);
« no previous file with comments | « Source/core/frame/LocalFrame.cpp ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698