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

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

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
Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index bea0b2b92a1e6ba000bf830e3065c3c771a8d571..eeffeec999f8dae0a79fab93efde3cd30784bcf5 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -52,6 +52,7 @@
#include "core/page/ChromeClient.h"
#include "core/page/Page.h"
#include "core/page/scrolling/ScrollingCoordinator.h"
+#include "core/page/scrolling/SnapCoordinator.h"
#include "core/page/scrolling/StickyPositionScrollingConstraints.h"
#include "core/page/scrolling/TopDocumentRootScrollerController.h"
#include "core/paint/FramePaintTiming.h"
@@ -1163,10 +1164,24 @@ void CompositedLayerMapping::UpdateGraphicsLayerGeometry(
UpdateChildrenTransform();
UpdateScrollParent(ScrollParent());
RegisterScrollingLayers();
+ UpdateSnapOffsets();
UpdateCompositingReasons();
}
+void CompositedLayerMapping::UpdateSnapOffsets() {
+ SnapCoordinator* snapCoordinator =
+ GetLayoutObject().GetDocument().GetSnapCoordinator();
+ /*Vector<double> horizontal = snapCoordinator->SnapOffsets(
+ *ToContainerNode(GetLayoutObject().GetNode()), kHorizontalScrollbar);
+ Vector<double> vertical = snapCoordinator->SnapOffsets(
+ *ToContainerNode(GetLayoutObject().GetNode()), kVerticalScrollbar);*/
+ WebSnapPointList offsets = snapCoordinator->SnapOffsets(
+ *ToContainerNode(GetLayoutObject().GetNode()));
+ if (scrolling_contents_layer_)
+ scrolling_contents_layer_->SetSnapOffsets(offsets);
+}
+
void CompositedLayerMapping::UpdateMainGraphicsLayerGeometry(
const IntRect& relative_compositing_bounds,
const IntRect& local_compositing_bounds,
@@ -1774,7 +1789,7 @@ void CompositedLayerMapping::UpdateDrawsContent() {
if (scrolling_layer_) {
// m_scrollingLayer never has backing store.
- // m_scrollingContentsLayer only needs backing store if the scrolled
+ // scrolling_contents_layer_ only needs backing store if the scrolled
// contents need to paint.
scrolling_contents_are_empty_ =
!owning_layer_.HasVisibleContent() ||
@@ -2282,7 +2297,7 @@ void CompositedLayerMapping::UpdateElementIdAndCompositorMutableProperties() {
graphics_layer_->SetElementId(element_id);
graphics_layer_->SetCompositorMutableProperties(primary_mutable_properties);
- // We always set the elementId for m_scrollingContentsLayer since it can be
+ // We always set the elementId for scrolling_contents_layer_ since it can be
// animated for smooth scrolling, so we don't need to set it conditionally
// here.
if (scrolling_contents_layer_.get())

Powered by Google App Engine
This is Rietveld 408576698