Commit 3a419c81 authored by yosin@chromium.org's avatar yosin@chromium.org

Check null position start of paragraph to move parameter in CompositeEditCommand::moveParagraph

This patch changes CompositeEditCommand::moveParagraph to check whether
|startOfParagraphToMove| is null position or not. If |startOfParagraphToMove|
is null position, |moveParagraph| does nothing as |startOfParagraphToMove|
equals to |destination|.

BUG=377709
TEST=LayoutTests/editing/execCommand/unlistify-body-crash.html

Review URL: https://codereview.chromium.org/303743003

git-svn-id: svn://svn.chromium.org/blink/trunk@175046 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 579b8db4
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function doReplace(tagName) {
var oldElement = document.getElementById(tagName);
var newElement = document.createElement(tagName);
while (oldElement.firstChild) {
newElement.appendChild(oldElement.firstChild);
}
oldElement.parentNode.replaceChild(newElement, oldElement);
}
onload = function() {
doReplace('body');
document.designMode = 'on';
getSelection().collapse(document.querySelector('li'), 1);
document.execCommand('InsertUnorderedList');
document.documentElement.textContent = 'PASS if Blink doesn\'t crash.';
};
</script>
</head>
<body>
<h6><ul><li><div id="body"><h6>bar<ul></ul></h6></div><br></li></ul></h6>
</body>
</html>
...@@ -1147,7 +1147,7 @@ void CompositeEditCommand::moveParagraph(const VisiblePosition& startOfParagraph ...@@ -1147,7 +1147,7 @@ void CompositeEditCommand::moveParagraph(const VisiblePosition& startOfParagraph
void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagraphToMove, const VisiblePosition& endOfParagraphToMove, const VisiblePosition& destination, bool preserveSelection, bool preserveStyle, Node* constrainingAncestor) void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagraphToMove, const VisiblePosition& endOfParagraphToMove, const VisiblePosition& destination, bool preserveSelection, bool preserveStyle, Node* constrainingAncestor)
{ {
if (startOfParagraphToMove == destination) if (startOfParagraphToMove == destination || startOfParagraphToMove.isNull())
return; return;
int startIndex = -1; int startIndex = -1;
......
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