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

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

Issue 1483013003: Find In Page doesn't work properly when " " is searched (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding testcase Created 5 years 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/editing/Editor.cpp
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp
index efec60f7e562efad5a4a867a8d861886caebbfe1..ec51fd0f695fce5ba5b3a1162622410673fb84ff 100644
--- a/third_party/WebKit/Source/core/editing/Editor.cpp
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -1191,8 +1191,19 @@ static PassRefPtrWillBeRawPtr<Range> findStringBetweenPositions(const String& ta
while (true) {
EphemeralRangeTemplate<Strategy> resultRange = findPlainText(searchRange, target, options);
- if (resultRange.isCollapsed())
+ if (resultRange.isCollapsed()) {
+ if (resultRange.endPosition() != searchRange.endPosition()) {
+ // Possibly whitespace spans over multiple TreeScopes.
+ // We skip this match and seek for the next occurance.
+ if (forward) {
+ searchRange = EphemeralRangeTemplate<Strategy>(nextPositionOf(resultRange.startPosition(), PositionMoveType::CodePoint), searchRange.endPosition());
+ } else {
+ searchRange = EphemeralRangeTemplate<Strategy>(searchRange.startPosition(), previousPositionOf(resultRange.endPosition(), PositionMoveType::CodePoint));
+ }
+ continue;
+ }
return nullptr;
+ }
RefPtrWillBeRawPtr<Range> rangeObject = Range::create(resultRange.document(), toPositionInDOMTree(resultRange.startPosition()), toPositionInDOMTree(resultRange.endPosition()));
if (!rangeObject->collapsed())
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/TextFinder.cpp » ('j') | third_party/WebKit/Source/web/TextFinder.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698