Title: [191559] releases/WebKitGTK/webkit-2.10
Revision
191559
Author
[email protected]
Date
2015-10-26 00:34:07 -0700 (Mon, 26 Oct 2015)

Log Message

Merge r191233 - Avoid to insert TAB before HTML element.
https://bugs.webkit.org/show_bug.cgi?id=149295
<rdar://problem/22746706>

Patch by Jiewen Tan <[email protected]> on 2015-10-16
Reviewed by Ryosuke Niwa.

Source/WebCore:

This is a merge of Blink r175047:
https://codereview.chromium.org/306583005

This patch avoids InsertTextCommand::insertTab before HTML element because
we can't set Text node as document element.

Test: editing/execCommand/insert-tab-to-html-element-crash.html

* editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::insertTab):

LayoutTests:

* editing/execCommand/insert-tab-to-html-element-crash-expected.txt: Added.
* editing/execCommand/insert-tab-to-html-element-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog (191558 => 191559)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog	2015-10-26 07:30:14 UTC (rev 191558)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog	2015-10-26 07:34:07 UTC (rev 191559)
@@ -1,3 +1,14 @@
+2015-10-16  Jiewen Tan  <[email protected]>
+
+        Avoid to insert TAB before HTML element.
+        https://bugs.webkit.org/show_bug.cgi?id=149295
+        <rdar://problem/22746706>
+
+        Reviewed by Ryosuke Niwa.
+
+        * editing/execCommand/insert-tab-to-html-element-crash-expected.txt: Added.
+        * editing/execCommand/insert-tab-to-html-element-crash.html: Added.
+
 2015-10-16  Zalan Bujtas  <[email protected]>
 
         First line box in paragraph using initial-letter overflows.

Added: releases/WebKitGTK/webkit-2.10/LayoutTests/editing/execCommand/insert-tab-to-html-element-crash-expected.txt (0 => 191559)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/editing/execCommand/insert-tab-to-html-element-crash-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/editing/execCommand/insert-tab-to-html-element-crash-expected.txt	2015-10-26 07:34:07 UTC (rev 191559)
@@ -0,0 +1 @@
+PASS if not crash.

Added: releases/WebKitGTK/webkit-2.10/LayoutTests/editing/execCommand/insert-tab-to-html-element-crash.html (0 => 191559)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/editing/execCommand/insert-tab-to-html-element-crash.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/editing/execCommand/insert-tab-to-html-element-crash.html	2015-10-26 07:34:07 UTC (rev 191559)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<head>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+_onload_ = function() {
+    getSelection().collapse(document.body, 0);
+    document.body.parentNode.removeChild(document.body);
+    document.designMode = 'on';
+    document.execCommand("InsertText", false, '\t');
+    document.documentElement.textContent = 'PASS if not crash.';
+}
+</script>
+</head>
+<body>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog (191558 => 191559)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog	2015-10-26 07:30:14 UTC (rev 191558)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog	2015-10-26 07:34:07 UTC (rev 191559)
@@ -1,3 +1,22 @@
+2015-10-16  Jiewen Tan  <[email protected]>
+
+        Avoid to insert TAB before HTML element.
+        https://bugs.webkit.org/show_bug.cgi?id=149295
+        <rdar://problem/22746706>
+
+        Reviewed by Ryosuke Niwa.
+
+        This is a merge of Blink r175047:
+        https://codereview.chromium.org/306583005
+
+        This patch avoids InsertTextCommand::insertTab before HTML element because
+        we can't set Text node as document element.
+
+        Test: editing/execCommand/insert-tab-to-html-element-crash.html
+
+        * editing/InsertTextCommand.cpp:
+        (WebCore::InsertTextCommand::insertTab):
+
 2015-10-16  Zalan Bujtas  <[email protected]>
 
         First line box in paragraph using initial-letter overflows.

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/editing/InsertTextCommand.cpp (191558 => 191559)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/editing/InsertTextCommand.cpp	2015-10-26 07:30:14 UTC (rev 191558)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/editing/InsertTextCommand.cpp	2015-10-26 07:34:07 UTC (rev 191559)
@@ -235,6 +235,8 @@
 Position InsertTextCommand::insertTab(const Position& pos)
 {
     Position insertPos = VisiblePosition(pos, DOWNSTREAM).deepEquivalent();
+    if (insertPos.isNull())
+        return pos;
 
     Node* node = insertPos.containerNode();
     unsigned int offset = node->isTextNode() ? insertPos.offsetInContainerNode() : 0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to