mirror of
https://github.com/servo/servo.git
synced 2025-09-07 13:38:20 +01:00
Auto merge of #12878 - Manishearth:clip-path, r=heycam
stylo: Support clip-path Todo: - [x] `set_clip_path` (probably needs a bunch of gecko bindings for running constructors/destructors) - [ ] Ensure that I've ordered the coordinates correctly - [ ] Check that it works - [x] Might want to convert NS_STYLE_FILL_RULE and NS_RADIUS to enum classes Depends on: - https://github.com/servo/rust-bindgen/pull/29 - https://github.com/Manishearth/gecko-dev/compare/servo:stylo...Manishearth:clip-path <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12878) <!-- Reviewable:end -->
This commit is contained in:
commit
609d47b44f
14 changed files with 627 additions and 14 deletions
|
@ -141,7 +141,8 @@ COMPILATION_TARGETS = {
|
|||
"nsStyleCoord::Calc", "nsRestyleHint", "ServoElementSnapshot",
|
||||
"nsChangeHint", "SheetParsingMode", "nsMainThreadPtrHandle",
|
||||
"nsMainThreadPtrHolder", "nscolor", "nsFont", "FontFamilyList",
|
||||
"FontFamilyType", "nsIAtom", "nsStyleContext"
|
||||
"FontFamilyType", "nsIAtom", "nsStyleContext", "StyleClipPath",
|
||||
"StyleBasicShapeType", "StyleBasicShape"
|
||||
],
|
||||
"void_types": [
|
||||
"nsINode", "nsIDocument", "nsIPrincipal", "nsIURI",
|
||||
|
|
|
@ -152,6 +152,9 @@ use structs::nsStyleContext;
|
|||
unsafe impl Send for nsStyleContext {}
|
||||
unsafe impl Sync for nsStyleContext {}
|
||||
impl HeapSizeOf for nsStyleContext { fn heap_size_of_children(&self) -> usize { 0 } }
|
||||
use structs::StyleClipPath;
|
||||
use structs::StyleBasicShapeType;
|
||||
use structs::StyleBasicShape;
|
||||
|
||||
pub type RawGeckoNode = nsINode;
|
||||
pub enum Element { }
|
||||
|
@ -326,6 +329,11 @@ extern "C" {
|
|||
pub fn Gecko_SetStyleCoordCalcValue(unit: *mut nsStyleUnit,
|
||||
value: *mut nsStyleUnion,
|
||||
calc: CalcValue);
|
||||
pub fn Gecko_CopyClipPathValueFrom(dst: *mut StyleClipPath,
|
||||
src: *const StyleClipPath);
|
||||
pub fn Gecko_DestroyClipPath(clip: *mut StyleClipPath);
|
||||
pub fn Gecko_NewBasicShape(type_: StyleBasicShapeType)
|
||||
-> *mut StyleBasicShape;
|
||||
pub fn Gecko_AddRefCalcArbitraryThread(aPtr: *mut Calc);
|
||||
pub fn Gecko_ReleaseCalcArbitraryThread(aPtr: *mut Calc);
|
||||
pub fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8, length: u32,
|
||||
|
|
|
@ -5452,7 +5452,7 @@ fn bindgen_test_layout_nsStyleSides() {
|
|||
assert_eq!(::std::mem::align_of::<nsStyleSides>() , 8usize);
|
||||
}
|
||||
/**
|
||||
* Class that represents a set of top-left/top-right/bottom-left/bottom-right
|
||||
* Class that represents a set of top-left/top-right/bottom-right/bottom-left
|
||||
* nsStyleCoord pairs. This is used to hold the dimensions of the
|
||||
* corners of a box (for, e.g., border-radius and outline-radius).
|
||||
*/
|
||||
|
@ -6375,8 +6375,7 @@ fn bindgen_test_layout_StyleAnimation() {
|
|||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct StyleBasicShape {
|
||||
pub mRefCnt: nsAutoRefCnt,
|
||||
pub _mOwningThread: nsAutoOwningThread,
|
||||
pub mRefCnt: ThreadSafeAutoRefCnt,
|
||||
pub mType: StyleBasicShapeType,
|
||||
pub mFillRule: StyleFillRule,
|
||||
pub mCoordinates: nsTArray<nsStyleCoord>,
|
||||
|
@ -6385,7 +6384,7 @@ pub struct StyleBasicShape {
|
|||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_StyleBasicShape() {
|
||||
assert_eq!(::std::mem::size_of::<StyleBasicShape>() , 128usize);
|
||||
assert_eq!(::std::mem::size_of::<StyleBasicShape>() , 120usize);
|
||||
assert_eq!(::std::mem::align_of::<StyleBasicShape>() , 8usize);
|
||||
}
|
||||
#[repr(C)]
|
||||
|
|
|
@ -5431,7 +5431,7 @@ fn bindgen_test_layout_nsStyleSides() {
|
|||
assert_eq!(::std::mem::align_of::<nsStyleSides>() , 8usize);
|
||||
}
|
||||
/**
|
||||
* Class that represents a set of top-left/top-right/bottom-left/bottom-right
|
||||
* Class that represents a set of top-left/top-right/bottom-right/bottom-left
|
||||
* nsStyleCoord pairs. This is used to hold the dimensions of the
|
||||
* corners of a box (for, e.g., border-radius and outline-radius).
|
||||
*/
|
||||
|
@ -6353,8 +6353,7 @@ fn bindgen_test_layout_StyleAnimation() {
|
|||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct StyleBasicShape {
|
||||
pub mRefCnt: nsAutoRefCnt,
|
||||
pub _mOwningThread: nsAutoOwningThread,
|
||||
pub mRefCnt: ThreadSafeAutoRefCnt,
|
||||
pub mType: StyleBasicShapeType,
|
||||
pub mFillRule: StyleFillRule,
|
||||
pub mCoordinates: nsTArray<nsStyleCoord>,
|
||||
|
@ -6363,7 +6362,7 @@ pub struct StyleBasicShape {
|
|||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_StyleBasicShape() {
|
||||
assert_eq!(::std::mem::size_of::<StyleBasicShape>() , 128usize);
|
||||
assert_eq!(::std::mem::size_of::<StyleBasicShape>() , 120usize);
|
||||
assert_eq!(::std::mem::align_of::<StyleBasicShape>() , 8usize);
|
||||
}
|
||||
#[repr(C)]
|
||||
|
|
|
@ -211,6 +211,17 @@ pub trait CoordDataMut : CoordData {
|
|||
*union = other.union();
|
||||
}
|
||||
|
||||
/// Useful for initializing uninits
|
||||
/// (set_value may segfault on uninits)
|
||||
fn leaky_set_null(&mut self) {
|
||||
use structs::nsStyleUnit::*;
|
||||
unsafe {
|
||||
let (unit, union) = self.values_mut();
|
||||
*unit = eStyleUnit_Null;
|
||||
*union.mInt.as_mut() = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn set_value(&mut self, value: CoordDataValue) {
|
||||
use self::CoordDataValue::*;
|
||||
|
|
|
@ -1172,6 +1172,8 @@ pub enum nsICSSAnonBoxPseudo {}
|
|||
pub static nsGkAtoms_minheight: *mut nsIAtom;
|
||||
#[link_name = "_ZN9nsGkAtoms13minimum_scaleE"]
|
||||
pub static nsGkAtoms_minimum_scale: *mut nsIAtom;
|
||||
#[link_name = "_ZN9nsGkAtoms9minlengthE"]
|
||||
pub static nsGkAtoms_minlength: *mut nsIAtom;
|
||||
#[link_name = "_ZN9nsGkAtoms6minposE"]
|
||||
pub static nsGkAtoms_minpos: *mut nsIAtom;
|
||||
#[link_name = "_ZN9nsGkAtoms9minusSignE"]
|
||||
|
@ -3838,6 +3840,8 @@ pub enum nsICSSAnonBoxPseudo {}
|
|||
pub static nsGkAtoms_onmozinterruptbegin: *mut nsIAtom;
|
||||
#[link_name = "_ZN9nsGkAtoms17onmozinterruptendE"]
|
||||
pub static nsGkAtoms_onmozinterruptend: *mut nsIAtom;
|
||||
#[link_name = "_ZN9nsGkAtoms14ondevicechangeE"]
|
||||
pub static nsGkAtoms_ondevicechange: *mut nsIAtom;
|
||||
#[link_name = "_ZN9nsGkAtoms12cdataTagNameE"]
|
||||
pub static nsGkAtoms_cdataTagName: *mut nsIAtom;
|
||||
#[link_name = "_ZN9nsGkAtoms14commentTagNameE"]
|
||||
|
@ -6083,6 +6087,8 @@ pub enum nsICSSAnonBoxPseudo {}
|
|||
pub static nsGkAtoms_minheight: *mut nsIAtom;
|
||||
#[link_name = "?minimum_scale@nsGkAtoms@@2PEAVnsIAtom@@EA"]
|
||||
pub static nsGkAtoms_minimum_scale: *mut nsIAtom;
|
||||
#[link_name = "?minlength@nsGkAtoms@@2PEAVnsIAtom@@EA"]
|
||||
pub static nsGkAtoms_minlength: *mut nsIAtom;
|
||||
#[link_name = "?minpos@nsGkAtoms@@2PEAVnsIAtom@@EA"]
|
||||
pub static nsGkAtoms_minpos: *mut nsIAtom;
|
||||
#[link_name = "?minusSign@nsGkAtoms@@2PEAVnsIAtom@@EA"]
|
||||
|
@ -8749,6 +8755,8 @@ pub enum nsICSSAnonBoxPseudo {}
|
|||
pub static nsGkAtoms_onmozinterruptbegin: *mut nsIAtom;
|
||||
#[link_name = "?onmozinterruptend@nsGkAtoms@@2PEAVnsIAtom@@EA"]
|
||||
pub static nsGkAtoms_onmozinterruptend: *mut nsIAtom;
|
||||
#[link_name = "?ondevicechange@nsGkAtoms@@2PEAVnsIAtom@@EA"]
|
||||
pub static nsGkAtoms_ondevicechange: *mut nsIAtom;
|
||||
#[link_name = "?cdataTagName@nsGkAtoms@@2PEAVnsIAtom@@EA"]
|
||||
pub static nsGkAtoms_cdataTagName: *mut nsIAtom;
|
||||
#[link_name = "?commentTagName@nsGkAtoms@@2PEAVnsIAtom@@EA"]
|
||||
|
@ -10994,6 +11002,8 @@ pub enum nsICSSAnonBoxPseudo {}
|
|||
pub static nsGkAtoms_minheight: *mut nsIAtom;
|
||||
#[link_name = "?minimum_scale@nsGkAtoms@@2PAVnsIAtom@@A"]
|
||||
pub static nsGkAtoms_minimum_scale: *mut nsIAtom;
|
||||
#[link_name = "?minlength@nsGkAtoms@@2PAVnsIAtom@@A"]
|
||||
pub static nsGkAtoms_minlength: *mut nsIAtom;
|
||||
#[link_name = "?minpos@nsGkAtoms@@2PAVnsIAtom@@A"]
|
||||
pub static nsGkAtoms_minpos: *mut nsIAtom;
|
||||
#[link_name = "?minusSign@nsGkAtoms@@2PAVnsIAtom@@A"]
|
||||
|
@ -13660,6 +13670,8 @@ pub enum nsICSSAnonBoxPseudo {}
|
|||
pub static nsGkAtoms_onmozinterruptbegin: *mut nsIAtom;
|
||||
#[link_name = "?onmozinterruptend@nsGkAtoms@@2PAVnsIAtom@@A"]
|
||||
pub static nsGkAtoms_onmozinterruptend: *mut nsIAtom;
|
||||
#[link_name = "?ondevicechange@nsGkAtoms@@2PAVnsIAtom@@A"]
|
||||
pub static nsGkAtoms_ondevicechange: *mut nsIAtom;
|
||||
#[link_name = "?cdataTagName@nsGkAtoms@@2PAVnsIAtom@@A"]
|
||||
pub static nsGkAtoms_cdataTagName: *mut nsIAtom;
|
||||
#[link_name = "?commentTagName@nsGkAtoms@@2PAVnsIAtom@@A"]
|
||||
|
@ -15332,6 +15344,7 @@ macro_rules! atom {
|
|||
("min") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::nsGkAtoms_min as *mut _) };
|
||||
("minheight") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::nsGkAtoms_minheight as *mut _) };
|
||||
("minimum-scale") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::nsGkAtoms_minimum_scale as *mut _) };
|
||||
("minlength") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::nsGkAtoms_minlength as *mut _) };
|
||||
("minpos") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::nsGkAtoms_minpos as *mut _) };
|
||||
("minus-sign") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::nsGkAtoms_minusSign as *mut _) };
|
||||
("minwidth") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::nsGkAtoms_minwidth as *mut _) };
|
||||
|
@ -16665,6 +16678,7 @@ macro_rules! atom {
|
|||
("ondevicelight") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::nsGkAtoms_ondevicelight as *mut _) };
|
||||
("onmozinterruptbegin") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::nsGkAtoms_onmozinterruptbegin as *mut _) };
|
||||
("onmozinterruptend") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::nsGkAtoms_onmozinterruptend as *mut _) };
|
||||
("ondevicechange") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::nsGkAtoms_ondevicechange as *mut _) };
|
||||
("#cdata-section") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::nsGkAtoms_cdataTagName as *mut _) };
|
||||
("#comment") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::nsGkAtoms_commentTagName as *mut _) };
|
||||
("#document") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::nsGkAtoms_documentNodeName as *mut _) };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue