JavaScriptCore:
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Mar 2009 03:39:14 +0000 (03:39 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Mar 2009 03:39:14 +0000 (03:39 +0000)
commitf65e43efdd70da970a4a71b9dcd1e6dc9e9d6cc0
treeee6fc098e9718738c07410ae43a4d91a21305d96
parent32efed8fe307ba4baca06470742dd7cff182c009
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41607 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JavaScriptCore/ChangeLog
JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h
JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
LayoutTests/ChangeLog
LayoutTests/platform/mac/editing/selection/word-thai-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/editing/selection/word-thai.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/TextIterator.cpp
WebCore/editing/TextIterator.h
WebCore/editing/visible_units.cpp