Reviewed by Harrison
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Mar 2005 22:32:15 +0000 (22:32 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Mar 2005 22:32:15 +0000 (22:32 +0000)
commitdced007ff54dc7253b31f4aba4f819fc1b2856e9
treef7be36a26fce07e068627d6690b7d0b3e06e9093
parent5b2adce0eb4732c952cadfb2c6a4165f698abb2f
    Reviewed by Harrison

        Fix for this bug:

        <rdar://problem/4032543> REGRESSION (Mail): Mail hangs when quoted text is pasted twice

        This code change fixes the bug in a non-obvious way. The root cause of the problem was
        that a VisiblePosition created using an affinity originating in Mail code caused
        two VisiblePosition objects that should have been equal to differ only in their
        affinities, which in turn caused us to run a code path that should not have run.

        * khtml/editing/visible_position.cpp:
        (khtml::VisiblePosition::VisiblePosition): Added copy constructor.
        (khtml::VisiblePosition::next): Factored out inline code that used to be here into new
        setAffinityUsingLinePosition() function.
        (khtml::isEqualIgnoringAffinity): New helper to handle cases when affinity in equality check does
        not matter. However, we want to know about such cases where a VisiblePosition differs only by affinity,
        and the code will assert in development when this happens.
        (khtml::isNotEqualIgnoringAffinity): Ditto, but not. :)
        (khtml::setAffinityUsingLinePosition): New helper function mentioned above. This will "correct"
        upstream affinity to downstream if the affinity does not make a difference for the position.
        * khtml/editing/visible_position.h:
        * khtml/editing/visible_range.h: Wacky bug. The operator== for this class took VisiblePosition classes!
        * khtml/editing/visible_units.cpp:
        (khtml::isStartOfParagraph): Now performs equality check without regard to affinity.
        (khtml::isEndOfParagraph): Ditto.
        (khtml::isStartOfBlock): Ditto.
        (khtml::isEndOfBlock): Ditto.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge setSelectedDOMRange:affinity:]): Adjusts the affinity using setAffinityUsingLinePosition()
        if necessary.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8781 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebCore/ChangeLog-2005-08-23
WebCore/khtml/editing/visible_position.cpp
WebCore/khtml/editing/visible_position.h
WebCore/khtml/editing/visible_range.h
WebCore/khtml/editing/visible_units.cpp
WebCore/kwq/WebCoreBridge.mm