Changeset 13244 in webkit


Ignore:
Timestamp:
Mar 9, 2006 6:20:26 PM (18 years ago)
Author:
adele
Message:

Reviewed by Tim O.

Removed unnecessary alerts in TextIterator advance methods.
We want to be able to use advance() even if the iterator is already at the end.

  • editing/visible_text.cpp: (khtml::TextIterator::advance): remove assert since TextIterator will just do nothing if its already at the end. (khtml::CharacterIterator::advance): ditto.
  • rendering/RenderTextField.cpp: (WebCore::RenderTextField::visiblePositionForIndex): Since the asserts in the iterator are removed, we don't have to check for it.atEnd() before calling advance.
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r13241 r13244  
     12006-03-09  Adele Peterson  <adele@apple.com>
     2
     3        Reviewed by Tim O.
     4
     5        Removed unnecessary alerts in TextIterator advance methods. 
     6        We want to be able to use advance() even if the iterator is already at the end.
     7
     8        * editing/visible_text.cpp:
     9        (khtml::TextIterator::advance): remove assert since TextIterator will just do nothing if its already at the end.
     10        (khtml::CharacterIterator::advance): ditto.
     11        * rendering/RenderTextField.cpp: (WebCore::RenderTextField::visiblePositionForIndex):
     12        Since the asserts in the iterator are removed, we don't have to check for it.atEnd() before calling advance.
     13
    1142006-03-09  David Hyatt <hyatt@apple.com>
    215
  • trunk/WebCore/editing/visible_text.cpp

    r13167 r13244  
    131131void TextIterator::advance()
    132132{
    133     // otherwise, where are we advancing from?
    134     assert(m_positionNode);
    135 
    136133    // reset the run information
    137134    m_positionNode = 0;
     
    757754void CharacterIterator::advance(int count)
    758755{
    759     assert(!atEnd());
    760 
    761756    m_atBreak = false;
    762757
  • trunk/WebCore/rendering/RenderTextField.cpp

    r13240 r13244  
    178178{   
    179179    if (index <= 0)
    180         return VisiblePosition(m_div.get(), 0, DOWNSTREAM);
     180        return VisiblePosition(m_div.get(), 0, UPSTREAM);
    181181    ExceptionCode ec = 0;
    182182    RefPtr<RangeImpl> range = new RangeImpl(document());
    183183    range->selectNodeContents(m_div.get(), ec);
    184184    CharacterIterator it(range.get());
    185     if (!it.atEnd())
    186         it.advance(index - 1);
     185    it.advance(index - 1);
    187186    return VisiblePosition(it.range()->endContainer(ec), it.range()->endOffset(ec), UPSTREAM);
    188187}
Note: See TracChangeset for help on using the changeset viewer.