Changeset 41607 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Mar 11, 2009, 8:39:14 PM (16 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

Reviewed by Darin Adler.

  • WTF support for fixing <rdar://problem/3919124> Thai text selection in Safari is incorrect
  • wtf/unicode/icu/UnicodeIcu.h: (WTF::Unicode::hasLineBreakingPropertyComplexContext): Added. Returns whether the character has Unicode line breaking property value SA ("Complex Context").
  • wtf/unicode/qt4/UnicodeQt4.h: (WTF::Unicode::hasLineBreakingPropertyComplexContext): Added an implementation that always returns false.

WebCore:

Reviewed by Darin Adler.

  • WebCore part of fixing <rdar://problem/3919124> Thai text selection in Safari is incorrect

Test: platform/mac/editing/selection/word-thai.html

Tested on Mac, but should work on all ICU platforms (or more precisely
on all platforms that implement
WTF::Unicode::hasLineBreakingPropertyComplexContext() correctly).

  • editing/TextIterator.cpp: (WebCore::BackwardsCharacterIterator::BackwardsCharacterIterator): Added. (WebCore::BackwardsCharacterIterator::range): Added. (WebCore::BackwardsCharacterIterator::advance): Added.
  • editing/TextIterator.h: Added BackwardsCharacterIterator with the minimal functionality required for this patch. (WebCore::BackwardsCharacterIterator::atEnd): Added.
  • editing/visible_units.cpp: (WebCore::firstNonComplexContextLineBreak): Added this helper function that returns the index of the first character in the string whose Unicode line breaking property value is not SA ("Complex Context"), or the length of the string if there is no such character. (WebCore::lastNonComplexContextLineBreak): Added this helper function that returns the index of the last character in the string whose Unicode line breaking property value is not SA ("Complex Context"), or -1 if there is no such character. (WebCore::previousBoundary): Changed the signature of the search function to include an offset parameter. Renamed the 'exception' local variable to 'ec' and changed its type to ExceptionCode. Extend the string forwards until the first character with Unicode line breaking property value other than SA. This gives the boundary search function enough context in the forward direction. Changed to use a BackwardsCharacterIterator for translating the backwards offset into a position. (WebCore::nextBoundary): Changed the signature of the search function to include an offset parameter. Extend the string backwards until the first character with Unicode line breaking property value other than SA. This gives the boundary search function enough context in the backwards direction. Restricted the workaround for <rdar://5192593> only to the line break case, because it was causing an extra character to be selected following a word that ended with a combining mark. (WebCore::startWordBoundary): Added an offset parameter. Check that going backwards from the given offset, there is a character with Unicode line breaking property value other than SA, and otherwise return 0 to request more context. (WebCore::endWordBoundary): Similar, but in reverse. (WebCore::previousWordPositionBoundary): Similar. (WebCore::nextWordPositionBoundary): Similar. (WebCore::startSentenceBoundary): Updated for the new search function signature. (WebCore::endSentenceBoundary): Ditto. (WebCore::previousSentencePositionBoundary): Ditto. (WebCore::nextSentencePositionBoundary): Ditto.

LayoutTests:

Reviewed by Darin Adler.

  • test for <rdar://problem/3919124> Thai text selection in Safari is incorrect
  • platform/mac/editing/selection/word-thai-expected.txt: Added.
  • platform/mac/editing/selection/word-thai.html: Added.
Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r41605 r41607  
     12009-03-11  Dan Bernstein  <[email protected]>
     2
     3        Reviewed by Darin Adler.
     4
     5        - WTF support for fixing <rdar://problem/3919124> Thai text selection
     6          in Safari is incorrect
     7
     8        * wtf/unicode/icu/UnicodeIcu.h:
     9        (WTF::Unicode::hasLineBreakingPropertyComplexContext): Added. Returns
     10        whether the character has Unicode line breaking property value SA
     11        ("Complex Context").
     12        * wtf/unicode/qt4/UnicodeQt4.h:
     13        (WTF::Unicode::hasLineBreakingPropertyComplexContext): Added an
     14        implementation that always returns false.
     15
    1162009-03-11  Darin Adler  <[email protected]>
    217
  • trunk/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h

    r39554 r41607  
    180180}
    181181
     182inline bool hasLineBreakingPropertyComplexContext(UChar32 c)
     183{
     184    return u_getIntPropertyValue(c, UCHAR_LINE_BREAK) == U_LB_COMPLEX_CONTEXT;
     185}
     186
    182187inline UChar32 mirroredChar(UChar32 c)
    183188{
  • trunk/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h

    r39554 r41607  
    353353}
    354354
     355inline bool hasLineBreakingPropertyComplexContext(UChar32)
     356{
     357    // FIXME: Implement this to return whether the character has line breaking property SA (Complex Context).
     358    return false;
     359}
     360
    355361inline UChar32 mirroredChar(UChar32 c)
    356362{
Note: See TracChangeset for help on using the changeset viewer.