-
Notifications
You must be signed in to change notification settings - Fork 10
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
What should the spec say about elements like HTMLAudioElement? #51
Comments
These events belong to the category of things that could happen even after cropping. They are covered in the spec, and is in fact the basis for many of the design decisions behind the spec. But we're not discussing these. Rather, we are discussing something that is known before minting and cannot change - the type of Element. If it is extremely unlikely that Web-developers would use a target of a certain type, then time spent expanding the definition to include it, and time to implement it, is time wasted. Time that could otherwise be used productively (to the benefit of all constituencies). We should seriously consider allowing user agents to reject some types. |
It seems HTMLAudioElement would be eligible to cropping according this definition but HTMLAudioElement should not be eligible to cropping based on the initial message of this thread. I have difficulties following what we are trying to discuss here. If the type of element is ensuring that it will always be 0x0, it should be very very very simple to implement and optimize. It seems what we are after here is something different, maybe scoping the spec down to only supporting div/iframe (?). Please also note that trying to revisit this issue has impact on the API discussions we are having in #50. This discussion seems fundamental (what are the input we want to support), so fundamental that it seems best to solve this issue before trying to rush out any API proposal like #50. |
At least with HTMLAudioElement, it does not appear that it's always 0x0. But please note that it was not me who introduced 0x0 into the discussion, I was only answering @jan-ivar's question. I don't think 0x0 is special, and I've explained as much. What I asked was - is it "sensible" to support HTMLAudioElement?
It is common even for engineers of all experience levels to underestimate future challenges in implementation. I do not feel confident enough to say it would be simple to implement cropping for all possible Element subtypes. The spec should not mandate that we MUST support an Element subtype, if that subtype is neither sensible (Web-developers don't need it) nor simple (browser-implementers might have a hard time with it). Such a requirement would serve nobody.
@youennf, you have previously agreed HTMLElement made sense, and at your suggestion, we even expanded to Element. You made this suggestion five months ago. The API as a whole has been debated for 1.5 years by now. I do not think this qualifies as "rushed". It is the nature of our jobs that decisions must be made without full certainty. Past a certain point, additional debates are less productive than making a decision, even if that decision could end up proving less than perfectly optimal. (To clarify - I think we're making a good decision in #50.) |
@beaufortfrancois right, I said: "Elements properties that control their visibility (e.g. So please answer this: should the presence or absence of the |
The visibility issue is a red herring - any Element can have 0 visible pixels if it's scrolled away from view. The real issue is explained here. (And to plainly answer your question - no, the presence/absence of controls is immaterial.) |
I think we should follow precedence set by element.requestFullscreen(). I see strong parallels between that API and cropTo: both APIs let a single element take over an entire viewport. Here's what element.requestFullscreen() requires of this to not reject:
Type-wise this would suggest we should reject on dialog element, and non-HTML non-SVG non-MathML elements, and nothing else. |
The parallel drawn with Note: This is not the only case of non-rectangular or partially-transparent element. We've used the bounding box for a reason. But the special thing with HTMLAudioElement is that non-rectangularity and/or transparency is different between user agents, which means an application misguidedly trying to use it as a crop-target would yield non-uniform results. It's a footgun. |
I also tried Safari. It turned out that |
Feel free to file a bug on Firefox, but can we agree this is irrelevant here? I've already shown the spec algorithm, and Chrome is compliant.
As you can see, it works. I think it's a good API. From a web developer's perspective:
|
Bugs are irrelevant and transitory. But abiding incompatibilities such as elements looking completely different between implementations, up to and including capturing background pixels in some implementations but not in others... That is very relevant.
The difference is that with requestFullscreen(), at worst you get slightly silly behavior for the local user, whereas with cropping, you could be exposing a different set of pixels to remote participants, possibly unbeknownst to the local user.
It's good and proper for browsers to pay for developers' lunch, but only if developers are going to eat it. Here, I think we'd be wasting time and effort on unrequested, undesired functionality, that no prudent developer would use. So far, developers seem to be happy with cropping to DIVs. We have expanded the scope all the way to Element rather speculatively. |
This seems like a red herring, because exposure of implementation-specific rendering is inherent with screen-capture and seems mostly orthogonal to cropping. I.e. we'd need to shut down screen capture entirely if this were an issue.
No more so than screen capture already is. We're not capturing the "element", we're capturing whatever CSS determines is rendered top-most at the pixel coordinates determined by the element's bounding rectangle, which may be pixels that have nothing to do with the element. So to speak of other rendering showing through behind round corners and calling that a "footgun" frankly has me worried about whether this API has received the scrutiny and vetting it deserves. I also don't think it's accurate to say this is somehow unique to HTMLAudioElement. HTMLVideoElement with controls look different in different browsers as well, and corner shapes are like the wind, they change with the seasons. |
This is a brand new API, so I don't see how you can claim this. See also https://crbug.com/1328836 detailing my run-in with this limitation in Chrome, which required me to use CSS workarounds.
Who's "we" and where are you going with this? HTMLAudioElement is an HTMLElement. |
That's missing the point. The problem is not that the players look different generally-speaking. I don't mind if one implementation exposes the play button to the left of the scrubbar and other implementation to the right of it. The problem is that the players' opacity and shape is different in substantive ways. This implementation-specific shape is peculiar to HTMLAudioElement and perhaps a handful other Elements. Consider a developer working with Firefox and Safari. They try to cropTo an audio element and they get only the player, which is rectangular and opaque. They're happy. They don't mind that the player is different in both cases. They ship it. Then it turns out that in Chrome, that still captured some background pixels. Oops! That's unfortunate. Sure, the same problem would have been observed with a div-containing-a-player, if the player happened to obscure something. But that case makes it clearer to the developer that they're capturing "what's in the div" and not "the player". It's a lesser issue.
We who participated in the discussion. |
No it is the exact same issue. I would like you to address what I already wrote on that so we don't go in circles: "We're not capturing the "element", we're capturing whatever CSS determines is rendered top-most at the pixel coordinates determined by the element's bounding rectangle, which may be pixels that have nothing to do with the element. So to speak of other rendering showing through behind round corners and calling that a "footgun" frankly has me worried about whether this API has received the scrutiny and vetting it deserves." If you're claiming the user somehow expects cropping to an "element" to somehow be safe from leaks of other information in the viewport (behind, around or on-top) or be anything other than a pixel-cropping operation of the viewport image, then we have an API fail, and we should change the API to make it clearer to web developers what the actual functionality exposed does and what it's side-effects are.
Lastly, web developers can already crop to any element using trial and error and pixel coordinates, which is more likely to produce surprising undesirable results across browsers: the cropping coordinates may appear fine in Chrome but cut off elements in say Firefox, or work some of the time but break at other times due to unforseen layout or language changes. Being able to specify an element would only improve the situation and the user agent's ability to include the necessary vendor-specific rendering. |
This isn't clear from the issue you've filed. To not waste the WG's time, may I suggest filing a more precise issue explaining what the problem is? |
I believe I have addressed this multiple times during the past 1.5 years. "To not waste the WG's time", I don't intend to address these topics again. The API shape and its trade-offs should be clear by now. We are discussing whether improvements can be made around the edges, with some niche Element sybtypes being excluded from this API because they make no sense, are useless to implement, and won't be employed by any developer because of their unique idiosyncracies.
That is not robust to resizing, which is a major reason why we even have Region Capture - as you should know. I don't see how this is relevant to our present discussion.
This would be the second time you ask me to branch this particular discussion. Actually, third time we do it. And frankly? I can't begin to imagine how my intent is not clear from the original issue. I think the way to show respect for this WG's time is to carefully read messages before responding to them, to be mindful of context, and to drive this discussion to completion without additional distractions. |
Here's a possible compromise. Instead of blocklists, let's employ allowlists. For the time being, let's redefine |
@eladalon1983 between what positions would that be a compromise?
What elements do you mean when you say "elements like HTMLAudioElement?" Do you include HTMLVideoElement? If so I would not have guessed that from the OP. @youennf also said: "I have difficulties following what we are trying to discuss here", which is why I suggested opening a fresh issue describing the problem anew. He proceeded to say/ask you:
Is having that discussion here your intent? I see no direct response from you to that statement/question.
Yes it's sensible and has consensus, which means I don't have to defend it (even though I did), rather people who want to make a change have to explain why it's not sensible. To help clarify, do you think it is sensible to support HTMLVideoElement? |
Clarification: All Elements are eligible to cropping based on the current definition in the spec - which I am arguing we should amend, because not all Element subtypes make sensible crop-targets. We started this discussion when I said that we should allow user agents to reject crop-minting for three categories of reasons. The three categories were laid out here, before you (@jan-ivar) insisted on branching the discussion. The present issue was created to discuss the first category - "Elements like HTMLAudioElement". I have been arguing for a while that we should allow user agents to reject these Elements. Is this clear now?
If this part were unclear before, you could have asked. @dontcallmedom, could you please help ensure the W3C does not devolve into 4Chan? It is quite inappropriate to claim that I am wasting the WG's time when I fail to answer a question that was never posed. To answer @jan-ivar's new question - I think HTMLVideoElement makes a relatively sensible crop-target and I don't presently seek to pack it in the same bin with HTMLAudioElement. I can start compiling a list of such subtypes after we decide what to do with HTMLAudioElement. The guiding principle is that Elements whose shape is not sufficiently constant between implementations do not make for sensible targets, because they don't produce a definition of a target area that is constant between implementations, or even different versions of a given implementation.
My intent is to find partners who are honestly engaged in having the discussion and following it wherever it naturally goes. If this means scoping back down to div/iframe, as Youenn and I have both now suggested ([1][2]), then that works for me too. Are you interested in this compromise, @jan-ivar? Yes or no?
I don't see how it helps anyone to claim "consensus" when one of three parties engaged in this discussion tells you they want to change things. It would make more sense to call this the "status quo".
Which I have. |
I am still puzzled by what we are discussing here. Can somebody summarise the various proposals? A few thoughts:
To be clear, I am not proposing that.
Please reread the sentence where I used "rush". With regards to the overall discussion, here is a rough sketch:
|
I'll summarize again. Note that if you want to know what I am trying to discuss, it helps to focus on what I am saying, and not confuse my choice of topic with my responses to off-topic questions. See more on this below. The general topic is that minting can fail - but at your request this discussion was branched. There are three categories for these failures. The current issue discusses why I think minting should fail (synchronously) for
This refers specifically to the other topic - criterion 2 of this message. You have asked me to branch the discussion off from there so as to keep these topics separate. So let's please observe your request - both of us.
Please read this reply, which responded to the comparison with the fullscreen API.
That's NOT what was being discussed. I have never discussed
Thank you for the clarification. This reversion to div/iframe was NOT the original intention of this thread, but it DOES provide a shortcut out of this issue, and I'd love it if we took it.
I believed you were floating the idea as a possible compromise; possibly temporary.
All of the people who have expressed interest in this API during WG interim meetings are represented here. Continuing the discussion in 20min-per-month slots during interim meetings does not serve us. |
OK, let's focus on this issue specifically then and if we want to discuss other issues, let's have separate issues. AIUI, you want the spec to state that creation of CropTarget for
I floated this idea to understand what was Chrome team request.
I do not think this invalidates the point that fullscreen API is a good source of information for designing media capture region. As I said earlier, I could see some use of cropping to an HTMLAudioElement. This might not be the most widespread use of it but why should the spec forbid it? AIUI, your argument for forbidding it is about HTMLAudioElement opacity. |
I have focused on this topic exclusively in this issue here. I would appreciate it if you could point out where this was ambiguous in my comments. (Note: My responses to others' off-topic messages do not count as me being off-topic myself.)
You understand correctly.
I too think that the fullscreen API is a good source of information. As soon as Jan-Ivar brought it up, I went out and examined its specification as well as implementation - as covered in my previous comments. What I found was that:
As stated in my previous messages, the main reason is that it makes for a poor crop-target. It's a footgun. (Because of the inherent, non-cross-compat shape differences.)
That the definition of a bounding box yields is meaningful does not mean it's useful.
I have no reason to suspect that it's difficult in Chrome's implementation.
What about |
I'd be happy to:
This appears to directly contradict your statement above that you've "focused on [HTMLAudioElement] exclusively in this issue", since you filed this issue and wrote the OP about a category of elements. "Elements like..." implies a category X of elements of which HTMLAudioElement is a part. But it's ambiguous what the criteria for category X are, which means it's ambiguous what criteria are being proposed to be enshrined in the spec, and what criteria are being used to justify it. I took a stab at the criteria being: no visual component, as did @youennf and even @beaufortfrancois it looks like judging by engagement to my rebuttal showing HTMLAudioElement does have a visual component at times. After conceding this, you then said visibility was not the criteria for what was "sensible", and linked to:
In other words, you seem to be relying on @alvestrand's definition. I asked @alvestrand today at our co-chair meeting, and he confirmed he thought cropping to an HTMLAudioElement didn't make sense because it didn't have a visual component. This would appear to support the view of others that visibility was the original criteria, and that you misunderstood Harald. Of course it's fine for you and Harald to have different reasons, but to others it is demonstrably ambiguous what you mean, since the only person you quoted used a different definition from yours. Your summarized criteria for what is "sensible" appears to be "Web-developers don't need it" as determined by you. Not only is this subjective and impractical — short of running every element type by you, this amounts to a highly ambiguous definition of what is sensible and what is not — But it's also surprisingly narrow: You said "we'd be wasting time and effort on unrequested, undesired functionality, that no prudent developer would use. So far, developers seem to be happy with cropping to DIVs". Here it seems like you're saying only DIVs are sensible? This appears to contradict your earlier statement that HTMLVideoElement was sensible, and ALSO your statement here that this is only about HTMLAudioElement. Based on these points which you've asked me to call out, I would say your position is far from clear, and that people who call this out are not in error. I would ask we not make claims about what makes sense or not without backing such claims up with arguments and facts that can be debated. I would also ask we limit debate to those arguments regardless of who makes them. This should save a lot of time. |
This new confusion is unrelated to that in Youenn's second bulletpoint of this message, where he goes back to discussing the second bulletpoint of this message. But, at any rate, "and similar elements" was featured in almost all of my messages. The one time it was missing - that was an unintended outlier. Please read that too as "and similar elements."
If you thought I used HTMLAudioElement solely because of a supposed mistaken notion of it being always-invisible, then why didn't you just respond that
Please don't attempt to read my mind. My first message did not mention visibility. My second message demonstrates full awareness that HTMLAudioElement can be visible. It is patently obvious that, as of 2022-05-27, we all knew HTMLAudioElement could be visible. Let's proceed.
I'll give an objective definition of valid crop-target-element-types in my next comment (for better visibility).
I said they were sufficient. This allows us to compromise on specifying them first, and expanding the definition later. |
Here is my proposed first draft of definition for which Element subtypes should be allowed.
Note:
I would have liked to include sensibility/usefulness, but I agree that it would be difficult to define, so let's shelve that for now. If (i) a non-null bounding box is easier to reach consensus on than (ii) well-defined size and opacity, then we can start with (i) and get back to (ii) later. |
Since CSS can be used to make any element (including |
I was not aware of that. Could you please explain how? |
for instance <html>
<style>script {display: block; font-family: monospace; }</style>
<body>
<div id="log"></div>
<script>
document.getElementById("log").textContent = "This page displays the script that controls it";
</script> (visible in https://jsfiddle.net/wuardx8k/, although it seems to show more of the script there because of jsfiddle specific code) |
That's interesting, I did not know you could do that to <script>. But does it really work for any Element? I tried playing around with <head> and <title> and that did not produce an observable result. I am not sure what I'd see with <br>, either...? |
https://jsfiddle.net/ze0q1sk7/ shows an example where |
Thanks, Dom. That was news to me - that all Elements can be made visible. If that's indeed the case for all Elements, it might be best to close this discussion. I still think part (ii) here could be interesting, but (i) would have been more interesting and compelling, and I see nobody else has much concern about (ii). -- |
Let's continue the discussion which stopped here.
It looks like some Elements are not sensible crop-targets. For example, HTMLAudioElement. What should we do with these?
Edit, 2022-05-27, 21:15 CEST, at @jan-ivar's request: In case it's not clear from the context of the aforementioned previous discussion, I am suggesting we allow user agents to reject
CropTarget.fromElemet()
on elements such as HTMLAudioElement.The text was updated successfully, but these errors were encountered: