OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PaintPropertyNode_h |
| 6 #define PaintPropertyNode_h |
| 7 |
| 8 #include "wtf/PassRefPtr.h" |
| 9 #include "wtf/RefCounted.h" |
| 10 #include "wtf/RefPtr.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 template <typename T> |
| 15 class PaintPropertyNode : public RefCounted<T> { |
| 16 public: |
| 17 // Parent property node, or nullptr if this is the root property. |
| 18 const T* parent() const { return m_parent.get(); } |
| 19 // Used to move this node from one tree to another. |
| 20 void setParent(PassRefPtr<T> parent) { m_parent = parent; } |
| 21 |
| 22 // See PaintPropertyTreeBuilder for explanation of isolation. |
| 23 bool isIsolationNode() const { return m_isIsolationNode; } |
| 24 void setIsIsolationNode() { m_isIsolationNode = true; } |
| 25 |
| 26 // This node or ancestor of this node that is not an isolation node. |
| 27 // This is for PaintArtifactCompositor to ignore isolation nodes. |
| 28 // TODO(wangxianzhu): This might be unnecessary when PaintArtifactCompositor |
| 29 // fully works. For now this avoids extra layers for isolation nodes and |
| 30 // pixel differences of layout tests caused by unknown reasons. |
| 31 const T* nonIsolationNode() const |
| 32 { |
| 33 const T* node = static_cast<const T*>(this); |
| 34 while (node && node->isIsolationNode()) |
| 35 node = node->parent(); |
| 36 return node; |
| 37 } |
| 38 |
| 39 // Parent non-isolation property node, or nullptr if this is the root proper
ty. |
| 40 // This is for PaintArtifactCompositor to ignore isolation nodes. |
| 41 const T* nonIsolationParent() const |
| 42 { |
| 43 return m_parent ? m_parent->nonIsolationNode() : nullptr; |
| 44 } |
| 45 |
| 46 protected: |
| 47 PaintPropertyNode() : m_isIsolationNode(false) { } |
| 48 PaintPropertyNode(PassRefPtr<T> parent) : m_parent(parent), m_isIsolationNod
e(false) { } |
| 49 |
| 50 private: |
| 51 RefPtr<T> m_parent; |
| 52 bool m_isIsolationNode; |
| 53 }; |
| 54 |
| 55 } // namespace blink |
| 56 |
| 57 #endif // PaintPropertyNode_h |
OLD | NEW |