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

Side by Side Diff: third_party/WebKit/Source/core/editing/Editor.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 1608
1609 Range* Editor::FindStringAndScrollToVisible(const String& target, 1609 Range* Editor::FindStringAndScrollToVisible(const String& target,
1610 Range* previous_match, 1610 Range* previous_match,
1611 FindOptions options) { 1611 FindOptions options) {
1612 Range* next_match = FindRangeOfString( 1612 Range* next_match = FindRangeOfString(
1613 target, EphemeralRangeInFlatTree(previous_match), options); 1613 target, EphemeralRangeInFlatTree(previous_match), options);
1614 if (!next_match) 1614 if (!next_match)
1615 return nullptr; 1615 return nullptr;
1616 1616
1617 Node* first_node = next_match->FirstNode(); 1617 Node* first_node = next_match->FirstNode();
1618
1618 first_node->GetLayoutObject()->ScrollRectToVisible( 1619 first_node->GetLayoutObject()->ScrollRectToVisible(
1619 LayoutRect(next_match->BoundingBox()), 1620 LayoutRect(next_match->BoundingBox()),
1620 ScrollAlignment::kAlignCenterIfNeeded, 1621 ScrollAlignment::kAlignCenterIfNeeded,
1621 ScrollAlignment::kAlignCenterIfNeeded, kUserScroll); 1622 ScrollAlignment::kAlignCenterIfNeeded, kProgrammaticScroll, true,
1623 kScrollBehaviorSmooth);
1624
1622 first_node->GetDocument().SetSequentialFocusNavigationStartingPoint( 1625 first_node->GetDocument().SetSequentialFocusNavigationStartingPoint(
1623 first_node); 1626 first_node);
1624 1627
1625 return next_match; 1628 return next_match;
1626 } 1629 }
1627 1630
1628 // TODO(yosin) We should return |EphemeralRange| rather than |Range|. We use 1631 // TODO(yosin) We should return |EphemeralRange| rather than |Range|. We use
1629 // |Range| object for checking whether start and end position crossing shadow 1632 // |Range| object for checking whether start and end position crossing shadow
1630 // boundaries, however we can do it without |Range| object. 1633 // boundaries, however we can do it without |Range| object.
1631 template <typename Strategy> 1634 template <typename Strategy>
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 1844
1842 DEFINE_TRACE(Editor) { 1845 DEFINE_TRACE(Editor) {
1843 visitor->Trace(frame_); 1846 visitor->Trace(frame_);
1844 visitor->Trace(last_edit_command_); 1847 visitor->Trace(last_edit_command_);
1845 visitor->Trace(undo_stack_); 1848 visitor->Trace(undo_stack_);
1846 visitor->Trace(mark_); 1849 visitor->Trace(mark_);
1847 visitor->Trace(typing_style_); 1850 visitor->Trace(typing_style_);
1848 } 1851 }
1849 1852
1850 } // namespace blink 1853 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698