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

Unified Diff: third_party/WebKit/Source/web/tests/SmoothScrollTest.cpp

Issue 2935813002: "Find" scrolling should be smoothly animated. (Closed)
Patch Set: Rebase and set ScrollRectToVisibleRecursive() to private. 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 | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/SmoothScrollTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/SmoothScrollTest.cpp b/third_party/WebKit/Source/web/tests/SmoothScrollTest.cpp
index 8f74a32ac1de17d5c1332c78338c4e2ff2ff3898..54e2d6efee79ab006dfce6dcb896b7ca3c635c94 100644
--- a/third_party/WebKit/Source/web/tests/SmoothScrollTest.cpp
+++ b/third_party/WebKit/Source/web/tests/SmoothScrollTest.cpp
@@ -3,6 +3,9 @@
// found in the LICENSE file.
#include "bindings/core/v8/ScrollIntoViewOptionsOrBoolean.h"
+#include "core/dom/Range.h"
+#include "core/editing/Editor.h"
+#include "core/editing/TextFinder.h"
#include "core/frame/ScrollIntoViewOptions.h"
#include "core/frame/ScrollToOptions.h"
#include "public/web/WebScriptSource.h"
@@ -283,6 +286,30 @@ TEST_F(SmoothScrollTest, BlockAndInlineSettings) {
content->OffsetTop() + content_height - window_height);
}
+TEST_F(SmoothScrollTest, FindTriggersSmoothScroll) {
+ v8::HandleScope HandleScope(v8::Isolate::GetCurrent());
+ WebView().Resize(WebSize(800, 600));
+ SimRequest request("https://example.com/test.html", "text/html");
+ LoadURL("https://example.com/test.html");
+ request.Complete(
+ "<div id='space' style='height: 2000px'></div>"
+ "<div id='content' style='height: 2000px'>text</div>");
+
+ Range* range = GetDocument().createRange();
+ MainFrame().GetFrame()->GetEditor().FindStringAndScrollToVisible(
+ "text", range, kCaseInsensitive);
+
+ // Scrolling the container
+ Compositor().BeginFrame(); // update run_state_.
+ Compositor().BeginFrame(); // Set start_time = now.
+ Compositor().BeginFrame(0.2);
+ ASSERT_EQ(Window().scrollY(), 299);
+
+ // Finish scrolling the container
+ Compositor().BeginFrame(1);
+ ASSERT_EQ(Window().scrollY(), 1708);
+}
+
} // namespace
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698