diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index e9bd05ac7b9250db3aebcdf47a1a1ffaca3526c7..6a1e5d794519e4e96ce4c38b926d21e1b34da93c 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,16 @@ +2010-12-20 Enrica Casucci + + Reviewed by Darin Adler. + + Crash at WebCore::SplitElementCommand::SplitElementCommand + https://bugs.webkit.org/show_bug.cgi?id=51278 + + + * 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 Reviewed by Darin Adler. diff --git a/LayoutTests/editing/execCommand/outdent-inline-blockquote-expected.txt b/LayoutTests/editing/execCommand/outdent-inline-blockquote-expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..376cc99c1ed82c0bbb9132a9b0dd8b19703afdb7 --- /dev/null +++ b/LayoutTests/editing/execCommand/outdent-inline-blockquote-expected.txt @@ -0,0 +1,3 @@ + +Executing Outdent on an inline blockquote that is not the first element in the document should not crash. +Test passed: no crash diff --git a/LayoutTests/editing/execCommand/outdent-inline-blockquote.html b/LayoutTests/editing/execCommand/outdent-inline-blockquote.html new file mode 100644 index 0000000000000000000000000000000000000000..dc625031424b95f47f5afd2e1f4206be38a583d4 --- /dev/null +++ b/LayoutTests/editing/execCommand/outdent-inline-blockquote.html @@ -0,0 +1,24 @@ + + +
+
Executing Outdent on an inline blockquote that is not the first element in the document should not crash.
+

+ + + diff --git a/LayoutTests/editing/execCommand/outdent-inline-list-expected.txt b/LayoutTests/editing/execCommand/outdent-inline-list-expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..30ddfc62a1349f84da165dd29ee7b9ba9892f527 --- /dev/null +++ b/LayoutTests/editing/execCommand/outdent-inline-list-expected.txt @@ -0,0 +1,8 @@ + +one +two +three +one +two +three +Test1 passed: no crash Test2 passed: no crash diff --git a/LayoutTests/editing/execCommand/outdent-inline-list.html b/LayoutTests/editing/execCommand/outdent-inline-list.html new file mode 100644 index 0000000000000000000000000000000000000000..39071ed33c4d7182b41bb8e55e2a8c8941235a24 --- /dev/null +++ b/LayoutTests/editing/execCommand/outdent-inline-list.html @@ -0,0 +1,29 @@ + + +
+
  1. one
  2. two
  3. three
+
  • one
  • two
  • three
+

+ + + diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index e2ba1af4a99037795e336a24aca7069c864cc548..1c8fc28ecee3288593181a276060a31318bef849 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,22 @@ +2010-12-20 Enrica Casucci + + Reviewed by Darin Adler. + + Crash at WebCore::SplitElementCommand::SplitElementCommand + https://bugs.webkit.org/show_bug.cgi?id=51278 + + + 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 Reviewed by Darin Adler. diff --git a/WebCore/editing/IndentOutdentCommand.cpp b/WebCore/editing/IndentOutdentCommand.cpp index 13056d37d75542a08d086969d854232c5e57a6b0..13d0f886dcd9dfcbbf3e70af39e2f161931a30de 100644 --- a/WebCore/editing/IndentOutdentCommand.cpp +++ b/WebCore/editing/IndentOutdentCommand.cpp @@ -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 &&