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

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

Issue 213773002: Make compositing updates 30.7% faster for calculator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix ASSERT Created 6 years, 9 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
Index: Source/core/rendering/compositing/CompositingPropertyUpdater.cpp
diff --git a/Source/core/rendering/compositing/CompositingPropertyUpdater.cpp b/Source/core/rendering/compositing/CompositingPropertyUpdater.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..269d3eadfbc39ccb38deaeede65dbaedab8046f7
--- /dev/null
+++ b/Source/core/rendering/compositing/CompositingPropertyUpdater.cpp
@@ -0,0 +1,61 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/rendering/compositing/CompositingPropertyUpdater.h"
+
+#include "core/rendering/RenderLayer.h"
+
+namespace WebCore {
+
+CompositingPropertyUpdater::CompositingPropertyUpdater()
+ : m_geometryMap(UseTransforms)
+{
+}
+
+CompositingPropertyUpdater::~CompositingPropertyUpdater()
+{
+}
+
+void CompositingPropertyUpdater::updateAncestorDependentProperties(RenderLayer* layer, UpdateType updateType)
+{
+ if (!layer->childNeedsToUpdateAncestorDependantProperties() && updateType != ForceUpdate)
+ return;
+
+ m_geometryMap.pushMappingsToAncestor(layer, layer->parent());
+
+ if (layer->needsToUpdateAncestorDependentProperties())
+ updateType = ForceUpdate;
+
+ if (updateType == ForceUpdate) {
+ RenderLayer::AncestorDependentProperties properties;
+
+ if (!layer->isRootLayer())
+ properties.absoluteBoundingBox = enclosingIntRect(m_geometryMap.absoluteRect(layer->overlapBounds()));
+
+ layer->updateAncestorDependentProperties(properties);
+ }
+
+ for (RenderLayer* child = layer->firstChild(); child; child = child->nextSibling())
+ updateAncestorDependentProperties(child, updateType);
+
+ m_geometryMap.popMappingsToAncestor(layer->parent());
+
+ layer->clearChildNeedsToUpdateAncestorDependantProperties();
+}
+
+#if !ASSERT_DISABLED
+
+void CompositingPropertyUpdater::assertNeedsToUpdateAncestorDependantPropertiesBitsCleared(RenderLayer* layer)
+{
+ ASSERT(!layer->childNeedsToUpdateAncestorDependantProperties());
+ ASSERT(!layer->needsToUpdateAncestorDependentProperties());
+
+ for (RenderLayer* child = layer->firstChild(); child; child = child->nextSibling())
+ assertNeedsToUpdateAncestorDependantPropertiesBitsCleared(child);
+}
+
+#endif
+
+} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698