[webkit-changes] cvs commit: WebKit/Misc.subproj WebSearchableTextView.m

John sullivan at opensource.apple.com
Fri Sep 9 11:34:59 PDT 2005


sullivan    05/09/09 11:34:58

  Modified:    .        ChangeLog
               kwq      KWQKHTMLPart.mm
               .        ChangeLog
               Misc.subproj WebSearchableTextView.m
  Log:
  WebCore:
  
          Reviewed by Tim Omernick.
  
          Test cases added: none, doesn't affect layout
  
          - fixed <rdar://problem/4250792> Find in HTML doesn't reveal match if only match was already selected
  
          * kwq/KWQKHTMLPart.mm:
          (KWQKHTMLPart::findString):
          If we end up finding the previously-selected text, just go through the normal success code path
          instead of bailing out early.
  
  WebKit:
  
          Reviewed by Tim Omernick.
  
          fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4070:
          Find in plain text won't find only occurrence if it overlaps selection
  
          * Misc.subproj/WebSearchableTextView.m:
          (-[NSString findString:selectedRange:options:wrap:]):
          in the wrap case, extend the search range far enough that text overlapping the
          selection (including the exact-match case) will be considered.
  
  Revision  Changes    Path
  1.108     +13 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.107
  retrieving revision 1.108
  diff -u -r1.107 -r1.108
  --- ChangeLog	8 Sep 2005 22:54:35 -0000	1.107
  +++ ChangeLog	9 Sep 2005 18:34:49 -0000	1.108
  @@ -1,3 +1,16 @@
  +2005-09-09  John Sullivan  <sullivan at apple.com>
  +
  +        Reviewed by Tim Omernick.
  +
  +        Test cases added: none, doesn't affect layout
  +        
  +        - fixed <rdar://problem/4250792> Find in HTML doesn't reveal match if only match was already selected
  +
  +        * kwq/KWQKHTMLPart.mm:
  +        (KWQKHTMLPart::findString):
  +        If we end up finding the previously-selected text, just go through the normal success code path
  +        instead of bailing out early.
  +
   2005-09-08  Vicki Murley  <vicki at apple.com>
   
           Reviewed by John Sullivan.
  
  
  
  1.670     +3 -4      WebCore/kwq/KWQKHTMLPart.mm
  
  Index: KWQKHTMLPart.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQKHTMLPart.mm,v
  retrieving revision 1.669
  retrieving revision 1.670
  diff -u -r1.669 -r1.670
  --- KWQKHTMLPart.mm	1 Sep 2005 18:03:34 -0000	1.669
  +++ KWQKHTMLPart.mm	9 Sep 2005 18:34:51 -0000	1.670
  @@ -645,10 +645,9 @@
       if (resultRange->collapsed(exception) && wrapFlag) {
           searchRange = rangeOfContents(xmlDocImpl());
           resultRange = findPlainText(searchRange.get(), target, forward, caseFlag);
  -        // If we got back to the same place we started, that doesn't count as success.
  -        if (*resultRange == *selection().toRange()) {
  -            return false;
  -        }
  +        // We used to return false here if we ended up with the same range that we started with
  +        // (e.g., the selection was already the only instance of this text). But we decided that
  +        // this should be a success case instead, so we'll just fall through in that case.
       }
   
       if (resultRange->collapsed(exception)) {
  
  
  
  1.3314    +12 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3313
  retrieving revision 1.3314
  diff -u -r1.3313 -r1.3314
  --- ChangeLog	8 Sep 2005 21:34:59 -0000	1.3313
  +++ ChangeLog	9 Sep 2005 18:34:53 -0000	1.3314
  @@ -1,3 +1,15 @@
  +2005-09-09  John Sullivan  <sullivan at apple.com>
  +
  +        Reviewed by Tim Omernick.
  +        
  +        fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4070:
  +        Find in plain text won't find only occurrence if it overlaps selection
  +
  +        * Misc.subproj/WebSearchableTextView.m:
  +        (-[NSString findString:selectedRange:options:wrap:]):
  +        in the wrap case, extend the search range far enough that text overlapping the
  +        selection (including the exact-match case) will be considered.
  +
   2005-09-08  Justin Garcia  <justin.garcia at apple.com>
   
           Reviewed by darin
  
  
  
  1.8       +17 -3     WebKit/Misc.subproj/WebSearchableTextView.m
  
  Index: WebSearchableTextView.m
  ===================================================================
  RCS file: /cvs/root/WebKit/Misc.subproj/WebSearchableTextView.m,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WebSearchableTextView.m	18 Jul 2005 18:02:21 -0000	1.7
  +++ WebSearchableTextView.m	9 Sep 2005 18:34:58 -0000	1.8
  @@ -146,9 +146,15 @@
               range = [self rangeOfString:string options:options range:searchRange];
           }
           
  -        if ((range.length == 0) && wrap) {	/* If not found look at the first part of the string */
  +        // If not found, search again from the beginning. Make search range large enough that
  +        // we'll find a match even if it partially overlapped the existing selection (including the
  +        // case where it exactly matches the existing selection).
  +        if ((range.length == 0) && wrap) {	
               searchRange.location = 0;
  -            searchRange.length = selectedRange.location;
  +            searchRange.length = selectedRange.location + selectedRange.length + [string length];
  +            if (searchRange.length > length) {
  +                searchRange.length = length;
  +            }
               range = [self rangeOfString:string options:options range:searchRange];
           }
       } else {
  @@ -163,8 +169,16 @@
               range = [self rangeOfString:string options:options range:searchRange];
           }
           
  +        // If not found, search again from the end. Make search range large enough that
  +        // we'll find a match even if it partially overlapped the existing selection (including the
  +        // case where it exactly matches the existing selection).
           if ((range.length == 0) && wrap) {
  -            searchRange.location = NSMaxRange(selectedRange);
  +            unsigned stringLength = [string length];
  +            if (selectedRange.location > stringLength) {
  +                searchRange.location = selectedRange.location - stringLength;
  +            } else {
  +                searchRange.location = 0;
  +            }
               searchRange.length = length - searchRange.location;
               range = [self rangeOfString:string options:options range:searchRange];
           }
  
  
  



More information about the webkit-changes mailing list