Bug 1685491 - part 4: Make typing-around-link-element-at-collapsed-selection.tentative.html use `Meta` + `ArrowLeft`/`ArrowRight` instead of unmodified `Home`/`End` on macOS r=smaug

On macOS, `Home` and `End` just scroll the scrollable element (i.e., not moving
caret position), `ArrowLeft` and `ArrowRight` with `Meta` (command key) work as
same as the other platforms.  So, this patch fixes some WPT too.  This may help
failures on Safari too.

Differential Revision: https://phabricator.services.mozilla.com/D102880
This commit is contained in:
Masayuki Nakano 2021-02-02 03:03:13 +00:00
Родитель 3210cefe0a
Коммит 43829b77b8
2 изменённых файлов: 10 добавлений и 21 удалений

Просмотреть файл

@ -211,25 +211,6 @@
[Inserting "XY" after making a link in <b> (following Home key press) in <p><b>[abc\]</b></p>]
expected: FAIL
[typing-around-link-element-at-collapsed-selection.tentative.html?target=DesignMode]
[Inserting "XY" after making a link (following End key press) in <p>[abc\]</p>]
expected:
if os == "mac": FAIL
[Inserting "XY" after making a link (following Home key press) in <p>[abc\]</p>]
expected:
if os == "mac": FAIL
[typing-around-link-element-at-collapsed-selection.tentative.html?target=ContentEditable]
[Inserting "XY" after making a link (following End key press) in <p>[abc\]</p>]
expected:
if os == "mac": FAIL
[Inserting "XY" after making a link (following Home key press) in <p>[abc\]</p>]
expected:
if os == "mac": FAIL
[typing-around-link-element-at-collapsed-selection.tentative.html?target=ContentEditable&child=b]
[Inserting "XY" after setting caret position to start of a link containing <b> (Selection.collapse) in <p><a href="about:blank"><b>ab[\]c</b></a></p>]

Просмотреть файл

@ -151,7 +151,11 @@ if (kChildTag[0] === "") {
innerHTML: `<p>${kParentTag[0]}[abc]${kParentTag[1]}</p>`,
run: async (utils) => {
utils.document.execCommand("createLink", false, "about:blank");
await utils.sendEndKey();
if (!navigator.platform.includes("Mac")) {
await utils.sendEndKey();
} else {
await utils.sendArrowRightKey(utils.kMetaKey);
}
await utils.sendKey("X", utils.kShiftKey);
await utils.sendKey("Y", utils.kShiftKey);
},
@ -196,7 +200,11 @@ if (kChildTag[0] === "") {
innerHTML: `<p>${kParentTag[0]}[abc]${kParentTag[1]}</p>`,
run: async (utils) => {
utils.document.execCommand("createLink", false, "about:blank");
await utils.sendHomeKey();
if (!navigator.platform.includes("Mac")) {
await utils.sendHomeKey();
} else {
await utils.sendArrowLeftKey(utils.kMetaKey);
}
await utils.sendKey("X", utils.kShiftKey);
await utils.sendKey("Y", utils.kShiftKey);
},