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

[css-fonts-4] font-weight and calc. #2590

Closed
emilio opened this issue Apr 17, 2018 · 7 comments
Closed

[css-fonts-4] font-weight and calc. #2590

emilio opened this issue Apr 17, 2018 · 7 comments
Labels
css-fonts-4 Current Work

Comments

@emilio
Copy link
Collaborator

emilio commented Apr 17, 2018

This is just a request for clarification.

https://drafts.csswg.org/css-fonts-4/#font-weight-numeric-values says:

Only values greater than or equal to 1, and less than or equal to 1000, are valid, and all other values are treated as parse errors.

This doesn't say how to handle calc(), but per my reading of previous discussions the expected behavior is that font-weight: calc(-1) is not a parse error, and it gets clamped at computed value time.

However no UA does this AFAICT. Am I right that that's the expected behavior? Or should we give up on not making calc() for numeric values out of range be a parse error?

@emilio emilio added the css-fonts-4 Current Work label Apr 17, 2018
@emilio
Copy link
Collaborator Author

emilio commented Apr 17, 2018

cc @litherum, @jwatt

@svgeesus
Copy link
Contributor

I agree that invalid at computed value time is the right way to go here.

@jwatt
Copy link
Contributor

jwatt commented Apr 17, 2018

/me waves at @svgeesus

@svgeesus
Copy link
Contributor

/wave

@emilio
Copy link
Collaborator Author

emilio commented Apr 17, 2018

Alright, apparently there are already tests for this, so I guess Edge at least does the right thing, will align with it.

Thanks!

@emilio emilio closed this as completed Apr 17, 2018
@litherum
Copy link
Contributor

I believe https://drafts.csswg.org/css-values-3/#calc-range describes what to do.

@tabatkins
Copy link
Member

Yes, the spec is very clear on this matter - it should be clamped to 1 at computed value time. It is definitely not invalid at computed value time; that's not even remotely related to calc(), it's a variables thing.

It absolutely can't be a parse error, because in the general case you can have expressions that can't be resolved at parse time. (V&U 3's calc() doesn't have any of these for purely numeric expressions, so you could tell at parse time what the value would end up being, but now that we have unit algebra it's back to being generally undecidable.)

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Apr 23, 2018
…ts. r=jwatt

The test adjustments are:

  A subtest of variable-presentation-attribute.html is marked as failure,
  pending resolution of w3c/csswg-drafts#2605.

  font-parse-numeric-stretch-style-weight.html is updated to:

    * handle calc per spec (invalid at computed-value time), see
      w3c/csswg-drafts#2590

    * Accept 0% in font-stretch: w3c/csswg-drafts#2591

    * Accept font-weight descriptor ranges where the start is greater than the
      end, per
      https://drafts.csswg.org/css-fonts-4/#descdef-font-face-font-weight, which
      says:

      > User agents must swap the computed value of the startpoint and endpoint
      > of the range in order to forbid decreasing ranges.

  font-shorthand.html is updated to presumably fix a copy-paste error, where
  "oblique 45deg" was expected to compute to "oblique", which is wrong.

The rest is removing failure annotations.

MozReview-Commit-ID: CNJ3LG71KRj
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Apr 23, 2018
The test adjustments are:

  A subtest of variable-presentation-attribute.html is marked as failure,
  pending resolution of w3c/csswg-drafts#2605.

  font-parse-numeric-stretch-style-weight.html is updated to:

    * handle calc per spec (invalid at computed-value time), see
      w3c/csswg-drafts#2590

    * Accept 0% in font-stretch: w3c/csswg-drafts#2591

    * Accept font-weight descriptor ranges where the start is greater than the
      end, per
      https://drafts.csswg.org/css-fonts-4/#descdef-font-face-font-weight, which
      says:

      > User agents must swap the computed value of the startpoint and endpoint
      > of the range in order to forbid decreasing ranges.

  font-shorthand.html is updated to presumably fix a copy-paste error, where
  "oblique 45deg" was expected to compute to "oblique", which is wrong.

The rest is removing failure annotations.
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1436048
gecko-commit: b61541f85293fa3fddd7edfe9863624f9a56e92b
gecko-integration-branch: mozilla-inbound
gecko-reviewers: jwatt
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Apr 24, 2018
The test adjustments are:

  A subtest of variable-presentation-attribute.html is marked as failure,
  pending resolution of w3c/csswg-drafts#2605.

  font-parse-numeric-stretch-style-weight.html is updated to:

    * handle calc per spec (invalid at computed-value time), see
      w3c/csswg-drafts#2590

    * Accept 0% in font-stretch: w3c/csswg-drafts#2591

    * Accept font-weight descriptor ranges where the start is greater than the
      end, per
      https://drafts.csswg.org/css-fonts-4/#descdef-font-face-font-weight, which
      says:

      > User agents must swap the computed value of the startpoint and endpoint
      > of the range in order to forbid decreasing ranges.

  font-shorthand.html is updated to presumably fix a copy-paste error, where
  "oblique 45deg" was expected to compute to "oblique", which is wrong.

The rest is removing failure annotations.
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1436048
gecko-commit: b61541f85293fa3fddd7edfe9863624f9a56e92b
gecko-integration-branch: mozilla-inbound
gecko-reviewers: jwatt
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 2, 2019
…ts. r=jwatt

The test adjustments are:

  A subtest of variable-presentation-attribute.html is marked as failure,
  pending resolution of w3c/csswg-drafts#2605.

  font-parse-numeric-stretch-style-weight.html is updated to:

    * handle calc per spec (invalid at computed-value time), see
      w3c/csswg-drafts#2590

    * Accept 0% in font-stretch: w3c/csswg-drafts#2591

    * Accept font-weight descriptor ranges where the start is greater than the
      end, per
      https://drafts.csswg.org/css-fonts-4/#descdef-font-face-font-weight, which
      says:

      > User agents must swap the computed value of the startpoint and endpoint
      > of the range in order to forbid decreasing ranges.

  font-shorthand.html is updated to presumably fix a copy-paste error, where
  "oblique 45deg" was expected to compute to "oblique", which is wrong.

The rest is removing failure annotations.

MozReview-Commit-ID: CNJ3LG71KRj

UltraBlame original commit: b61541f85293fa3fddd7edfe9863624f9a56e92b
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 2, 2019
…ts. r=jwatt

The test adjustments are:

  A subtest of variable-presentation-attribute.html is marked as failure,
  pending resolution of w3c/csswg-drafts#2605.

  font-parse-numeric-stretch-style-weight.html is updated to:

    * handle calc per spec (invalid at computed-value time), see
      w3c/csswg-drafts#2590

    * Accept 0% in font-stretch: w3c/csswg-drafts#2591

    * Accept font-weight descriptor ranges where the start is greater than the
      end, per
      https://drafts.csswg.org/css-fonts-4/#descdef-font-face-font-weight, which
      says:

      > User agents must swap the computed value of the startpoint and endpoint
      > of the range in order to forbid decreasing ranges.

  font-shorthand.html is updated to presumably fix a copy-paste error, where
  "oblique 45deg" was expected to compute to "oblique", which is wrong.

The rest is removing failure annotations.

MozReview-Commit-ID: CNJ3LG71KRj

UltraBlame original commit: b61541f85293fa3fddd7edfe9863624f9a56e92b
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 2, 2019
…ts. r=jwatt

The test adjustments are:

  A subtest of variable-presentation-attribute.html is marked as failure,
  pending resolution of w3c/csswg-drafts#2605.

  font-parse-numeric-stretch-style-weight.html is updated to:

    * handle calc per spec (invalid at computed-value time), see
      w3c/csswg-drafts#2590

    * Accept 0% in font-stretch: w3c/csswg-drafts#2591

    * Accept font-weight descriptor ranges where the start is greater than the
      end, per
      https://drafts.csswg.org/css-fonts-4/#descdef-font-face-font-weight, which
      says:

      > User agents must swap the computed value of the startpoint and endpoint
      > of the range in order to forbid decreasing ranges.

  font-shorthand.html is updated to presumably fix a copy-paste error, where
  "oblique 45deg" was expected to compute to "oblique", which is wrong.

The rest is removing failure annotations.

MozReview-Commit-ID: CNJ3LG71KRj

UltraBlame original commit: b61541f85293fa3fddd7edfe9863624f9a56e92b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-fonts-4 Current Work
Projects
None yet
Development

No branches or pull requests

5 participants