Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3286)

Unified Diff: cc/layers/layer_impl.h

Issue 2867793002: Add a cache of LayerImpl's viewport layer type (Closed)
Patch Set: Rebase from space Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/layers/layer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_impl.h
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index 4d2e85310fb23b08bb6659ef7414bade89188fda..2ed76e65d6aab49250dcac3e0d15281c759f5cd2 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -70,6 +70,15 @@ enum DrawMode {
DRAW_MODE_RESOURCELESS_SOFTWARE
};
+enum ViewportLayerType {
+ NOT_VIEWPORT_LAYER,
+ INNER_VIEWPORT_CONTAINER,
+ OUTER_VIEWPORT_CONTAINER,
+ INNER_VIEWPORT_SCROLL,
+ OUTER_VIEWPORT_SCROLL,
+ LAST_VIEWPORT_LAYER_TYPE = OUTER_VIEWPORT_SCROLL,
+};
+
class CC_EXPORT LayerImpl {
public:
static std::unique_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
@@ -264,12 +273,22 @@ class CC_EXPORT LayerImpl {
// of pixels) due to use of single precision float.
gfx::SizeF BoundsForScrolling() const;
- // Viewport bounds delta are used for viewport layers and accounts for changes
- // in the viewport layers from browser controls and page scale factors. These
- // deltas are only set on the active tree.
+ // Viewport bounds delta are only used for viewport layers and account for
+ // changes in the viewport layers from browser controls and page scale
+ // factors. These deltas are only set on the active tree.
void SetViewportBoundsDelta(const gfx::Vector2dF& bounds_delta);
gfx::Vector2dF ViewportBoundsDelta() const;
+ void SetViewportLayerType(ViewportLayerType type) {
+ // Once set as a viewport layer type, the viewport type should not change.
+ DCHECK(viewport_layer_type() == NOT_VIEWPORT_LAYER ||
+ viewport_layer_type() == type);
+ viewport_layer_type_ = type;
+ }
+ ViewportLayerType viewport_layer_type() const {
+ return static_cast<ViewportLayerType>(viewport_layer_type_);
+ }
+
void SetCurrentScrollOffset(const gfx::ScrollOffset& scroll_offset);
gfx::ScrollOffset CurrentScrollOffset() const;
@@ -503,6 +522,10 @@ class CC_EXPORT LayerImpl {
// (all content was complete).
bool was_ever_ready_since_last_transform_animation_ : 1;
+ static_assert(LAST_VIEWPORT_LAYER_TYPE < (1u << 3),
+ "enough bits for ViewportLayerType (viewport_layer_type_)");
+ uint8_t viewport_layer_type_ : 3; // ViewportLayerType
+
Region non_fast_scrollable_region_;
Region touch_event_handler_region_;
SkColor background_color_;
« no previous file with comments | « no previous file | cc/layers/layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698