From 3418878dd60b4b262fea9e3a4631fada1ac36fe0 Mon Sep 17 00:00:00 2001 From: nainar Date: Sun, 20 Aug 2017 19:05:06 -0700 Subject: [PATCH 1/2] Add serialization for the following: margin margin-{bottom,left,right,top} --- css-typed-om/Overview.bs | 57 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/css-typed-om/Overview.bs b/css-typed-om/Overview.bs index 0e6033f0..0b13d591 100644 --- a/css-typed-om/Overview.bs +++ b/css-typed-om/Overview.bs @@ -302,6 +302,17 @@ The append(DOMString property, 4. Else, return `null`. +
+ To check if StylePropertyMap has a property, run these steps: + + 1. Run the algorithm to [=get a value from a StylePropertyMap=] with property property, + 1. If the algoritm returns a {{CSSStyleValue}} return true. + + 2. If the algorithm returns `null` return false. + +
+ +
To set a value on a StylePropertyMap, run these steps: @@ -2892,6 +2903,52 @@ depending on the property they came from: return "currentcolor". 2. Otherwise, return the result of serializing the <> value. +: 'margin' +:: + 1. Let |values| initially be the empty [=list=]. + 2. If 'margin-bottom' does not specify ''0'' for it's initial value, + serialize 'margin-bottom' and append it to |values|. + 3. If 'margin-left' does not specify ''0'' for it's initial value, + serialize 'margin-left' and append it to |values|. + 4. If 'margin-right' does not specify ''0'' for it's initial value, + serialize 'margin-right' and append it to |values|. + 5. If 'margin-top' does not specify ''0'' for it's initial value, + 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). + +: 'margin-bottom' +:: + 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 <> return the + result of serializing the <> 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 <> return the + result of serializing the <> 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 <> return the + result of serializing the <> 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 <> return the + result of serializing the <> value. Security Considerations {#security-considerations} From 98997e50a46f5a11d6ea2e6ad189ca54425f01e8 Mon Sep 17 00:00:00 2001 From: Naina Raisinghani Date: Tue, 22 Aug 2017 16:31:21 +1000 Subject: [PATCH 2/2] Collapsing serialization --- css-typed-om/Overview.bs | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/css-typed-om/Overview.bs b/css-typed-om/Overview.bs index 0b13d591..7f66a1f9 100644 --- a/css-typed-om/Overview.bs +++ b/css-typed-om/Overview.bs @@ -302,17 +302,6 @@ The append(DOMString property, 4. Else, return `null`.
-
- To check if StylePropertyMap has a property, run these steps: - - 1. Run the algorithm to [=get a value from a StylePropertyMap=] with property property, - 1. If the algoritm returns a {{CSSStyleValue}} return true. - - 2. If the algorithm returns `null` return false. - -
- -
To set a value on a StylePropertyMap, run these steps: @@ -2906,16 +2895,24 @@ depending on the property they came from: : 'margin' :: 1. Let |values| initially be the empty [=list=]. - 2. If 'margin-bottom' does not specify ''0'' for it's initial value, - serialize 'margin-bottom' and append it to |values|. - 3. If 'margin-left' does not specify ''0'' for it's initial value, - serialize 'margin-left' and append it to |values|. - 4. If 'margin-right' does not specify ''0'' for it's initial value, - serialize 'margin-right' and append it to |values|. - 5. If 'margin-top' does not specify ''0'' for it's initial value, - 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|, + 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'