Commit ca1c95ff authored by enrica@apple.com's avatar enrica@apple.com

Crash at WebCore::SplitElementCommand::SplitElementCommand

https://bugs.webkit.org/show_bug.cgi?id=51278
<rdar://problem/7347139> 

Reviewed by Darin Adler.

WebCore: 

Executing outdent command on an inline blockquote that is
not the first element in a block causes a crash.
The fix consists in chaging the was the start of block is
calculated in case of the inline blockquote.
        
Test: editing/execCommand/outdent-inline-blockquote.html
      editing/execCommand/outdent-inline-list.html

* editing/IndentOutdentCommand.cpp:
(WebCore::IndentOutdentCommand::outdentParagraph):

LayoutTests: 

* editing/execCommand/outdent-inline-blockquote-expected.txt: Added.
* editing/execCommand/outdent-inline-blockquote.html: Added.
* editing/execCommand/outdent-inline-list-expected.txt: Added.
* editing/execCommand/outdent-inline-list.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e864155a
2010-12-20 Enrica Casucci <enrica@apple.com>
Reviewed by Darin Adler.
Crash at WebCore::SplitElementCommand::SplitElementCommand
https://bugs.webkit.org/show_bug.cgi?id=51278
<rdar://problem/7347139>
* editing/execCommand/outdent-inline-blockquote-expected.txt: Added.
* editing/execCommand/outdent-inline-blockquote.html: Added.
* editing/execCommand/outdent-inline-list-expected.txt: Added.
* editing/execCommand/outdent-inline-list.html: Added.
2010-12-20 Oliver Hunt <oliver@apple.com>
Reviewed by Darin Adler.
......
Executing Outdent on an inline blockquote that is not the first element in the document should not crash.
Test passed: no crash
<html>
<body contenteditable="true">
<br>
<blockquote id="test" style="display: inline">Executing Outdent on an inline blockquote that is not the first element in the document should not crash.</blockquote>
<p id="console"></p>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function log(message) {
var console = document.getElementById("console");
var text = document.createTextNode(message);
console.appendChild(text);
}
var s = window.getSelection();
var p1 = document.getElementById("test");
s.setPosition(p1, 0);
document.execCommand("Outdent", false, 0);
log("Test passed: no crash");
</script>
</body>
</html>
one
two
three
one
two
three
Test1 passed: no crash Test2 passed: no crash
<html>
<body contenteditable="true">
<br>
<ol><li id="test1" style="display: inline">one</li><li>two</li><li>three</li></ol>
<ul><li id="test2" style="display: inline">one</li><li>two</li><li>three</li></ul>
<p id="console"></p>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function log(message) {
var console = document.getElementById("console");
var text = document.createTextNode(message);
console.appendChild(text);
}
var s = window.getSelection();
var p = document.getElementById("test1");
s.setPosition(p, 0);
document.execCommand("Outdent", false, 0);
log("Test1 passed: no crash ");
var p = document.getElementById("test2");
s.setPosition(p, 0);
document.execCommand("Outdent", false, 0);
log("Test2 passed: no crash");
</script>
</body>
</html>
2010-12-20 Enrica Casucci <enrica@apple.com>
Reviewed by Darin Adler.
Crash at WebCore::SplitElementCommand::SplitElementCommand
https://bugs.webkit.org/show_bug.cgi?id=51278
<rdar://problem/7347139>
Executing outdent command on an inline blockquote that is
not the first element in a block causes a crash.
The fix consists in chaging the was the start of block is
calculated in case of the inline blockquote.
Test: editing/execCommand/outdent-inline-blockquote.html
editing/execCommand/outdent-inline-list.html
* editing/IndentOutdentCommand.cpp:
(WebCore::IndentOutdentCommand::outdentParagraph):
2010-12-20 Oliver Hunt <oliver@apple.com>
Reviewed by Darin Adler.
......
......@@ -135,7 +135,9 @@ void IndentOutdentCommand::outdentParagraph()
// The selection is inside a blockquote i.e. enclosingNode is a blockquote
VisiblePosition positionInEnclosingBlock = VisiblePosition(Position(enclosingNode, 0));
VisiblePosition startOfEnclosingBlock = startOfBlock(positionInEnclosingBlock);
// If the blockquote is inline, the start of the enclosing block coincides with
// positionInEnclosingBlock.
VisiblePosition startOfEnclosingBlock = (enclosingNode->renderer() && enclosingNode->renderer()->isInline()) ? positionInEnclosingBlock : startOfBlock(positionInEnclosingBlock);
VisiblePosition lastPositionInEnclosingBlock = VisiblePosition(Position(enclosingNode, enclosingNode->childNodeCount()));
VisiblePosition endOfEnclosingBlock = endOfBlock(lastPositionInEnclosingBlock);
if (visibleStartOfParagraph == startOfEnclosingBlock &&
......
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