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

Support shorthand property "all" #15055

Closed
upsuper opened this issue Jan 17, 2017 · 4 comments
Closed

Support shorthand property "all" #15055

upsuper opened this issue Jan 17, 2017 · 4 comments

Comments

@upsuper
Copy link
Member

@upsuper upsuper commented Jan 17, 2017

all is a shorthand property defined in css-cascade spec to set almost all of properties at the same time to a given CSS-wide keyword. So it is mainly a style system thing, which doesn't require any layout support.

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Jan 17, 2017

The naive way to implement this would be literally as described: expand it at parse time to hundreds of longhand declarations and cascade all of these.

But that sounds expensive, and it’s probably possible to be smarter about it. What does Gecko do?


Note:

https://drafts.csswg.org/css-variables/#defining-variables

Custom properties are not reset by the all property.

@emilio
Copy link
Member

@emilio emilio commented Jan 17, 2017

If we see the all property it seems we could do the following:

  • If the value is inherit, drop all our computed styles right now, and just clone the parent one, which is easy (except we need to unicode-bidi and direction if they were specified).
  • If the value is initial, do the same, just cloning from the default computed values instead.
  • If the value is unset, clone individual structs as needed from either the default computed values or the inherited values depending on whether it's a reset or an inherited struct.
@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Jan 17, 2017

If we see

There’s two separate phases: parsing, which is when other shorthands are expanded into their longhands, and cascading. So far, longhand declarations expanded from the same shorthand declaration casacde separately. But maybe we can treat all differently and have an All variant in the PropertyDeclaration enum? (Which so far only contains longhands and custom properties.)

@emilio
Copy link
Member

@emilio emilio commented Jan 17, 2017

Yeah, that looks reasonable to me, and it's what I had assumed when writing my comment above.

heycam added a commit to heycam/servo that referenced this issue Apr 13, 2017
heycam added a commit to heycam/servo that referenced this issue Apr 13, 2017
heycam added a commit to heycam/servo that referenced this issue Apr 14, 2017
heycam added a commit to heycam/servo that referenced this issue Apr 14, 2017
heycam added a commit to heycam/servo that referenced this issue Apr 14, 2017
stshine added a commit to stshine/servo that referenced this issue Apr 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.