Changeset 80405 in webkit


Ignore:
Timestamp:
Mar 4, 2011, 9:20:23 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2011-03-04 Jia Pu <jpu@apple.com>

Reviewed by Darin Adler.

Those checking in Editor::removeSpellAndCorrectionMarkersFromWordsToBeEdited() should be done with VisiblePosition::isNull().
https://bugs.webkit.org/show_bug.cgi?id=55731

No new tests. There's no behavioral change.

This patch improved clarity and readability of Editor::removeSpellAndCorrectionMarkersFromWordsToBeEdited().

  • editing/Editor.cpp: (WebCore::Editor::removeSpellAndCorrectionMarkersFromWordsToBeEdited):
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r80404 r80405  
     12011-03-04  Jia Pu  <jpu@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Those checking in Editor::removeSpellAndCorrectionMarkersFromWordsToBeEdited() should be done with VisiblePosition::isNull().
     6        https://bugs.webkit.org/show_bug.cgi?id=55731
     7
     8        No new tests. There's no behavioral change.
     9
     10        This patch improved clarity and readability of Editor::removeSpellAndCorrectionMarkersFromWordsToBeEdited().
     11
     12        * editing/Editor.cpp:
     13        (WebCore::Editor::removeSpellAndCorrectionMarkersFromWordsToBeEdited):
     14
    1152011-03-04  John Bauman  <jbauman@chromium.org>
    216
  • trunk/Source/WebCore/editing/Editor.cpp

    r80226 r80405  
    26912691    VisiblePosition endOfLastWord = endOfWord(endOfSelection, RightWordIfOnBoundary);
    26922692
    2693     // This can be the case if the end of selection is at the end of document.
    2694     if (endOfLastWord.deepEquivalent().anchorType() != Position::PositionIsOffsetInAnchor) {
    2695         startOfLastWord = startOfWord(frame()->selection()->selection().start(), LeftWordIfOnBoundary);
    2696         endOfLastWord = endOfWord(frame()->selection()->selection().start(), LeftWordIfOnBoundary);
     2693    if (startOfFirstWord.isNull()) {
     2694        startOfFirstWord = startOfWord(startOfSelection, RightWordIfOnBoundary);
     2695        endOfFirstWord = endOfWord(startOfSelection, RightWordIfOnBoundary);
     2696    }
     2697   
     2698    if (endOfLastWord.isNull()) {
     2699        startOfLastWord = startOfWord(endOfSelection, LeftWordIfOnBoundary);
     2700        endOfLastWord = endOfWord(endOfSelection, LeftWordIfOnBoundary);
    26972701    }
    26982702
     
    27012705    if (doNotRemoveIfSelectionAtWordBoundary && endOfFirstWord == startOfSelection) {
    27022706        startOfFirstWord = nextWordPosition(startOfFirstWord);
    2703         if (startOfFirstWord.isNull() || startOfFirstWord == endOfSelection)
    2704             return;
    27052707        endOfFirstWord = endOfWord(startOfFirstWord, RightWordIfOnBoundary);
    2706         if (endOfFirstWord.deepEquivalent().anchorType() != Position::PositionIsOffsetInAnchor)
     2708        if (startOfFirstWord == endOfSelection)
    27072709            return;
    27082710    }
     
    27132715        startOfLastWord = previousWordPosition(startOfLastWord);
    27142716        endOfLastWord = endOfWord(startOfLastWord, RightWordIfOnBoundary);
    2715         if (endOfLastWord == startOfFirstWord)
     2717        if (endOfLastWord == startOfSelection)
    27162718            return;
    27172719    }
     2720
     2721    if (startOfFirstWord.isNull() || endOfFirstWord.isNull() || startOfLastWord.isNull() || endOfLastWord.isNull())
     2722        return;
    27182723
    27192724    // Now we remove markers on everything between startOfFirstWord and endOfLastWord.
Note: See TracChangeset for help on using the changeset viewer.