Revert of Fix incorrect number of matches and misleading highlighting in "Find...

Revert of Fix incorrect number of matches and misleading highlighting in "Find on Page" results (https://codereview.chromium.org/422443004/)

Reason for revert:
This broke FindInPageControllerTest.LargePage on multiple bots (e.g. http://build.chromium.org/p/chromium.win/builders/Win7%20Tests%20%282%29/builds/30423)

Filed a bug:
https://code.google.com/p/chromium/issues/detail?id=398017

Original issue's description:
> Fix incorrect number of matches and misleading highlighting in "Find on Page" results.
> 
> BUG= 397563
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=179000

TBR=yosin@chromium.org,tkent@chromium.org,iceman@yandex-team.ru
NOTREECHECKS=true
NOTRY=true
BUG= 397563

Review URL: https://codereview.chromium.org/424803002

git-svn-id: svn://svn.chromium.org/blink/trunk@179036 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ce6f73cc
......@@ -242,7 +242,7 @@ void TextFinder::scopeStringMatches(int identifier, const WebString& searchText,
// This is a continuation of a scoping operation that timed out and didn't
// complete last time around, so we should start from where we left off.
ASSERT(m_resumeScopingFromRange->collapsed());
searchStart = m_resumeScopingFromRange->startPosition();
searchStart = m_resumeScopingFromRange->startPosition().next();
if (searchStart.document() != searchEnd.document())
return;
}
......@@ -318,7 +318,7 @@ void TextFinder::scopeStringMatches(int identifier, const WebString& searchText,
// result range. There is no need to use a VisiblePosition here,
// since findPlainText will use a TextIterator to go over the visible
// text nodes.
searchStart = resultEnd;
searchStart = resultStart.next();
m_resumeScopingFromRange = Range::create(*resultStart.document(), resultStart, resultStart);
timedOut = (currentTime() - startTime) >= maxScopingDuration;
......
......@@ -289,26 +289,4 @@ TEST_F(TextFinderTest, ScopeTextMatchesWithShadowDOM)
EXPECT_EQ(findInPageRect(textInIElement, 0, textInIElement, 3), matchRects[2]);
}
TEST_F(TextFinderTest, ScopeRepeatPatternTextMatches)
{
document().body()->setInnerHTML("ab ab ab ab ab", ASSERT_NO_EXCEPTION);
Node* textNode = document().body()->firstChild();
int identifier = 0;
WebString searchText(String("ab ab"));
WebFindOptions findOptions; // Default.
textFinder().resetMatchCount();
textFinder().scopeStringMatches(identifier, searchText, findOptions, true);
while (textFinder().scopingInProgress())
FrameTestHelpers::runPendingTasks();
EXPECT_EQ(2, textFinder().totalMatchCount());
WebVector<WebFloatRect> matchRects;
textFinder().findMatchRects(matchRects);
ASSERT_EQ(2u, matchRects.size());
EXPECT_EQ(findInPageRect(textNode, 0, textNode, 5), matchRects[0]);
EXPECT_EQ(findInPageRect(textNode, 6, textNode, 11), matchRects[1]);
}
} // namespace
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment