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

Unified Diff: cc/layers/layer_sticky_position_constraint.cc

Issue 2733633002: Handle nested position:sticky elements correctly (compositor) (Closed)
Patch Set: Revert float changes to unittests too Created 3 years, 9 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
Index: cc/layers/layer_sticky_position_constraint.cc
diff --git a/cc/layers/layer_sticky_position_constraint.cc b/cc/layers/layer_sticky_position_constraint.cc
index 79414d6a8775daeb4d3a0a67a9b4717cdb61432e..7168e26169cc3401918b193e1655fd7dfe317be7 100644
--- a/cc/layers/layer_sticky_position_constraint.cc
+++ b/cc/layers/layer_sticky_position_constraint.cc
@@ -4,6 +4,8 @@
#include "cc/layers/layer_sticky_position_constraint.h"
+#include "cc/layers/layer.h"
+
namespace cc {
LayerStickyPositionConstraint::LayerStickyPositionConstraint()
@@ -15,7 +17,9 @@ LayerStickyPositionConstraint::LayerStickyPositionConstraint()
left_offset(0.f),
right_offset(0.f),
top_offset(0.f),
- bottom_offset(0.f) {}
+ bottom_offset(0.f),
+ nearest_layer_shifting_sticky_box(Layer::INVALID_ID),
+ nearest_layer_shifting_containing_block(Layer::INVALID_ID) {}
LayerStickyPositionConstraint::LayerStickyPositionConstraint(
const LayerStickyPositionConstraint& other)
@@ -33,7 +37,11 @@ LayerStickyPositionConstraint::LayerStickyPositionConstraint(
scroll_container_relative_sticky_box_rect(
other.scroll_container_relative_sticky_box_rect),
scroll_container_relative_containing_block_rect(
- other.scroll_container_relative_containing_block_rect) {}
+ other.scroll_container_relative_containing_block_rect),
+ nearest_layer_shifting_sticky_box(
+ other.nearest_layer_shifting_sticky_box),
+ nearest_layer_shifting_containing_block(
+ other.nearest_layer_shifting_containing_block) {}
bool LayerStickyPositionConstraint::operator==(
const LayerStickyPositionConstraint& other) const {
@@ -52,7 +60,11 @@ bool LayerStickyPositionConstraint::operator==(
scroll_container_relative_sticky_box_rect ==
other.scroll_container_relative_sticky_box_rect &&
scroll_container_relative_containing_block_rect ==
- other.scroll_container_relative_containing_block_rect;
+ other.scroll_container_relative_containing_block_rect &&
+ nearest_layer_shifting_sticky_box ==
+ other.nearest_layer_shifting_sticky_box &&
+ nearest_layer_shifting_containing_block ==
+ other.nearest_layer_shifting_containing_block;
}
bool LayerStickyPositionConstraint::operator!=(
@@ -60,4 +72,10 @@ bool LayerStickyPositionConstraint::operator!=(
return !(*this == other);
}
+int LayerStickyPositionConstraint::NearestStickyAncestor() {
+ return (nearest_layer_shifting_sticky_box != Layer::INVALID_ID)
+ ? nearest_layer_shifting_sticky_box
+ : nearest_layer_shifting_containing_block;
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698