Changeset 181072 in webkit


Ignore:
Timestamp:
Mar 5, 2015 12:56:22 AM (9 years ago)
Author:
g.czajkowski@samsung.com
Message:

TextCheckingParagraph::isEmpty() is sufficient to check whether paragraph is empty
https://bugs.webkit.org/show_bug.cgi?id=142276

Reviewed by Darin Adler.

TextCheckingParagraph::isEmpty() already calls TextCheckingParagraph::isRangeEmpty().
There is no need to call them both at the caller site.

No new tests. No behavior change.

  • editing/Editor.cpp:

(WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
Update caller site.

  • editing/TextCheckingHelper.cpp:

(WebCore::TextCheckingParagraph::isEmpty):
Avoid using helepers here to get rid of them as they are
no longer needed outside TextCheckingParagraph.

  • editing/TextCheckingHelper.h:

(WebCore::TextCheckingParagraph::isTextEmpty): Deleted.
(WebCore::TextCheckingParagraph::isRangeEmpty): Deleted.
Do not expose isTextEmpty() and isRangeEmpty().

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r181069 r181072  
     12015-03-05  Grzegorz Czajkowski  <g.czajkowski@samsung.com>
     2
     3        TextCheckingParagraph::isEmpty() is sufficient to check whether paragraph is empty
     4        https://bugs.webkit.org/show_bug.cgi?id=142276
     5
     6        Reviewed by Darin Adler.
     7
     8        TextCheckingParagraph::isEmpty() already calls TextCheckingParagraph::isRangeEmpty().
     9        There is no need to call them both at the caller site.
     10
     11        No new tests. No behavior change.
     12
     13        * editing/Editor.cpp:
     14        (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
     15        Update caller site.
     16
     17        * editing/TextCheckingHelper.cpp:
     18        (WebCore::TextCheckingParagraph::isEmpty):
     19        Avoid using helepers here to get rid of them as they are
     20        no longer needed outside TextCheckingParagraph.
     21
     22        * editing/TextCheckingHelper.h:
     23        (WebCore::TextCheckingParagraph::isTextEmpty): Deleted.
     24        (WebCore::TextCheckingParagraph::isRangeEmpty): Deleted.
     25        Do not expose isTextEmpty() and isRangeEmpty().
     26
    1272015-03-04  Simon Fraser  <simon.fraser@apple.com>
    228
  • trunk/Source/WebCore/editing/Editor.cpp

    r179758 r181072  
    23532353    Range* rangeToCheck = shouldMarkGrammar ? grammarRange : spellingRange;
    23542354    TextCheckingParagraph paragraphToCheck(rangeToCheck);
    2355     if (paragraphToCheck.isRangeEmpty() || paragraphToCheck.isEmpty())
     2355    if (paragraphToCheck.isEmpty())
    23562356        return;
    23572357    RefPtr<Range> paragraphRange = paragraphToCheck.paragraphRange();
  • trunk/Source/WebCore/editing/TextCheckingHelper.cpp

    r173235 r181072  
    185185    // Both predicates should have same result, but we check both just for sure.
    186186    // We need to investigate to remove this redundancy.
    187     return isRangeEmpty() || isTextEmpty();
     187    return checkingStart() >= checkingEnd() || text().isEmpty();
    188188}
    189189
  • trunk/Source/WebCore/editing/TextCheckingHelper.h

    r163712 r181072  
    5151    String textSubstring(unsigned pos, unsigned len = UINT_MAX) const { return text().substring(pos, len); }
    5252    UChar textCharAt(int index) const { return text()[static_cast<unsigned>(index)]; }
    53     bool isTextEmpty() const { return text().isEmpty(); }
    5453
    5554    bool isEmpty() const;
    56     bool isRangeEmpty() const { return checkingStart() >= checkingEnd(); }
    5755
    5856    int checkingStart() const;
Note: See TracChangeset for help on using the changeset viewer.