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

Side by Side Diff: third_party/WebKit/Source/web/tests/TextFinderTest.cpp

Issue 2775663008: LayoutObject::absoluteBoundingBoxRectForRange() should take EphemeralRange (Closed)
Patch Set: Addressed Review comments Created 3 years, 8 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "web/TextFinder.h" 5 #include "web/TextFinder.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/NodeList.h" 9 #include "core/dom/NodeList.h"
10 #include "core/dom/Range.h" 10 #include "core/dom/Range.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 TextFinder& TextFinderTest::textFinder() const { 59 TextFinder& TextFinderTest::textFinder() const {
60 return *m_textFinder; 60 return *m_textFinder;
61 } 61 }
62 62
63 WebFloatRect TextFinderTest::findInPageRect(Node* startContainer, 63 WebFloatRect TextFinderTest::findInPageRect(Node* startContainer,
64 int startOffset, 64 int startOffset,
65 Node* endContainer, 65 Node* endContainer,
66 int endOffset) { 66 int endOffset) {
67 Range* range = Range::create(startContainer->document(), startContainer, 67 const Position startPosition(startContainer, startOffset);
68 startOffset, endContainer, endOffset); 68 const Position endPosition(endContainer, endOffset);
69 EphemeralRange range(startPosition, endPosition);
69 return WebFloatRect(findInPageRectFromRange(range)); 70 return WebFloatRect(findInPageRectFromRange(range));
70 } 71 }
71 72
72 TEST_F(TextFinderTest, FindTextSimple) { 73 TEST_F(TextFinderTest, FindTextSimple) {
73 document().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ"); 74 document().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ");
74 document().updateStyleAndLayout(); 75 document().updateStyleAndLayout();
75 Node* textNode = document().body()->firstChild(); 76 Node* textNode = document().body()->firstChild();
76 77
77 int identifier = 0; 78 int identifier = 0;
78 WebString searchText(String("FindMe")); 79 WebString searchText(String("FindMe"));
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 // of the TimeProxyPlatform timer is greater than timeout threshold. 604 // of the TimeProxyPlatform timer is greater than timeout threshold.
604 textFinder().startScopingStringMatches(identifier, searchPattern, 605 textFinder().startScopingStringMatches(identifier, searchPattern,
605 findOptions); 606 findOptions);
606 while (textFinder().scopingInProgress()) 607 while (textFinder().scopingInProgress())
607 runPendingTasks(); 608 runPendingTasks();
608 609
609 EXPECT_EQ(4, textFinder().totalMatchCount()); 610 EXPECT_EQ(4, textFinder().totalMatchCount());
610 } 611 }
611 612
612 } // namespace blink 613 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698