Skip to content

[css-fonts] @font-palette-values rule has no object model #1655

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

Closed
svgeesus opened this issue Jul 27, 2017 · 10 comments
Closed

[css-fonts] @font-palette-values rule has no object model #1655

svgeesus opened this issue Jul 27, 2017 · 10 comments
Assignees
Labels
css-fonts-4 Current Work

Comments

@svgeesus
Copy link
Contributor

https://drafts.csswg.org/css-fonts-4/#font-palette-values

This rule needs an enumeration added, for example

partial interface CSSRule {
  const unsigned short FONT_PALETTE_VALUES_RULE = 15;
}

and a definition of the interface, something like:

interface CSSFontPaletteValuesRule : CSSRule {
  attribute CSSOMString fontFamily;
  attribute CSSOMString basePalette;
  attribute CSSOMRGBColor integer;
}

???? No idea how in WebIDL to declare an unbounded set of descriptors whose names are the set of integers. Would that be a map?

Nor how to declare that it is <color> not just the DOM 2 CSS RGBColor.

Also, those are really bad descriptor names, overly generic.

@svgeesus svgeesus added the css-fonts-4 Current Work label Jul 27, 2017
@tabatkins
Copy link
Member

No idea how in WebIDL to declare an unbounded set of descriptors whose names are the set of integers. Would that be a map?

Best way is to make the interface maplike, yeah, so you'd do palette.set(1, "red").

@litherum
Copy link
Contributor

litherum commented Mar 6, 2018

3009d53

@litherum litherum closed this as completed Mar 6, 2018
@tabatkins tabatkins reopened this Mar 6, 2018
@tabatkins
Copy link
Member

(Comment left on commit.)

@svgeesus
Copy link
Contributor Author

@tabatkins you said

This should definitely not be using the old DOM 2 Style classes. Make it just take a CSSOMString, with a manually-defined set() method that checks that it [=CSS/parses=] as a CSS value, and throws a TypeError if not.

Sounds like you know exactly what you want, but we aren't sure and this issue is languishing. Care to gives us something copy-pastable?

@tabatkins
Copy link
Member

The "old DOM 2 Style class" I was referring to was CSSOMRGBColor; that interface is long obsolete and should never be used for anything. Just drop it from the signature.

Then just define the error handling properly: use [=CSS/parse=] to parse it as a <color>, and if it returns failure, throw a SyntaxError.

@svgeesus
Copy link
Contributor Author

@tabatkins this was assigned to you my @litherum because, although you left hints on what needed to be done, neither of us was totally sure. Could uou make further comments so we can land the PR ?

@tabatkins
Copy link
Member

My last comment is exactly what you need to do.

CSSOMRGBColor; that interface is long obsolete and should never be used for anything. Just drop it from the signature.

and

use [=CSS/parse=] to parse it as a <color>, and if it returns failure, throw a SyntaxError.

rather than the existing vague "parsed as a solid color" wording. Plus it should throw on a parse error, not just return undefined and do nothing.

@svgeesus
Copy link
Contributor Author

I wasn't sure how to add to the interface to make it throw.

@tabatkins
Copy link
Member

Nothing on the interface. In the text, say:

[=throw=] a {{SyntaxError}}

@svgeesus
Copy link
Contributor Author

done

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

3 participants