Index: third_party/WebKit/Source/platform/graphics/paint/PaintPropertyNode.h |
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintPropertyNode.h b/third_party/WebKit/Source/platform/graphics/paint/PaintPropertyNode.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2518646aa689b21490b61df70e61b1ccbc5fe57a |
--- /dev/null |
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintPropertyNode.h |
@@ -0,0 +1,57 @@ |
+// 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 PaintPropertyNode_h |
+#define PaintPropertyNode_h |
+ |
+#include "wtf/PassRefPtr.h" |
+#include "wtf/RefCounted.h" |
+#include "wtf/RefPtr.h" |
+ |
+namespace blink { |
+ |
+template <typename T> |
+class PaintPropertyNode : public RefCounted<T> { |
+public: |
+ // Parent property node, or nullptr if this is the root property. |
+ const T* parent() const { return m_parent.get(); } |
+ // Used to move this node from one tree to another. |
+ void setParent(PassRefPtr<T> parent) { m_parent = parent; } |
+ |
+ // See PaintPropertyTreeBuilder for explanation of isolation. |
+ bool isIsolationNode() const { return m_isIsolationNode; } |
+ void setIsIsolationNode() { m_isIsolationNode = true; } |
+ |
+ // This node or ancestor of this node that is not an isolation node. |
+ // This is for PaintArtifactCompositor to ignore isolation nodes. |
+ // TODO(wangxianzhu): This might be unnecessary when PaintArtifactCompositor |
+ // fully works. For now this avoids extra layers for isolation nodes and |
+ // pixel differences of layout tests caused by unknown reasons. |
+ const T* nonIsolationNode() const |
+ { |
+ const T* node = static_cast<const T*>(this); |
+ while (node && node->isIsolationNode()) |
+ node = node->parent(); |
+ return node; |
+ } |
+ |
+ // Parent non-isolation property node, or nullptr if this is the root property. |
+ // This is for PaintArtifactCompositor to ignore isolation nodes. |
+ const T* nonIsolationParent() const |
+ { |
+ return m_parent ? m_parent->nonIsolationNode() : nullptr; |
+ } |
+ |
+protected: |
+ PaintPropertyNode() : m_isIsolationNode(false) { } |
+ PaintPropertyNode(PassRefPtr<T> parent) : m_parent(parent), m_isIsolationNode(false) { } |
+ |
+private: |
+ RefPtr<T> m_parent; |
+ bool m_isIsolationNode; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // PaintPropertyNode_h |