Permalink
Browse files

style: Add bindings for LengthPercentage, and use it for text-indent.

Which is the only property that uses LengthPercentage alone.

Differential Revision: https://phabricator.services.mozilla.com/D17737
  • Loading branch information...
emilio committed Jan 26, 2019
1 parent 207ff73 commit 15f503d000b5a995b53bf5064f2071fa794ea423
@@ -7,6 +7,8 @@ autogen_warning = """/* DO NOT MODIFY THIS MANUALLY! This file was generated usi
* a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
* 2. Run `rustup run nightly cbindgen toolkit/library/rust/ --lockfile Cargo.lock --crate style -o layout/style/ServoStyleConsts.h`
*/
#include "nsCoord.h"
#include "Units.h"
class nsAtom;
namespace mozilla {
namespace css {
@@ -27,7 +29,7 @@ namespaces = ["mozilla"]

[parse]
parse_deps = true
include = ["cssparser"]
include = ["cssparser", "style_traits"]

[struct]
derive_eq = true
@@ -71,3 +73,20 @@ include = [
"LengthPercentage",
]
item_types = ["enums", "structs", "typedefs"]

[export.body]
"LengthPercentage" = """
// Defined in nsStyleCoord.h
static inline StyleLengthPercentage Zero();
inline bool HasPercent() const;
inline bool ConvertsToLength() const;
inline nscoord ToLength() const;
inline bool ConvertsToPercentage() const;
inline float ToPercentage() const;
inline CSSCoord LengthInCSSPixels() const;
inline float Percentage() const;
inline CSSCoord ResolveToCSSPixels(CSSCoord aPercentageBasisInCSSPixels) const;
template<typename T> inline CSSCoord ResolveToCSSPixelsWith(T aPercentageGetter) const;
inline nscoord Resolve(nscoord aPercentageBasis) const;
template<typename T> inline nscoord ResolveWith(T aPercentageGetter) const;
"""
@@ -1389,7 +1389,7 @@ impl Clone for ${style_struct.gecko_struct_name} {
"FlexBasis": impl_style_coord,
"Length": impl_absolute_length,
"LengthOrNormal": impl_style_coord,
"LengthPercentage": impl_style_coord,
"LengthPercentage": impl_simple,
"LengthPercentageOrAuto": impl_style_coord,
"LengthPercentageOrNone": impl_style_coord,
"MaxLength": impl_style_coord,
@@ -73,11 +73,12 @@ impl ToComputedValue for specified::Length {
/// https://drafts.csswg.org/css-values-4/#typedef-length-percentage
#[allow(missing_docs)]
#[derive(Clone, Copy, Debug, MallocSizeOf, ToAnimatedZero)]
#[repr(C)]
pub struct LengthPercentage {
#[animation(constant)]
pub clamping_mode: AllowedNumericType,
length: Length,
percentage: Percentage,
#[animation(constant)]
pub clamping_mode: AllowedNumericType,
/// Whether we specified a percentage or not.
#[animation(constant)]
pub has_percentage: bool,
@@ -678,6 +679,7 @@ impl NonNegativeLengthPercentage {
ToAnimatedValue,
ToAnimatedZero,
)]
#[repr(C)]
pub struct CSSPixelLength(CSSFloat);

impl CSSPixelLength {

0 comments on commit 15f503d

Please sign in to comment.