2010-09-14 Ryosuke Niwa <rniwa@webkit.org>
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Sep 2010 20:29:00 +0000 (20:29 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Sep 2010 20:29:00 +0000 (20:29 +0000)
commitfe444889281554fb8e9aed2b7d125d9e6f3a0bf3
tree526fcff12d8523be22fcb9e3547e8f2dde46f2d5
parentdb4d485cd518afe825799be8e18f672215ff7e3a
2010-09-14  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Tony Chang.

        applyInlineStyleToNodeRange does not extend run properly
        https://bugs.webkit.org/show_bug.cgi?id=45616

        The bug was caused by applyInlineStyleToNodeRange's skipping a node whenever it has children.
        Fixed the bug by only skipping a node that contains the past end node, contains non-editable region,
        or has a non-editable parent node. Also fixed a bug that applyInlineStyleToNodeRange does not remove
        styled elements in a run that are identical to the one added. addInlineStyleIfNeeded now removes
        all styled elements in a run using removeStyleFromRunBeforeApplyingStyle before calling addInlineStyleIfNeeded.

        Test: editing/style/inline-style-extend-run.html

        * editing/ApplyStyleCommand.cpp:
        (WebCore::containsNonEditableRegion): Added.
        (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange): See above.
        (WebCore::ApplyStyleCommand::removeStyleFromRunBeforeApplyingStyle): Added, see above.
        (WebCore::ApplyStyleCommand::removeInlineStyleFromElement): Added support for RemoveAlways.
        (WebCore::ApplyStyleCommand::removeImplicitlyStyledElement): Replaced RemoveAttributesAndElements by RemoveIfNeeded.
        (WebCore::ApplyStyleCommand::extractInlineStyleToPushDown): Replaced RemoveAttributesAndElements by RemoveIfNeeded.
        * editing/ApplyStyleCommand.h:
2010-09-14  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Tony Chang.

        applyInlineStyleToNodeRange does not extend a run properly
        https://bugs.webkit.org/show_bug.cgi?id=45616

        Added a test to ensure WebKit adds just one element when applying inline style and removes redundant styled elements.
        Rebaseline of other tests are required because WebKit now generates less elements.

        * editing/execCommand/script-tests/toggle-style-3.js: Merged two b elements.
        * editing/execCommand/toggle-style-3-expected.txt: Ditto.
        * editing/execCommand/unlink-expected.txt: Changed the order in which span and anchor appear.
        * editing/style/inline-style-extend-run-expected.txt: Added.
        * editing/style/inline-style-extend-run.html: Added.
        * editing/style/script-tests/inline-style-extend-run.js: Added.
        (testSingleToggle):
        * editing/style/script-tests/make-text-writing-direction-inline.js: Merged two spans.
        * fast/events/event-input-contentEditable-expected.txt: Merged two anchor elements.
        * fast/events/event-input-contentEditable.html: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@67490 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/execCommand/script-tests/toggle-style-3.js
LayoutTests/editing/execCommand/toggle-style-3-expected.txt
LayoutTests/editing/execCommand/unlink-expected.txt
LayoutTests/editing/style/inline-style-extend-run-expected.txt [new file with mode: 0644]
LayoutTests/editing/style/inline-style-extend-run.html [new file with mode: 0644]
LayoutTests/editing/style/script-tests/inline-style-extend-run.js [new file with mode: 0644]
LayoutTests/editing/style/script-tests/make-text-writing-direction-inline.js
LayoutTests/fast/events/event-input-contentEditable-expected.txt
LayoutTests/fast/events/script-tests/event-input-contentEditable.js
WebCore/ChangeLog
WebCore/editing/ApplyStyleCommand.cpp
WebCore/editing/ApplyStyleCommand.h