2010-08-27 Ryosuke Niwa <rniwa@webkit.org>
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Aug 2010 04:38:58 +0000 (04:38 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Aug 2010 04:38:58 +0000 (04:38 +0000)
commit038748b12ceffed28bf2802fd4c9fb64d5d9663e
tree9c8ce1b38b8ba5207a40cd66cfed48845ada9bda
parentdc7df96404d0c4c30ef449f4c52aecfcef0daeec
2010-08-27  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Darin Adler.

        cannot remove text-decoration when style is added by u or s
        https://bugs.webkit.org/show_bug.cgi?id=44560

        The bug was caused by WebKit not pushing down implicitly added styles to descendent nodes.
        Fixed the bug by pushing down all elements that implicitly add style.

        extractInlineStyleToPushDown now calls removeImplicitlyStyledElement, which was modified to extract
        the style implicitly added by the element to extractStyle.

        This revealed a bug in applyInlineStyleToPushDown where applyInlineStyleIfNeeded could add
        an implicitly styled element inside an element with a conflicting style, thereby overriding the style of the element.
        Fixed this by extending the logic to honor the existing inline style declaration used in
        the case of rewriting inline style declaration to all cases including the one calling addInlineStyleIfNeeded.

        Also fixed a bug in removeInlineStyle where pushDownInlineStyleAroundNode was called on a text node
        outside of selection if start was at the end of the text node.

        Test: editing/style/push-down-implicit-styles.html

        * editing/ApplyStyleCommand.cpp:
        (WebCore::ApplyStyleCommand::removeImplicitlyStyledElement): Added extractedStyle, which receives
        the style implicitly added by the element being removed.
        (WebCore::ApplyStyleCommand::extractInlineStyleToPushDown): Calls removeImplicitlyStyledElement
        to remove the implicitly styled element and extract the inline style added by the element.
        (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown): Fixed a bug that addInlineStyleIfNeeded
        could override the inline style declaration style of the node.
        (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode): Uses extractInlineStyleToPushDown
        (WebCore::ApplyStyleCommand::removeInlineStyle): See above.
        * editing/ApplyStyleCommand.h: Prototype changes.
2010-08-27  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Darin Adler.

        cannot remove text-decoration when style is added by u or s
        https://bugs.webkit.org/show_bug.cgi?id=44560

        Added a test to ensure WebKit removes text-decorations added by u or s
        and pushes down implicit styles properly into descendent nodes.

        * editing/style/push-down-implicit-styles-expected.txt: Added.
        * editing/style/push-down-implicit-styles.html: Added.
        * editing/style/script-tests/push-down-implicit-styles.js: Added.
        (testSingleToggle):
        (selectAll):
        (selectTest):
        (selectSecondWord):
        (selectLastTwoWords):
        * editing/style/typing-style-003-expected.txt: Negation of inline
        styles are now done by pushing down implicitly styled elements rather than
        canceling them by inline style declarations.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@66324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/editing/style/push-down-implicit-styles-expected.txt [new file with mode: 0644]
LayoutTests/editing/style/push-down-implicit-styles.html [new file with mode: 0644]
LayoutTests/editing/style/script-tests/push-down-implicit-styles.js [new file with mode: 0644]
LayoutTests/editing/style/typing-style-003-expected.txt
WebCore/ChangeLog
WebCore/editing/ApplyStyleCommand.cpp
WebCore/editing/ApplyStyleCommand.h