Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove MIME types from mandatory data list that are not supported by all browsers. #155

Merged
merged 4 commits into from
Oct 14, 2021

Conversation

snianu
Copy link
Contributor

@snianu snianu commented Sep 2, 2021

Closes w3c/editing#305

For normative changes, the following tasks have been completed:

  • Modified Web platform tests (link to pull request)

Implementation commitment:

  • Already implemented by WebKit, Chromium & Gecko.

Preview | Diff

@annevk
Copy link
Member

annevk commented Sep 14, 2021

I would prefer to only land the MUST lists as those seem to have agreement. Optional support for types doesn't seem like a great thing to allow and wasn't discussed in the referenced issue.

@snianu
Copy link
Contributor Author

snianu commented Sep 15, 2021

@annevk
Chromium, Safari & FF have support for types that are not in the list, but they are exposed via DataTransfer & async clipboard APIs.
e.g. Safari has support for text/uri-list, Chrome has support for image/svg+xml etc.
I think it's fine to add the mime types that are supported in all browsers in the MUST support list, but we should at least mention the types that are supported by a particular browser so the web authors are aware of it. This type may not be available in other browsers so I added those "optional" types to the MAY support list. It also leaves room for future improvements to support more standard well known types defined by the OS (this is different than custom formats support).

@annevk
Copy link
Member

annevk commented Sep 20, 2021

That's not entirely clear to me. For the types that only some browser supports the right answer might well be that the browser removes support for that type. If all browsers are to implement it, it shouldn't be optional. This isn't a guide for web developers, this is what we want browsers to converge on.

@snianu
Copy link
Contributor Author

snianu commented Sep 21, 2021

@annevk OK, removed the optional types. PTAL.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

This looks to be in line with the discussion, however, shouldn't JPEG and GIF be supported as well?

This would benefit from at least one other set of eyes.

@snianu
Copy link
Contributor Author

snianu commented Sep 22, 2021

Added @mkruisselbrink to the review as well.

@snianu
Copy link
Contributor Author

snianu commented Sep 22, 2021

shouldn't JPEG and GIF be supported as well

I think in Chromium, we convert these into PNG and write it to the clipboard. @a-sully made changes in this space so maybe he can confirm the behavior here.

@a-sully
Copy link

a-sully commented Sep 22, 2021

I'm not familiar with the details of how non-PNG images are written to the clipboard, but I can confirm that PNG is the only image format supported on the Chromium clipboard. That being said, JPEGs and GIFs are typically copied to and read from the clipboard as files using the text/uri-list mime type anyways.

@snianu
Copy link
Contributor Author

snianu commented Sep 22, 2021

@a-sully

That being said, JPEGs and GIFs are typically copied to and read from the clipboard as files using the text/uri-list mime type anyways

At least on Windows, I don't see Chromium reading GIF, JPEGs files. In this method, I see only PNG and BMP formats being read from the clipboard. However, on Windows, when I copy a GIF file, the location of the file is present in the clipboard under CFSTR_FILEDESCRIPTORA format. So looks like this is only supported via DnD/DataTransfer APIs, but not in async clipboard APIs. Is my understanding correct?

@a-sully
Copy link

a-sully commented Sep 22, 2021

They're read as files using the ReadFilenames() code path. Though it seems that Windows (CFSTR_FILENAMEW) and Mac (NSFilenamesPboardType) actually use custom types rather than text/uri-list (which is used on Linux + Android), so I take that back. Should've confirmed in the code first.

I realized I wasn't very clear on this above. Yes, you are correct. Reading files is not yet supported for the Async Clipboard API, though we'd like to at some point (see the tracking bug).

@snianu
Copy link
Contributor Author

snianu commented Sep 22, 2021

Thank you for confirming! Since Safari already supports text/uri-list MIME type and Chrome has plans to add support for this MIME type in the future, should we add this format to the mandatory data types?

@snianu
Copy link
Contributor Author

snianu commented Sep 28, 2021

Gentle ping.. I'd like to merge this PR and work on improving other parts of the spec.

@snianu snianu added the Agenda+ label Oct 4, 2021
@snianu
Copy link
Contributor Author

snianu commented Oct 7, 2021

Adding @mbrodesser as well. Gentle ping for review....

Copy link

@mbrodesser mbrodesser left a comment

Choose a reason for hiding this comment

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

Looks OK to me, given the previous discussion at w3c/editing#305.
Only the title of the PR should be adapted to reflect the current change.

@snianu snianu changed the title Add mandatory and optional data types list. Remove MIME types from mandatory data list that are not supported by all browsers. Oct 14, 2021
@snianu
Copy link
Contributor Author

snianu commented Oct 14, 2021

Adding @whsieh as well for sign-off

@whsieh
Copy link

whsieh commented Oct 14, 2021

Looks good to me!

@snianu snianu merged commit fa5ed32 into main Oct 14, 2021
github-actions bot added a commit that referenced this pull request Oct 14, 2021
…all browsers. (#155)

SHA: fa5ed32
Reason: push, by @snianu

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@annevk annevk deleted the data-types branch October 15, 2021 08:15
snianu added a commit that referenced this pull request Dec 13, 2021
…all browsers. (#155)

* Add mandatory and optional data types list.

* Add optional types separately.

* Remove optional data type.
@snianu snianu mentioned this pull request Sep 15, 2023
4 tasks
@sanketj sanketj removed the Agenda+ label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Explicitly define supported MIME types in Async Clipboard Spec
7 participants