| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 #include "web/TextFinder.h" | 6 #include "web/TextFinder.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/dom/NodeList.h" | 10 #include "core/dom/NodeList.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 WebVector<WebFloatRect> matchRects; | 295 WebVector<WebFloatRect> matchRects; |
| 296 textFinder().findMatchRects(matchRects); | 296 textFinder().findMatchRects(matchRects); |
| 297 ASSERT_EQ(2u, matchRects.size()); | 297 ASSERT_EQ(2u, matchRects.size()); |
| 298 EXPECT_EQ(findInPageRect(textNode, 4, textNode, 10), matchRects[0]); | 298 EXPECT_EQ(findInPageRect(textNode, 4, textNode, 10), matchRects[0]); |
| 299 EXPECT_EQ(findInPageRect(textNode, 14, textNode, 20), matchRects[1]); | 299 EXPECT_EQ(findInPageRect(textNode, 14, textNode, 20), matchRects[1]); |
| 300 } | 300 } |
| 301 | 301 |
| 302 TEST_F(TextFinderTest, ScopeTextMatchesWithShadowDOM) | 302 TEST_F(TextFinderTest, ScopeTextMatchesWithShadowDOM) |
| 303 { | 303 { |
| 304 document().body()->setInnerHTML("<b>FOO</b><i>foo</i>", ASSERT_NO_EXCEPTION)
; | 304 document().body()->setInnerHTML("<b>FOO</b><i>foo</i>", ASSERT_NO_EXCEPTION)
; |
| 305 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = document().body()->createShadowR
ootInternal(ShadowRootType::Open, ASSERT_NO_EXCEPTION); | 305 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = document().body()->createShadowR
ootInternal(ShadowRootType::V0, ASSERT_NO_EXCEPTION); |
| 306 shadowRoot->setInnerHTML("<content select=\"i\"></content><u>Foo</u><content
></content>", ASSERT_NO_EXCEPTION); | 306 shadowRoot->setInnerHTML("<content select=\"i\"></content><u>Foo</u><content
></content>", ASSERT_NO_EXCEPTION); |
| 307 Node* textInBElement = document().body()->firstChild()->firstChild(); | 307 Node* textInBElement = document().body()->firstChild()->firstChild(); |
| 308 Node* textInIElement = document().body()->lastChild()->firstChild(); | 308 Node* textInIElement = document().body()->lastChild()->firstChild(); |
| 309 Node* textInUElement = shadowRoot->childNodes()->item(1)->firstChild(); | 309 Node* textInUElement = shadowRoot->childNodes()->item(1)->firstChild(); |
| 310 | 310 |
| 311 int identifier = 0; | 311 int identifier = 0; |
| 312 WebString searchText(String("fOO")); | 312 WebString searchText(String("fOO")); |
| 313 WebFindOptions findOptions; // Default. | 313 WebFindOptions findOptions; // Default. |
| 314 | 314 |
| 315 textFinder().resetMatchCount(); | 315 textFinder().resetMatchCount(); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 // There will be only one iteration before timeout, because increment | 504 // There will be only one iteration before timeout, because increment |
| 505 // of the TimeProxyPlatform timer is greater than timeout threshold. | 505 // of the TimeProxyPlatform timer is greater than timeout threshold. |
| 506 textFinder().scopeStringMatches(identifier, searchPattern, findOptions, true
); | 506 textFinder().scopeStringMatches(identifier, searchPattern, findOptions, true
); |
| 507 while (textFinder().scopingInProgress()) | 507 while (textFinder().scopingInProgress()) |
| 508 runPendingTasks(); | 508 runPendingTasks(); |
| 509 | 509 |
| 510 EXPECT_EQ(4, textFinder().totalMatchCount()); | 510 EXPECT_EQ(4, textFinder().totalMatchCount()); |
| 511 } | 511 } |
| 512 | 512 |
| 513 } // namespace blink | 513 } // namespace blink |
| OLD | NEW |