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

Unified Diff: cc/blink/web_layer_impl.cc

Issue 2251303003: Implement position: sticky updates on compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with master and add comments to WebLayerStickyPositionConstraint members. Created 4 years, 3 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 | « cc/blink/web_layer_impl.h ('k') | cc/input/main_thread_scrolling_reason.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/blink/web_layer_impl.cc
diff --git a/cc/blink/web_layer_impl.cc b/cc/blink/web_layer_impl.cc
index 20b07be492d284a8328e387c34f614fb756e4a60..6277c372a22f44ba09ae8c92d224c5dd89a02f7c 100644
--- a/cc/blink/web_layer_impl.cc
+++ b/cc/blink/web_layer_impl.cc
@@ -25,6 +25,7 @@
#include "third_party/WebKit/public/platform/WebFloatRect.h"
#include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h"
#include "third_party/WebKit/public/platform/WebLayerScrollClient.h"
+#include "third_party/WebKit/public/platform/WebLayerStickyPositionConstraint.h"
#include "third_party/WebKit/public/platform/WebSize.h"
#include "third_party/skia/include/core/SkMatrix44.h"
#include "ui/gfx/geometry/rect_conversions.h"
@@ -363,6 +364,53 @@ blink::WebLayerPositionConstraint WebLayerImpl::positionConstraint() const {
return ToWebLayerPositionConstraint(layer_->position_constraint());
}
+static blink::WebLayerStickyPositionConstraint
+ToWebLayerStickyPositionConstraint(
+ const cc::LayerStickyPositionConstraint& constraint) {
+ blink::WebLayerStickyPositionConstraint web_constraint;
+ web_constraint.isSticky = constraint.is_sticky;
+ web_constraint.isAnchoredLeft = constraint.is_anchored_left;
+ web_constraint.isAnchoredRight = constraint.is_anchored_right;
+ web_constraint.isAnchoredTop = constraint.is_anchored_top;
+ web_constraint.isAnchoredBottom = constraint.is_anchored_bottom;
+ web_constraint.leftOffset = constraint.left_offset;
+ web_constraint.rightOffset = constraint.right_offset;
+ web_constraint.topOffset = constraint.top_offset;
+ web_constraint.bottomOffset = constraint.bottom_offset;
+ web_constraint.scrollContainerRelativeStickyBoxRect =
+ constraint.scroll_container_relative_sticky_box_rect;
+ web_constraint.scrollContainerRelativeContainingBlockRect =
+ constraint.scroll_container_relative_containing_block_rect;
+ return web_constraint;
+}
+static cc::LayerStickyPositionConstraint ToStickyPositionConstraint(
+ const blink::WebLayerStickyPositionConstraint& web_constraint) {
+ cc::LayerStickyPositionConstraint constraint;
+ constraint.is_sticky = web_constraint.isSticky;
+ constraint.is_anchored_left = web_constraint.isAnchoredLeft;
+ constraint.is_anchored_right = web_constraint.isAnchoredRight;
+ constraint.is_anchored_top = web_constraint.isAnchoredTop;
+ constraint.is_anchored_bottom = web_constraint.isAnchoredBottom;
+ constraint.left_offset = web_constraint.leftOffset;
+ constraint.right_offset = web_constraint.rightOffset;
+ constraint.top_offset = web_constraint.topOffset;
+ constraint.bottom_offset = web_constraint.bottomOffset;
+ constraint.scroll_container_relative_sticky_box_rect =
+ web_constraint.scrollContainerRelativeStickyBoxRect;
+ constraint.scroll_container_relative_containing_block_rect =
+ web_constraint.scrollContainerRelativeContainingBlockRect;
+ return constraint;
+}
+void WebLayerImpl::setStickyPositionConstraint(
+ const blink::WebLayerStickyPositionConstraint& constraint) {
+ layer_->SetStickyPositionConstraint(ToStickyPositionConstraint(constraint));
+}
+blink::WebLayerStickyPositionConstraint WebLayerImpl::stickyPositionConstraint()
+ const {
+ return ToWebLayerStickyPositionConstraint(
+ layer_->sticky_position_constraint());
+}
+
void WebLayerImpl::setScrollClient(blink::WebLayerScrollClient* scroll_client) {
if (scroll_client) {
layer_->set_did_scroll_callback(
« no previous file with comments | « cc/blink/web_layer_impl.h ('k') | cc/input/main_thread_scrolling_reason.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698