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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1188563005: Compute snap offsets (both repeat and element based) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use client and scroll size to handle overlay scrollbars Created 4 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 | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/frame/LocalFrame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 45a91520ec31434010ac96e70b77e51e429b7f9c..6293a4abeed8f0b5e52058c55dc9d8c077ed3e28 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -195,6 +195,7 @@
#include "core/page/PointerLockController.h"
#include "core/page/scrolling/RootScroller.h"
#include "core/page/scrolling/ScrollingCoordinator.h"
+#include "core/page/scrolling/SnapCoordinator.h"
#include "core/svg/SVGDocumentExtensions.h"
#include "core/svg/SVGTitleElement.h"
#include "core/svg/SVGUseElement.h"
@@ -1635,6 +1636,9 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
columnGap = overflowStyle->columnGap();
}
+ ScrollSnapType snapType = overflowStyle->getScrollSnapType();
+ const LengthPoint& snapDestination = overflowStyle->scrollSnapDestination();
+
RefPtr<ComputedStyle> documentStyle = layoutView()->mutableStyle();
if (documentStyle->getWritingMode() != rootWritingMode
|| documentStyle->direction() != rootDirection
@@ -1643,7 +1647,9 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
|| documentStyle->imageRendering() != imageRendering
|| documentStyle->overflowX() != overflowX
|| documentStyle->overflowY() != overflowY
- || documentStyle->columnGap() != columnGap) {
+ || documentStyle->columnGap() != columnGap
+ || documentStyle->getScrollSnapType() != snapType
+ || documentStyle->scrollSnapDestination() != snapDestination) {
RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*documentStyle);
newStyle->setWritingMode(rootWritingMode);
newStyle->setDirection(rootDirection);
@@ -1653,6 +1659,8 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
newStyle->setOverflowX(overflowX);
newStyle->setOverflowY(overflowY);
newStyle->setColumnGap(columnGap);
+ newStyle->setScrollSnapType(snapType);
+ newStyle->setScrollSnapDestination(snapDestination);
layoutView()->setStyle(newStyle);
setupFontBuilder(*newStyle);
}
@@ -5518,6 +5526,14 @@ bool Document::threadedParsingEnabledForTesting()
return s_threadedParsingEnabledForTesting;
}
+SnapCoordinator* Document::snapCoordinator()
+{
+ if (RuntimeEnabledFeatures::cssScrollSnapPointsEnabled() && !m_snapCoordinator)
+ m_snapCoordinator = SnapCoordinator::create();
+
+ return m_snapCoordinator.get();
+}
+
void Document::setContextFeatures(ContextFeatures& features)
{
m_contextFeatures = &features;
@@ -5959,6 +5975,7 @@ DEFINE_TRACE(Document)
visitor->trace(m_canvasFontCache);
visitor->trace(m_intersectionObserverController);
visitor->trace(m_intersectionObserverData);
+ visitor->trace(m_snapCoordinator);
Supplementable<Document>::trace(visitor);
TreeScope::trace(visitor);
ContainerNode::trace(visitor);
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/frame/LocalFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698