2011-01-27 Emil A Eklund <eae@chromium.org>

        Reviewed by Darin Adler.

        contentEditable formatBlock crashes on divs with contenteditable="false"
        https://bugs.webkit.org/show_bug.cgi?id=53263

        Add test for executing a formatBlock command on a selection containing an
        element with contenteditable=false.

        * editing/execCommand/format-block-contenteditable-false-expected.txt: Added.
        * editing/execCommand/format-block-contenteditable-false.html: Added.
2011-01-27  Emil A Eklund  <eae@chromium.org>

        Reviewed by Darin Adler.

        contentEditable formatBlock crashes on divs with contenteditable="false"
        https://bugs.webkit.org/show_bug.cgi?id=53263

        Check if editableRootForPosition returns null for position.

        Test: editing/execCommand/format-block-contenteditable-false.html

        * editing/FormatBlockCommand.cpp:
        (WebCore::FormatBlockCommand::formatRange):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76903 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0a9e4ccc
2011-01-27 Emil A Eklund <eae@chromium.org>
Reviewed by Darin Adler.
contentEditable formatBlock crashes on divs with contenteditable="false"
https://bugs.webkit.org/show_bug.cgi?id=53263
Add test for executing a formatBlock command on a selection containing an
element with contenteditable=false.
* editing/execCommand/format-block-contenteditable-false-expected.txt: Added.
* editing/execCommand/format-block-contenteditable-false.html: Added.
2011-01-27 Kenneth Russell <kbr@google.com>
Reviewed by James Robinson.
formatblock on selection with a contenteditable="false" child.
| <h1>
| <i>
| "
<#selection-anchor>Will select from here
"
| <br>
| <i>
| "
until here.<#selection-focus>
"
| <div>
| contenteditable="false"
| "
over this contenteditable=false div
"
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/dump-as-markup.js"></script>
</head>
<body>
<div id="editorcontainer" contenteditable="true">
Will select from here
<div contenteditable="false">
over this contenteditable=false div
</div>
until here.
</div>
</body>
<script>
Markup.description('formatblock on selection with a contenteditable="false" child.');
var selection = window.getSelection();
selection.removeAllRanges();
var container = document.getElementById('editorcontainer');
var range = document.createRange()
range.setStartBefore(container.firstChild);
range.setEndAfter(container.lastChild);
selection.addRange(range);
document.execCommand('italic', false, "");
document.execCommand('formatblock', false, "<h1>");
Markup.dump(container);
</script>
</html>
2011-01-27 Emil A Eklund <eae@chromium.org>
Reviewed by Darin Adler.
contentEditable formatBlock crashes on divs with contenteditable="false"
https://bugs.webkit.org/show_bug.cgi?id=53263
Check if editableRootForPosition returns null for position.
Test: editing/execCommand/format-block-contenteditable-false.html
* editing/FormatBlockCommand.cpp:
(WebCore::FormatBlockCommand::formatRange):
2011-01-27 Dimitri Glazkov <dglazkov@chromium.org>
Reviewed by Darin Adler.
......@@ -67,6 +67,9 @@ void FormatBlockCommand::formatRange(const Position& start, const Position& end,
RefPtr<Range> range = Range::create(document(), start, endOfSelection);
Element* refNode = enclosingBlockFlowElement(end);
Element* root = editableRootForPosition(start);
// Root is null for elements with contenteditable=false.
if (!root)
return;
if (isElementForFormatBlock(refNode->tagQName()) && start == startOfBlock(start)
&& (end == endOfBlock(end) || isNodeVisiblyContainedWithin(refNode, range.get()))
&& refNode != root && !root->isDescendantOf(refNode)) {
......
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