Skip to content

script: Add Document selection copy/select all context menu options - #48101

Merged
mrobinson merged 1 commit into
servo:mainfrom
mrobinson:selection-copy
Sep 16, 2026
Merged

mrobinson merged 1 commit into
servo:mainfrom
mrobinson:selection-copy

Conversation

@mrobinson

Copy link
Copy Markdown
Member

This change adds initial Document selection integration with the
context menu so that the user can copy the selection to the clipboard or
select the entire Document contents. As part of this change a new
generic EditingContext struct is created to manage integration with
the various editing hosts. This will be used for keyboard shortcuts in
the future as well.

One small change is also made here: paste and cut are disabled for read
only form controls.

Finally, the context menu unit tests are cleaned up and expanded to more
easily add support for testing "select all." Currently there are no unit
tests for clipboard integration, so unfortunately there is no test for
this.

Testing: This change adds various embedder API unit tests.

@mrobinson
mrobinson requested a review from gterzian as a code owner September 15, 2026 12:56
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Sep 15, 2026
@mrobinson mrobinson mentioned this pull request Sep 15, 2026
25 of 40 tasks
@codecov-commenter

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@TimvdLippe

Copy link
Copy Markdown
Contributor

How does this relate to #48025 ?

@mrobinson

Copy link
Copy Markdown
Member Author

How does this relate to #48025 ?

This sits alongside #48025 (though perhaps it would be nice to harmonize how select all works before landing that one), but a followup to this will try to integrate all of the keyboard handling into the EditingContext struct created for this change.

@dzfrias

dzfrias commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Would definitely be nice to integrate the CTRL-A work with this. After checking out this PR, and particularly the implementation of select_all in document/editing.rs, it looks select_all by targets everything in the body element (when it exists) as opposed to the document. I think this differs from other browsers, which select everything in the document in every case.

For example:

<!doctype html>
<head>
  <style>
    /* This is selected in Chrome. */
    * {
      display: block;
    }
  </style>
</head>
<body bgcolor="white">
  <textarea>Nice</textarea>
  <p>Awesome</p>
</body>

@mrobinson

mrobinson commented Sep 15, 2026 •

Copy link
Copy Markdown
Member Author

I've taken Firefox's approach here (mostly) which is to target the body and then fall back to the document element.

  1. Create this file:
<!DOCTYPE html>
abcdef
  1. Open the file in Firefox
  2. Choose "Select All" from the context menu
  3. In the developer tools console run document.getSelection():
    Selection { anchorNode: body, anchorOffset: 0, focusNode: body, focusOffset: 1, isCollapsed: false, rangeCount: 1, type: "Range", direction: "forward", caretBidiLevel: 0 }

@dzfrias

dzfrias commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Ok, I see. When this lands then I will update my PR to use the logic introduced in this PR.

@mrobinson mrobinson added the T-linux-wpt Do a try run of the WPT label Sep 15, 2026
@github-actions github-actions Bot removed the T-linux-wpt Do a try run of the WPT label Sep 15, 2026
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#34988426097) for Linux (WPT)

@github-actions

Copy link
Copy Markdown

Test results for linux-wpt from try job (#34988426097):

Flaky unexpected result (30)
  • TIMEOUT [expected OK] /_webgl/conformance2/extensions/promoted-extensions.html
  • CRASH [expected OK] /_webgl/conformance2/uniforms/dependent-buffer-change.html
  • TIMEOUT [expected OK] /cookies/attributes/domain.sub.html
    • TIMEOUT [expected PASS] subtest: No host cookies returned for host cookies after non-host redirect 3

      Test timed out
      

  • TIMEOUT [expected PASS] /css/compositing/mix-blend-mode/mix-blend-mode-paragraph.html
  • OK /css/css-fonts/variations/at-font-face-font-matching.html (#20684)
    • FAIL [expected PASS] subtest: Matching font-weight: '501' should prefer '502 510' over '503 520'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

    • FAIL [expected PASS] subtest: Matching font-weight: '501' should prefer '503 520' over '500'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

    • FAIL [expected PASS] subtest: Matching font-stretch: '90%' should prefer '50% 80%' over '60% 70%'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

    • FAIL [expected PASS] subtest: Matching font-style: 'oblique 0deg' should prefer 'oblique 40deg 50deg' over 'oblique -50deg -20deg'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

    • FAIL [expected PASS] subtest: Matching font-style: 'oblique -20deg' should prefer 'oblique -20deg' over 'oblique -60deg -40deg'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

    • FAIL [expected PASS] subtest: Matching font-style: 'oblique -20deg' should prefer 'oblique 0deg' over 'oblique 30deg 60deg'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

  • CRASH [expected ERROR] /css/filter-effects/parsing/flood-opacity-invalid.svg
  • OK [expected ERROR] /css/selectors/invalidation/media-loading-pseudo-classes-in-has.sub.html
  • CRASH [expected OK] /dom/nodes/NodeList-static-length-getter-tampered-indexOf-2.html
  • OK [expected TIMEOUT] /fetch/api/redirect/redirect-keepalive.https.any.html (#32153)
    • PASS [expected TIMEOUT] subtest: [keepalive][iframe][load] mixed content redirect; setting up
  • TIMEOUT [expected OK] /fetch/content-encoding/zstd/big-zstd-body.https.any.worker.html
    • TIMEOUT [expected PASS] subtest: large zstd data should be decompressed successfully

      Test timed out
      

    • NOTRUN [expected FAIL] subtest: large zstd data should be decompressed successfully with byte stream
  • OK /html/browsers/browsing-the-web/navigating-across-documents/008.html (#24456)
    • PASS [expected FAIL] subtest: Link with onclick form submit to javascript url and href navigation
  • TIMEOUT [expected OK] /html/browsers/browsing-the-web/navigating-across-documents/cross-origin-top-navigation-with-user-activation-in-parent.window.html
    • TIMEOUT [expected FAIL] subtest: Cross-origin top navigation is blocked without user activation, even if the parent has user activation

      Test timed out
      

  • OK [expected TIMEOUT] /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/form-submit-button-click.html (#44099)
    • FAIL [expected TIMEOUT] subtest: Replace before load, triggered by submitButton.click()

      assert_equals: expected "http://web-platform.test:8000/common/blank.html?thereplacement=" but got "http://web-platform.test:8000/html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/resources/code-injector.html?pipe=sub(none)&amp;code=%0A%20%20%20%20const%20form%20%3D%20document.createElement(%22form%22)%3B%0A%20%20%20%20form.action%20%3D%20%22%2Fcommon%2Fblank.html%22%3B%0A%0A%20%20%20%20const%20input%20%3D%20document.createElement(%22input%22)%3B%0A%20%20%20%20input.type%20%3D%20%22hidden%22%3B%0A%20%20%20%20input.name%20%3D%20%22thereplacement%22%3B%0A%20%20%20%20form.append(input)%3B%0A%0A%20%20%20%20const%20button%20%3D%20document.createElement(%22button%22)%3B%0A%20%20%20%20button.type%20%3D%20%22submit%22%3B%0A%20%20%20%20form.append(button)%3B%0A%0A%20%20%20%20document.currentScript.before(form)%3B%0A%20%20%20%20button.click()%3B%0A%20%20"
      

  • OK [expected TIMEOUT] /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/form-submit.html (#44028)
  • TIMEOUT [expected ERROR] /html/browsers/history/the-location-interface/location_replace_session_history.html (#41896)
  • OK /html/semantics/embedded-content/media-elements/audio_loop_seek_to_eos.html (#41226)
    • FAIL [expected PASS] subtest: seeking to the end of looping audio

      promise_test: Unhandled rejection with value: object "TypeError: this argument is not a finite floating-point value"
      

  • CRASH [expected FAIL] /html/semantics/interestfor/interestfor-plain-inline-element.tentative.html
  • OK /html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.html (#47290)
    • PASS [expected FAIL] subtest: expect-no-linked-resources hint was ignored
  • TIMEOUT [expected OK] /html/user-activation/navigation-state-reset-sameorigin.html (#45151)
    • TIMEOUT [expected FAIL] subtest: Post-navigation state reset.

      Test timed out
      

  • OK /html/webappapis/dynamic-markup-insertion/document-write/iframe_005.html (#43671)
    • PASS [expected FAIL] subtest: document.write external script into iframe write back into parent
  • TIMEOUT [expected OK] /pointerevents/compat/pointerevent_touch-action_two-finger_interaction.html (#44693)
    • NOTRUN [expected PASS] subtest: touch two-finger pan on 'touch-action: pan-x pan-y'
    • NOTRUN [expected FAIL] subtest: touch two-finger pan on 'touch-action: pinch-zoom'
  • OK /pointerevents/compat/pointerevent_touch_target_after_pointerdown_target_removed.tentative.html (#42813)
    • PASS [expected FAIL] subtest: After a touchstart listener removes its target, touch events should be fired on the touchstart target even though an orphan and pointer events should be fired on the parent
    • PASS [expected FAIL] subtest: After a touchstart listener removes its target, touchmove event should be fired on the pointerdown target
  • OK /pointerevents/pointerevent_pointercapture_in_frame.html?touch (#45445)
    • FAIL [expected PASS] subtest: Test touchpointer capture in same-origin frame: Pointer down at inner frame and set pointer capture.

      assert_true: Timed out waiting for lostpointercapture expected true got false
      

    • FAIL [expected PASS] subtest: Test touchpointer capture in same-origin frame: Pointer down at inner frame and set pointer capture to outer frame should not capture.

      assert_array_equals: Received events: innerFrame received pointerdown,innerFrame received pointermove,innerFrame received pointerup,innerFrame received lostpointercapture lengths differ, expected array ["innerFrame received pointerdown", "innerFrame received pointermove", "innerFrame received pointerup"] length 3, got ["innerFrame received pointerdown", "innerFrame received pointermove", "innerFrame received pointerup", "innerFrame received lostpointercapture"] length 4
      

  • OK /sanitizer-api/sanitizer-inert-document.html (#45260)
    • PASS [expected FAIL] subtest: Test whether setHTML loads the image.
    • FAIL [expected PASS] subtest: Test whether setHTMLUnsafe loads the image.

      promise_test: Unhandled rejection with value: "The server observed a request. It shouldn't have."
      

  • OK /touch-events/single-tap-when-touchend-listener-use-sync-xhr.html (#41175)
    • PASS [expected FAIL] subtest: Click event should be fired when touchend opens synchronous XHR
  • OK /upgrade-insecure-requests/gen/sharedworker-module-data.meta/upgrade/xhr.https.html
    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects allowed for xhr to cross-http-downgrade origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'allowed'. expected "allowed" but got "blocked"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects allowed for xhr to cross-http-downgrade origin and no-redirect redirection from https context.

      assert_equals: The resource request should be 'allowed'. expected "allowed" but got "blocked"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects allowed for xhr to cross-https origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'allowed'. expected "allowed" but got "blocked"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects allowed for xhr to same-http-downgrade origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'allowed'. expected "allowed" but got "blocked"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects allowed for xhr to same-http-downgrade origin and no-redirect redirection from https context.

      assert_equals: The resource request should be 'allowed'. expected "allowed" but got "blocked"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects allowed for xhr to same-https origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'allowed'. expected "allowed" but got "blocked"
      

  • OK /webdriver/tests/classic/dismiss_alert/dismiss.py (#39098)
    • FAIL [expected PASS] subtest: test_dismiss_in_popup_window

      webdriver.error.TimeoutException: timeout (500): Timed out after 5.0 seconds with message: No new window was opened
      

  • CRASH [expected OK] /webstorage/storage_local_setitem_quotaexceedederr.window.html
  • CRASH [expected OK] /webstorage/storage_session_setitem_quotaexceedederr.window.html
  • OK /webxr/xrSession_features_deviceSupport.https.html (#24357)
    • FAIL [expected PASS] subtest: Immersive XRSession requests with no supported device should reject

      assert_unreached: Should have rejected: undefined Reached unreachable code
      

Stable unexpected results that are known to be intermittent (14)
  • TIMEOUT [expected OK] /_mozilla/mozilla/window-resize-event.html (#36741)
    • TIMEOUT [expected PASS] subtest: Popup onresize event fires after resizeTo

      Test timed out
      

  • OK /beacon/beacon-basic.https.window.html (#41723)
    • FAIL [expected PASS] subtest: Payload size restriction should be accumulated: type = string

      assert_false: expected false got true
      

    • FAIL [expected PASS] subtest: Payload size restriction should be accumulated: type = arraybuffer

      assert_false: expected false got true
      

    • FAIL [expected PASS] subtest: Payload size restriction should be accumulated: type = blob

      assert_false: expected false got true
      

  • TIMEOUT /fetch/metadata/generated/css-images.sub.tentative.html (#29047)
    • PASS [expected FAIL] subtest: content sec-fetch-site - HTTPS downgrade-upgrade
  • OK /html/browsers/browsing-the-web/navigating-across-documents/005.html (#27062)
    • PASS [expected FAIL] subtest: Link with onclick navigation and href navigation
  • OK /html/semantics/embedded-content/media-elements/media_fragment_seek.html (#24114)
    • PASS [expected FAIL] subtest: Video should seek to time specified in media fragment syntax
  • OK [expected TIMEOUT] /html/semantics/embedded-content/media-elements/src_object_blob.html (#40340)
    • PASS [expected TIMEOUT] subtest: HTMLMediaElement.srcObject blob
  • OK [expected CRASH] /html/semantics/scripting-1/the-script-element/module/choice-of-error-1.html (#44058)
    • FAIL [expected PASS] subtest: Parse errors in different files should be reported depending on different roots

      assert_not_equals: two different parse errors should be reported got disallowed value object "SyntaxError: expected expression, got '%'"
      

  • OK /infrastructure/testdriver/click_window.html (#47303)
    • PASS [expected FAIL] subtest: TestDriver click method in window
  • OK /pointerevents/pointerevent_pointercapture_in_frame.html?pen (#45536)
    • PASS [expected FAIL] subtest: Test penpointer capture in same-origin frame: Pointer down at inner frame and set pointer capture.
    • PASS [expected FAIL] subtest: Test penpointer capture in same-origin frame: Pointer down at inner frame and set pointer capture to outer frame should not capture.
  • OK /preload/prefetch-document.html (#37210)
    • PASS [expected FAIL] subtest: different-site document prefetch with 'as=document' should not be consumed
  • OK /resource-timing/test_resource_timing.html (#25720)
    • PASS [expected FAIL] subtest: PerformanceEntry has correct name, initiatorType, startTime, and duration (img)
  • OK [expected TIMEOUT] /trusted-types/trusted-types-navigation.html?06-10 (#37920)
    • PASS [expected TIMEOUT] subtest: Navigate a frame via anchor with javascript:-urls in report-only mode.
    • PASS [expected NOTRUN] subtest: Navigate a frame via anchor with javascript:-urls w/ default policy in report-only mode.
    • FAIL [expected NOTRUN] subtest: Navigate a window via anchor with javascript:-urls w/ a default policy throwing an exception in enforcing mode.

      promise_test: Unhandled rejection with value: "Unexpected message received: \"No securitypolicyviolation reported!\""
      

    • FAIL [expected NOTRUN] subtest: Navigate a window via anchor with javascript:-urls w/ a default policy throwing an exception in report-only mode.

      promise_test: Unhandled rejection with value: "Unexpected message received: \"No securitypolicyviolation reported!\""
      

  • TIMEOUT [expected OK] /trusted-types/trusted-types-navigation.html?26-30 (#38807)
    • TIMEOUT [expected PASS] subtest: Navigate a window via form-submission with javascript:-urls in report-only mode.

      Test timed out
      

    • NOTRUN [expected PASS] subtest: Navigate a window via form-submission with javascript:-urls w/ default policy in report-only mode.
    • NOTRUN [expected PASS] subtest: Navigate a frame via form-submission with javascript:-urls in enforcing mode.
    • NOTRUN [expected PASS] subtest: Navigate a frame via form-submission with javascript:-urls w/ default policy in enforcing mode.
  • OK /visual-viewport/resize-event-order.html (#41981)
    • FAIL [expected PASS] subtest: Popup: DOMWindow resize fired before VisualViewport.

      assert_equals: expected "window-attribute,window-addEventListener,visualViewport-attribute,visualViewport-addEventListener" but got ""
      

@github-actions

Copy link
Copy Markdown

✨ Try run (#34988426097) succeeded.

Comment on lines +34 to +44
if let Ok(editing_context) = EditingContext::try_from(node) {
return editing_context;
}

let mut current_node = UnrootedDom::from_ref(node, no_gc);
while let Some(parent) = current_node.parent_in_flat_tree(no_gc).into_parent() {
if let Ok(editing_context) = EditingContext::try_from(&**parent) {
return editing_context;
}
current_node = parent;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(A thought in passing, but I recommend no change: it would be possible to deduplicate the two if lets by changing while let to loop and moving the parent lookup to the end of the loop. But it’s not that much duplication and the loop is arguably uglier.)

Comment on lines +453 to +410
pub(crate) fn selection_text(&self) -> Option<String> {
pub(crate) fn selection(&self) -> Option<String> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this rename? An unqualified selection method sounds like it might return a range or a Selection object. If this is anticipating text/html selections that can contain more than text, maybe selection_content?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the idea is that eventually this will return other types of data such as rich text and it will set all of the types onto the clipboard (or at least advertise them and then later read them). I think that selection_content is fine as a name, so I've made that rename.

}
}

pub(crate) fn selection(&self, cx: &mut JSContext) -> Option<String> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as in text_input.rs re: naming of this method

Comment thread components/servo/tests/context_menu.rs Outdated
Comment on lines +156 to +159
<div><img src=\"https://servo.org/img.png\" style=\"width: 50px; height: 50px;\"></div> \
<div style=\"width: 50px; height: 50px;\"><input type=\"text\"></div> \
<div style=\"width: 50px; height: 50px;\"><input type=\"text\" readonly value=\"text\"></div> \
<a href=\"https://nested.org\"><img src=\"https://servo.org/nested.png\" style=\"width: 50px; height: 50px;\"></a>",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These <img> elements make real HTTP requests over the internet, right? Would it be better to use http://localhost instead of servo.org? Those URLs are 404 so a failed fetch is expected anyway

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've switched this to be a data URL.

selection.focusOffset == 1 && \
selection.focusNode == document.body",
);
assert_eq!(result, Ok(JSValue::Boolean(true)));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this test also run ContextMenuAction::Copy and assert the text sent to the "clipboard"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I've added a simple ClipboardDelegate that records the contents of the clipboard and also added a test that copy works here. The test is now called test_contextual_context_menu_select_all_and_copy.

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Sep 15, 2026

@mrobinson mrobinson left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review!

Comment on lines +453 to +410
pub(crate) fn selection_text(&self) -> Option<String> {
pub(crate) fn selection(&self) -> Option<String> {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the idea is that eventually this will return other types of data such as rich text and it will set all of the types onto the clipboard (or at least advertise them and then later read them). I think that selection_content is fine as a name, so I've made that rename.

selection.focusOffset == 1 && \
selection.focusNode == document.body",
);
assert_eq!(result, Ok(JSValue::Boolean(true)));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I've added a simple ClipboardDelegate that records the contents of the clipboard and also added a test that copy works here. The test is now called test_contextual_context_menu_select_all_and_copy.

Comment thread components/servo/tests/context_menu.rs Outdated
Comment on lines +156 to +159
<div><img src=\"https://servo.org/img.png\" style=\"width: 50px; height: 50px;\"></div> \
<div style=\"width: 50px; height: 50px;\"><input type=\"text\"></div> \
<div style=\"width: 50px; height: 50px;\"><input type=\"text\" readonly value=\"text\"></div> \
<a href=\"https://nested.org\"><img src=\"https://servo.org/nested.png\" style=\"width: 50px; height: 50px;\"></a>",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've switched this to be a data URL.

@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Sep 16, 2026
@mrobinson
mrobinson enabled auto-merge September 16, 2026 07:43
@mrobinson
mrobinson added this pull request to the merge queue Sep 16, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Sep 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 16, 2026
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Sep 16, 2026
This change adds initial `Document` selection integration with the
context menu so that the user can copy the selection to the clipboard or
select the entire `Document` contents. As part of this change a new
generic `EditingContext` struct is created to manage integration with
the various editing hosts. This will be used for keyboard shortcuts in
the future as well.

One small change is also made here: paste and cut are disabled for read
only form controls.

Finally, the context menu unit tests are cleaned up and expanded to more
easily add support for testing "select all." Currently there are no unit
tests for clipboard integration, so unfortunately there is no test for
this.

Signed-off-by: Martin Robinson <[email protected]>
@servo-highfive servo-highfive removed the S-tests-failed The changes caused existing tests to fail. label Sep 16, 2026
@mrobinson

mrobinson commented Sep 16, 2026 •

Copy link
Copy Markdown
Member Author

Apparently if-let chains in a match is a different feature than if-let chains and the former isn't stabilized in our version of Rust. 🤔

@mrobinson
mrobinson enabled auto-merge September 16, 2026 08:45
@mrobinson
mrobinson added this pull request to the merge queue Sep 16, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Sep 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 16, 2026
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Sep 16, 2026
@mrobinson
mrobinson added this pull request to the merge queue Sep 16, 2026
@servo-highfive servo-highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Sep 16, 2026
Merged via the queue into servo:main with commit ca0a163 Sep 16, 2026
39 checks passed
@mrobinson
mrobinson deleted the selection-copy branch September 16, 2026 11:45
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Sep 16, 2026
RichardTjokroutomo pushed a commit to RichardTjokroutomo/servo that referenced this pull request Oct 6, 2026
…servo#48101)

This change adds initial `Document` selection integration with the
context menu so that the user can copy the selection to the clipboard or
select the entire `Document` contents. As part of this change a new
generic `EditingContext` struct is created to manage integration with
the various editing hosts. This will be used for keyboard shortcuts in
the future as well.

One small change is also made here: paste and cut are disabled for read
only form controls.

Finally, the context menu unit tests are cleaned up and expanded to more
easily add support for testing "select all." Currently there are no unit
tests for clipboard integration, so unfortunately there is no test for
this.

Testing: This change adds various embedder API unit tests.

Signed-off-by: Martin Robinson <[email protected]>
hhhwsqhhh pushed a commit to hhhwsqhhh/servo that referenced this pull request Oct 12, 2026
…servo#48101)

This change adds initial `Document` selection integration with the
context menu so that the user can copy the selection to the clipboard or
select the entire `Document` contents. As part of this change a new
generic `EditingContext` struct is created to manage integration with
the various editing hosts. This will be used for keyboard shortcuts in
the future as well.

One small change is also made here: paste and cut are disabled for read
only form controls.

Finally, the context menu unit tests are cleaned up and expanded to more
easily add support for testing "select all." Currently there are no unit
tests for clipboard integration, so unfortunately there is no test for
this.

Testing: This change adds various embedder API unit tests.

Signed-off-by: Martin Robinson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants