-
Notifications
You must be signed in to change notification settings - Fork 715
[cssom] Don't use "applies to" to define getComputedStyle behavior #3678
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
Comments
Some interop bugs: That's from a quick skim. I'll try to get engines to align here. |
Another one: https://bugzilla.mozilla.org/show_bug.cgi?id=1550997 |
Another one: https://bugzilla.mozilla.org/show_bug.cgi?id=1551000 |
So for https://drafts.csswg.org/cssom/#resolved-value-special-case-property-like-height with that case the only thing left is to define when they're resolved and how. In Gecko, the check is "The element has a CSS layout box, and either the computed value of display is not inline, or the element is a replaced element". In WebKit / Blink the check is "The element has a layout box, and @kojiishi or @mstensho, do you know what would be a good-ish definition of what |
…ues. r=mats The spec says that when there's no box or the property doesn't apply, the computed value should be returned. That's not what we're doing right now, we're clamping by min-/max- values, which is wrong. This patch makes us match other engines and the spec, and it's an attempt to get interop on resolved values in: w3c/csswg-drafts#3678 WebKit fails the WPT test, but due to a different reason: https://bugs.webkit.org/show_bug.cgi?id=197814 Differential Revision: https://phabricator.services.mozilla.com/D30780 --HG-- extra : moz-landing-system : lando
…ues. r=mats The spec says that when there's no box or the property doesn't apply, the computed value should be returned. That's not what we're doing right now, we're clamping by min-/max- values, which is wrong. This patch makes us match other engines and the spec, and it's an attempt to get interop on resolved values in: w3c/csswg-drafts#3678 WebKit fails the WPT test, but due to a different reason: https://bugs.webkit.org/show_bug.cgi?id=197814 Differential Revision: https://phabricator.services.mozilla.com/D30780
It means, for non-SVG, the element is not text nor an inline box (e.g., span). Atomic inlines (replaced elements and inline block) are For SVG, I'm not an expert, but generally using |
The spec says that when there's no box or the property doesn't apply, the computed value should be returned. That's not what we're doing right now, we're clamping by min-/max- values, which is wrong. This patch makes us match other engines and the spec, and it's an attempt to get interop on resolved values in: w3c/csswg-drafts#3678 WebKit fails the WPT test, but due to a different reason: https://bugs.webkit.org/show_bug.cgi?id=197814 Differential Revision: https://phabricator.services.mozilla.com/D30780 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1527392 gecko-commit: d51f3432e142ef24333b125087f5fccc2fbc366a gecko-integration-branch: central gecko-reviewers: mats
The spec says that when there's no box or the property doesn't apply, the computed value should be returned. That's not what we're doing right now, we're clamping by min-/max- values, which is wrong. This patch makes us match other engines and the spec, and it's an attempt to get interop on resolved values in: w3c/csswg-drafts#3678 WebKit fails the WPT test, but due to a different reason: https://bugs.webkit.org/show_bug.cgi?id=197814 Differential Revision: https://phabricator.services.mozilla.com/D30780 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1527392 gecko-commit: d51f3432e142ef24333b125087f5fccc2fbc366a gecko-integration-branch: central gecko-reviewers: mats
w3c/svgwg#349 is another issue, seems like Blink returns used values for |
https://chromium.googlesource.com/chromium/src/+/269ecd52bd4e0ec15a70924b089589f9bfe26ee0 is the commit that introduced that, for my own reference. cc @fsoder |
For SVG elements Blink essentially follows "applies to". |
@fsoder Seems like other than Blink every engine uses "CSS layout box which isn't a replaced inline element", would you be open to revert that patch? What |
I suggested returning computed values in w3c/svgwg#349 - an issue that I filed in response to a bug report - which would indicate level of author interest. |
If you're implementing support for those properties within an SVG layout context, then the properties apply to the element as far as computed/resolved styles are concerned. But maybe we should be stating that explicitly? Can we modify an "applies to" line in a partial property definition box? (ping @tabatkins) |
Sure but do we really want them to return the used value? I always thought of the resolved value thing as a whole as a compatibility issue, rather than a feature. |
@emilio, see the discussion in w3c/svgwg#349. The general consensus was consistency of author expectations (as in https://crbug.com/772707). Most properties that accept a length convert it to px when retrieved from But, the current behavior in Blink results in an inconsistency between width/height (resolved value is used value, AKA always px) and the other SVG geometry properties (resolved value is computed value). For this issue, the question is: How can we define the legacy requirements for resolved value in a way that is independent of "applies to"? Only then can we talk about whether there are contexts where a property applies to an element, but there is no legacy requirement for returning used values in |
Would people be fine if I updated the spec to say that the
I think that matches all of WebKit / Blink / Gecko, per all the comments here, modulo blink resolving these for these three svg elements. |
(Also this is not true, these properties are the exception, not the rule) |
Oh, though according to that Chromium issue, safari does return used value here as well? :( |
Ok, so safari doesn't return the used value (per testing in https://phabricator.services.mozilla.com/D35651). Firefox does return something similar to the used value if display is different than So we probably still can decide what to do. I'd prefer to change the spec to say "The element has a CSS layout box (thus no SVG layout), and isn't a replaced inline box.", but we could also go for the Blink behavior and add the whitelist of svg elements for which we return the used value... |
The spec says that when there's no box or the property doesn't apply, the computed value should be returned. That's not what we're doing right now, we're clamping by min-/max- values, which is wrong. This patch makes us match other engines and the spec, and it's an attempt to get interop on resolved values in: w3c/csswg-drafts#3678 WebKit fails the WPT test, but due to a different reason: https://bugs.webkit.org/show_bug.cgi?id=197814 Differential Revision: https://phabricator.services.mozilla.com/D30780 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1527392 gecko-commit: d51f3432e142ef24333b125087f5fccc2fbc366a gecko-integration-branch: central gecko-reviewers: mats
…ues. r=mats The spec says that when there's no box or the property doesn't apply, the computed value should be returned. That's not what we're doing right now, we're clamping by min-/max- values, which is wrong. This patch makes us match other engines and the spec, and it's an attempt to get interop on resolved values in: w3c/csswg-drafts#3678 WebKit fails the WPT test, but due to a different reason: https://bugs.webkit.org/show_bug.cgi?id=197814 Differential Revision: https://phabricator.services.mozilla.com/D30780 UltraBlame original commit: d51f3432e142ef24333b125087f5fccc2fbc366a
…ues. r=mats The spec says that when there's no box or the property doesn't apply, the computed value should be returned. That's not what we're doing right now, we're clamping by min-/max- values, which is wrong. This patch makes us match other engines and the spec, and it's an attempt to get interop on resolved values in: w3c/csswg-drafts#3678 WebKit fails the WPT test, but due to a different reason: https://bugs.webkit.org/show_bug.cgi?id=197814 Differential Revision: https://phabricator.services.mozilla.com/D30780 UltraBlame original commit: d51f3432e142ef24333b125087f5fccc2fbc366a
…ues. r=mats The spec says that when there's no box or the property doesn't apply, the computed value should be returned. That's not what we're doing right now, we're clamping by min-/max- values, which is wrong. This patch makes us match other engines and the spec, and it's an attempt to get interop on resolved values in: w3c/csswg-drafts#3678 WebKit fails the WPT test, but due to a different reason: https://bugs.webkit.org/show_bug.cgi?id=197814 Differential Revision: https://phabricator.services.mozilla.com/D30780 UltraBlame original commit: d51f3432e142ef24333b125087f5fccc2fbc366a
…ues. r=mats The spec says that when there's no box or the property doesn't apply, the computed value should be returned. That's not what we're doing right now, we're clamping by min-/max- values, which is wrong. This patch makes us match other engines and the spec, and it's an attempt to get interop on resolved values in: w3c/csswg-drafts#3678 WebKit fails the WPT test, but due to a different reason: https://bugs.webkit.org/show_bug.cgi?id=197814 Differential Revision: https://phabricator.services.mozilla.com/D30780
The definition of resolved values in CSSOM — which are used in
getComputedStyle
results — currently includes sets of properties where the resolved value switches between the used value and the computed value depending on whether "the property applies to the element or pseudo-element".As discussed in #3414 (comment), this is problematic because "applies to" isn't strictly defined for many properties in a way that can be used in normative tests. And the conclusion of the group in that discussion is that it would be better to fix the resolved value definition than to make "applies to" in property definition boxes as strict as would be required.
Since the used vs computed behavior is about legacy compat, the first step could be to review current implementations more carefully. Then maybe we can find a better definition for when the result switches from one to the other.
The text was updated successfully, but these errors were encountered: