2010-11-22 Ryosuke Niwa <rniwa@webkit.org>
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Nov 2010 00:25:10 +0000 (00:25 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Nov 2010 00:25:10 +0000 (00:25 +0000)
commit7703842d3be719bfc4f93f84cd04d7285638f5bc
tree85583cee56e7da88b7ded64083808cb333deb60d
parent588c1d31dbd880df78fe52a0ec2a535aca37d372
2010-11-22  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Tony Chang.

        SelectionController::typingStyle() should return EditingStyle*
        https://bugs.webkit.org/show_bug.cgi?id=49813

        Changed the return value of SelectionController::typingStyle() to EditingStyle*.
        Also added SelectionController::copyTypingStyle() to copy the typing style
        as an instance of CSSMutableStyleDeclaration.

        No tests are added since this is no behavioral change.

        * WebView/WebFrame.mm:
        (-[WebFrame _typingStyle]): Calls SelectionController::copyTypingStyle()
2010-11-22  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Tony Chang.

        SelectionController::typingStyle() should return EditingStyle*
        https://bugs.webkit.org/show_bug.cgi?id=49813

        Changed the return type of SelectionController::typingStyle to EditingStyle*.

        Extracted textDirection from Editor::textDirectionForSelection to hide the underlying
        CSSMutableStyleDeclaration.

        Also extracted the code to preserve unicode-bidi and direction CSS properties in
        InsertTextCommand::input, and moved into EditingStyle::prepareToApplyAt. ShouldPreserveWritingDirection,
        which is added to the argument list of EditingStyle::prepareToApplyAt, decides whether or not
        these two properties are preserved.

        Also added SelectionController::copyTypingStyle() to copy the typing style as an instance of
        CSSMutableStyleDeclaration.

        No new tests are added since this is a refactoring.

        * editing/EditingStyle.cpp:
        (WebCore::EditingStyle::textDirection): Extracted from Editor::textDirectionForSelection.
        (WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode): Added a missing null check.
        (WebCore::EditingStyle::prepareToApplyAt): See above.
        (WebCore::editingStyleIncludingTypingStyle): Calls SelectionController::typingStyle.
        * editing/EditingStyle.h: Moved WritingDirection from Editor.h
        * editing/Editor.cpp:
        (WebCore::Editor::textDirectionForSelection): Calls EditingStyle::textDirection.
        (WebCore::Editor::computeAndSetTypingStyle): Calls SelectionController::typingStyle.
        (WebCore::Editor::selectionComputedStyle): Ditto.
        (WebCore::Editor::styleForSelectionStart): Ditto.
        * editing/Editor.h:
        * editing/InsertLineBreakCommand.cpp:
        (WebCore::InsertLineBreakCommand::doApply): Ditto.
        * editing/InsertTextCommand.cpp:
        (WebCore::InsertTextCommand::input): Calls EditingStyle::prepareToApplyAt with PreserveWritingDirection.
        * editing/SelectionController.h:
        (WebCore::SelectionController::typingStyle): Returns EditingStyle* rather than CSSMutableStyleDeclaration*.
        (WebCore::SelectionController::copyTypingStyle): Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@72573 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebCore/ChangeLog
WebCore/editing/EditingStyle.cpp
WebCore/editing/EditingStyle.h
WebCore/editing/Editor.cpp
WebCore/editing/Editor.h
WebCore/editing/InsertLineBreakCommand.cpp
WebCore/editing/InsertTextCommand.cpp
WebCore/editing/SelectionController.h
WebKit/mac/ChangeLog
WebKit/mac/WebView/WebFrame.mm