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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.h

Issue 2338373004: Refactor PropertyTreeState as GeometryPropertyTreeState (Closed)
Patch Set: Rebase Created 4 years, 3 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: third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.h
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.h b/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.h
deleted file mode 100644
index 7d8b893c3b1fa31121079080ad6c9f3e35c8413a..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2016 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.
-
-#ifndef PropertyTreeState_h
-#define PropertyTreeState_h
-
-#include "platform/graphics/paint/ClipPaintPropertyNode.h"
-#include "platform/graphics/paint/EffectPaintPropertyNode.h"
-#include "platform/graphics/paint/TransformPaintPropertyNode.h"
-#include "wtf/HashFunctions.h"
-#include "wtf/HashTraits.h"
-
-namespace blink {
-
-// Represents the combination of transform, clip and effect nodes for a particular coordinate space.
-// See GeometryMapper.
-// Scroll nodes (ScrollPaintPropertyNode) are not needed for mapping geometry and have been left off
-// of this structure.
-// TODO(pdr): Rename this GeometryPropertyTreeState.
-struct PropertyTreeState {
- PropertyTreeState() : PropertyTreeState(nullptr, nullptr, nullptr) {}
-
- PropertyTreeState(
- const TransformPaintPropertyNode* transform,
- const ClipPaintPropertyNode* clip,
- const EffectPaintPropertyNode* effect)
- : transform(transform), clip(clip), effect(effect) {}
-
- RefPtr<const TransformPaintPropertyNode> transform;
- RefPtr<const ClipPaintPropertyNode> clip;
- RefPtr<const EffectPaintPropertyNode> effect;
-};
-
-template <class A>
-unsigned propertyTreeNodeDepth(const A* node)
-{
- unsigned depth = 0;
- while (node) {
- depth++;
- node = node->parent();
- }
- return depth;
-}
-
-template <class A>
-const A* propertyTreeNearestCommonAncestor(const A* a, const A* b)
-{
- // Measure both depths.
- unsigned depthA = propertyTreeNodeDepth<A>(a);
- unsigned depthB = propertyTreeNodeDepth<A>(b);
-
- // Make it so depthA >= depthB.
- if (depthA < depthB) {
- std::swap(a, b);
- std::swap(depthA, depthB);
- }
-
- // Make it so depthA == depthB.
- while (depthA > depthB) {
- a = a->parent();
- depthA--;
- }
-
- // Walk up until we find the ancestor.
- while (a != b) {
- a = a->parent();
- b = b->parent();
- }
- return a;
-}
-
-} // namespace blink
-
-#endif // PropertyTreeState_h

Powered by Google App Engine
This is Rietveld 408576698