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

Unified Diff: third_party/WebKit/Source/core/editing/Editor.cpp

Issue 2935813002: "Find" scrolling should be smoothly animated. (Closed)
Patch Set: 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 | « no previous file | third_party/WebKit/Source/web/tests/SmoothScrollTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/Editor.cpp
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp
index e31a15ba917ac60211ce405a3072e80fae1ad9d7..47f6887bf0b08ca507983807103645a681f3064c 100644
--- a/third_party/WebKit/Source/core/editing/Editor.cpp
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -1615,10 +1615,26 @@ Range* Editor::FindStringAndScrollToVisible(const String& target,
return nullptr;
Node* first_node = next_match->FirstNode();
- first_node->GetLayoutObject()->ScrollRectToVisible(
- LayoutRect(next_match->BoundingBox()),
- ScrollAlignment::kAlignCenterIfNeeded,
- ScrollAlignment::kAlignCenterIfNeeded, kUserScroll);
sunyunjia 2017/06/12 21:17:57 Not sure why this was kUserScroll. Perhaps we shou
bokan 2017/06/13 01:48:08 Acknowledged.
+ first_node->GetDocument()
bokan 2017/06/13 01:48:08 This leaks too many details of how smooth scroll a
sunyunjia 2017/06/13 17:45:11 Done.
+ .GetPage()
+ ->GetSmoothScrollSequencer()
+ ->AbortAnimations();
+ if (RuntimeEnabledFeatures::CSSOMSmoothScrollEnabled()) {
bokan 2017/06/13 01:48:08 This has no web-facing consequences so there's no
sunyunjia 2017/06/13 17:45:11 Done.
+ first_node->GetLayoutObject()->ScrollRectToVisible(
+ LayoutRect(next_match->BoundingBox()),
+ ScrollAlignment::kAlignCenterIfNeeded,
+ ScrollAlignment::kAlignCenterIfNeeded, kProgrammaticScroll, true,
+ kScrollBehaviorSmooth);
+ first_node->GetDocument()
+ .GetPage()
+ ->GetSmoothScrollSequencer()
+ ->RunQueuedAnimations();
+ } else {
+ first_node->GetLayoutObject()->ScrollRectToVisible(
+ LayoutRect(next_match->BoundingBox()),
+ ScrollAlignment::kAlignCenterIfNeeded,
+ ScrollAlignment::kAlignCenterIfNeeded, kUserScroll);
+ }
first_node->GetDocument().SetSequentialFocusNavigationStartingPoint(
first_node);
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/SmoothScrollTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698