WebCore:
authorjustin.garcia@apple.com <justin.garcia@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Dec 2007 07:43:26 +0000 (07:43 +0000)
committerjustin.garcia@apple.com <justin.garcia@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Dec 2007 07:43:26 +0000 (07:43 +0000)
commitb3837da7b22ea6a5012ec7a38d266da8d707a609
tree36a1755414b02d81ca6eeb8fd6b27cfa40bc811e
parenteee3eab9fb131fd08e17ec95fb1e30f11516915b
WebCore:

        Reviewed by Oliver Hunt.

        <rdar://problem/5482023> GoogleDocs: After FormatBlock in an empty document, certain functions are disabled

        We were trying to insert a block of the requested type before the body element.

        * editing/FormatBlockCommand.cpp:
        (WebCore::FormatBlockCommand::doApply):
        Removed unnecessary ()s in the if condition.
        Removed "|| !upstreamStart.node()->isDescendantOf(root)" from the if condition, since
        a) upstreamStart will never be outside the root editable element, since in that case
        there would be no block inside the editable root to Format, and b) if upstreamStart.node()
        *is* the root, then refNode is the root, and we shouldn't insert before the root, we should insert
        at [root, 0].
        Added comments to explain the use of upstream() in the second if-clause.
        Added an early return for case where there is nothing selected, in that case, there is nothing
        to move.

LayoutTests:

        Reviewed by Oliver Hunt.

        <rdar://problem/5482023> GoogleDocs: After performing FormatBlock in an empty document, certain functions are disabled

        * editing/execCommand/5482023.html: Added.
        * platform/mac/editing/execCommand/5482023-expected.checksum: Added.
        * platform/mac/editing/execCommand/5482023-expected.png: Added.
        * platform/mac/editing/execCommand/5482023-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28611 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/editing/execCommand/5482023.html [new file with mode: 0644]
LayoutTests/platform/mac/editing/execCommand/5482023-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/editing/execCommand/5482023-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/editing/execCommand/5482023-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/FormatBlockCommand.cpp