Re: [csswg-drafts] Add a clipboard media type

> I'm not an implementer, but I would have assumed the technical part 
to be relatively easy, because the layout algorithm would mostly be 
the same as the one used for the screen or print layout.

Well, on the one hand, you are right that code to do layout already 
exists. But that code does not get invoked when doing copy-paste 
operations today, and it would now need to. This would change a simple
 string manipulation operation into a much heaving operation doing 
selector matching, cascading, inheritance, style computation, and 
create a box tree separate from the one used for the page (since it 
has different styles), and then since you don't want to use the DOM 
as-is, you'd need some form of layout/paint...

Moreover, you couldn't actually reuse the existing layout and paint 
part of the code, because you'd need to render to a string, which is a
 one dimensional thing, very different from the two 2 canvas CSS 
rendering operates in. For sure, rendering to a string is going to be 
much simpler than rendering to 2D, but that's still code that doesn't 
exist today that needs to be written.

And then you have all sorts of weird questions. If part or all of the 
thing you have selected and are trying to copy is set to 
`display:none` in the clipboard media type, what do you do? What if 
you had selected the generated content of a pseudo element, and in the
 clipboard media type it has a different content?

> I still think it would be good to have a way to influence clipboard 
layout in some way, but I can understand your disagreement on the 
proposed 'clipboard' media type.
> So, if you think, this is not feasible, feel free to WONTFIX this.

I think this was a good instance of thinking out of the box to see if 
a different approach could get us somewhere. I'm glad we looked at it,
 but ultimately, it doesn't work out.

-- 
GitHub Notification of comment by frivoal
Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/648#issuecomment-256926789 
using your GitHub account

Received on Friday, 28 October 2016 13:58:07 UTC