Reviewed by Hyatt
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Feb 2005 22:11:16 +0000 (22:11 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Feb 2005 22:11:16 +0000 (22:11 +0000)
commite6d49949b8dad99fb5a77e7af690d45c75f504f6
treea64c3522b9f6075e8bba1540b7eca206adb8f5a5
parent91dac0aa3c61859b07d6a3b65e244dd9bdd58db9
    Reviewed by Hyatt

        Fix for this bug:

        <rdar://problem/4017641> REGRESSION (Mail): you can only bold/unbold a selection starting from end of line once

        Problem is with the way we figure out whether to add or remove a style based on
        the current selection. In this case, the code is looking at the end of the
        previous line, which is not bold, and deduces incorrectly that the operation is
        a "make bold". Then the style code runs to make bold, but there is nothing on
        the end of the previous line to embolden, so we get into a cycle where the same
        thing happens each time cmd-b is hit.

        * khtml/khtml_part.cpp:
        (KHTMLPart::selectionComputedStyle):  Call editingStartPosition() to get the right position for the font determination.
        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::editingStartPosition): New helper function that "does the right thing" based on whether the
        selection is a caret or a range, moving upstream for the former, and downstream for the latter.
        * khtml/xml/dom2_rangeimpl.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::fontForSelection): Call editingStartPosition() to get the right position for the font determination.

        New tests:

        * layout-tests/editing/style/style-boundary-001-expected.txt
        * layout-tests/editing/style/style-boundary-001.html
        * layout-tests/editing/style/style-boundary-002-expected.txt
        * layout-tests/editing/style/style-boundary-002.html
        * layout-tests/editing/style/style-boundary-003-expected.txt
        * layout-tests/editing/style/style-boundary-003.html
        * layout-tests/editing/style/style-boundary-004-expected.txt
        * layout-tests/editing/style/style-boundary-004.html

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8677 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/editing/style/style-boundary-001-expected.txt [new file with mode: 0644]
LayoutTests/editing/style/style-boundary-001.html [new file with mode: 0644]
LayoutTests/editing/style/style-boundary-002-expected.txt [new file with mode: 0644]
LayoutTests/editing/style/style-boundary-002.html [new file with mode: 0644]
LayoutTests/editing/style/style-boundary-003-expected.txt [new file with mode: 0644]
LayoutTests/editing/style/style-boundary-003.html [new file with mode: 0644]
LayoutTests/editing/style/style-boundary-004-expected.txt [new file with mode: 0644]
LayoutTests/editing/style/style-boundary-004.html [new file with mode: 0644]
WebCore/ChangeLog-2005-08-23
WebCore/khtml/khtml_part.cpp
WebCore/khtml/xml/dom2_rangeimpl.cpp
WebCore/khtml/xml/dom2_rangeimpl.h
WebCore/kwq/KWQKHTMLPart.mm