WebCore:

2009-04-21  Justin Garcia  <justin.garcia@apple.com>

        Reviewed by Dan Bernstein.

        https://bugs.webkit.org/show_bug.cgi?id=25320
        Crash when changing block styles in a root that contains no visible content (but contains nodes with renderers)

        * editing/CompositeEditCommand.cpp:
        (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary): If the enclosing block is the 
        root editable element and it contains no visible content, create a new block but don't try and move 
        content into it, since there's nothing for moveParagraphs to move.

LayoutTests:

2009-04-21  Justin Garcia  <justin.garcia@apple.com>
        
        Reviewed by Dan Bernstein.

        https://bugs.webkit.org/show_bug.cgi?id=25320
        Crash when changing block styles in a root that contains no visible content (but contains nodes with renderers)

        * editing/execCommand/25320-expected.txt: Added.
        * editing/execCommand/25320.html: Added.
        * platform/mac/fast/forms/caret-rtl-expected.checksum: Replaced.
        * platform/mac/fast/forms/caret-rtl-expected.txt: Replaced.



git-svn-id: svn://svn.chromium.org/blink/trunk@42735 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 5dca3c2b
2009-04-21 Justin Garcia <justin.garcia@apple.com>
Reviewed by Dan Bernstein.
https://bugs.webkit.org/show_bug.cgi?id=25320
Crash when changing block styles in a root that contains no visible content (but contains nodes with renderers)
* editing/execCommand/25320-expected.txt: Added.
* editing/execCommand/25320.html: Added.
* platform/mac/fast/forms/caret-rtl-expected.checksum: Replaced.
* platform/mac/fast/forms/caret-rtl-expected.txt: Replaced.
2009-04-21 Darin Adler <darin@apple.com>
Reviewed by Dan Bernstein.
......
This tests for a crash when doing a block style change inside an editable root that contains rendered, but invisible content. This test shouldn't crash and the text-align:center should go onto a new paragraph element, not the body.
<div style="text-align: center;"><br></div><div style="padding-left: 5px;"></div>
<head>
<script>
function runTest() {
if (layoutTestController)
layoutTestController.dumpAsText();
document.body.focus();
document.execCommand("JustifyCenter");
document.body.innerText = "This tests for a crash when doing a block style change inside an editable root that contains rendered, but invisible content. This test shouldn't crash and the text-align:center should go onto a new paragraph element, not the body." + "\n\n" + document.body.innerHTML;
}
</script>
</head>
<body onLoad="runTest();" contentEditable="true"><div style="padding-left: 5px;"></div></body>
2009-04-21 Justin Garcia <justin.garcia@apple.com>
Reviewed by Dan Bernstein.
https://bugs.webkit.org/show_bug.cgi?id=25320
Crash when changing block styles in a root that contains no visible content (but contains nodes with renderers)
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary): If the enclosing block is the
root editable element and it contains no visible content, create a new block but don't try and move
content into it, since there's nothing for moveParagraphs to move.
2009-04-21 Darin Adler <darin@apple.com>
Reviewed by Dan Bernstein.
......@@ -656,9 +656,9 @@ PassRefPtr<Node> CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessar
// If the block is the root editable element, always move content to a new block,
// since it is illegal to modify attributes on the root editable element for editing.
if (upstreamStart.node() == editableRootForPosition(upstreamStart)) {
// If the block is the root editable element and it contains no rendered content, create a new
// block but don't try and move content into it, since there's nothing to move.
if (!hasARenderedDescendant(upstreamStart.node()))
// If the block is the root editable element and it contains no visible content, create a new
// block but don't try and move content into it, since there's nothing for moveParagraphs to move.
if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(upstreamStart.node()->renderer()))
return insertNewDefaultParagraphElementAt(upstreamStart);
} else if (isBlock(upstreamEnd.node())) {
if (!upstreamEnd.node()->isDescendantOf(upstreamStart.node())) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment