diff options
author | Xidorn Quan <me@upsuper.org> | 2017-01-10 20:21:41 +1100 |
---|---|---|
committer | Xidorn Quan <me@upsuper.org> | 2017-01-11 11:17:58 +1100 |
commit | 2f2044e4b7dcb98872f91869d4f42b67d0c38a94 (patch) | |
tree | 5b39f5fe79137d0ce77a0ced37cabe5befe533a4 /components | |
parent | e494a0f0a731ce3917b82dceb670dac6e32c0611 (diff) | |
download | servo-2f2044e4b7dcb98872f91869d4f42b67d0c38a94.tar.gz servo-2f2044e4b7dcb98872f91869d4f42b67d0c38a94.zip |
Add gecko leagcy logical properties aliases
Diffstat (limited to 'components')
4 files changed, 16 insertions, 3 deletions
diff --git a/components/style/properties/data.py b/components/style/properties/data.py index c20a8b846d2..abec5947041 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -14,6 +14,14 @@ ALL_SIDES = [(side, False) for side in PHYSICAL_SIDES] + [(side, True) for side ALL_SIZES = [(size, False) for size in PHYSICAL_SIZES] + [(size, True) for size in LOGICAL_SIZES] +def maybe_moz_logical_alias(product, side, prop): + if product == "gecko" and side[1]: + axis, dir = side[0].split("-") + if axis == "inline": + return prop % dir + return None + + def to_rust_ident(name): name = name.replace("-", "_") if name in ["static", "super", "box", "move"]: # Rust keywords diff --git a/components/style/properties/longhand/border.mako.rs b/components/style/properties/longhand/border.mako.rs index 0da25f2a26b..3fc8f4624e2 100644 --- a/components/style/properties/longhand/border.mako.rs +++ b/components/style/properties/longhand/border.mako.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> -<% from data import Method, PHYSICAL_SIDES, ALL_SIDES %> +<% from data import Method, PHYSICAL_SIDES, ALL_SIDES, maybe_moz_logical_alias %> <% data.new_style_struct("Border", inherited=False, additional_methods=[Method("border_" + side + "_has_nonzero_width", @@ -18,6 +18,7 @@ % for side in ALL_SIDES: ${helpers.predefined_type("border-%s-color" % side[0], "CSSColor", "::cssparser::Color::CurrentColor", + alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-color"), spec=maybe_logical_spec(side, "color"), animatable=True, logical = side[1])} % endfor @@ -26,12 +27,14 @@ ${helpers.predefined_type("border-%s-style" % side[0], "BorderStyle", "specified::BorderStyle::none", needs_context=False, need_clone=True, + alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-style"), spec=maybe_logical_spec(side, "style"), animatable=False, logical = side[1])} % endfor % for side in ALL_SIDES: <%helpers:longhand name="border-${side[0]}-width" animatable="True" logical="${side[1]}" + alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-width") spec="${maybe_logical_spec(side, 'width')}"> use app_units::Au; use std::fmt; diff --git a/components/style/properties/longhand/margin.mako.rs b/components/style/properties/longhand/margin.mako.rs index 810386ae023..0875b4673c3 100644 --- a/components/style/properties/longhand/margin.mako.rs +++ b/components/style/properties/longhand/margin.mako.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> -<% from data import ALL_SIDES %> +<% from data import ALL_SIDES, maybe_moz_logical_alias %> <% data.new_style_struct("Margin", inherited=False) %> % for side in ALL_SIDES: @@ -14,5 +14,6 @@ %> ${helpers.predefined_type("margin-%s" % side[0], "LengthOrPercentageOrAuto", "computed::LengthOrPercentageOrAuto::Length(Au(0))", + alias=maybe_moz_logical_alias(product, side, "-moz-margin-%s"), animatable=True, logical = side[1], spec = spec)} % endfor diff --git a/components/style/properties/longhand/padding.mako.rs b/components/style/properties/longhand/padding.mako.rs index 1f029f53192..64ad713d616 100644 --- a/components/style/properties/longhand/padding.mako.rs +++ b/components/style/properties/longhand/padding.mako.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> -<% from data import ALL_SIDES %> +<% from data import ALL_SIDES, maybe_moz_logical_alias %> <% data.new_style_struct("Padding", inherited=False) %> % for side in ALL_SIDES: @@ -15,6 +15,7 @@ ${helpers.predefined_type("padding-%s" % side[0], "LengthOrPercentage", "computed::LengthOrPercentage::Length(Au(0))", "parse_non_negative", + alias=maybe_moz_logical_alias(product, side, "-moz-padding-%s"), needs_context=False, animatable=True, logical = side[1], |