Changeset 214893 in webkit for trunk/Source/WebCore/page/Page.cpp
- Timestamp:
- Apr 4, 2017, 12:59:52 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/page/Page.cpp
r214621 r214893 648 648 } 649 649 650 static Frame* incrementFrame(Frame* curr, bool forward, bool wrapFlag)650 static Frame* incrementFrame(Frame* curr, bool forward, CanWrap canWrap, DidWrap* didWrap = nullptr) 651 651 { 652 652 return forward 653 ? curr->tree().traverseNext WithWrap(wrapFlag)654 : curr->tree().traversePrevious WithWrap(wrapFlag);655 } 656 657 bool Page::findString(const String& target, FindOptions options )653 ? curr->tree().traverseNext(canWrap, didWrap) 654 : curr->tree().traversePrevious(canWrap, didWrap); 655 } 656 657 bool Page::findString(const String& target, FindOptions options, DidWrap* didWrap) 658 658 { 659 659 if (target.isEmpty()) 660 660 return false; 661 661 662 bool shouldWrap = options & WrapAround;662 CanWrap canWrap = options & WrapAround ? CanWrap::Yes : CanWrap::No; 663 663 Frame* frame = &focusController().focusedOrMainFrame(); 664 664 Frame* startFrame = frame; … … 670 670 return true; 671 671 } 672 frame = incrementFrame(frame, !(options & Backwards), shouldWrap);672 frame = incrementFrame(frame, !(options & Backwards), canWrap, didWrap); 673 673 } while (frame && frame != startFrame); 674 674 675 675 // Search contents of startFrame, on the other side of the selection that we did earlier. 676 676 // We cheat a bit and just research with wrap on 677 if (shouldWrap && !startFrame->selection().isNone()) { 677 if (canWrap == CanWrap::Yes && !startFrame->selection().isNone()) { 678 if (didWrap) 679 *didWrap = DidWrap::Yes; 678 680 bool found = startFrame->editor().findString(target, options | WrapAround | StartInSelection); 679 681 focusController().setFocusedFrame(frame); … … 694 696 if (frame->selection().isRange()) 695 697 frameWithSelection = frame; 696 frame = incrementFrame(frame, true, false);698 frame = incrementFrame(frame, true, CanWrap::No); 697 699 } while (frame); 698 700 … … 736 738 return nullptr; 737 739 738 bool shouldWrap = options & WrapAround;740 CanWrap canWrap = options & WrapAround ? CanWrap::Yes : CanWrap::No; 739 741 Frame* frame = referenceRange ? referenceRange->ownerDocument().frame() : &mainFrame(); 740 742 Frame* startFrame = frame; … … 743 745 return resultRange; 744 746 745 frame = incrementFrame(frame, !(options & Backwards), shouldWrap);747 frame = incrementFrame(frame, !(options & Backwards), canWrap); 746 748 } while (frame && frame != startFrame); 747 749 748 750 // Search contents of startFrame, on the other side of the reference range that we did earlier. 749 751 // We cheat a bit and just search again with wrap on. 750 if ( shouldWrap&& referenceRange) {752 if (canWrap == CanWrap::Yes && referenceRange) { 751 753 if (RefPtr<Range> resultRange = startFrame->editor().rangeOfString(target, referenceRange, options | WrapAround | StartInSelection)) 752 754 return resultRange; … … 768 770 frame->editor().setMarkedTextMatchesAreHighlighted(shouldHighlightMatches == HighlightMatches); 769 771 matchCount += frame->editor().countMatchesForText(target, 0, options, maxMatchCount ? (maxMatchCount - matchCount) : 0, shouldMarkMatches == MarkMatches, 0); 770 frame = incrementFrame(frame, true, false);772 frame = incrementFrame(frame, true, CanWrap::No); 771 773 } while (frame); 772 774 … … 789 791 do { 790 792 frame->document()->markers().removeMarkers(DocumentMarker::TextMatch); 791 frame = incrementFrame(frame, true, false);793 frame = incrementFrame(frame, true, CanWrap::No); 792 794 } while (frame); 793 795 }
Note:
See TracChangeset
for help on using the changeset viewer.