Changeset 128188 in webkit


Ignore:
Timestamp:
Sep 11, 2012 8:08:43 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] Take account for single words that exceed our client character limit
https://bugs.webkit.org/show_bug.cgi?id=96389

Fix to the processing of long single-line text using getRangeForSpellCheckWithFineGranularity.
This was failing if a single word was longer than our maximum allowed limit.

Internally reviewed by Mike Fenton.

Patch by Nima Ghanavatian <nghanavatian@rim.com> on 2012-09-11
Reviewed by Rob Buis.

  • WebKitSupport/InputHandler.cpp:

(WebKit):
(BlackBerry::WebKit::InputHandler::getRangeForSpellCheckWithFineGranularity):

Location:
trunk/Source/WebKit/blackberry
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/ChangeLog

    r128183 r128188  
     12012-09-11  Nima Ghanavatian  <nghanavatian@rim.com>
     2
     3        [BlackBerry] Take account for single words that exceed our client character limit
     4        https://bugs.webkit.org/show_bug.cgi?id=96389
     5
     6        Fix to the processing of long single-line text using getRangeForSpellCheckWithFineGranularity.
     7        This was failing if a single word was longer than our maximum allowed limit.
     8
     9        Internally reviewed by Mike Fenton.
     10
     11        Reviewed by Rob Buis.
     12
     13        * WebKitSupport/InputHandler.cpp:
     14        (WebKit):
     15        (BlackBerry::WebKit::InputHandler::getRangeForSpellCheckWithFineGranularity):
     16
    1172012-09-11  Arvid Nilsson  <anilsson@rim.com>
    218
  • trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp

    r128183 r128188  
    939939{
    940940    VisiblePosition endOfCurrentWord = endOfWord(startPosition);
    941     RefPtr<Range> rangeForSpellChecking;
    942     while (endOfCurrentWord != endPosition) {
    943         rangeForSpellChecking = VisibleSelection(startPosition, endOfCurrentWord).toNormalizedRange();
    944         // If we exceed the MaxSpellCheckingStringLength limit, then go back one word and return this range.
    945         if (rangeForSpellChecking->text().length() >= MaxSpellCheckingStringLength)
    946             return VisibleSelection(startPosition, endOfWord(previousWordPosition(endOfCurrentWord))).toNormalizedRange();
    947 
    948         endOfCurrentWord = endOfWord(nextWordPosition(endOfCurrentWord));
     941
     942    // Keep iterating until one of our cases is hit, or we've incremented the starting position right to the end.
     943    while (startPosition != endPosition) {
     944        // Check the text length within this range.
     945        if (VisibleSelection(startPosition, endOfCurrentWord).toNormalizedRange()->text().length() >= MaxSpellCheckingStringLength) {
     946            // If this is not the first word, return a Range with end boundary set to the previous word.
     947            if (startOfWord(endOfCurrentWord, LeftWordIfOnBoundary) != startPosition)
     948                return VisibleSelection(startPosition, endOfWord(previousWordPosition(endOfCurrentWord), LeftWordIfOnBoundary)).toNormalizedRange();
     949
     950            // Our first word has gone over the character limit. Increment the starting position past an uncheckable word.
     951            startPosition = endOfCurrentWord;
     952        } else if (endOfCurrentWord == endPosition) {
     953            // Return the last segment if the end of our word lies at the end of the range.
     954            return VisibleSelection(startPosition, endPosition).toNormalizedRange();
     955        } else {
     956            // Increment the current word.
     957            endOfCurrentWord = endOfWord(nextWordPosition(endOfCurrentWord));
     958        }
    949959    }
    950960    return 0;
Note: See TracChangeset for help on using the changeset viewer.