WebKit Bugzilla
Attachment 362723 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 for landing
bug-194703-20190222083203.patch (text/plain), 26.94 KB, created by
Wenson Hsieh
on 2019-02-22 08:32:03 PST
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-02-22 08:32:03 PST
Size:
26.94 KB
patch
obsolete
>Subversion Revision: 241930 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 5ac8e2e4ce235e295358e9445ac3a744fd632456..d2ec3ef3c8df77f1f9189468863370806c2a632b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,37 @@ >+2019-02-22 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 Ryosuke Niwa. >+ >+ 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::SetInlineWritingDirection and >+ EditAction::SetBlockWritingDirection, 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-21 Daniel Bates <dabates@apple.com> > > Same Site Lax cookies are not sent with cross-site redirect from client-initiated load >diff --git a/Source/WebKitLegacy/win/ChangeLog b/Source/WebKitLegacy/win/ChangeLog >index 3b78c276680c2a956e3b56c9c64fc573dbd938f7..9ad822766715a7781d255b3e66ed802252d51617 100644 >--- a/Source/WebKitLegacy/win/ChangeLog >+++ b/Source/WebKitLegacy/win/ChangeLog >@@ -1,3 +1,14 @@ >+2019-02-22 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 Ryosuke Niwa. >+ >+ * WebCoreSupport/WebEditorClient.cpp: >+ (undoNameForEditAction): >+ > 2019-02-18 Wenson Hsieh <wenson_hsieh@apple.com> > > [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements >diff --git a/Source/WebCore/editing/CompositeEditCommand.cpp b/Source/WebCore/editing/CompositeEditCommand.cpp >index 91d8af180a4e311ac361b33baeb91c2400b11413..70e8ecee49f34f36ed20845032ef2ba9333c8c3d 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::SetInlineWritingDirection: >+ case EditAction::SetBlockWritingDirection: > 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..733b429518675f65dda671a8a1af8cf35c47b79c 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::SetInlineWritingDirection: >+ case EditAction::SetBlockWritingDirection: > 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..122bb4d8ca8d6bed76aa78209119b4b6a6a3e825 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, >+ SetInlineWritingDirection, >+ SetBlockWritingDirection, > Subscript, > Superscript, > Underline, >diff --git a/Source/WebCore/editing/EditCommand.cpp b/Source/WebCore/editing/EditCommand.cpp >index 34c79c9a7d99a58ab030e93833b845cba8132e40..2befe1fde49d81b60a026ebb39d93ff05142f2c0 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::SetInlineWritingDirection: > return "formatSetInlineTextDirection"_s; >+ case EditAction::SetBlockWritingDirection: >+ return "formatSetBlockTextDirection"_s; > default: > return emptyString(); > } >diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp >index 937e74471595d4fa43059f48deb90621c229d7f8..0a33f9590f8e61a3e7cc90f913f9f60c417f1d30 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::SetInlineWritingDirection: >+ case EditAction::SetBlockWritingDirection: > return style->getPropertyValue(CSSPropertyDirection); > default: > return { }; >@@ -1803,7 +1804,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::SetBlockWritingDirection); > if (!dispatchBeforeInputEvent(focusedFormElement, writingDirectionInputTypeName, directionValue)) > return; > >@@ -1815,7 +1816,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::SetBlockWritingDirection); > } > > WritingDirection Editor::baseWritingDirectionForSelectionStart() const >diff --git a/Source/WebCore/editing/EditorCommand.cpp b/Source/WebCore/editing/EditorCommand.cpp >index b460b94be6ef06c6e557309616921d80654f1515..82163e678202782d2c120cafa3c78b2d5bb08375 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::SetInlineWritingDirection); > 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::SetInlineWritingDirection); > 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::SetInlineWritingDirection); > return true; > } > >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp b/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp >index 2e89d412ba4537643c5dd3ccca1bf1822ea002c6..aae1e000f8fac98e372294001c69c4c70ed53ff9 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp >@@ -588,7 +588,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::SetInlineWritingDirection: >+ case EditAction::SetBlockWritingDirection: >+ 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 98fcb600fc47fe78de6333d96e879df552ab9795..019fa0305b9ffdf6c67b380095cec552d449c30b 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,24 @@ >+2019-02-22 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 Ryosuke Niwa. >+ >+ 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-21 Daniel Bates <dabates@apple.com> > > Same Site Lax cookies are not sent with cross-site redirect from client-initiated load >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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194703
:
362205
| 362723