| 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
|
| index c59fc27f16496f21a0052eded86c7f093ef9d3da..19555592996153b78883df9520f1af9cc9f6b1c2 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.h
|
| +++ b/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.h
|
| @@ -18,7 +18,7 @@ namespace blink {
|
| // other objects. RefPtrs are used to guard against use-after-free bugs and
|
| // DCHECKs ensure PropertyTreeState never retains the last reference to a
|
| // property tree node.
|
| -class PropertyTreeState {
|
| +class PLATFORM_EXPORT PropertyTreeState {
|
| public:
|
| PropertyTreeState(const TransformPaintPropertyNode* transform,
|
| const ClipPaintPropertyNode* clip,
|
| @@ -34,6 +34,8 @@ class PropertyTreeState {
|
| DCHECK(!m_scroll || !m_scroll->hasOneRef());
|
| }
|
|
|
| + bool hasDirectCompositingReasons() const;
|
| +
|
| const TransformPaintPropertyNode* transform() const {
|
| DCHECK(!m_transform || !m_transform->hasOneRef());
|
| return m_transform.get();
|
| @@ -66,6 +68,50 @@ class PropertyTreeState {
|
| m_scroll = std::move(node);
|
| }
|
|
|
| + enum InnermostNode {
|
| + None, // None means that all nodes are their root values
|
| + Transform,
|
| + Clip,
|
| + Effect,
|
| + };
|
| +
|
| + // There is always a well-defined order in which the transform, clip
|
| + // and effects of a PropertyTreeState apply. This method returns which
|
| + // of them applies first to content drawn with this PropertyTreeState.
|
| + // Note that it may be the case that multiple nodes from the same tree apply
|
| + // before any from another tree. This can happen, for example, if multiple
|
| + // effects or clips apply to a descendant transform state from the transform
|
| + // node.
|
| + //
|
| + // This method is meant to be used in concert with
|
| + // |PropertyTreeStateIterator|, which allows one to iterate over the nodes in
|
| + // the order in which they apply.
|
| + //
|
| + // Example:
|
| + //
|
| + // Transform tree Clip tree Effect tree
|
| + // ~~~~~~~~~~~~~~ ~~~~~~~~~ ~~~~~~~~~~~
|
| + // Root Root Root
|
| + // | | |
|
| + // T C E
|
| + //
|
| + // Suppose that PropertyTreeState(T, C, E).innerMostNode() is E, and
|
| + // PropertytreeState(T, C, Root).innermostNode() is C. Then a PaintChunk
|
| + // that has propertyTreeState = PropertyTreeState(T, C, E) can be painted
|
| + // with the following display list structure:
|
| + //
|
| + // [BeginTransform] [BeginClip] [BeginEffect] PaintChunk drawings
|
| + // [EndEffect] [EndClip] [EndTransform]
|
| + //
|
| + // The PropertyTreeStateIterator will behave like this:
|
| + //
|
| + // PropertyTreeStateIterator iterator(PropertyTreeState(T, C, E));
|
| + // DCHECK(iterator.innermostNode() == Effect);
|
| + // DCHECK(iterator.next()->innermostNode() == Clip);
|
| + // DCHECK(iterator.next()->innermostNode() == Transform);
|
| + // DCHECK(iterator.next()->innermostNode() == None);
|
| + InnermostNode innermostNode() const;
|
| +
|
| private:
|
| RefPtr<const TransformPaintPropertyNode> m_transform;
|
| RefPtr<const ClipPaintPropertyNode> m_clip;
|
| @@ -78,6 +124,21 @@ inline bool operator==(const PropertyTreeState& a, const PropertyTreeState& b) {
|
| a.effect() == b.effect() && a.scroll() == b.scroll();
|
| }
|
|
|
| +// Iterates over the sequence transforms, clips and effects for a
|
| +// PropertyTreeState between that state and the "root" state (all nodes equal
|
| +// to *::Root()), in the order that they apply.
|
| +//
|
| +// See also PropertyTreeState::innermostNode for a more detailed example.
|
| +class PLATFORM_EXPORT PropertyTreeStateIterator {
|
| + public:
|
| + PropertyTreeStateIterator(const PropertyTreeState& properties)
|
| + : m_properties(properties) {}
|
| + const PropertyTreeState* next();
|
| +
|
| + private:
|
| + PropertyTreeState m_properties;
|
| +};
|
| +
|
| } // namespace blink
|
|
|
| #endif // PropertyTreeState_h
|
|
|