WebKit Bugzilla
Attachment 362205 Details for
Bug 194703
: Input type "formatSetInlineTextDirection" is dispatched when changing paragraph-level text direction
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194703-20190215205244.patch (text/plain), 26.84 KB, created by
Wenson Hsieh
on 2019-02-15 20:52:44 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-02-15 20:52:44 PST
Size:
26.84 KB
patch
obsolete
>Subversion Revision: 241590 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 576e704ee2558bab55ee620e45ffbb1de8e35e47..8993992764979693db8b3016270d87e39b4d2767 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,37 @@ >+2019-02-15 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Input type "formatSetInlineTextDirection" is dispatched when changing paragraph-level text direction >+ https://bugs.webkit.org/show_bug.cgi?id=194703 >+ <rdar://problem/48111775> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Currently, when changing text direction, WebKit always sends input events of type formatSetInlineTextDirection, >+ even when changing paragraph text direction. Instead, we should be emitting formatSetBlockTextDirection in this >+ scenario. This is problematic when using the context menus on macOS to change writing direction, since changing >+ "Selection Direction" is currently indistinguishable from changing "Paragraph Direction". >+ >+ To fix this, we split EditAction::SetWritingDirection into EditAction::SetTextWritingDirection and >+ EditAction::SetBaseWritingDirection, which emit inline and block text direction input events, respectively. >+ >+ Tests: fast/events/before-input-events-prevent-block-text-direction.html >+ fast/events/before-input-events-prevent-inline-text-direction.html >+ >+ * editing/CompositeEditCommand.cpp: >+ (WebCore::CompositeEditCommand::apply): >+ * editing/EditAction.cpp: >+ (WebCore::undoRedoLabel): >+ * editing/EditAction.h: >+ * editing/EditCommand.cpp: >+ (WebCore::inputTypeNameForEditingAction): >+ * editing/Editor.cpp: >+ (WebCore::inputEventDataForEditingStyleAndAction): >+ (WebCore::Editor::setBaseWritingDirection): >+ * editing/EditorCommand.cpp: >+ (WebCore::executeMakeTextWritingDirectionLeftToRight): >+ (WebCore::executeMakeTextWritingDirectionNatural): >+ (WebCore::executeMakeTextWritingDirectionRightToLeft): >+ > 2019-02-15 Philippe Normand <pnormand@igalia.com> > > [GStreamer] Simplify GObject class name check >diff --git a/Source/WebKitLegacy/win/ChangeLog b/Source/WebKitLegacy/win/ChangeLog >index c6688d18294ee59519c4fda9a644d9f39c6d61ae..11f833febdbd560124c0ca2aa2c3a0d15a85f738 100644 >--- a/Source/WebKitLegacy/win/ChangeLog >+++ b/Source/WebKitLegacy/win/ChangeLog >@@ -1,3 +1,14 @@ >+2019-02-15 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Input type "formatSetInlineTextDirection" is dispatched when changing paragraph-level text direction >+ https://bugs.webkit.org/show_bug.cgi?id=194703 >+ <rdar://problem/48111775> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebCoreSupport/WebEditorClient.cpp: >+ (undoNameForEditAction): >+ > 2019-02-10 Darin Adler <darin@apple.com> > > Replace more uses of String::format with StringConcatenate (mostly non-Apple platform-specific cases) >diff --git a/Source/WebCore/editing/CompositeEditCommand.cpp b/Source/WebCore/editing/CompositeEditCommand.cpp >index 91d8af180a4e311ac361b33baeb91c2400b11413..141af217896b405e17875d035871bf437318f36f 100644 >--- a/Source/WebCore/editing/CompositeEditCommand.cpp >+++ b/Source/WebCore/editing/CompositeEditCommand.cpp >@@ -342,7 +342,8 @@ void CompositeEditCommand::apply() > case EditAction::TypingInsertFinalComposition: > case EditAction::Paste: > case EditAction::DeleteByDrag: >- case EditAction::SetWritingDirection: >+ case EditAction::SetTextWritingDirection: >+ case EditAction::SetBaseWritingDirection: > case EditAction::Cut: > case EditAction::Unspecified: > case EditAction::Insert: >diff --git a/Source/WebCore/editing/EditAction.cpp b/Source/WebCore/editing/EditAction.cpp >index 31d216f1d041fef3ce3d4f4f61b1d823206de7da..d2d6fa1e04cad1055d161019454a71170b4b46f3 100644 >--- a/Source/WebCore/editing/EditAction.cpp >+++ b/Source/WebCore/editing/EditAction.cpp >@@ -74,7 +74,8 @@ String undoRedoLabel(EditAction editAction) > return WEB_UI_STRING_KEY("Center", "Center (Undo action name)", "Undo action name"); > case EditAction::Justify: > return WEB_UI_STRING_KEY("Justify", "Justify (Undo action name)", "Undo action name"); >- case EditAction::SetWritingDirection: >+ case EditAction::SetTextWritingDirection: >+ case EditAction::SetBaseWritingDirection: > return WEB_UI_STRING_KEY("Set Writing Direction", "Set Writing Direction (Undo action name)", "Undo action name"); > case EditAction::Subscript: > return WEB_UI_STRING_KEY("Subscript", "Subscript (Undo action name)", "Undo action name"); >diff --git a/Source/WebCore/editing/EditAction.h b/Source/WebCore/editing/EditAction.h >index 17e8be976c5c9cd383bf1f500fcd5691f36e81b9..aee379a6959b8fbb09136918ba9f113fd2795e0a 100644 >--- a/Source/WebCore/editing/EditAction.h >+++ b/Source/WebCore/editing/EditAction.h >@@ -54,7 +54,8 @@ enum class EditAction : uint8_t { > AlignRight, > Center, > Justify, >- SetWritingDirection, >+ SetTextWritingDirection, >+ SetBaseWritingDirection, > Subscript, > Superscript, > Underline, >diff --git a/Source/WebCore/editing/EditCommand.cpp b/Source/WebCore/editing/EditCommand.cpp >index 34c79c9a7d99a58ab030e93833b845cba8132e40..de0d2c8278cb11782ebe6c295f2de3da250ce8f9 100644 >--- a/Source/WebCore/editing/EditCommand.cpp >+++ b/Source/WebCore/editing/EditCommand.cpp >@@ -110,8 +110,10 @@ String inputTypeNameForEditingAction(EditAction action) > return "formatIndent"_s; > case EditAction::Outdent: > return "formatOutdent"_s; >- case EditAction::SetWritingDirection: >+ case EditAction::SetTextWritingDirection: > return "formatSetInlineTextDirection"_s; >+ case EditAction::SetBaseWritingDirection: >+ return "formatSetBlockTextDirection"_s; > default: > return emptyString(); > } >diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp >index df190e5d396cb9677c9c4d3087aacc3827ea32bb..69f429f911760073f20b07bafbfe398d35316bb7 100644 >--- a/Source/WebCore/editing/Editor.cpp >+++ b/Source/WebCore/editing/Editor.cpp >@@ -153,7 +153,8 @@ static String inputEventDataForEditingStyleAndAction(const StyleProperties* styl > switch (action) { > case EditAction::SetColor: > return style->getPropertyValue(CSSPropertyColor); >- case EditAction::SetWritingDirection: >+ case EditAction::SetTextWritingDirection: >+ case EditAction::SetBaseWritingDirection: > return style->getPropertyValue(CSSPropertyDirection); > default: > return { }; >@@ -1796,7 +1797,7 @@ void Editor::setBaseWritingDirection(WritingDirection direction) > > auto& focusedFormElement = downcast<HTMLTextFormControlElement>(*focusedElement); > auto directionValue = direction == WritingDirection::LeftToRight ? "ltr" : "rtl"; >- auto writingDirectionInputTypeName = inputTypeNameForEditingAction(EditAction::SetWritingDirection); >+ auto writingDirectionInputTypeName = inputTypeNameForEditingAction(EditAction::SetBaseWritingDirection); > if (!dispatchBeforeInputEvent(focusedFormElement, writingDirectionInputTypeName, directionValue)) > return; > >@@ -1808,7 +1809,7 @@ void Editor::setBaseWritingDirection(WritingDirection direction) > > auto style = MutableStyleProperties::create(); > style->setProperty(CSSPropertyDirection, direction == WritingDirection::LeftToRight ? "ltr" : direction == WritingDirection::RightToLeft ? "rtl" : "inherit", false); >- applyParagraphStyleToSelection(style.ptr(), EditAction::SetWritingDirection); >+ applyParagraphStyleToSelection(style.ptr(), EditAction::SetBaseWritingDirection); > } > > WritingDirection Editor::baseWritingDirectionForSelectionStart() const >diff --git a/Source/WebCore/editing/EditorCommand.cpp b/Source/WebCore/editing/EditorCommand.cpp >index 9494709dc6f159c08172b6bfcb22873165d46525..c8cf3d677d136357c4e26729408e1682cd39d7a6 100644 >--- a/Source/WebCore/editing/EditorCommand.cpp >+++ b/Source/WebCore/editing/EditorCommand.cpp >@@ -585,7 +585,7 @@ static bool executeMakeTextWritingDirectionLeftToRight(Frame& frame, Event*, Edi > auto style = MutableStyleProperties::create(); > style->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed); > style->setProperty(CSSPropertyDirection, CSSValueLtr); >- frame.editor().applyStyle(style.ptr(), EditAction::SetWritingDirection); >+ frame.editor().applyStyle(style.ptr(), EditAction::SetTextWritingDirection); > return true; > } > >@@ -593,7 +593,7 @@ static bool executeMakeTextWritingDirectionNatural(Frame& frame, Event*, EditorC > { > auto style = MutableStyleProperties::create(); > style->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal); >- frame.editor().applyStyle(style.ptr(), EditAction::SetWritingDirection); >+ frame.editor().applyStyle(style.ptr(), EditAction::SetTextWritingDirection); > return true; > } > >@@ -602,7 +602,7 @@ static bool executeMakeTextWritingDirectionRightToLeft(Frame& frame, Event*, Edi > auto style = MutableStyleProperties::create(); > style->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed); > style->setProperty(CSSPropertyDirection, CSSValueRtl); >- frame.editor().applyStyle(style.ptr(), EditAction::SetWritingDirection); >+ frame.editor().applyStyle(style.ptr(), EditAction::SetTextWritingDirection); > return true; > } > >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp b/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp >index 2e7ea5819432ad557caf788fd139674b1b67417f..83327cc703b26fa850c0e7844a4487072d548017 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp >@@ -594,7 +594,9 @@ static String undoNameForEditAction(EditAction editAction) > case EditAction::AlignRight: return WEB_UI_STRING_KEY("Align Right", "Align Right (Undo action name)", "Undo action name"); > case EditAction::Center: return WEB_UI_STRING_KEY("Center", "Center (Undo action name)", "Undo action name"); > case EditAction::Justify: return WEB_UI_STRING_KEY("Justify", "Justify (Undo action name)", "Undo action name"); >- case EditAction::SetWritingDirection: return WEB_UI_STRING_KEY("Set Writing Direction", "Set Writing Direction (Undo action name)", "Undo action name"); >+ case EditAction::SetTextWritingDirection: >+ case EditAction::SetBaseWritingDirection: >+ return WEB_UI_STRING_KEY("Set Writing Direction", "Set Writing Direction (Undo action name)", "Undo action name"); > case EditAction::Subscript: return WEB_UI_STRING_KEY("Subscript", "Subscript (Undo action name)", "Undo action name"); > case EditAction::Superscript: return WEB_UI_STRING_KEY("Superscript", "Superscript (Undo action name)", "Undo action name"); > case EditAction::Bold: return WEB_UI_STRING_KEY("Bold", "Bold (Undo action name)", "Undo action name"); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 1af7989c41f7d17cd88860056567e07ede7e4178..0593b646871769bf16feb781e0ff8007f2ab27f8 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,24 @@ >+2019-02-15 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Input type "formatSetInlineTextDirection" is dispatched when changing paragraph-level text direction >+ https://bugs.webkit.org/show_bug.cgi?id=194703 >+ <rdar://problem/48111775> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Rebaseline some existing tests to expect input events of type "formatSetBlockTextDirection" instead of >+ "formatSetInlineTextDirection" when changing paragraph text direction; additionally, add a new layout test that >+ changes the inline text direction in some Bidi text, and verify that "formatSetInlineTextDirection" is emitted >+ in this scenario, and that calling `preventDefault()` in the beforeinput event handler causes no change to be >+ made. >+ >+ * editing/input/ios/rtl-keyboard-input-on-focus-expected.txt: >+ * fast/events/before-input-events-prevent-block-text-direction-expected.txt: Added. >+ * fast/events/before-input-events-prevent-block-text-direction.html: Renamed from LayoutTests/fast/events/before-input-events-prevent-text-direction.html. >+ * fast/events/before-input-events-prevent-inline-text-direction-expected.txt: Added. >+ * fast/events/before-input-events-prevent-inline-text-direction.html: Added. >+ * fast/events/before-input-events-prevent-text-direction-expected.txt: Removed. >+ > 2019-02-14 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r241497. >diff --git a/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt b/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt >index 30b1950e5de6d289369936199617c46b6acae6fc..fdc5538bdce7bf2a8597ed27d29ead89676e89a2 100644 >--- a/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt >+++ b/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt >@@ -14,24 +14,24 @@ Using English keyboard: > > Observed 'beforeinput' events: [ > { >- "inputType": "formatSetInlineTextDirection", >+ "inputType": "formatSetBlockTextDirection", > "data": "rtl", > "order": 1 > }, > { >- "inputType": "formatSetInlineTextDirection", >+ "inputType": "formatSetBlockTextDirection", > "data": "ltr", > "order": 3 > } > ] > Observed 'input' events: [ > { >- "inputType": "formatSetInlineTextDirection", >+ "inputType": "formatSetBlockTextDirection", > "data": "rtl", > "order": 2 > }, > { >- "inputType": "formatSetInlineTextDirection", >+ "inputType": "formatSetBlockTextDirection", > "data": "ltr", > "order": 4 > } >diff --git a/LayoutTests/fast/events/before-input-events-prevent-block-text-direction-expected.txt b/LayoutTests/fast/events/before-input-events-prevent-block-text-direction-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..eb9e5736192b46327304c7470bd818469d108b66 >--- /dev/null >+++ b/LayoutTests/fast/events/before-input-events-prevent-block-text-direction-expected.txt >@@ -0,0 +1,17 @@ >+Hello world >+ >+*** TESTING RICH TEXT *** >+Initial text direction: "rtl" >+Fired onbeforeinput event of inputType 'formatSetBlockTextDirection' with data: 'ltr' >+Text direction after setting to LTR while preventing default: "rtl" >+Fired onbeforeinput event of inputType 'formatSetBlockTextDirection' with data: 'ltr' >+Fired input event of inputType 'formatSetBlockTextDirection' with data: 'ltr' >+Text direction after setting to LTR without preventing default: "ltr" >+*** TESTING PLAIN TEXT *** >+Initial text direction: "rtl" >+Fired onbeforeinput event of inputType 'formatSetBlockTextDirection' with data: 'ltr' >+Text direction after setting to LTR while preventing default: "rtl" >+Fired onbeforeinput event of inputType 'formatSetBlockTextDirection' with data: 'ltr' >+Fired input event of inputType 'formatSetBlockTextDirection' with data: 'ltr' >+Text direction after setting to LTR without preventing default: "ltr" >+ >diff --git a/LayoutTests/fast/events/before-input-events-prevent-block-text-direction.html b/LayoutTests/fast/events/before-input-events-prevent-block-text-direction.html >new file mode 100644 >index 0000000000000000000000000000000000000000..735a4485fc7ec4c9119b2c4c0ea8c67add7d558a >--- /dev/null >+++ b/LayoutTests/fast/events/before-input-events-prevent-block-text-direction.html >@@ -0,0 +1,69 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <style> >+ #editor { >+ direction: rtl; >+ border: 1px blue dashed; >+ } >+ </style> >+</head> >+ >+<body> >+ <div id="editor" contenteditable oninput=handleInputEvent(event) onbeforeinput=handleBeforeInputEvent(event)> >+ <div id="content">Hello world</div> >+ </div> >+ <input type="text" id="textfield" value="hi" dir="rtl" oninput=handleInputEvent(event) onbeforeinput=handleBeforeInputEvent(event)></input> >+ <div id="output"></div> >+ <script> >+ let write = s => output.innerHTML += `${s}<br>`; >+ (function() >+ { >+ window.shouldPreventDefault = true; >+ if (!window.eventSender || !window.internals || !window.testRunner) { >+ write("To test manually, try to change the text direction to ltr. This should be prevented."); >+ return; >+ } >+ >+ internals.settings.setInputEventsEnabled(true); >+ testRunner.dumpAsText(); >+ editor.focus(); >+ write("*** TESTING RICH TEXT ***"); >+ write(`Initial text direction: "${getComputedStyle(content).direction}"`); >+ >+ internals.setBaseWritingDirection("Ltr"); >+ write(`Text direction after setting to LTR while preventing default: "${getComputedStyle(content).direction}"`); >+ >+ window.shouldPreventDefault = false; >+ >+ internals.setBaseWritingDirection("Ltr"); >+ write(`Text direction after setting to LTR without preventing default: "${getComputedStyle(content).direction}"`); >+ >+ window.shouldPreventDefault = true; >+ textfield.focus(); >+ write("*** TESTING PLAIN TEXT ***"); >+ write(`Initial text direction: "${textfield.getAttribute("dir")}"`); >+ >+ internals.setBaseWritingDirection("Ltr"); >+ write(`Text direction after setting to LTR while preventing default: "${textfield.getAttribute("dir")}"`); >+ >+ window.shouldPreventDefault = false; >+ >+ internals.setBaseWritingDirection("Ltr"); >+ write(`Text direction after setting to LTR without preventing default: "${textfield.getAttribute("dir")}"`); >+ })(); >+ >+ function handleInputEvent(event) >+ { >+ write(`Fired input event of inputType '${event.inputType}' with data: '${event.data}'`); >+ } >+ >+ function handleBeforeInputEvent(event) >+ { >+ write(`Fired onbeforeinput event of inputType '${event.inputType}' with data: '${event.data}'`); >+ if (window.shouldPreventDefault) >+ event.preventDefault(); >+ } >+ </script> >+</body> >+</html> >diff --git a/LayoutTests/fast/events/before-input-events-prevent-inline-text-direction-expected.txt b/LayoutTests/fast/events/before-input-events-prevent-inline-text-direction-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8f996dd195c758af1ba0a6bdbfbcd508b490b318 >--- /dev/null >+++ b/LayoutTests/fast/events/before-input-events-prevent-inline-text-direction-expected.txt >@@ -0,0 +1,34 @@ >+Verifies that changing the text writing direction fires input events which may be prevented. To manually test, select '××§×ר' in the top contenteditable and change the selection direction to 'left to right'; then, select the same word in the prevented contenteditable and change selection direction to 'left to right'. Check that the bottom editable area's contents did not change. >+ >+beforeinput, formatSetInlineTextDirection, ltr on #notPrevented: >+| "Hello <#selection-anchor>××§×ר<#selection-focus> ××©× ×¢×ר×ת world" >+ >+input, formatSetInlineTextDirection, ltr on #notPrevented: >+| "Hello " >+| <span> >+| style="unicode-bidi: embed;" >+| "<#selection-anchor>××§×ר<#selection-focus>" >+| " ××©× ×¢×ר×ת world" >+ >+beforeinput, formatSetInlineTextDirection, rtl on #notPrevented: >+| "Hello " >+| <span> >+| style="unicode-bidi: embed;" >+| "××§×ר" >+| " ××©× ×¢×ר×ת <#selection-anchor>world<#selection-focus>" >+ >+input, formatSetInlineTextDirection, rtl on #notPrevented: >+| "Hello " >+| <span> >+| style="unicode-bidi: embed;" >+| "××§×ר" >+| " ××©× ×¢×ר×ת " >+| <span> >+| style="unicode-bidi: embed; direction: rtl;" >+| "<#selection-anchor>world<#selection-focus>" >+ >+beforeinput, formatSetInlineTextDirection, ltr on #prevented: >+| "Hello <#selection-anchor>××§×ר<#selection-focus> ××©× ×¢×ר×ת world" >+ >+beforeinput, formatSetInlineTextDirection, rtl on #prevented: >+| "Hello ××§×ר ××©× ×¢×ר×ת <#selection-anchor>world<#selection-focus>" >diff --git a/LayoutTests/fast/events/before-input-events-prevent-inline-text-direction.html b/LayoutTests/fast/events/before-input-events-prevent-inline-text-direction.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c536f0de79d5789c6a3cadac64f6efe5accea43b >--- /dev/null >+++ b/LayoutTests/fast/events/before-input-events-prevent-inline-text-direction.html >@@ -0,0 +1,49 @@ >+<!DOCTYPE html> >+<meta charset="utf8"> >+<html> >+<head> >+ <script src="../../resources/dump-as-markup.js"></script> >+ <style> >+ #editor { >+ border: 1px blue dashed; >+ } >+ </style> >+ <script> >+ const dumpMarkupOnInput = e => Markup.dump(e.target, `${e.type}, ${e.inputType}, ${e.data} on #${e.target.id}`); >+ >+ Markup.description("Verifies that changing the text writing direction fires input events which may be prevented. To manually test, select '××§×ר' in the top contenteditable and change the selection direction to 'left to right'; then, select the same word in the prevented contenteditable and change selection direction to 'left to right'. Check that the bottom editable area's contents did not change."); >+ Markup.noAutoDump(); >+ >+ addEventListener("load", () => { >+ const notPrevented = document.querySelector("#notPrevented"); >+ const prevented = document.querySelector("#prevented"); >+ >+ notPrevented.addEventListener("input", dumpMarkupOnInput); >+ notPrevented.addEventListener("beforeinput", dumpMarkupOnInput); >+ prevented.addEventListener("input", dumpMarkupOnInput); >+ prevented.addEventListener("beforeinput", event => { >+ dumpMarkupOnInput(event); >+ event.preventDefault(); >+ }); >+ >+ getSelection().setBaseAndExtent(notPrevented.firstChild, 6, notPrevented.firstChild, 10); >+ if (!window.testRunner) >+ return; >+ testRunner.execCommand("MakeTextWritingDirectionLeftToRight"); >+ getSelection().setBaseAndExtent(notPrevented.lastChild, 11, notPrevented.lastChild, 16); >+ testRunner.execCommand("MakeTextWritingDirectionRightToLeft"); >+ >+ getSelection().setBaseAndExtent(prevented.firstChild, 6, prevented.firstChild, 10); >+ testRunner.execCommand("MakeTextWritingDirectionLeftToRight"); >+ getSelection().setBaseAndExtent(prevented.lastChild, 21, prevented.lastChild, 26); >+ testRunner.execCommand("MakeTextWritingDirectionRightToLeft"); >+ >+ Markup.notifyDone(); >+ }); >+ </script> >+</head> >+<body> >+ <div contenteditable id="notPrevented">Hello ××§×ר ××©× ×¢×ר×ת world</div> >+ <div contenteditable id="prevented">Hello ××§×ר ××©× ×¢×ר×ת world</div> >+</body> >+</html> >diff --git a/LayoutTests/fast/events/before-input-events-prevent-text-direction-expected.txt b/LayoutTests/fast/events/before-input-events-prevent-text-direction-expected.txt >deleted file mode 100644 >index 3620d7f8ef4302cceb6c30bd0bd4fcd28485ed62..0000000000000000000000000000000000000000 >--- a/LayoutTests/fast/events/before-input-events-prevent-text-direction-expected.txt >+++ /dev/null >@@ -1,17 +0,0 @@ >-Hello world >- >-*** TESTING RICH TEXT *** >-Initial text direction: "rtl" >-Fired onbeforeinput event of inputType 'formatSetInlineTextDirection' with data: 'ltr' >-Text direction after setting to LTR while preventing default: "rtl" >-Fired onbeforeinput event of inputType 'formatSetInlineTextDirection' with data: 'ltr' >-Fired input event of inputType 'formatSetInlineTextDirection' with data: 'ltr' >-Text direction after setting to LTR without preventing default: "ltr" >-*** TESTING PLAIN TEXT *** >-Initial text direction: "rtl" >-Fired onbeforeinput event of inputType 'formatSetInlineTextDirection' with data: 'ltr' >-Text direction after setting to LTR while preventing default: "rtl" >-Fired onbeforeinput event of inputType 'formatSetInlineTextDirection' with data: 'ltr' >-Fired input event of inputType 'formatSetInlineTextDirection' with data: 'ltr' >-Text direction after setting to LTR without preventing default: "ltr" >- >diff --git a/LayoutTests/fast/events/before-input-events-prevent-text-direction.html b/LayoutTests/fast/events/before-input-events-prevent-text-direction.html >deleted file mode 100644 >index 735a4485fc7ec4c9119b2c4c0ea8c67add7d558a..0000000000000000000000000000000000000000 >--- a/LayoutTests/fast/events/before-input-events-prevent-text-direction.html >+++ /dev/null >@@ -1,69 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <style> >- #editor { >- direction: rtl; >- border: 1px blue dashed; >- } >- </style> >-</head> >- >-<body> >- <div id="editor" contenteditable oninput=handleInputEvent(event) onbeforeinput=handleBeforeInputEvent(event)> >- <div id="content">Hello world</div> >- </div> >- <input type="text" id="textfield" value="hi" dir="rtl" oninput=handleInputEvent(event) onbeforeinput=handleBeforeInputEvent(event)></input> >- <div id="output"></div> >- <script> >- let write = s => output.innerHTML += `${s}<br>`; >- (function() >- { >- window.shouldPreventDefault = true; >- if (!window.eventSender || !window.internals || !window.testRunner) { >- write("To test manually, try to change the text direction to ltr. This should be prevented."); >- return; >- } >- >- internals.settings.setInputEventsEnabled(true); >- testRunner.dumpAsText(); >- editor.focus(); >- write("*** TESTING RICH TEXT ***"); >- write(`Initial text direction: "${getComputedStyle(content).direction}"`); >- >- internals.setBaseWritingDirection("Ltr"); >- write(`Text direction after setting to LTR while preventing default: "${getComputedStyle(content).direction}"`); >- >- window.shouldPreventDefault = false; >- >- internals.setBaseWritingDirection("Ltr"); >- write(`Text direction after setting to LTR without preventing default: "${getComputedStyle(content).direction}"`); >- >- window.shouldPreventDefault = true; >- textfield.focus(); >- write("*** TESTING PLAIN TEXT ***"); >- write(`Initial text direction: "${textfield.getAttribute("dir")}"`); >- >- internals.setBaseWritingDirection("Ltr"); >- write(`Text direction after setting to LTR while preventing default: "${textfield.getAttribute("dir")}"`); >- >- window.shouldPreventDefault = false; >- >- internals.setBaseWritingDirection("Ltr"); >- write(`Text direction after setting to LTR without preventing default: "${textfield.getAttribute("dir")}"`); >- })(); >- >- function handleInputEvent(event) >- { >- write(`Fired input event of inputType '${event.inputType}' with data: '${event.data}'`); >- } >- >- function handleBeforeInputEvent(event) >- { >- write(`Fired onbeforeinput event of inputType '${event.inputType}' with data: '${event.data}'`); >- if (window.shouldPreventDefault) >- event.preventDefault(); >- } >- </script> >-</body> >-</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
rniwa
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194703
: 362205 |
362723