Title: [252233] trunk
Revision
252233
Author
carlo...@webkit.org
Date
2019-11-08 01:09:36 -0800 (Fri, 08 Nov 2019)

Log Message

'Strikethrough' editing command reported as 'formatUnderline'
https://bugs.webkit.org/show_bug.cgi?id=203944

Reviewed by Adrian Perez de Castro.

Source/WebCore:

Add an EditAction for strikeThrough command.

Test: fast/events/input-events-strikethrough-type.html

* editing/EditAction.cpp:
(WebCore::undoRedoLabel): Handle StrikeThrough action.
* editing/EditAction.h:
* editing/EditCommand.cpp:
(WebCore::inputTypeNameForEditingAction): Ditto.
* editing/EditorCommand.cpp:
(WebCore::executeStrikethrough): Use StrikeThrough action instead of Underline.

LayoutTests:

* fast/events/input-events-strikethrough-type-expected.txt: Added.
* fast/events/input-events-strikethrough-type.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (252232 => 252233)


--- trunk/LayoutTests/ChangeLog	2019-11-08 04:02:47 UTC (rev 252232)
+++ trunk/LayoutTests/ChangeLog	2019-11-08 09:09:36 UTC (rev 252233)
@@ -1,3 +1,13 @@
+2019-11-08  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        'Strikethrough' editing command reported as 'formatUnderline'
+        https://bugs.webkit.org/show_bug.cgi?id=203944
+
+        Reviewed by Adrian Perez de Castro.
+
+        * fast/events/input-events-strikethrough-type-expected.txt: Added.
+        * fast/events/input-events-strikethrough-type.html: Added.
+
 2019-11-07  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         Default NamepaceURI must be gotten from the topmost parent before the SVG <foreignObject>

Added: trunk/LayoutTests/fast/events/input-events-strikethrough-type-expected.txt (0 => 252233)


--- trunk/LayoutTests/fast/events/input-events-strikethrough-type-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/input-events-strikethrough-type-expected.txt	2019-11-08 09:09:36 UTC (rev 252233)
@@ -0,0 +1,11 @@
+Check that strikeThrough command produces an input event of type formatStrikeThrough
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS event.type is "input"
+PASS event.inputType is "formatStrikeThrough"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/events/input-events-strikethrough-type.html (0 => 252233)


--- trunk/LayoutTests/fast/events/input-events-strikethrough-type.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/input-events-strikethrough-type.html	2019-11-08 09:09:36 UTC (rev 252233)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src=""
+</head>
+<body>
+    <div id="editable" contenteditable></div>
+    <script type="text/_javascript_">
+        description("Check that strikeThrough command produces an input event of type formatStrikeThrough");
+
+        document.getElementById("editable").focus();
+        if (window.testRunner) {
+            document._oninput_ = function(event) {
+                shouldBeEqualToString("event.type", "input");
+                shouldBeEqualToString("event.inputType", "formatStrikeThrough");
+            }
+            testRunner.execCommand('strikeThrough');
+        }
+    </script>
+    <script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (252232 => 252233)


--- trunk/Source/WebCore/ChangeLog	2019-11-08 04:02:47 UTC (rev 252232)
+++ trunk/Source/WebCore/ChangeLog	2019-11-08 09:09:36 UTC (rev 252233)
@@ -1,3 +1,22 @@
+2019-11-08  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        'Strikethrough' editing command reported as 'formatUnderline'
+        https://bugs.webkit.org/show_bug.cgi?id=203944
+
+        Reviewed by Adrian Perez de Castro.
+
+        Add an EditAction for strikeThrough command.
+
+        Test: fast/events/input-events-strikethrough-type.html
+
+        * editing/EditAction.cpp:
+        (WebCore::undoRedoLabel): Handle StrikeThrough action.
+        * editing/EditAction.h:
+        * editing/EditCommand.cpp:
+        (WebCore::inputTypeNameForEditingAction): Ditto.
+        * editing/EditorCommand.cpp:
+        (WebCore::executeStrikethrough): Use StrikeThrough action instead of Underline.
+
 2019-11-07  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         Default NamepaceURI must be gotten from the topmost parent before the SVG <foreignObject>

Modified: trunk/Source/WebCore/editing/EditAction.cpp (252232 => 252233)


--- trunk/Source/WebCore/editing/EditAction.cpp	2019-11-08 04:02:47 UTC (rev 252232)
+++ trunk/Source/WebCore/editing/EditAction.cpp	2019-11-08 09:09:36 UTC (rev 252233)
@@ -84,6 +84,8 @@
         return WEB_UI_STRING_KEY("Superscript", "Superscript (Undo action name)", "Undo action name");
     case EditAction::Underline:
         return WEB_UI_STRING_KEY("Underline", "Underline (Undo action name)", "Undo action name");
+    case EditAction::StrikeThrough:
+        return WEB_UI_STRING_KEY("StrikeThrough", "StrikeThrough (Undo action name)", "Undo action name");
     case EditAction::Outline:
         return WEB_UI_STRING_KEY("Outline", "Outline (Undo action name)", "Undo action name");
     case EditAction::Unscript:

Modified: trunk/Source/WebCore/editing/EditAction.h (252232 => 252233)


--- trunk/Source/WebCore/editing/EditAction.h	2019-11-08 04:02:47 UTC (rev 252232)
+++ trunk/Source/WebCore/editing/EditAction.h	2019-11-08 09:09:36 UTC (rev 252233)
@@ -59,6 +59,7 @@
     Subscript,
     Superscript,
     Underline,
+    StrikeThrough,
     Outline,
     Unscript,
     DeleteByDrag,

Modified: trunk/Source/WebCore/editing/EditCommand.cpp (252232 => 252233)


--- trunk/Source/WebCore/editing/EditCommand.cpp	2019-11-08 04:02:47 UTC (rev 252232)
+++ trunk/Source/WebCore/editing/EditCommand.cpp	2019-11-08 09:09:36 UTC (rev 252233)
@@ -56,6 +56,8 @@
         return "formatSuperscript"_s;
     case EditAction::Underline:
         return "formatUnderline"_s;
+    case EditAction::StrikeThrough:
+        return "formatStrikeThrough"_s;
     case EditAction::SetColor:
         return "formatFontColor"_s;
     case EditAction::DeleteByDrag:

Modified: trunk/Source/WebCore/editing/EditorCommand.cpp (252232 => 252233)


--- trunk/Source/WebCore/editing/EditorCommand.cpp	2019-11-08 04:02:47 UTC (rev 252232)
+++ trunk/Source/WebCore/editing/EditorCommand.cpp	2019-11-08 09:09:36 UTC (rev 252233)
@@ -1082,8 +1082,7 @@
 {
     Ref<EditingStyle> style = EditingStyle::create();
     style->setStrikeThroughChange(textDecorationChangeForToggling(frame.editor(), CSSPropertyWebkitTextDecorationsInEffect, "line-through"_s));
-    // FIXME: Needs a new EditAction!
-    return applyCommandToFrame(frame, source, EditAction::Underline, WTFMove(style));
+    return applyCommandToFrame(frame, source, EditAction::StrikeThrough, WTFMove(style));
 }
 
 static bool executeStyleWithCSS(Frame& frame, Event*, EditorCommandSource, const String& value)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to