-
Notifications
You must be signed in to change notification settings - Fork 142
Add serialization for the margin and margin-{bottom,left,right,top} #456
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
Conversation
margin margin-{bottom,left,right,top}
css-typed-om/Overview.bs
Outdated
</div> | ||
|
||
|
||
<div algorithm> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this doing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo. Removed.
css-typed-om/Overview.bs
Outdated
: 'margin' | ||
:: | ||
1. Let |values| initially be the empty [=list=]. | ||
2. If 'margin-bottom' does not specify ''0'' for it's initial value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
css-typed-om/Overview.bs
Outdated
serialize 'margin-top' and append it to |values|. | ||
6. If 'margin' is set to the ''inherit'' keyword, append "inherit" to |values|. | ||
7. Return the result of concatenating all the items in |values|, | ||
separated by " " (U+0020 SPACE). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many of the 4-length properties have collapsed versions when all the lengths (or some of the lengths) are the same. Do we currently serialize collapsed versions? Do other browsers? If there's consensus on collapsed serialization then we should spec that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked other browsers and fixed it to include collapsing. (Copied the Chrome implementation here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shans PTAL?
css-typed-om/Overview.bs
Outdated
</div> | ||
|
||
|
||
<div algorithm> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo. Removed.
css-typed-om/Overview.bs
Outdated
: 'margin' | ||
:: | ||
1. Let |values| initially be the empty [=list=]. | ||
2. If 'margin-bottom' does not specify ''0'' for it's initial value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
css-typed-om/Overview.bs
Outdated
serialize 'margin-top' and append it to |values|. | ||
6. If 'margin' is set to the ''inherit'' keyword, append "inherit" to |values|. | ||
7. Return the result of concatenating all the items in |values|, | ||
separated by " " (U+0020 SPACE). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked other browsers and fixed it to include collapsing. (Copied the Chrome implementation here)
|
||
: 'margin-bottom' | ||
:: | ||
1. If the value specifies ''0'', exit the algorithm. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exit and do what? When serializing 'margin-bottom', ''0px'' is still a valid value that needs to be serialized. The algorithm always needs to output a value.
(Also, in general, lengths need to be talked about in slightly more generic terms. It's not about specifying ''0'', it's about the <<length>>
value being equivalent to ''0px''.)
Same applies to all the 'margin-*' properties.
:: | ||
1. If the value specifies ''0'', exit the algorithm. | ||
2. If the value is the ''inherit'' keyword, | ||
return "inherit". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, we should address this at a higher level. This doesn't address any of the other global keywords, and every property allows the global keywords. Go ahead and cut this line entirely; we need to intervene for these keywords before getting to any specific property.
1. If the value specifies ''0'', exit the algorithm. | ||
2. If the value is the ''inherit'' keyword, | ||
return "inherit". | ||
3. If the value is of type <<margin-width>> return the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<<margin-width>>
isn't a type. It's either a <<length>>
or auto
; serialize these two branches.
1. |topValue| and |bottomValue| are not equivalent | ||
2. Or |rightValue| and |leftValue| are not equivalent. | ||
8. If |rightValue| and |leftValue| are not equivalent append |leftValue| to |values|. | ||
9. If 'margin' is set to the ''inherit'' keyword, append "inherit" to |values|. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like the sub-properties, cut this line. We'll deal with the global keywords generically.
@shans PTAL? Thanks!