-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2892,6 +2892,60 @@ depending on the property they came from: | |
return "currentcolor". | ||
2. Otherwise, return the result of serializing the <<color>> value. | ||
|
||
: 'margin' | ||
:: | ||
1. Let |values| initially be the empty [=list=]. | ||
2. If 'margin-top' does not specify ''0'' for its value, | ||
consider 'margin-top' to be |topValue| and append it to |values|. | ||
3. If 'margin-right' does not specify ''0'' for its value, | ||
consider 'margin-right' to be |rightValue|. | ||
4. If 'margin-bottom' does not specify ''0'' for its value, | ||
consider 'margin-bottom' to be |bottomValue|. | ||
5. If 'margin-left' does not specify ''0'' for its value, | ||
consider 'margin-left' to be |leftValue|. | ||
6. Append |rightValue| to |values| if one of the following conditions is true: | ||
1. |rightValue| and |topValue| are not equivalent, | ||
2. |topValue| and |bottomValue| are not equivalent | ||
3. Or |rightValue| and |leftValue| are not equivalent. | ||
7. Append |bottomValue| to |values| if one of the following conditions is true: | ||
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|. | ||
10. Return the result of concatenating all the items in |values|, | ||
separated by " " (U+0020 SPACE). | ||
|
||
: 'margin-bottom' | ||
:: | ||
1. If the value specifies ''0'', exit the algorithm. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Same applies to all the 'margin-*' properties. |
||
2. If the value is the ''inherit'' keyword, | ||
return "inherit". | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
3. If the value is of type <<margin-width>> return the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
result of serializing the <<margin-width>> value. | ||
|
||
: 'margin-left' | ||
:: | ||
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 | ||
result of serializing the <<margin-width>> value. | ||
|
||
: 'margin-right' | ||
:: | ||
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 | ||
result of serializing the <<margin-width>> value. | ||
|
||
: 'margin-top' | ||
:: | ||
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 | ||
result of serializing the <<margin-width>> value. | ||
|
||
|
||
Security Considerations {#security-considerations} | ||
|
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.