Title: [94880] branches/chromium/874
- Revision
- 94880
- Author
- sulli...@chromium.org
- Date
- 2011-09-09 15:51:44 -0700 (Fri, 09 Sep 2011)
Log Message
Merge 94832 - Crashes in WebCore::InsertNodeBeforeCommand constructor.
https://bugs.webkit.org/show_bug.cgi?id=67763
Reviewed by Ryosuke Niwa.
Source/WebCore:
Changes editableRootForPosition() to use the position's containerNode instead of deprecatedNode so that
positions which are before or after a given node cannot return that node as the editable root.
Test: editing/inserting/insert-paragraph-selection-outside-contenteditable.html
* editing/htmlediting.cpp:
(WebCore::editableRootForPosition): use containerNode instead of deprecatedNode.
LayoutTests:
Tests for crash when the selection is outside the contenteditable node.
* editing/inserting/insert-paragraph-selection-outside-contenteditable-expected.txt: Added.
* editing/inserting/insert-paragraph-selection-outside-contenteditable.html: Added.
TBR=sulli...@chromium.org
BUG=95550
Review URL: http://codereview.chromium.org/7866016
Modified Paths
Added Paths
Diff
Copied: branches/chromium/874/LayoutTests/editing/inserting/insert-paragraph-selection-outside-contenteditable-expected.txt (from rev 94832, trunk/LayoutTests/editing/inserting/insert-paragraph-selection-outside-contenteditable-expected.txt) (0 => 94880)
--- branches/chromium/874/LayoutTests/editing/inserting/insert-paragraph-selection-outside-contenteditable-expected.txt (rev 0)
+++ branches/chromium/874/LayoutTests/editing/inserting/insert-paragraph-selection-outside-contenteditable-expected.txt 2011-09-09 22:51:44 UTC (rev 94880)
@@ -0,0 +1,3 @@
+This test ensures that WebKit does not crash or edit the content when the selection is outside of the contenteditable area.
+
+PASS
Copied: branches/chromium/874/LayoutTests/editing/inserting/insert-paragraph-selection-outside-contenteditable.html (from rev 94832, trunk/LayoutTests/editing/inserting/insert-paragraph-selection-outside-contenteditable.html) (0 => 94880)
--- branches/chromium/874/LayoutTests/editing/inserting/insert-paragraph-selection-outside-contenteditable.html (rev 0)
+++ branches/chromium/874/LayoutTests/editing/inserting/insert-paragraph-selection-outside-contenteditable.html 2011-09-09 22:51:44 UTC (rev 94880)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <meter id="root" contenteditable><span id="wrapper">xxx</span></meter>
+
+ <script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var originalContent = root.outerHTML;
+ var sel = window.getSelection();
+ sel.setPosition(document.getElementById("wrapper"), 1);
+ document.execCommand("InsertParagraph", false, null);
+ var editedContent = root.outerHTML;
+ root.style.display = 'none'; // Remove from output.
+
+ document.writeln('This test ensures that WebKit does not crash or edit the content when the selection is outside of the contenteditable area.<br><br>');
+ document.writeln(originalContent == editedContent ? 'PASS' : 'FAIL: expected ' + originalContent + ' but was changed to ' + editedContent);
+ </script>
+</body>
+</html>
Modified: branches/chromium/874/Source/WebCore/editing/htmlediting.cpp (94879 => 94880)
--- branches/chromium/874/Source/WebCore/editing/htmlediting.cpp 2011-09-09 22:47:49 UTC (rev 94879)
+++ branches/chromium/874/Source/WebCore/editing/htmlediting.cpp 2011-09-09 22:51:44 UTC (rev 94880)
@@ -176,7 +176,7 @@
Element* editableRootForPosition(const Position& p)
{
- Node* node = p.deprecatedNode();
+ Node* node = p.containerNode();
if (!node)
return 0;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes