Title: [221199] trunk
- Revision
- 221199
- Author
- [email protected]
- Date
- 2017-08-25 12:04:23 -0700 (Fri, 25 Aug 2017)
Log Message
Using the touchbar, both align left and align justify send a beforeinput event with the 'formatJustifyLeft' inputType.
https://bugs.webkit.org/show_bug.cgi?id=168669
<rdar://problem/30639155>
Reviewed by Beth Dakin.
Source/WebCore:
Small tweak to add a "formatJustifyFull" inputType when justifying text using the touch bar's rich text
formatting controls. Currently, the EditActionJustify edit command incorrectly maps to "formatJustifyLeft".
Test: fast/events/input-events-text-alignment.html
* editing/EditCommand.cpp:
(WebCore::inputTypeNameForEditingAction):
LayoutTests:
Adds a new LayoutTest checking that the text alignment editor commands, "Align{Right|Center|Left|Justify}",
correctly propagate input events and beforeinput events of inputType "formatJustify{Right|Center|Left|Justify}",
and that these text alignment style changes can be prevented by calling preventDefault() on the dispatched
beforeinput event.
* fast/events/input-events-text-alignment-expected.txt: Added.
* fast/events/input-events-text-alignment.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (221198 => 221199)
--- trunk/LayoutTests/ChangeLog 2017-08-25 18:57:44 UTC (rev 221198)
+++ trunk/LayoutTests/ChangeLog 2017-08-25 19:04:23 UTC (rev 221199)
@@ -1,3 +1,19 @@
+2017-08-25 Wenson Hsieh <[email protected]>
+
+ Using the touchbar, both align left and align justify send a beforeinput event with the 'formatJustifyLeft' inputType.
+ https://bugs.webkit.org/show_bug.cgi?id=168669
+ <rdar://problem/30639155>
+
+ Reviewed by Beth Dakin.
+
+ Adds a new LayoutTest checking that the text alignment editor commands, "Align{Right|Center|Left|Justify}",
+ correctly propagate input events and beforeinput events of inputType "formatJustify{Right|Center|Left|Justify}",
+ and that these text alignment style changes can be prevented by calling preventDefault() on the dispatched
+ beforeinput event.
+
+ * fast/events/input-events-text-alignment-expected.txt: Added.
+ * fast/events/input-events-text-alignment.html: Added.
+
2017-08-25 Brady Eidson <[email protected]>
Introduce ServerWorkerRegistration task queues.
Added: trunk/LayoutTests/fast/events/input-events-text-alignment-expected.txt (0 => 221199)
--- trunk/LayoutTests/fast/events/input-events-text-alignment-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/input-events-text-alignment-expected.txt 2017-08-25 19:04:23 UTC (rev 221199)
@@ -0,0 +1,33 @@
+To manually test this, change the text alignment and check the resulting debug messages.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+beforeinput (inputType = formatJustifyCenter)
+input (inputType = formatJustifyCenter)
+getComputedStyle(text).textAlign = 'center'
+beforeinput (inputType = formatJustifyRight)
+input (inputType = formatJustifyRight)
+getComputedStyle(text).textAlign = 'right'
+beforeinput (inputType = formatJustifyLeft)
+input (inputType = formatJustifyLeft)
+getComputedStyle(text).textAlign = 'left'
+beforeinput (inputType = formatJustifyFull)
+input (inputType = formatJustifyFull)
+getComputedStyle(text).textAlign = 'justify'
+beforeinput (inputType = formatJustifyCenter)
+Prevented default
+getComputedStyle(text).textAlign = 'justify'
+beforeinput (inputType = formatJustifyRight)
+Prevented default
+getComputedStyle(text).textAlign = 'justify'
+beforeinput (inputType = formatJustifyLeft)
+Prevented default
+getComputedStyle(text).textAlign = 'justify'
+beforeinput (inputType = formatJustifyFull)
+Prevented default
+getComputedStyle(text).textAlign = 'justify'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+WebKit
Added: trunk/LayoutTests/fast/events/input-events-text-alignment.html (0 => 221199)
--- trunk/LayoutTests/fast/events/input-events-text-alignment.html (rev 0)
+++ trunk/LayoutTests/fast/events/input-events-text-alignment.html 2017-08-25 19:04:23 UTC (rev 221199)
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+</head>
+<body>
+ <div id="editable" contenteditable _onbeforeinput_=handleInput(event) _oninput_=handleInput(event)><div id="text">WebKit</div></div>
+ <script type="text/_javascript_">
+ description("To manually test this, change the text alignment and check the resulting debug messages.");
+
+ let range = document.createRange();
+ range.setStartBefore(text);
+ range.setEndAfter(text);
+ getSelection().addRange(range);
+
+ if (window.testRunner) {
+ preventDefaultForBeforeInputEvents = false;
+
+ execCommandAndLogComputedTextAlignmentStyle("AlignCenter");
+ execCommandAndLogComputedTextAlignmentStyle("AlignRight");
+ execCommandAndLogComputedTextAlignmentStyle("AlignLeft");
+ execCommandAndLogComputedTextAlignmentStyle("AlignJustified");
+
+ preventDefaultForBeforeInputEvents = true;
+
+ execCommandAndLogComputedTextAlignmentStyle("AlignCenter");
+ execCommandAndLogComputedTextAlignmentStyle("AlignRight");
+ execCommandAndLogComputedTextAlignmentStyle("AlignLeft");
+ execCommandAndLogComputedTextAlignmentStyle("AlignJustified");
+ }
+
+ function handleInput(event)
+ {
+ debug(`${event.type} (inputType = ${event.inputType})`);
+ if (window.preventDefaultForBeforeInputEvents && event.type === "beforeinput") {
+ event.preventDefault();
+ debug("Prevented default");
+ }
+ }
+
+ function execCommandAndLogComputedTextAlignmentStyle(command) {
+ testRunner.execCommand(command);
+ debug(`getComputedStyle(text).textAlign = '${getComputedStyle(text).textAlign}'`);
+ }
+ </script>
+ <script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (221198 => 221199)
--- trunk/Source/WebCore/ChangeLog 2017-08-25 18:57:44 UTC (rev 221198)
+++ trunk/Source/WebCore/ChangeLog 2017-08-25 19:04:23 UTC (rev 221199)
@@ -1,3 +1,19 @@
+2017-08-25 Wenson Hsieh <[email protected]>
+
+ Using the touchbar, both align left and align justify send a beforeinput event with the 'formatJustifyLeft' inputType.
+ https://bugs.webkit.org/show_bug.cgi?id=168669
+ <rdar://problem/30639155>
+
+ Reviewed by Beth Dakin.
+
+ Small tweak to add a "formatJustifyFull" inputType when justifying text using the touch bar's rich text
+ formatting controls. Currently, the EditActionJustify edit command incorrectly maps to "formatJustifyLeft".
+
+ Test: fast/events/input-events-text-alignment.html
+
+ * editing/EditCommand.cpp:
+ (WebCore::inputTypeNameForEditingAction):
+
2017-08-25 Brady Eidson <[email protected]>
Introduce ServerWorkerRegistration task queues.
Modified: trunk/Source/WebCore/editing/EditCommand.cpp (221198 => 221199)
--- trunk/Source/WebCore/editing/EditCommand.cpp 2017-08-25 18:57:44 UTC (rev 221198)
+++ trunk/Source/WebCore/editing/EditCommand.cpp 2017-08-25 19:04:23 UTC (rev 221199)
@@ -43,6 +43,7 @@
{
switch (action) {
case EditActionJustify:
+ return ASCIILiteral("formatJustifyFull");
case EditActionAlignLeft:
return ASCIILiteral("formatJustifyLeft");
case EditActionAlignRight:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes