[webkit-changes] [WebKit/WebKit] 03472c: `document.execCommand("copy")` only triggers if th...

Tim Nguyen noreply at github.com
Tue Jan 7 12:47:53 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 03472c5b0900124d973e7e31c74d60864ec9224b
      https://github.com/WebKit/WebKit/commit/03472c5b0900124d973e7e31c74d60864ec9224b
  Author: Tim Nguyen <ntim at apple.com>
  Date:   2025-01-07 (Tue, 07 Jan 2025)

  Changed paths:
    M LayoutTests/editing/execCommand/enabling-and-selection-2-expected.txt
    M LayoutTests/editing/execCommand/enabling-and-selection-2.html
    M LayoutTests/editing/execCommand/enabling-and-selection-expected.txt
    M LayoutTests/editing/execCommand/enabling-and-selection.html
    A LayoutTests/editing/pasteboard/copy-text-from-uneditable-element-expected.txt
    A LayoutTests/editing/pasteboard/copy-text-from-uneditable-element.html
    M LayoutTests/editing/pasteboard/gtk/middle-click-onpaste-expected.txt
    M LayoutTests/editing/pasteboard/gtk/middle-click-onpaste.html
    M LayoutTests/imported/w3c/web-platform-tests/editing/other/exec-command-without-editable-element.tentative-expected.txt
    M LayoutTests/platform/gtk/imported/w3c/web-platform-tests/editing/other/exec-command-without-editable-element.tentative-expected.txt
    M LayoutTests/platform/wpe/imported/w3c/web-platform-tests/editing/other/exec-command-without-editable-element.tentative-expected.txt
    M Source/WebCore/editing/Editor.cpp
    M Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebViewEditor.cpp

  Log Message:
  -----------
  `document.execCommand("copy")` only triggers if there is a selection
https://bugs.webkit.org/show_bug.cgi?id=156529
rdar://27792460

Reviewed by Ryosuke Niwa.

Take the focused element as clipboard event target if context is not editable as specification mentions:
https://www.w3.org/TR/clipboard-apis/#fire-a-clipboard-event

To avoid regressing hire.apple.com when landing bug 284630, we also need to unconditionally allow copying from uneditable elements.

* LayoutTests/editing/execCommand/enabling-and-selection-2-expected.txt:
* LayoutTests/editing/execCommand/enabling-and-selection-2.html:
* LayoutTests/editing/execCommand/enabling-and-selection-expected.txt:
* LayoutTests/editing/execCommand/enabling-and-selection.html:
* LayoutTests/editing/pasteboard/copy-text-from-uneditable-element-expected.txt: Added.
* LayoutTests/editing/pasteboard/copy-text-from-uneditable-element.html: Added.
* LayoutTests/editing/pasteboard/gtk/middle-click-onpaste-expected.txt:
* LayoutTests/editing/pasteboard/gtk/middle-click-onpaste.html:
* LayoutTests/imported/w3c/web-platform-tests/editing/other/exec-command-without-editable-element.tentative-expected.txt:
* LayoutTests/platform/gtk/imported/w3c/web-platform-tests/editing/other/exec-command-without-editable-element.tentative-expected.txt:
* LayoutTests/platform/wpe/imported/w3c/web-platform-tests/editing/other/exec-command-without-editable-element.tentative-expected.txt:
* Source/WebCore/editing/Editor.cpp:
(WebCore::Editor::canCopy const):
(WebCore::Editor::findEventTargetFromSelection const):
* Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebViewEditor.cpp:
(testWebViewEditorCutCopyPasteNonEditable):

Canonical link: https://commits.webkit.org/288559@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list