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

Unified Diff: third_party/WebKit/Source/core/input/ScrollManager.cpp

Issue 2769793002: Implement CSS: scroll-boundary-behavior (Closed)
Patch Set: Use only gpuBenchmarking. Created 3 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
Index: third_party/WebKit/Source/core/input/ScrollManager.cpp
diff --git a/third_party/WebKit/Source/core/input/ScrollManager.cpp b/third_party/WebKit/Source/core/input/ScrollManager.cpp
index c858794fe836c173daa354c437ed73fef0562e7d..e32f759d83768562f7527091bc4a299fc34baacf 100644
--- a/third_party/WebKit/Source/core/input/ScrollManager.cpp
+++ b/third_party/WebKit/Source/core/input/ScrollManager.cpp
@@ -6,6 +6,7 @@
#include <memory>
#include "core/dom/DOMNodeIds.h"
+#include "core/dom/NodeComputedStyle.h"
#include "core/events/GestureEvent.h"
#include "core/frame/BrowserControls.h"
#include "core/frame/FrameView.h"
@@ -79,12 +80,15 @@ AutoscrollController* ScrollManager::GetAutoscrollController() const {
}
void ScrollManager::RecomputeScrollChain(const Node& start_node,
+ const ScrollState& scroll_state,
std::deque<int>& scroll_chain) {
scroll_chain.clear();
DCHECK(start_node.GetLayoutObject());
LayoutBox* cur_box = start_node.GetLayoutObject()->EnclosingBox();
Element* document_element = frame_->GetDocument()->documentElement();
+ bool x_dominated =
+ (std::abs(scroll_state.deltaX()) > std::abs(scroll_state.deltaY()));
// Scrolling propagates along the containing block chain and ends at the
// RootScroller element. The RootScroller element will have a custom
@@ -108,6 +112,14 @@ void ScrollManager::RecomputeScrollChain(const Node& start_node,
if (IsViewportScrollingElement(*cur_element) ||
cur_element == document_element)
break;
+
+ if ((x_dominated &&
+ cur_element->GetComputedStyle()->ScrollBoundaryBehaviorX() !=
+ EScrollBoundaryBehavior::kAuto) ||
+ (!x_dominated &&
+ cur_element->GetComputedStyle()->ScrollBoundaryBehaviorY() !=
+ EScrollBoundaryBehavior::kAuto))
+ break;
}
cur_box = cur_box->ContainingBlock();
@@ -188,14 +200,14 @@ void ScrollManager::CustomizedScroll(const Node& start_node,
if (scroll_state.FullyConsumed())
return;
- if (scroll_state.deltaX() || scroll_state.deltaY())
+ if (scroll_state.deltaX() || scroll_state.deltaY()) {
frame_->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
+ if (current_scroll_chain_.empty())
+ RecomputeScrollChain(start_node, scroll_state, current_scroll_chain_);
+ scroll_state.SetScrollChain(current_scroll_chain_);
- if (current_scroll_chain_.empty())
- RecomputeScrollChain(start_node, current_scroll_chain_);
- scroll_state.SetScrollChain(current_scroll_chain_);
-
- scroll_state.distributeToScrollChainDescendant();
+ scroll_state.distributeToScrollChainDescendant();
+ }
}
void ScrollManager::ComputeScrollRelatedMetrics(

Powered by Google App Engine
This is Rietveld 408576698