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

Add feComposite support for operator attribute's lighter value #9074

Merged
merged 13 commits into from
Mar 3, 2021
Merged
114 changes: 92 additions & 22 deletions api/SVGFECompositeElement.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,40 +51,52 @@
"__compat": {
"support": {
"chrome": {
"version_added": "5"
"version_added": "5",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://crbug.com/137230'>Chromium bug 137230</a>)."
Copy link
Collaborator Author

@hamishwillee hamishwillee Feb 16, 2021

Choose a reason for hiding this comment

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

FYI added all these "BackgroundImage/BackgroundAlpha notes to mirror feComposite (which this API does). Only thing that supports it is Edge before v79

Copy link
Collaborator

Choose a reason for hiding this comment

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

A few thoughts there:

  1. If I understand correctly, this note means that neither BackgroundImage nor BackgroundAlpha are accepted as values to the in1 or in2 attributes?
  2. Ordinarily, I'd say that when we repeat the same note again and again, it's often a sign that the information needs to be expressed as a subfeature or something else odd is going on. Except, in this case…
  3. Apparently no browser supports these values, so there's no actual compat story to worry about, right?

Unless there's a reason for web developers to expect these values to work, I'm inclined to suggest dropping all of these identical notes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, wait, I get it now: Edge before Edge 79 is the oddity; no current browser supports it, but there was somewhat recent support in Edge. Nobody else has implemented this. Reading the linked bugs, it looks like nobody else will implement it.

Here's my new take:

  • Drop all the notes on the SVGFECompositeElement data about accepted attributes. in1 etc. are reflected attributes, so we don't cover supported values in the interface. I get into more detail about this on the lighterForError feature, since it's a bigger issue there.
  • On the feComposite data, reduce this to one and only one note, for Edge (see suggestion below).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Essentially yes. You can specify those of course (they are "valid" options) but the only thing they they work on is pre-Blink-Edge. So "no current browser".

My read of the defect reports is because this is very hard to do, not because it isn't a good idea. Even the example in the SVG spec uses these. I have just removed that example from the docs. Also yes, that some browsers won't ever fix this.

But my concern is that without the note everyone will think all the spec values for in1 and in2 will work. I think you're saying "that doesn't matter". I will take your direction and update appropriately :-)

Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. To clear up a point of confusion: reflected attributes set and get the source element's attributes. For example, given page source <feComposite in1="somevalue">, SVGFECompositeElement.in1 returns "somevalue" and SVGFECompositeElement.in1 = "NEW" sets the element to <feComposite in1="NEW">. In terms of behavior, reflected attributes provide access to underlying element but don't really add anything more.

    Consequently, to avoid duplication, we document support for attribute values on the element itself, not the interface to that element. We figure that people don't really learn about, for example, the attributes of HTML elements by reading the HTML*Element interface docs.

  2. my concern is that without the note everyone will think all the spec values for in1 and in2 will work

    I didn't realize the spec used these (unsupported) values as examples and I appreciate that you're trying to guard against misunderstanding here. In that case, I think the right way to handle this is to have subfeatures for in1 and in2 (on the svg.elements.feComposite.{in1,in2} features) that represent each of the values for it and provide complete compat data for each, instead of notes. I think that gives readers a clearer idea of what is and is not supported.

    There's one additional bit of nuance here, however: because spec authors write ahead of implementation, there are often features which are in specs and never implemented. BCD can be a source of additional confusion, as folks get the idea that a feature in BCD means that it's a live concern. This is why we avoid all false features, where possible.

    In this case, the BackgroundImage and BackgroundAlpha values were once supported by at least one browser, so that deserves an entry.

  3. I was trying to avoid repetitious notes. Repetitious notes are hard to follow. When every entry has a note and the text is very similar between them, then it's hard to know what's actually noteworthy. That's why I was leaning toward writing notes for the exceptional, not usual, case.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Two additional thoughts here:

  • I missed that IE supported BackgroundImage and BackgroundAlpha as well. I think my general point still stands, however, that these are interesting because they're different from the others.
  • I said that we should "have subfeatures for in1 and in2 (on the svg.elements.feComposite.{in1,in2} features) that represent each of the values". I am not asking you to add features for every value yourself as part of this PR (that's optional). I just meant that svg.elements.feComposite.{in1,in2}.BackgroundImage and svg.elements.feComposite.{in1,in2}.BackgroundAlpha would be germane here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ddbeck You didn't miss anything about IE. I'm an idiot - those notes were supposed to be on Edge. Fixed.

But my feeling is that this is probably worth merging now because it is "not wrong" and adds a lot of corrected information about supported versions.

There are ongoing discussions like #9074 (comment) and this one on possibly adding subfeatures, but I'd happily do those as a post process. Up to you.

},
"chrome_android": {
"version_added": "18"
"version_added": "18",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://crbug.com/137230'>Chromium bug 137230</a>)."
},
"edge": {
"version_added": "12"
"version_added": "12",
"notes": "BackgroundImage/BackgroundAlpha are not supported from version 79 (see <a href='https://crbug.com/137230'>Chromium bug 137230</a>)."
},
"firefox": {
"version_added": "3"
"version_added": "3",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://bugzil.la/437554'>bug 437554</a>)."
},
"firefox_android": {
"version_added": "4"
"version_added": "4",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://bugzil.la/437554'>bug 437554</a>)."
},
"ie": {
"version_added": "10"
"version_added": "10",
"notes": "BackgroundImage/BackgroundAlpha are not supported."
},
"opera": {
"version_added": "15"
"version_added": "15",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://crbug.com/137230'>Chromium bug 137230</a>)."
},
"opera_android": {
"version_added": "14"
"version_added": "14",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://crbug.com/137230'>Chromium bug 137230</a>)."
},
"safari": {
"version_added": "6"
"version_added": "6",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://webkit.org/b/6022'>Webkit bug 137230</a>)."
},
"safari_ios": {
"version_added": "6"
"version_added": "6",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://webkit.org/b/6022'>Webkit bug 137230</a>)."
},
"samsunginternet_android": {
"version_added": "1.0"
"version_added": "1.0",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://crbug.com/137230'>Chromium bug 137230</a>)."
},
"webview_android": {
"version_added": "≤37"
"version_added": "≤37",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://crbug.com/137230'>Chromium bug 137230</a>)."
}
},
"status": {
Expand All @@ -98,13 +110,16 @@
"__compat": {
"support": {
"chrome": {
"version_added": "5"
"version_added": "5",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://crbug.com/137230'>Chromium bug 137230</a>)."
},
"chrome_android": {
"version_added": "18"
"version_added": "18",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://crbug.com/137230'>Chromium bug 137230</a>)."
},
"edge": {
"version_added": "12"
"version_added": "12",
"notes": "BackgroundImage/BackgroundAlpha are not supported from version 79 (see <a href='https://crbug.com/137230'>Chromium bug 137230</a>)."
},
"firefox": {
"version_added": "3"
Expand All @@ -113,25 +128,32 @@
"version_added": "4"
},
"ie": {
"version_added": "10"
"version_added": "10",
"notes": "BackgroundImage/BackgroundAlpha are not supported."
},
"opera": {
"version_added": "15"
"version_added": "15",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://crbug.com/137230'>Chromium bug 137230</a>)."
},
"opera_android": {
"version_added": "14"
"version_added": "14",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://crbug.com/137230'>Chromium bug 137230</a>)."
},
"safari": {
"version_added": "6"
"version_added": "6",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://webkit.org/b/6022'>Webkit bug 137230</a>)."
},
"safari_ios": {
"version_added": "6"
"version_added": "6",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://webkit.org/b/6022'>Webkit bug 137230</a>)."
},
"samsunginternet_android": {
"version_added": "1.0"
"version_added": "1.0",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://crbug.com/137230'>Chromium bug 137230</a>)."
},
"webview_android": {
"version_added": "≤37"
"version_added": "≤37",
"notes": "BackgroundImage/BackgroundAlpha are not supported (see <a href='https://crbug.com/137230'>Chromium bug 137230</a>)."
}
},
"status": {
Expand Down Expand Up @@ -329,6 +351,54 @@
}
}
},
"lighterForError": {
Copy link
Collaborator Author

@hamishwillee hamishwillee Feb 16, 2021

Choose a reason for hiding this comment

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

Robert (domain expert) confirmed lighterForError (what a weird key name for operator supporting the lighter value!) should be added to SVGFECompositeElement too. I have matched the feComposite versions exactly except for Safari.

For Safari the operator was not added until version 6, so I pushed the implementation of operator value lighter to be that same version. That is not "rock solid" (i.e. no bug confirmation) but very likely.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, but we should drop this feature entirely. For reflected attributes, we typically just track whether the attribute exists as part of the API. This is us mostly following the convention of specifications for these things: the IDL usually specifies the reflection, while the specification for the element defines valid values.

(Plus—and this is definitely not your fault, since you're following the structure from the element data—the structure is wrong. This ought to be a subfeature of operator, not a peer to operator.)

Copy link
Collaborator Author

@hamishwillee hamishwillee Feb 19, 2021

Choose a reason for hiding this comment

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

@ddbeck So to summarize, I just remove this addition altogether? - we simply don't track things supported at this level in the BCD. Sounds nuts, but there you go.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, we should only have data on the element, not the interface. I got into this more in #9074 (comment). But let me know if you have more questions—it's not an obvious distinction.

Copy link
Collaborator Author

@hamishwillee hamishwillee Feb 23, 2021

Choose a reason for hiding this comment

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

@ddbeck What I think you're saying is that we don't document the bits of an SVG element that reflects a javascript API - we'd just document the javascript behaviour. Right?

So I understand why you wanted me to delete the lighterForError from the reflected API svg/elements/feComposite.json , but THIS is api/SVGFECompositeElement - the API from which we reflect. Which makes me think that it should have stayed.

Or did you mean that we document on the element but not the javascript API? Either way, doesn't one of them need comments about the features? The comments here said delete this from both /api and /svg

What am I missing?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or did you mean that we document on the element but not the javascript API? Either way, doesn't one of them need comments about the features? The comments here said delete this from both /api and /svg

I meant on the element, not the API. Sorry, I didn't mean to suggest deleting all of them everywhere. I think the various threads on this PR made it hard to keep track of which thing was which. I'll post a standalone review that summarizes things that need to change to get this merged.

"__compat": {
"description": "<code>operator</code> value: <code>lighter</code>",
"support": {
"chrome": {
"version_added": "45"
},
"chrome_android": {
"version_added": "45"
},
"edge": {
"version_added": "≤18"
},
"firefox": {
"version_added": "86"
},
"firefox_android": {
"version_added": "86"
},
"ie": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note, IE doesn't work support lighter for feComposite, so set false in that and here too (verified by testing).

"version_added": false
},
"opera": {
"version_added": "32"
},
"opera_android": {
"version_added": "32"
},
"safari": {
"version_added": "6"
},
"safari_ios": {
"version_added": "6"
},
"samsunginternet_android": {
"version_added": "5.0"
},
"webview_android": {
"version_added": "45"
}
},
"status": {
"experimental": false,
"standard_track": true,
"deprecated": false
}
}
},
"operator": {
"__compat": {
"support": {
Expand Down
Loading