Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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 WebDisplayItemClipTree_h | |
| 6 #define WebDisplayItemClipTree_h | |
| 7 | |
| 8 #include "public/platform/WebCommon.h" | |
| 9 #include "public/platform/WebFloatRect.h" | |
| 10 #include "public/platform/WebPrivateOwnPtr.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class DisplayItemClipTree; | |
| 15 | |
| 16 // Represents a hierarchy of rectangular clips which apply to ranges of a | |
| 17 // display list and may be of interest to the compositor. | |
| 18 // | |
| 19 // It consists of a tree of "transform nodes", stored in a flattened | |
| 20 // representation in which their order is not guaranteed. Each node has a | |
| 21 // parent (whose clip, and those of its ancestors, also apply to content), | |
| 22 // a transform node index (into an associated |WebDisplayItemTransformTree| | |
| 23 // which defines the coordinate space in which this clip is interpreted), | |
| 24 // and a rectangle representing the clip. | |
| 25 // | |
| 26 // Rounded-rect clips are represented here by their bounding rect; the rounded | |
| 27 // clip should be represented outside the clip tree (e.g. as a mask). | |
| 28 class BLINK_PLATFORM_EXPORT WebDisplayItemClipTree { | |
| 29 public: | |
| 30 enum : size_t { kInvalidIndex = static_cast<size_t>(-1) }; | |
|
pdr.
2015/08/17 22:25:08
kInvalidIndex -> kRootIndex?
jbroman
2015/08/17 23:57:19
This is replicating WebDisplayItemTransformTree.h,
pdr.
2015/08/18 04:31:42
SGTM
| |
| 31 | |
| 32 struct ClipNode { | |
| 33 ClipNode(size_t parent, size_t transformNodeIndex, const WebFloatRect& c lipRect) | |
| 34 : parentNodeIndex(parent) | |
| 35 , transformNodeIndex(transformNodeIndex) | |
| 36 , clipRect(clipRect) | |
| 37 { | |
| 38 } | |
| 39 | |
| 40 bool isRoot() const { return parentNodeIndex == kInvalidIndex; } | |
| 41 | |
| 42 // Index of parent in m_nodes (kInvalidIndex for root). | |
| 43 size_t parentNodeIndex; | |
| 44 | |
| 45 // Index of transform node in which this clip should be interpreted. | |
| 46 // Cannot be WebDisplayItemTransformTree::kInvalidIndex. | |
| 47 size_t transformNodeIndex; | |
| 48 | |
| 49 // Rectangular clip in the space of the transform node. | |
| 50 WebFloatRect clipRect; | |
| 51 }; | |
| 52 | |
| 53 WebDisplayItemClipTree(); | |
| 54 #if INSIDE_BLINK | |
| 55 WebDisplayItemClipTree(const WTF::PassOwnPtr<DisplayItemClipTree>&); | |
| 56 #endif | |
| 57 | |
| 58 ~WebDisplayItemClipTree(); | |
| 59 | |
| 60 // Returns the number of nodes in the clip tree. | |
| 61 size_t nodeCount() const; | |
| 62 | |
| 63 // Returns a node in the clip tree by its index (from 0 to nodeCount() - 1). | |
| 64 const ClipNode& nodeAt(size_t index) const; | |
| 65 | |
| 66 private: | |
| 67 WebPrivateOwnPtr<const DisplayItemClipTree> m_private; | |
| 68 }; | |
| 69 | |
| 70 } // namespace blink | |
| 71 | |
| 72 #endif // WebDisplayItemClipTree_h | |
| OLD | NEW |