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

Unified Diff: cc/blink/web_layer_impl.cc

Issue 2767213003: First Implementation of Snapped Points
Patch Set: Rebase and format Created 3 years, 6 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/input_handler.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 5526a70f430a682daf21468d400d99c8d8efd263..70dfa66898463f886a7fea92433a4d1fbb4e2d62 100644
--- a/cc/blink/web_layer_impl.cc
+++ b/cc/blink/web_layer_impl.cc
@@ -19,6 +19,7 @@
#include "cc/blink/web_blend_mode.h"
#include "cc/layers/layer.h"
#include "cc/layers/layer_position_constraint.h"
+#include "cc/layers/snap_point_list.h"
#include "cc/trees/element_id.h"
#include "cc/trees/layer_tree_host.h"
#include "third_party/WebKit/public/platform/WebFloatPoint.h"
@@ -27,6 +28,7 @@
#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/WebKit/public/platform/WebSnapPointList.h"
#include "third_party/skia/include/core/SkMatrix44.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/vector2d_conversions.h"
@@ -411,6 +413,21 @@ static cc::LayerStickyPositionConstraint ToStickyPositionConstraint(
web_constraint.nearest_layer_shifting_containing_block;
return constraint;
}
+static cc::SnapPointList ToSnapPointList(
+ const blink::WebSnapPointList& web_list) {
+ cc::SnapPointList list;
+ for (blink::WebSnapPoint point : web_list.HorizontalOffsets()) {
+ /*LOG(ERROR) << point.offset << " " << point.must_snap << " "
+ << point.is_start << " " << point.is_end;*/
+ list.horizontal.push_back(cc::SnapPoint(point.offset, point.must_snap,
+ point.is_start, point.is_end));
+ }
+ for (blink::WebSnapPoint point : web_list.VerticalOffsets()) {
+ list.vertical.push_back(cc::SnapPoint(point.offset, point.must_snap,
+ point.is_start, point.is_end));
+ }
+ return list;
+}
void WebLayerImpl::SetStickyPositionConstraint(
const blink::WebLayerStickyPositionConstraint& constraint) {
layer_->SetStickyPositionConstraint(ToStickyPositionConstraint(constraint));
@@ -432,6 +449,11 @@ void WebLayerImpl::SetScrollClient(blink::WebLayerScrollClient* scroll_client) {
}
}
+void WebLayerImpl::SetScrollSnapOffsets(
+ const blink::WebSnapPointList& offsets) {
+ layer_->SetScrollSnapOffsets(ToSnapPointList(offsets));
+}
+
void WebLayerImpl::SetLayerClient(cc::LayerClient* client) {
layer_->SetLayerClient(client);
}
« no previous file with comments | « cc/blink/web_layer_impl.h ('k') | cc/input/input_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698