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

Side by Side Diff: Source/web/TextFinder.cpp

Issue 241303002: Rename WebFrameImpl to WebLocalFrameImpl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix Mac too Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/TextFinder.h ('k') | Source/web/WebDOMFileSystem.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 31
32 #include "config.h" 32 #include "config.h"
33 #include "TextFinder.h" 33 #include "TextFinder.h"
34 34
35 #include "FindInPageCoordinates.h" 35 #include "FindInPageCoordinates.h"
36 #include "WebFindOptions.h" 36 #include "WebFindOptions.h"
37 #include "WebFrameClient.h" 37 #include "WebFrameClient.h"
38 #include "WebFrameImpl.h" 38 #include "WebLocalFrameImpl.h"
39 #include "WebViewClient.h" 39 #include "WebViewClient.h"
40 #include "WebViewImpl.h" 40 #include "WebViewImpl.h"
41 #include "core/dom/DocumentMarker.h" 41 #include "core/dom/DocumentMarker.h"
42 #include "core/dom/DocumentMarkerController.h" 42 #include "core/dom/DocumentMarkerController.h"
43 #include "core/dom/Range.h" 43 #include "core/dom/Range.h"
44 #include "core/dom/shadow/ShadowRoot.h" 44 #include "core/dom/shadow/ShadowRoot.h"
45 #include "core/editing/Editor.h" 45 #include "core/editing/Editor.h"
46 #include "core/editing/TextIterator.h" 46 #include "core/editing/TextIterator.h"
47 #include "core/editing/VisibleSelection.h" 47 #include "core/editing/VisibleSelection.h"
48 #include "core/frame/FrameView.h" 48 #include "core/frame/FrameView.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 const WebString m_searchText; 90 const WebString m_searchText;
91 const WebFindOptions m_options; 91 const WebFindOptions m_options;
92 const bool m_reset; 92 const bool m_reset;
93 }; 93 };
94 94
95 bool TextFinder::find(int identifier, const WebString& searchText, const WebFind Options& options, bool wrapWithinFrame, WebRect* selectionRect) 95 bool TextFinder::find(int identifier, const WebString& searchText, const WebFind Options& options, bool wrapWithinFrame, WebRect* selectionRect)
96 { 96 {
97 if (!m_ownerFrame.frame() || !m_ownerFrame.frame()->page()) 97 if (!m_ownerFrame.frame() || !m_ownerFrame.frame()->page())
98 return false; 98 return false;
99 99
100 WebFrameImpl* mainFrameImpl = m_ownerFrame.viewImpl()->mainFrameImpl(); 100 WebLocalFrameImpl* mainFrameImpl = m_ownerFrame.viewImpl()->mainFrameImpl();
101 101
102 if (!options.findNext) 102 if (!options.findNext)
103 m_ownerFrame.frame()->page()->unmarkAllTextMatches(); 103 m_ownerFrame.frame()->page()->unmarkAllTextMatches();
104 else 104 else
105 setMarkerActive(m_activeMatch.get(), false); 105 setMarkerActive(m_activeMatch.get(), false);
106 106
107 if (m_activeMatch && &m_activeMatch->ownerDocument() != m_ownerFrame.frame() ->document()) 107 if (m_activeMatch && &m_activeMatch->ownerDocument() != m_ownerFrame.frame() ->document())
108 m_activeMatch = nullptr; 108 m_activeMatch = nullptr;
109 109
110 // If the user has selected something since the last Find operation we want 110 // If the user has selected something since the last Find operation we want
(...skipping 23 matching lines...) Expand all
134 134
135 m_ownerFrame.invalidateAll(); 135 m_ownerFrame.invalidateAll();
136 return false; 136 return false;
137 } 137 }
138 138
139 #if OS(ANDROID) 139 #if OS(ANDROID)
140 m_ownerFrame.viewImpl()->zoomToFindInPageRect(m_ownerFrame.frameView()->cont entsToWindow(enclosingIntRect(RenderObject::absoluteBoundingBoxRectForRange(m_ac tiveMatch.get())))); 140 m_ownerFrame.viewImpl()->zoomToFindInPageRect(m_ownerFrame.frameView()->cont entsToWindow(enclosingIntRect(RenderObject::absoluteBoundingBoxRectForRange(m_ac tiveMatch.get()))));
141 #endif 141 #endif
142 142
143 setMarkerActive(m_activeMatch.get(), true); 143 setMarkerActive(m_activeMatch.get(), true);
144 WebFrameImpl* oldActiveFrame = mainFrameImpl->ensureTextFinder().m_currentAc tiveMatchFrame; 144 WebLocalFrameImpl* oldActiveFrame = mainFrameImpl->ensureTextFinder().m_curr entActiveMatchFrame;
145 mainFrameImpl->ensureTextFinder().m_currentActiveMatchFrame = &m_ownerFrame; 145 mainFrameImpl->ensureTextFinder().m_currentActiveMatchFrame = &m_ownerFrame;
146 146
147 // Make sure no node is focused. See http://crbug.com/38700. 147 // Make sure no node is focused. See http://crbug.com/38700.
148 m_ownerFrame.frame()->document()->setFocusedElement(nullptr); 148 m_ownerFrame.frame()->document()->setFocusedElement(nullptr);
149 149
150 if (!options.findNext || activeSelection) { 150 if (!options.findNext || activeSelection) {
151 // This is either a Find operation or a Find-next from a new start point 151 // This is either a Find operation or a Find-next from a new start point
152 // due to a selection, so we set the flag to ask the scoping effort 152 // due to a selection, so we set the flag to ask the scoping effort
153 // to find the active rect for us and report it back to the UI. 153 // to find the active rect for us and report it back to the UI.
154 m_locatingActiveRect = true; 154 m_locatingActiveRect = true;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 225 }
226 226
227 if (!shouldScopeMatches(searchText)) { 227 if (!shouldScopeMatches(searchText)) {
228 // Note that we want to defer the final update when resetting even if sh ouldScopeMatches returns false. 228 // Note that we want to defer the final update when resetting even if sh ouldScopeMatches returns false.
229 // This is done in order to prevent sending a final message based only o n the results of the first frame 229 // This is done in order to prevent sending a final message based only o n the results of the first frame
230 // since m_framesScopingCount would be 0 as other frames have yet to res et. 230 // since m_framesScopingCount would be 0 as other frames have yet to res et.
231 finishCurrentScopingEffort(identifier); 231 finishCurrentScopingEffort(identifier);
232 return; 232 return;
233 } 233 }
234 234
235 WebFrameImpl* mainFrameImpl = m_ownerFrame.viewImpl()->mainFrameImpl(); 235 WebLocalFrameImpl* mainFrameImpl = m_ownerFrame.viewImpl()->mainFrameImpl();
236 RefPtrWillBeRawPtr<Range> searchRange(rangeOfContents(m_ownerFrame.frame()-> document())); 236 RefPtrWillBeRawPtr<Range> searchRange(rangeOfContents(m_ownerFrame.frame()-> document()));
237 237
238 Node* originalEndContainer = searchRange->endContainer(); 238 Node* originalEndContainer = searchRange->endContainer();
239 int originalEndOffset = searchRange->endOffset(); 239 int originalEndOffset = searchRange->endOffset();
240 240
241 TrackExceptionState exceptionState, exceptionState2; 241 TrackExceptionState exceptionState, exceptionState2;
242 if (m_resumeScopingFromRange) { 242 if (m_resumeScopingFromRange) {
243 // This is a continuation of a scoping operation that timed out and didn 't 243 // This is a continuation of a scoping operation that timed out and didn 't
244 // complete last time around, so we should start from where we left off. 244 // complete last time around, so we should start from where we left off.
245 searchRange->setStart(m_resumeScopingFromRange->startContainer(), m_resu meScopingFromRange->startOffset(exceptionState2) + 1, exceptionState); 245 searchRange->setStart(m_resumeScopingFromRange->startContainer(), m_resu meScopingFromRange->startOffset(exceptionState2) + 1, exceptionState);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 357 }
358 358
359 finishCurrentScopingEffort(identifier); 359 finishCurrentScopingEffort(identifier);
360 } 360 }
361 361
362 void TextFinder::flushCurrentScopingEffort(int identifier) 362 void TextFinder::flushCurrentScopingEffort(int identifier)
363 { 363 {
364 if (!m_ownerFrame.frame() || !m_ownerFrame.frame()->page()) 364 if (!m_ownerFrame.frame() || !m_ownerFrame.frame()->page())
365 return; 365 return;
366 366
367 WebFrameImpl* mainFrameImpl = m_ownerFrame.viewImpl()->mainFrameImpl(); 367 WebLocalFrameImpl* mainFrameImpl = m_ownerFrame.viewImpl()->mainFrameImpl();
368 mainFrameImpl->ensureTextFinder().decrementFramesScopingCount(identifier); 368 mainFrameImpl->ensureTextFinder().decrementFramesScopingCount(identifier);
369 } 369 }
370 370
371 void TextFinder::finishCurrentScopingEffort(int identifier) 371 void TextFinder::finishCurrentScopingEffort(int identifier)
372 { 372 {
373 flushCurrentScopingEffort(identifier); 373 flushCurrentScopingEffort(identifier);
374 374
375 m_scopingInProgress = false; 375 m_scopingInProgress = false;
376 m_lastFindRequestCompletedWithNoMatches = !m_lastMatchCount; 376 m_lastFindRequestCompletedWithNoMatches = !m_lastMatchCount;
377 377
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 { 425 {
426 if (!m_findMatchesCache.isEmpty()) 426 if (!m_findMatchesCache.isEmpty())
427 m_ownerFrame.viewImpl()->mainFrameImpl()->ensureTextFinder().m_findMatch MarkersVersion++; 427 m_ownerFrame.viewImpl()->mainFrameImpl()->ensureTextFinder().m_findMatch MarkersVersion++;
428 428
429 m_findMatchesCache.clear(); 429 m_findMatchesCache.clear();
430 m_findMatchRectsAreValid = false; 430 m_findMatchRectsAreValid = false;
431 } 431 }
432 432
433 bool TextFinder::isActiveMatchFrameValid() const 433 bool TextFinder::isActiveMatchFrameValid() const
434 { 434 {
435 WebFrameImpl* mainFrameImpl = m_ownerFrame.viewImpl()->mainFrameImpl(); 435 WebLocalFrameImpl* mainFrameImpl = m_ownerFrame.viewImpl()->mainFrameImpl();
436 WebFrameImpl* activeMatchFrame = mainFrameImpl->activeMatchFrame(); 436 WebLocalFrameImpl* activeMatchFrame = mainFrameImpl->activeMatchFrame();
437 return activeMatchFrame && activeMatchFrame->activeMatch() && activeMatchFra me->frame()->tree().isDescendantOf(mainFrameImpl->frame()); 437 return activeMatchFrame && activeMatchFrame->activeMatch() && activeMatchFra me->frame()->tree().isDescendantOf(mainFrameImpl->frame());
438 } 438 }
439 439
440 void TextFinder::updateFindMatchRects() 440 void TextFinder::updateFindMatchRects()
441 { 441 {
442 IntSize currentContentsSize = m_ownerFrame.contentsSize(); 442 IntSize currentContentsSize = m_ownerFrame.contentsSize();
443 if (m_contentsSizeForCurrentFindMatchRects != currentContentsSize) { 443 if (m_contentsSizeForCurrentFindMatchRects != currentContentsSize) {
444 m_contentsSizeForCurrentFindMatchRects = currentContentsSize; 444 m_contentsSizeForCurrentFindMatchRects = currentContentsSize;
445 m_findMatchRectsAreValid = false; 445 m_findMatchRectsAreValid = false;
446 } 446 }
(...skipping 18 matching lines...) Expand all
465 if (!it->m_rect.isEmpty()) 465 if (!it->m_rect.isEmpty())
466 filteredMatches.append(*it); 466 filteredMatches.append(*it);
467 } 467 }
468 468
469 m_findMatchesCache.swap(filteredMatches); 469 m_findMatchesCache.swap(filteredMatches);
470 } 470 }
471 471
472 // Invalidate the rects in child frames. Will be updated later during traver sal. 472 // Invalidate the rects in child frames. Will be updated later during traver sal.
473 if (!m_findMatchRectsAreValid) 473 if (!m_findMatchRectsAreValid)
474 for (WebFrame* child = m_ownerFrame.firstChild(); child; child = child-> nextSibling()) 474 for (WebFrame* child = m_ownerFrame.firstChild(); child; child = child-> nextSibling())
475 toWebFrameImpl(child)->ensureTextFinder().m_findMatchRectsAreValid = false; 475 toWebLocalFrameImpl(child)->ensureTextFinder().m_findMatchRectsAreVa lid = false;
476 476
477 m_findMatchRectsAreValid = true; 477 m_findMatchRectsAreValid = true;
478 } 478 }
479 479
480 WebFloatRect TextFinder::activeFindMatchRect() 480 WebFloatRect TextFinder::activeFindMatchRect()
481 { 481 {
482 if (!isActiveMatchFrameValid()) 482 if (!isActiveMatchFrameValid())
483 return WebFloatRect(); 483 return WebFloatRect();
484 484
485 return WebFloatRect(findInPageRectFromRange(m_currentActiveMatchFrame->activ eMatch())); 485 return WebFloatRect(findInPageRectFromRange(m_currentActiveMatchFrame->activ eMatch()));
486 } 486 }
487 487
488 void TextFinder::findMatchRects(WebVector<WebFloatRect>& outputRects) 488 void TextFinder::findMatchRects(WebVector<WebFloatRect>& outputRects)
489 { 489 {
490 Vector<WebFloatRect> matchRects; 490 Vector<WebFloatRect> matchRects;
491 for (WebFrameImpl* frame = &m_ownerFrame; frame; frame = toWebFrameImpl(fram e->traverseNext(false))) 491 for (WebLocalFrameImpl* frame = &m_ownerFrame; frame; frame = toWebLocalFram eImpl(frame->traverseNext(false)))
492 frame->ensureTextFinder().appendFindMatchRects(matchRects); 492 frame->ensureTextFinder().appendFindMatchRects(matchRects);
493 493
494 outputRects = matchRects; 494 outputRects = matchRects;
495 } 495 }
496 496
497 void TextFinder::appendFindMatchRects(Vector<WebFloatRect>& frameRects) 497 void TextFinder::appendFindMatchRects(Vector<WebFloatRect>& frameRects)
498 { 498 {
499 updateFindMatchRects(); 499 updateFindMatchRects();
500 frameRects.reserveCapacity(frameRects.size() + m_findMatchesCache.size()); 500 frameRects.reserveCapacity(frameRects.size() + m_findMatchesCache.size());
501 for (Vector<FindMatch>::const_iterator it = m_findMatchesCache.begin(); it ! = m_findMatchesCache.end(); ++it) { 501 for (Vector<FindMatch>::const_iterator it = m_findMatchesCache.begin(); it ! = m_findMatchesCache.end(); ++it) {
502 ASSERT(!it->m_rect.isEmpty()); 502 ASSERT(!it->m_rect.isEmpty());
503 frameRects.append(it->m_rect); 503 frameRects.append(it->m_rect);
504 } 504 }
505 } 505 }
506 506
507 int TextFinder::selectNearestFindMatch(const WebFloatPoint& point, WebRect* sele ctionRect) 507 int TextFinder::selectNearestFindMatch(const WebFloatPoint& point, WebRect* sele ctionRect)
508 { 508 {
509 TextFinder* bestFinder = 0; 509 TextFinder* bestFinder = 0;
510 int indexInBestFrame = -1; 510 int indexInBestFrame = -1;
511 float distanceInBestFrame = FLT_MAX; 511 float distanceInBestFrame = FLT_MAX;
512 512
513 for (WebFrameImpl* frame = &m_ownerFrame; frame; frame = toWebFrameImpl(fram e->traverseNext(false))) { 513 for (WebLocalFrameImpl* frame = &m_ownerFrame; frame; frame = toWebLocalFram eImpl(frame->traverseNext(false))) {
514 float distanceInFrame; 514 float distanceInFrame;
515 TextFinder& finder = frame->ensureTextFinder(); 515 TextFinder& finder = frame->ensureTextFinder();
516 int indexInFrame = finder.nearestFindMatch(point, distanceInFrame); 516 int indexInFrame = finder.nearestFindMatch(point, distanceInFrame);
517 if (distanceInFrame < distanceInBestFrame) { 517 if (distanceInFrame < distanceInBestFrame) {
518 bestFinder = &finder; 518 bestFinder = &finder;
519 indexInBestFrame = indexInFrame; 519 indexInBestFrame = indexInFrame;
520 distanceInBestFrame = distanceInFrame; 520 distanceInBestFrame = distanceInFrame;
521 } 521 }
522 } 522 }
523 523
(...skipping 26 matching lines...) Expand all
550 int TextFinder::selectFindMatch(unsigned index, WebRect* selectionRect) 550 int TextFinder::selectFindMatch(unsigned index, WebRect* selectionRect)
551 { 551 {
552 ASSERT_WITH_SECURITY_IMPLICATION(index < m_findMatchesCache.size()); 552 ASSERT_WITH_SECURITY_IMPLICATION(index < m_findMatchesCache.size());
553 553
554 RefPtrWillBeRawPtr<Range> range = m_findMatchesCache[index].m_range; 554 RefPtrWillBeRawPtr<Range> range = m_findMatchesCache[index].m_range;
555 if (!range->boundaryPointsValid() || !range->startContainer()->inDocument()) 555 if (!range->boundaryPointsValid() || !range->startContainer()->inDocument())
556 return -1; 556 return -1;
557 557
558 // Check if the match is already selected. 558 // Check if the match is already selected.
559 TextFinder& mainFrameTextFinder = m_ownerFrame.viewImpl()->mainFrameImpl()-> ensureTextFinder(); 559 TextFinder& mainFrameTextFinder = m_ownerFrame.viewImpl()->mainFrameImpl()-> ensureTextFinder();
560 WebFrameImpl* activeMatchFrame = mainFrameTextFinder.m_currentActiveMatchFra me; 560 WebLocalFrameImpl* activeMatchFrame = mainFrameTextFinder.m_currentActiveMat chFrame;
561 if (&m_ownerFrame != activeMatchFrame || !m_activeMatch || !areRangesEqual(m _activeMatch.get(), range.get())) { 561 if (&m_ownerFrame != activeMatchFrame || !m_activeMatch || !areRangesEqual(m _activeMatch.get(), range.get())) {
562 if (isActiveMatchFrameValid()) 562 if (isActiveMatchFrameValid())
563 activeMatchFrame->ensureTextFinder().setMatchMarkerActive(false); 563 activeMatchFrame->ensureTextFinder().setMatchMarkerActive(false);
564 564
565 m_activeMatchIndexInCurrentFrame = m_findMatchesCache[index].m_ordinal - 1; 565 m_activeMatchIndexInCurrentFrame = m_findMatchesCache[index].m_ordinal - 1;
566 566
567 // Set this frame as the active frame (the one with the active highlight ). 567 // Set this frame as the active frame (the one with the active highlight ).
568 mainFrameTextFinder.m_currentActiveMatchFrame = &m_ownerFrame; 568 mainFrameTextFinder.m_currentActiveMatchFrame = &m_ownerFrame;
569 m_ownerFrame.viewImpl()->setFocusedFrame(&m_ownerFrame); 569 m_ownerFrame.viewImpl()->setFocusedFrame(&m_ownerFrame);
570 570
(...skipping 20 matching lines...) Expand all
591 activeMatchRect = m_ownerFrame.frameView()->contentsToWindow(activeMatch BoundingBox); 591 activeMatchRect = m_ownerFrame.frameView()->contentsToWindow(activeMatch BoundingBox);
592 m_ownerFrame.viewImpl()->zoomToFindInPageRect(activeMatchRect); 592 m_ownerFrame.viewImpl()->zoomToFindInPageRect(activeMatchRect);
593 } 593 }
594 594
595 if (selectionRect) 595 if (selectionRect)
596 *selectionRect = activeMatchRect; 596 *selectionRect = activeMatchRect;
597 597
598 return ordinalOfFirstMatch() + m_activeMatchIndexInCurrentFrame + 1; 598 return ordinalOfFirstMatch() + m_activeMatchIndexInCurrentFrame + 1;
599 } 599 }
600 600
601 PassOwnPtr<TextFinder> TextFinder::create(WebFrameImpl& ownerFrame) 601 PassOwnPtr<TextFinder> TextFinder::create(WebLocalFrameImpl& ownerFrame)
602 { 602 {
603 return adoptPtr(new TextFinder(ownerFrame)); 603 return adoptPtr(new TextFinder(ownerFrame));
604 } 604 }
605 605
606 TextFinder::TextFinder(WebFrameImpl& ownerFrame) 606 TextFinder::TextFinder(WebLocalFrameImpl& ownerFrame)
607 : m_ownerFrame(ownerFrame) 607 : m_ownerFrame(ownerFrame)
608 , m_currentActiveMatchFrame(0) 608 , m_currentActiveMatchFrame(0)
609 , m_activeMatchIndexInCurrentFrame(-1) 609 , m_activeMatchIndexInCurrentFrame(-1)
610 , m_resumeScopingFromRange(nullptr) 610 , m_resumeScopingFromRange(nullptr)
611 , m_lastMatchCount(-1) 611 , m_lastMatchCount(-1)
612 , m_totalMatchCount(-1) 612 , m_totalMatchCount(-1)
613 , m_framesScopingCount(-1) 613 , m_framesScopingCount(-1)
614 , m_findRequestIdentifier(-1) 614 , m_findRequestIdentifier(-1)
615 , m_nextInvalidateAfter(0) 615 , m_nextInvalidateAfter(0)
616 , m_findMatchMarkersVersion(0) 616 , m_findMatchMarkersVersion(0)
(...skipping 14 matching lines...) Expand all
631 m_ownerFrame.frame()->document()->markers().addTextMatchMarker(range, active Match); 631 m_ownerFrame.frame()->document()->markers().addTextMatchMarker(range, active Match);
632 } 632 }
633 633
634 void TextFinder::setMarkerActive(Range* range, bool active) 634 void TextFinder::setMarkerActive(Range* range, bool active)
635 { 635 {
636 if (!range || range->collapsed(IGNORE_EXCEPTION)) 636 if (!range || range->collapsed(IGNORE_EXCEPTION))
637 return; 637 return;
638 m_ownerFrame.frame()->document()->markers().setMarkersActive(range, active); 638 m_ownerFrame.frame()->document()->markers().setMarkersActive(range, active);
639 } 639 }
640 640
641 int TextFinder::ordinalOfFirstMatchForFrame(WebFrameImpl* frame) const 641 int TextFinder::ordinalOfFirstMatchForFrame(WebLocalFrameImpl* frame) const
642 { 642 {
643 int ordinal = 0; 643 int ordinal = 0;
644 WebFrameImpl* mainFrameImpl = m_ownerFrame.viewImpl()->mainFrameImpl(); 644 WebLocalFrameImpl* mainFrameImpl = m_ownerFrame.viewImpl()->mainFrameImpl();
645 // Iterate from the main frame up to (but not including) |frame| and 645 // Iterate from the main frame up to (but not including) |frame| and
646 // add up the number of matches found so far. 646 // add up the number of matches found so far.
647 for (WebFrameImpl* it = mainFrameImpl; it != frame; it = toWebFrameImpl(it-> traverseNext(true))) { 647 for (WebLocalFrameImpl* it = mainFrameImpl; it != frame; it = toWebLocalFram eImpl(it->traverseNext(true))) {
648 TextFinder& finder = it->ensureTextFinder(); 648 TextFinder& finder = it->ensureTextFinder();
649 if (finder.m_lastMatchCount > 0) 649 if (finder.m_lastMatchCount > 0)
650 ordinal += finder.m_lastMatchCount; 650 ordinal += finder.m_lastMatchCount;
651 } 651 }
652 return ordinal; 652 return ordinal;
653 } 653 }
654 654
655 bool TextFinder::shouldScopeMatches(const String& searchText) 655 bool TextFinder::shouldScopeMatches(const String& searchText)
656 { 656 {
657 // Don't scope if we can't find a frame or a view. 657 // Don't scope if we can't find a frame or a view.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 if (!m_framesScopingCount) 733 if (!m_framesScopingCount)
734 m_ownerFrame.increaseMatchCount(0, identifier); 734 m_ownerFrame.increaseMatchCount(0, identifier);
735 } 735 }
736 736
737 int TextFinder::ordinalOfFirstMatch() const 737 int TextFinder::ordinalOfFirstMatch() const
738 { 738 {
739 return ordinalOfFirstMatchForFrame(&m_ownerFrame); 739 return ordinalOfFirstMatchForFrame(&m_ownerFrame);
740 } 740 }
741 741
742 } // namespace blink 742 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/TextFinder.h ('k') | Source/web/WebDOMFileSystem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698