Skip to content

Commit 27c11eb

Browse files
committed
servo: Merge #16334 - Stylo - support image-orientation property (from chenpighead:stylo-image-orientation-support); r=bholley
First, we need to make Servo's image-orientation parser to be agreed with Gecko's. Numbers without any AngleUnit, including unitless 0 angle, should be invalid for image-orientation. However, rotate() and skew() for transform properties accept unitless 0 angle. In order to make all these properties work properly, I fixed Angle::parse() to match Gecko. For the existing users of Angle::parse(), I create Angle::parse_with_unitless() and use it as an alternative for them. Once w3c/csswg-drafts#1162 is resolved, we shall be able to use an unified version of Angle::parse() then. The parser of image-orientation is also fixed to report parsing errors on empty string. Then, with the newly added binding functions support in Gecko side, we shall reuse the same methods from Gecko to pass the computed value from Servo to Gecko. Gecko bug: Bug 1341758 --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ Source-Repo: https://github.com/servo/servo Source-Revision: 2544c085214f368ec0a189bd8aefd7d83f75563b
1 parent a290019 commit 27c11eb

File tree

8 files changed

+150
-83
lines changed

8 files changed

+150
-83
lines changed

servo/components/style/gecko_bindings/bindings.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,18 @@ extern "C" {
704704
extern "C" {
705705
pub fn Gecko_CopyFontFamilyFrom(dst: *mut nsFont, src: *const nsFont);
706706
}
707+
extern "C" {
708+
pub fn Gecko_SetImageOrientation(aVisibility: *mut nsStyleVisibility,
709+
aRadians: f64, aFlip: bool);
710+
}
711+
extern "C" {
712+
pub fn Gecko_SetImageOrientationAsFromImage(aVisibility:
713+
*mut nsStyleVisibility);
714+
}
715+
extern "C" {
716+
pub fn Gecko_CopyImageOrientationFrom(aDst: *mut nsStyleVisibility,
717+
aSrc: *const nsStyleVisibility);
718+
}
707719
extern "C" {
708720
pub fn Gecko_SetListStyleType(style_struct: *mut nsStyleList, type_: u32);
709721
}

servo/components/style/gecko_bindings/structs_debug.rs

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23700,6 +23700,8 @@ pub mod root {
2370023700
pub mModeFlags: root::nsStyleImageRequest_Mode,
2370123701
pub mResolved: bool,
2370223702
}
23703+
pub type nsStyleImageRequest_URLValueData =
23704+
root::mozilla::css::URLValueData;
2370323705
#[repr(u8)]
2370423706
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2370523707
pub enum nsStyleImageRequest_Mode { Track = 1, Discard = 2, }
@@ -23758,6 +23760,7 @@ pub mod root {
2375823760
eStyleImageType_Image = 1,
2375923761
eStyleImageType_Gradient = 2,
2376023762
eStyleImageType_Element = 3,
23763+
eStyleImageType_URL = 4,
2376123764
}
2376223765
#[repr(C)]
2376323766
#[derive(Debug)]
@@ -23808,11 +23811,14 @@ pub mod root {
2380823811
pub mCropRect: root::mozilla::UniquePtr
2380923812
root::mozilla::DefaultDelete>,
2381023813
}
23814+
pub type nsStyleImage_URLValue = root::mozilla::css::URLValue;
23815+
pub type nsStyleImage_URLValueData = root::mozilla::css::URLValueData;
2381123816
#[repr(C)]
2381223817
#[derive(Debug, Copy)]
2381323818
pub struct nsStyleImage__bindgen_ty_1 {
2381423819
pub mImage: root::__BindgenUnionField<*mut root::nsStyleImageRequest>,
2381523820
pub mGradient: root::__BindgenUnionField<*mut root::nsStyleGradient>,
23821+
pub mURLValue: root::__BindgenUnionField<*mut root::nsStyleImage_URLValue>,
2381623822
pub mElementId: root::__BindgenUnionField<*mut u16>,
2381723823
pub bindgen_union_field: u64,
2381823824
}
@@ -23838,6 +23844,12 @@ pub mod root {
2383823844
"Alignment of field: " , stringify ! (
2383923845
nsStyleImage__bindgen_ty_1 ) , "::" , stringify ! (
2384023846
mGradient ) ));
23847+
assert_eq! (unsafe {
23848+
& ( * ( 0 as * const nsStyleImage__bindgen_ty_1 ) ) .
23849+
mURLValue as * const _ as usize } , 0usize , concat ! (
23850+
"Alignment of field: " , stringify ! (
23851+
nsStyleImage__bindgen_ty_1 ) , "::" , stringify ! (
23852+
mURLValue ) ));
2384123853
assert_eq! (unsafe {
2384223854
& ( * ( 0 as * const nsStyleImage__bindgen_ty_1 ) ) .
2384323855
mElementId as * const _ as usize } , 0usize , concat ! (
@@ -24066,7 +24078,6 @@ pub mod root {
2406624078
#[derive(Debug)]
2406724079
pub struct nsStyleImageLayers_Layer {
2406824080
pub mImage: root::nsStyleImage,
24069-
pub mSourceURI: root::RefPtr,
2407024081
pub mPosition: root::mozilla::Position,
2407124082
pub mSize: root::nsStyleImageLayers_Size,
2407224083
pub mClip: root::nsStyleImageLayers_Layer_StyleGeometryBox,
@@ -24081,8 +24092,8 @@ pub mod root {
2408124092
nsStyleImageLayers_Layer_StyleGeometryBox;
2408224093
#[test]
2408324094
fn bindgen_test_layout_nsStyleImageLayers_Layer() {
24084-
assert_eq!(::std::mem::size_of::() ,
24085-
104usize , concat ! (
24095+
assert_eq!(::std::mem::size_of::() , 96usize
24096+
, concat ! (
2408624097
"Size of: " , stringify ! ( nsStyleImageLayers_Layer ) ));
2408724098
assert_eq! (::std::mem::align_of::() ,
2408824099
8usize , concat ! (
@@ -24096,61 +24107,55 @@ pub mod root {
2409624107
));
2409724108
assert_eq! (unsafe {
2409824109
& ( * ( 0 as * const nsStyleImageLayers_Layer ) ) .
24099-
mSourceURI as * const _ as usize } , 32usize , concat ! (
24100-
"Alignment of field: " , stringify ! (
24101-
nsStyleImageLayers_Layer ) , "::" , stringify ! (
24102-
mSourceURI ) ));
24103-
assert_eq! (unsafe {
24104-
& ( * ( 0 as * const nsStyleImageLayers_Layer ) ) .
24105-
mPosition as * const _ as usize } , 40usize , concat ! (
24110+
mPosition as * const _ as usize } , 32usize , concat ! (
2410624111
"Alignment of field: " , stringify ! (
2410724112
nsStyleImageLayers_Layer ) , "::" , stringify ! (
2410824113
mPosition ) ));
2410924114
assert_eq! (unsafe {
2411024115
& ( * ( 0 as * const nsStyleImageLayers_Layer ) ) . mSize
24111-
as * const _ as usize } , 64usize , concat ! (
24116+
as * const _ as usize } , 56usize , concat ! (
2411224117
"Alignment of field: " , stringify ! (
2411324118
nsStyleImageLayers_Layer ) , "::" , stringify ! ( mSize )
2411424119
));
2411524120
assert_eq! (unsafe {
2411624121
& ( * ( 0 as * const nsStyleImageLayers_Layer ) ) . mClip
24117-
as * const _ as usize } , 92usize , concat ! (
24122+
as * const _ as usize } , 84usize , concat ! (
2411824123
"Alignment of field: " , stringify ! (
2411924124
nsStyleImageLayers_Layer ) , "::" , stringify ! ( mClip )
2412024125
));
2412124126
assert_eq! (unsafe {
2412224127
& ( * ( 0 as * const nsStyleImageLayers_Layer ) ) .
24123-
mOrigin as * const _ as usize } , 93usize , concat ! (
24128+
mOrigin as * const _ as usize } , 85usize , concat ! (
2412424129
"Alignment of field: " , stringify ! (
2412524130
nsStyleImageLayers_Layer ) , "::" , stringify ! ( mOrigin
2412624131
) ));
2412724132
assert_eq! (unsafe {
2412824133
& ( * ( 0 as * const nsStyleImageLayers_Layer ) ) .
24129-
mAttachment as * const _ as usize } , 94usize , concat ! (
24134+
mAttachment as * const _ as usize } , 86usize , concat ! (
2413024135
"Alignment of field: " , stringify ! (
2413124136
nsStyleImageLayers_Layer ) , "::" , stringify ! (
2413224137
mAttachment ) ));
2413324138
assert_eq! (unsafe {
2413424139
& ( * ( 0 as * const nsStyleImageLayers_Layer ) ) .
24135-
mBlendMode as * const _ as usize } , 95usize , concat ! (
24140+
mBlendMode as * const _ as usize } , 87usize , concat ! (
2413624141
"Alignment of field: " , stringify ! (
2413724142
nsStyleImageLayers_Layer ) , "::" , stringify ! (
2413824143
mBlendMode ) ));
2413924144
assert_eq! (unsafe {
2414024145
& ( * ( 0 as * const nsStyleImageLayers_Layer ) ) .
24141-
mComposite as * const _ as usize } , 96usize , concat ! (
24146+
mComposite as * const _ as usize } , 88usize , concat ! (
2414224147
"Alignment of field: " , stringify ! (
2414324148
nsStyleImageLayers_Layer ) , "::" , stringify ! (
2414424149
mComposite ) ));
2414524150
assert_eq! (unsafe {
2414624151
& ( * ( 0 as * const nsStyleImageLayers_Layer ) ) .
24147-
mMaskMode as * const _ as usize } , 97usize , concat ! (
24152+
mMaskMode as * const _ as usize } , 89usize , concat ! (
2414824153
"Alignment of field: " , stringify ! (
2414924154
nsStyleImageLayers_Layer ) , "::" , stringify ! (
2415024155
mMaskMode ) ));
2415124156
assert_eq! (unsafe {
2415224157
& ( * ( 0 as * const nsStyleImageLayers_Layer ) ) .
24153-
mRepeat as * const _ as usize } , 98usize , concat ! (
24158+
mRepeat as * const _ as usize } , 90usize , concat ! (
2415424159
"Alignment of field: " , stringify ! (
2415524160
nsStyleImageLayers_Layer ) , "::" , stringify ! ( mRepeat
2415624161
) ));
@@ -24167,7 +24172,7 @@ pub mod root {
2416724172
}
2416824173
#[test]
2416924174
fn bindgen_test_layout_nsStyleImageLayers() {
24170-
assert_eq!(::std::mem::size_of::() , 160usize ,
24175+
assert_eq!(::std::mem::size_of::() , 152usize ,
2417124176
concat ! ( "Size of: " , stringify ! ( nsStyleImageLayers )
2417224177
));
2417324178
assert_eq! (::std::mem::align_of::() , 8usize ,
@@ -24248,7 +24253,7 @@ pub mod root {
2424824253
}
2424924254
#[test]
2425024255
fn bindgen_test_layout_nsStyleBackground() {
24251-
assert_eq!(::std::mem::size_of::() , 168usize ,
24256+
assert_eq!(::std::mem::size_of::() , 160usize ,
2425224257
concat ! ( "Size of: " , stringify ! ( nsStyleBackground )
2425324258
));
2425424259
assert_eq! (::std::mem::align_of::() , 8usize ,
@@ -24261,7 +24266,7 @@ pub mod root {
2426124266
, "::" , stringify ! ( mImage ) ));
2426224267
assert_eq! (unsafe {
2426324268
& ( * ( 0 as * const nsStyleBackground ) ) .
24264-
mBackgroundColor as * const _ as usize } , 160usize ,
24269+
mBackgroundColor as * const _ as usize } , 152usize ,
2426524270
concat ! (
2426624271
"Alignment of field: " , stringify ! ( nsStyleBackground )
2426724272
, "::" , stringify ! ( mBackgroundColor ) ));
@@ -26362,7 +26367,7 @@ pub mod root {
2636226367
}
2636326368
#[test]
2636426369
fn bindgen_test_layout_nsStyleSVGReset() {
26365-
assert_eq!(::std::mem::size_of::() , 200usize ,
26370+
assert_eq!(::std::mem::size_of::() , 192usize ,
2636626371
concat ! ( "Size of: " , stringify ! ( nsStyleSVGReset )
2636726372
));
2636826373
assert_eq! (::std::mem::align_of::() , 8usize ,
@@ -26375,48 +26380,48 @@ pub mod root {
2637526380
"::" , stringify ! ( mMask ) ));
2637626381
assert_eq! (unsafe {
2637726382
& ( * ( 0 as * const nsStyleSVGReset ) ) . mClipPath as *
26378-
const _ as usize } , 160usize , concat ! (
26383+
const _ as usize } , 152usize , concat ! (
2637926384
"Alignment of field: " , stringify ! ( nsStyleSVGReset ) ,
2638026385
"::" , stringify ! ( mClipPath ) ));
2638126386
assert_eq! (unsafe {
2638226387
& ( * ( 0 as * const nsStyleSVGReset ) ) . mStopColor as *
26383-
const _ as usize } , 176usize , concat ! (
26388+
const _ as usize } , 168usize , concat ! (
2638426389
"Alignment of field: " , stringify ! ( nsStyleSVGReset ) ,
2638526390
"::" , stringify ! ( mStopColor ) ));
2638626391
assert_eq! (unsafe {
2638726392
& ( * ( 0 as * const nsStyleSVGReset ) ) . mFloodColor as
26388-
* const _ as usize } , 180usize , concat ! (
26393+
* const _ as usize } , 172usize , concat ! (
2638926394
"Alignment of field: " , stringify ! ( nsStyleSVGReset ) ,
2639026395
"::" , stringify ! ( mFloodColor ) ));
2639126396
assert_eq! (unsafe {
2639226397
& ( * ( 0 as * const nsStyleSVGReset ) ) . mLightingColor
26393-
as * const _ as usize } , 184usize , concat ! (
26398+
as * const _ as usize } , 176usize , concat ! (
2639426399
"Alignment of field: " , stringify ! ( nsStyleSVGReset ) ,
2639526400
"::" , stringify ! ( mLightingColor ) ));
2639626401
assert_eq! (unsafe {
2639726402
& ( * ( 0 as * const nsStyleSVGReset ) ) . mStopOpacity as
26398-
* const _ as usize } , 188usize , concat ! (
26403+
* const _ as usize } , 180usize , concat ! (
2639926404
"Alignment of field: " , stringify ! ( nsStyleSVGReset ) ,
2640026405
"::" , stringify ! ( mStopOpacity ) ));
2640126406
assert_eq! (unsafe {
2640226407
& ( * ( 0 as * const nsStyleSVGReset ) ) . mFloodOpacity
26403-
as * const _ as usize } , 192usize , concat ! (
26408+
as * const _ as usize } , 184usize , concat ! (
2640426409
"Alignment of field: " , stringify ! ( nsStyleSVGReset ) ,
2640526410
"::" , stringify ! ( mFloodOpacity ) ));
2640626411
assert_eq! (unsafe {
2640726412
& ( * ( 0 as * const nsStyleSVGReset ) ) .
26408-
mDominantBaseline as * const _ as usize } , 196usize ,
26413+
mDominantBaseline as * const _ as usize } , 188usize ,
2640926414
concat ! (
2641026415
"Alignment of field: " , stringify ! ( nsStyleSVGReset ) ,
2641126416
"::" , stringify ! ( mDominantBaseline ) ));
2641226417
assert_eq! (unsafe {
2641326418
& ( * ( 0 as * const nsStyleSVGReset ) ) . mVectorEffect
26414-
as * const _ as usize } , 197usize , concat ! (
26419+
as * const _ as usize } , 189usize , concat ! (
2641526420
"Alignment of field: " , stringify ! ( nsStyleSVGReset ) ,
2641626421
"::" , stringify ! ( mVectorEffect ) ));
2641726422
assert_eq! (unsafe {
2641826423
& ( * ( 0 as * const nsStyleSVGReset ) ) . mMaskType as *
26419-
const _ as usize } , 198usize , concat ! (
26424+
const _ as usize } , 190usize , concat ! (
2642026425
"Alignment of field: " , stringify ! ( nsStyleSVGReset ) ,
2642126426
"::" , stringify ! ( mMaskType ) ));
2642226427
}

0 commit comments

Comments
 (0)