summaryrefslogtreecommitdiff
path: root/chromium/cc/trees/element_id.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-17 13:57:45 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-19 13:44:40 +0000
commit6ec7b8da05d21a3878bd21c691b41e675d74bb1c (patch)
treeb87f250bc19413750b9bb9cdbf2da20ef5014820 /chromium/cc/trees/element_id.h
parentec02ee4181c49b61fce1c8fb99292dbb8139cc90 (diff)
downloadqtwebengine-chromium-6ec7b8da05d21a3878bd21c691b41e675d74bb1c.tar.gz
BASELINE: Update Chromium to 60.0.3112.70
Change-Id: I9911c2280a014d4632f254857876a395d4baed2d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/cc/trees/element_id.h')
-rw-r--r--chromium/cc/trees/element_id.h41
1 files changed, 26 insertions, 15 deletions
diff --git a/chromium/cc/trees/element_id.h b/chromium/cc/trees/element_id.h
index 74de4c9995f..059cf2b36d7 100644
--- a/chromium/cc/trees/element_id.h
+++ b/chromium/cc/trees/element_id.h
@@ -24,20 +24,32 @@ class TracedValue;
namespace cc {
-// An "element" is really an animation target. It retains the name element to be
-// symmetric with ElementAnimations and blink::ElementAnimations, but is not
-// in fact tied to the notion of a blink element. It is also not associated with
-// the notion of a Layer. Ultimately, these ids will be used to look up the
-// property tree node associated with the given animation.
+using ElementIdType = uint64_t;
+
+static const ElementIdType kInvalidElementId = 0;
+
+// Element ids are chosen by cc's clients and can be used as a stable identifier
+// across updates.
+//
+// Historically, the layer tree stored all compositing data but this has been
+// refactored over time into auxilliary structures such as property trees.
+//
+// In composited scrolling, Layers directly reference scroll tree nodes
+// (Layer::scroll_tree_index) but scroll tree nodes are being refactored to
+// reference stable element ids instead of layers. Scroll property nodes have
+// unique element ids that blink creates from scrollable areas (though this is
+// opaque to the compositor). This refactoring of scroll nodes keeping a
+// scrolling element id instead of a scrolling layer id allows for more general
+// compositing where, for example, multiple layers scroll with one scroll node.
//
-// These ids are chosen by cc's clients to permit the destruction and
-// restoration of cc entities (when visuals are hidden and shown) but maintain
-// stable identifiers. There will be a single layer for an ElementId, but
-// not every layer will have an id.
+// The animation system (see: ElementAnimations and blink::ElementAnimations) is
+// another auxilliary structure to the layer tree and uses element ids as a
+// stable identifier for animation targets. A Layer's element id can change over
+// the Layer's lifetime because non-default ElementIds are only set during an
+// animation's lifetime.
struct CC_EXPORT ElementId {
- ElementId(int primaryId, int secondaryId)
- : primaryId(primaryId), secondaryId(secondaryId) {}
- ElementId() : ElementId(0, 0) {}
+ explicit ElementId(int id) : id_(id) {}
+ ElementId() : ElementId(kInvalidElementId) {}
bool operator==(const ElementId& o) const;
bool operator!=(const ElementId& o) const;
@@ -52,11 +64,10 @@ struct CC_EXPORT ElementId {
// The compositor treats this as an opaque handle and should not know how to
// interpret these bits. Non-blink cc clients typically operate in terms of
// layers and may set this value to match the client's layer id.
- int primaryId;
- int secondaryId;
+ ElementIdType id_;
};
-CC_EXPORT ElementId LayerIdToElementIdForTesting(int layer_id);
+ElementId CC_EXPORT LayerIdToElementIdForTesting(int layer_id);
struct CC_EXPORT ElementIdHash {
size_t operator()(ElementId key) const;