[webkit-changes] cvs commit: WebCore/khtml/editing visible_text.cpp

Alexey ap at opensource.apple.com
Wed Dec 28 10:21:50 PST 2005


ap          05/12/28 10:21:50

  Modified:    .        ChangeLog
               khtml/editing visible_text.cpp
  Log:
          Reviewed by Maciej.
  
          - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6246
            TextIterator::rangeFromLocationAndLength() returns nil range for an
            empty document
  
          Test: editing/input/range-for-empty-document.html
  
          * khtml/editing/visible_text.cpp:
          (khtml::TextIterator::rangeFromLocationAndLength):
          Handle the case of an empty document and (0, 0) requested range.
  
  Revision  Changes    Path
  1.49      +14 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- ChangeLog	28 Dec 2005 18:18:34 -0000	1.48
  +++ ChangeLog	28 Dec 2005 18:21:49 -0000	1.49
  @@ -1,3 +1,17 @@
  +2005-12-28  Alexey Proskuryakov  <ap at nypop.com>
  +
  +        Reviewed by Maciej.
  +
  +        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6246
  +          TextIterator::rangeFromLocationAndLength() returns nil range for an 
  +          empty document
  +
  +        Test: editing/input/range-for-empty-document.html
  +
  +        * khtml/editing/visible_text.cpp:
  +        (khtml::TextIterator::rangeFromLocationAndLength):
  +        Handle the case of an empty document and (0, 0) requested range.
  +
   2005-12-28  Anders Carlsson  <andersca at mac.com>
   
           Reviewed and landed by Geoff.
  
  
  
  1.45      +16 -1     WebCore/khtml/editing/visible_text.cpp
  
  Index: visible_text.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/visible_text.cpp,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- visible_text.cpp	21 Dec 2005 02:05:11 -0000	1.44
  +++ visible_text.cpp	28 Dec 2005 18:21:50 -0000	1.45
  @@ -1,5 +1,6 @@
   /*
    * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
  + * Copyright (C) 2005 Alexey Proskuryakov.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
  @@ -994,7 +995,21 @@
   
       RefPtr<RangeImpl> textRunRange;
   
  -    for (TextIterator it(rangeOfContents(doc).get()); !it.atEnd(); it.advance()) {
  +    TextIterator it(rangeOfContents(doc).get());
  +    
  +    if (rangeLocation == 0 && rangeLength == 0) {
  +        int exception = 0;
  +        textRunRange = it.range();
  +        
  +        resultRange->setStart(textRunRange->startContainer(exception), 0, exception);
  +        assert(exception == 0);
  +        resultRange->setEnd(textRunRange->startContainer(exception), 0, exception);
  +        assert(exception == 0);
  +        
  +        return resultRange;
  +    }
  +
  +    for (; !it.atEnd(); it.advance()) {
           int len = it.length();
           textRunRange = it.range();
   
  
  
  



More information about the webkit-changes mailing list