mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
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
This commit is contained in:
parent
207ff730c2
commit
15f503d000
3 changed files with 25 additions and 4 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue