mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
style: Derive more length stuff, and shrink MaxLength / MozLength's repr(C) representation.
This patch: * Makes LengthPercentageOrAuto generic, and removes a bunch of code fo LengthPercentageOrNone, which was used only for servo and now can use the normal MaxLength (with a cfg() guard for the ExtremumLength variant). * Shrinks MaxLength / MozLength's repr(C) reperesentation by reducing enum nesting. The shrinking is in preparation for using them from C++ too, though that'd be a different bug. * Moves NonNegative usage to the proper places so that stuff for them can be derived. I did this on top of bug 1523071 to prove both that it could be possible and that stuff wasn't too messy. It got a bit messy, but just because of a bug I had fixed in bindgen long time ago already, so this updates bindgen's patch version to grab a fix instead of ugly workarounds :) Differential Revision: https://phabricator.services.mozilla.com/D17762
This commit is contained in:
parent
8dad956513
commit
a68bc29b96
17 changed files with 337 additions and 520 deletions
|
@ -1390,7 +1390,6 @@ impl Clone for ${style_struct.gecko_struct_name} {
|
|||
"LengthOrNormal": impl_style_coord,
|
||||
"LengthPercentage": impl_simple,
|
||||
"LengthPercentageOrAuto": impl_style_coord,
|
||||
"LengthPercentageOrNone": impl_style_coord,
|
||||
"MaxLength": impl_style_coord,
|
||||
"MozLength": impl_style_coord,
|
||||
"MozScriptMinSize": impl_absolute_length,
|
||||
|
@ -3831,11 +3830,11 @@ fn static_assert() {
|
|||
BackgroundSize::Explicit { width: explicit_width, height: explicit_height } => {
|
||||
let mut w_type = nsStyleImageLayers_Size_DimensionType::eAuto;
|
||||
let mut h_type = nsStyleImageLayers_Size_DimensionType::eAuto;
|
||||
if let Some(w) = explicit_width.0.to_calc_value() {
|
||||
if let Some(w) = explicit_width.to_calc_value() {
|
||||
width = w;
|
||||
w_type = nsStyleImageLayers_Size_DimensionType::eLengthPercentage;
|
||||
}
|
||||
if let Some(h) = explicit_height.0.to_calc_value() {
|
||||
if let Some(h) = explicit_height.to_calc_value() {
|
||||
height = h;
|
||||
h_type = nsStyleImageLayers_Size_DimensionType::eLengthPercentage;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue