зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #10848 - Add Servo_GetStyleFoo functions to get style structs from GeckoComputedValues (from heycam:struct-accessor); r=bholley
r?@bholley Source-Repo: https://github.com/servo/servo Source-Revision: e079e01320cf4b0f80c7d6307cf6d53fe7703ec4
This commit is contained in:
Родитель
497a8b7fd3
Коммит
55fc6c831d
|
@ -98,7 +98,7 @@ class Method(object):
|
||||||
|
|
||||||
|
|
||||||
class StyleStruct(object):
|
class StyleStruct(object):
|
||||||
def __init__(self, name, inherited, gecko_ffi_name=None, additional_methods=None):
|
def __init__(self, name, inherited, gecko_name=None, additional_methods=None):
|
||||||
self.servo_struct_name = "Servo" + name
|
self.servo_struct_name = "Servo" + name
|
||||||
self.gecko_struct_name = "Gecko" + name
|
self.gecko_struct_name = "Gecko" + name
|
||||||
self.trait_name = name
|
self.trait_name = name
|
||||||
|
@ -106,7 +106,8 @@ class StyleStruct(object):
|
||||||
self.ident = to_rust_ident(self.trait_name_lower)
|
self.ident = to_rust_ident(self.trait_name_lower)
|
||||||
self.longhands = []
|
self.longhands = []
|
||||||
self.inherited = inherited
|
self.inherited = inherited
|
||||||
self.gecko_ffi_name = gecko_ffi_name
|
self.gecko_name = gecko_name or name
|
||||||
|
self.gecko_ffi_name = "nsStyle" + self.gecko_name
|
||||||
self.additional_methods = additional_methods or []
|
self.additional_methods = additional_methods or []
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
<% data.new_style_struct("Background", inherited=False, gecko_ffi_name="nsStyleBackground") %>
|
<% data.new_style_struct("Background", inherited=False) %>
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"background-color", "CSSColor",
|
"background-color", "CSSColor",
|
||||||
"::cssparser::Color::RGBA(::cssparser::RGBA { red: 0., green: 0., blue: 0., alpha: 0. }) /* transparent */")}
|
"::cssparser::Color::RGBA(::cssparser::RGBA { red: 0., green: 0., blue: 0., alpha: 0. }) /* transparent */")}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
<% from data import Method %>
|
<% from data import Method %>
|
||||||
|
|
||||||
<% data.new_style_struct("Border", inherited=False, gecko_ffi_name="nsStyleBorder",
|
<% data.new_style_struct("Border", inherited=False,
|
||||||
additional_methods=[Method("border_" + side + "_has_nonzero_width",
|
additional_methods=[Method("border_" + side + "_has_nonzero_width",
|
||||||
"bool") for side in ["top", "right", "bottom", "left"]]) %>
|
"bool") for side in ["top", "right", "bottom", "left"]]) %>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<% data.new_style_struct("Box",
|
<% data.new_style_struct("Box",
|
||||||
inherited=False,
|
inherited=False,
|
||||||
gecko_ffi_name="nsStyleDisplay",
|
gecko_name="Display",
|
||||||
additional_methods=[Method("transition_count", "usize")]) %>
|
additional_methods=[Method("transition_count", "usize")]) %>
|
||||||
|
|
||||||
// TODO(SimonSapin): don't parse `inline-table`, since we don't support it
|
// TODO(SimonSapin): don't parse `inline-table`, since we don't support it
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
<% data.new_style_struct("Color", inherited=True, gecko_ffi_name="nsStyleColor") %>
|
<% data.new_style_struct("Color", inherited=True) %>
|
||||||
|
|
||||||
<%helpers:raw_longhand name="color" need_clone="True">
|
<%helpers:raw_longhand name="color" need_clone="True">
|
||||||
use cssparser::Color as CSSParserColor;
|
use cssparser::Color as CSSParserColor;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
<% data.new_style_struct("Column", inherited=False, gecko_ffi_name="nsStyleColumn") %>
|
<% data.new_style_struct("Column", inherited=False) %>
|
||||||
|
|
||||||
<%helpers:longhand name="column-width" experimental="True">
|
<%helpers:longhand name="column-width" experimental="True">
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
<% data.new_style_struct("Counters", inherited=False, gecko_ffi_name="nsStyleContent") %>
|
<% data.new_style_struct("Counters", inherited=False, gecko_name="Content") %>
|
||||||
|
|
||||||
<%helpers:longhand name="content">
|
<%helpers:longhand name="content">
|
||||||
use cssparser::Token;
|
use cssparser::Token;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
// Box-shadow, etc.
|
// Box-shadow, etc.
|
||||||
<% data.new_style_struct("Effects", inherited=False, gecko_ffi_name="nsStyleEffects") %>
|
<% data.new_style_struct("Effects", inherited=False) %>
|
||||||
|
|
||||||
<%helpers:longhand name="opacity">
|
<%helpers:longhand name="opacity">
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
<% data.new_style_struct("Font",
|
<% data.new_style_struct("Font",
|
||||||
inherited=True,
|
inherited=True,
|
||||||
gecko_ffi_name="nsStyleFont",
|
|
||||||
additional_methods=[Method("compute_font_hash", is_mut=True)]) %>
|
additional_methods=[Method("compute_font_hash", is_mut=True)]) %>
|
||||||
<%helpers:longhand name="font-family">
|
<%helpers:longhand name="font-family">
|
||||||
use self::computed_value::FontFamily;
|
use self::computed_value::FontFamily;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
<% data.new_style_struct("InheritedBox", inherited=True, gecko_ffi_name="nsStyleVisibility") %>
|
<% data.new_style_struct("InheritedBox", inherited=True, gecko_name="Visibility") %>
|
||||||
|
|
||||||
${helpers.single_keyword("direction", "ltr rtl", need_clone=True)}
|
${helpers.single_keyword("direction", "ltr rtl", need_clone=True)}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
<% data.new_style_struct("InheritedTable", inherited=True, gecko_ffi_name="nsStyleTableBorder") %>
|
<% data.new_style_struct("InheritedTable", inherited=True, gecko_name="TableBorder") %>
|
||||||
|
|
||||||
${helpers.single_keyword("border-collapse", "separate collapse", gecko_constant_prefix="NS_STYLE_BORDER")}
|
${helpers.single_keyword("border-collapse", "separate collapse", gecko_constant_prefix="NS_STYLE_BORDER")}
|
||||||
${helpers.single_keyword("empty-cells", "show hide", gecko_constant_prefix="NS_STYLE_TABLE_EMPTY_CELLS")}
|
${helpers.single_keyword("empty-cells", "show hide", gecko_constant_prefix="NS_STYLE_TABLE_EMPTY_CELLS")}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
<% data.new_style_struct("InheritedText", inherited=True, gecko_ffi_name="nsStyleText") %>
|
<% data.new_style_struct("InheritedText", inherited=True, gecko_name="Text") %>
|
||||||
|
|
||||||
<%helpers:longhand name="line-height">
|
<%helpers:longhand name="line-height">
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
<% data.new_style_struct("List", inherited=True, gecko_ffi_name="nsStyleList") %>
|
<% data.new_style_struct("List", inherited=True) %>
|
||||||
|
|
||||||
${helpers.single_keyword("list-style-position", "outside inside")}
|
${helpers.single_keyword("list-style-position", "outside inside")}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
<% data.new_style_struct("Margin", inherited=False, gecko_ffi_name="nsStyleMargin") %>
|
<% data.new_style_struct("Margin", inherited=False) %>
|
||||||
|
|
||||||
% for side in ["top", "right", "bottom", "left"]:
|
% for side in ["top", "right", "bottom", "left"]:
|
||||||
${helpers.predefined_type("margin-" + side, "LengthOrPercentageOrAuto",
|
${helpers.predefined_type("margin-" + side, "LengthOrPercentageOrAuto",
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
<% data.new_style_struct("Outline",
|
<% data.new_style_struct("Outline",
|
||||||
inherited=False,
|
inherited=False,
|
||||||
gecko_ffi_name="nsStyleOutline",
|
|
||||||
additional_methods=[Method("outline_has_nonzero_width", "bool")]) %>
|
additional_methods=[Method("outline_has_nonzero_width", "bool")]) %>
|
||||||
|
|
||||||
// TODO(pcwalton): `invert`
|
// TODO(pcwalton): `invert`
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
<% data.new_style_struct("Padding", inherited=False, gecko_ffi_name="nsStylePadding") %>
|
<% data.new_style_struct("Padding", inherited=False) %>
|
||||||
|
|
||||||
% for side in ["top", "right", "bottom", "left"]:
|
% for side in ["top", "right", "bottom", "left"]:
|
||||||
${helpers.predefined_type("padding-" + side, "LengthOrPercentage",
|
${helpers.predefined_type("padding-" + side, "LengthOrPercentage",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
<% data.new_style_struct("Pointing", inherited=True, gecko_ffi_name="nsStyleUserInterface") %>
|
<% data.new_style_struct("Pointing", inherited=True, gecko_name="UserInterface") %>
|
||||||
|
|
||||||
<%helpers:longhand name="cursor">
|
<%helpers:longhand name="cursor">
|
||||||
pub use self::computed_value::T as SpecifiedValue;
|
pub use self::computed_value::T as SpecifiedValue;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
<% data.new_style_struct("Position", inherited=False, gecko_ffi_name="nsStylePosition") %>
|
<% data.new_style_struct("Position", inherited=False) %>
|
||||||
|
|
||||||
% for side in ["top", "right", "bottom", "left"]:
|
% for side in ["top", "right", "bottom", "left"]:
|
||||||
${helpers.predefined_type(side, "LengthOrPercentageOrAuto",
|
${helpers.predefined_type(side, "LengthOrPercentageOrAuto",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
<% data.new_style_struct("SVG", inherited=False, gecko_ffi_name="nsStyleSVGReset") %>
|
<% data.new_style_struct("SVG", inherited=False, gecko_name="SVGReset") %>
|
||||||
|
|
||||||
${helpers.single_keyword("dominant-baseline",
|
${helpers.single_keyword("dominant-baseline",
|
||||||
"""auto use-script no-change reset-size ideographic alphabetic hanging
|
"""auto use-script no-change reset-size ideographic alphabetic hanging
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// https://www.w3.org/TR/SVG/
|
// https://www.w3.org/TR/SVG/
|
||||||
<% data.new_style_struct("SVGInherited",
|
<% data.new_style_struct("SVGInherited",
|
||||||
inherited=True,
|
inherited=True,
|
||||||
gecko_ffi_name="nsStyleSVG") %>
|
gecko_name="SVG") %>
|
||||||
|
|
||||||
// Section 10 - Text
|
// Section 10 - Text
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
<% data.new_style_struct("Table", inherited=False, gecko_ffi_name="nsStyleTable") %>
|
<% data.new_style_struct("Table", inherited=False) %>
|
||||||
|
|
||||||
${helpers.single_keyword("table-layout", "auto fixed", gecko_ffi_name="mLayoutStrategy")}
|
${helpers.single_keyword("table-layout", "auto fixed", gecko_ffi_name="mLayoutStrategy")}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<% data.new_style_struct("Text",
|
<% data.new_style_struct("Text",
|
||||||
inherited=False,
|
inherited=False,
|
||||||
gecko_ffi_name="nsStyleTextReset",
|
gecko_name="TextReset",
|
||||||
additional_methods=[Method("has_underline", "bool"),
|
additional_methods=[Method("has_underline", "bool"),
|
||||||
Method("has_overline", "bool"),
|
Method("has_overline", "bool"),
|
||||||
Method("has_line_through", "bool")]) %>
|
Method("has_line_through", "bool")]) %>
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
<% from data import Method %>
|
||||||
|
|
||||||
|
// CSS Basic User Interface Module Level 1
|
||||||
|
// https://drafts.csswg.org/css-ui-3/
|
||||||
|
<% data.new_style_struct("UI", inherited=False, gecko_name="UIReset") %>
|
||||||
|
|
||||||
|
${helpers.single_keyword("ime-mode", "normal auto active disabled inactive", products="gecko",
|
||||||
|
gecko_ffi_name="mIMEMode")}
|
|
@ -0,0 +1,12 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
<% from data import Method %>
|
||||||
|
|
||||||
|
// Non-standard properties that Gecko uses for XUL elements.
|
||||||
|
<% data.new_style_struct("XUL", inherited=False) %>
|
||||||
|
|
||||||
|
${helpers.single_keyword("-moz-box-align", "stretch start center baseline end", products="gecko",
|
||||||
|
gecko_ffi_name="mBoxAlign", gecko_constant_prefix="NS_STYLE_BOX_ALIGN")}
|
|
@ -66,8 +66,10 @@ pub mod longhands {
|
||||||
<%include file="/longhand/position.mako.rs" />
|
<%include file="/longhand/position.mako.rs" />
|
||||||
<%include file="/longhand/table.mako.rs" />
|
<%include file="/longhand/table.mako.rs" />
|
||||||
<%include file="/longhand/text.mako.rs" />
|
<%include file="/longhand/text.mako.rs" />
|
||||||
|
<%include file="/longhand/ui.mako.rs" />
|
||||||
<%include file="/longhand/svg_inherited.mako.rs" />
|
<%include file="/longhand/svg_inherited.mako.rs" />
|
||||||
<%include file="/longhand/svg.mako.rs" />
|
<%include file="/longhand/svg.mako.rs" />
|
||||||
|
<%include file="/longhand/xul.mako.rs" />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -92,29 +92,29 @@ pub extern "C" fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ArcHelpers<GeckoType, ServoType> {
|
pub struct ArcHelpers<GeckoType, ServoType> {
|
||||||
phantom1: PhantomData<GeckoType>,
|
phantom1: PhantomData<GeckoType>,
|
||||||
phantom2: PhantomData<ServoType>,
|
phantom2: PhantomData<ServoType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<GeckoType, ServoType> ArcHelpers<GeckoType, ServoType> {
|
impl<GeckoType, ServoType> ArcHelpers<GeckoType, ServoType> {
|
||||||
fn with<F, Output>(raw: *mut GeckoType, cb: F) -> Output
|
pub fn with<F, Output>(raw: *mut GeckoType, cb: F) -> Output
|
||||||
where F: FnOnce(&Arc<ServoType>) -> Output {
|
where F: FnOnce(&Arc<ServoType>) -> Output {
|
||||||
let owned = unsafe { Self::into(raw) };
|
let owned = unsafe { Self::into(raw) };
|
||||||
let result = cb(&owned);
|
let result = cb(&owned);
|
||||||
forget(owned);
|
forget(owned);
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn into(ptr: *mut GeckoType) -> Arc<ServoType> {
|
pub unsafe fn into(ptr: *mut GeckoType) -> Arc<ServoType> {
|
||||||
transmute(ptr)
|
transmute(ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn addref(ptr: *mut GeckoType) {
|
pub unsafe fn addref(ptr: *mut GeckoType) {
|
||||||
Self::with(ptr, |arc| forget(arc.clone()));
|
Self::with(ptr, |arc| forget(arc.clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn release(ptr: *mut GeckoType) {
|
pub unsafe fn release(ptr: *mut GeckoType) {
|
||||||
let _ = Self::into(ptr);
|
let _ = Self::into(ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,14 +11,13 @@
|
||||||
|
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
% for style_struct in data.style_structs:
|
% for style_struct in data.style_structs:
|
||||||
%if style_struct.gecko_ffi_name:
|
|
||||||
use gecko_style_structs::${style_struct.gecko_ffi_name};
|
use gecko_style_structs::${style_struct.gecko_ffi_name};
|
||||||
use bindings::Gecko_Construct_${style_struct.gecko_ffi_name};
|
use bindings::Gecko_Construct_${style_struct.gecko_ffi_name};
|
||||||
use bindings::Gecko_CopyConstruct_${style_struct.gecko_ffi_name};
|
use bindings::Gecko_CopyConstruct_${style_struct.gecko_ffi_name};
|
||||||
use bindings::Gecko_Destroy_${style_struct.gecko_ffi_name};
|
use bindings::Gecko_Destroy_${style_struct.gecko_ffi_name};
|
||||||
% endif
|
|
||||||
% endfor
|
% endfor
|
||||||
use gecko_style_structs;
|
use gecko_style_structs;
|
||||||
|
use glue::ArcHelpers;
|
||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
use std::fmt::{self, Debug};
|
use std::fmt::{self, Debug};
|
||||||
use std::mem::{transmute, zeroed};
|
use std::mem::{transmute, zeroed};
|
||||||
|
@ -103,13 +102,9 @@ impl ComputedValues for GeckoComputedValues {
|
||||||
|
|
||||||
<%def name="declare_style_struct(style_struct)">
|
<%def name="declare_style_struct(style_struct)">
|
||||||
#[derive(Clone, HeapSizeOf, Debug)]
|
#[derive(Clone, HeapSizeOf, Debug)]
|
||||||
% if style_struct.gecko_ffi_name:
|
|
||||||
pub struct ${style_struct.gecko_struct_name} {
|
pub struct ${style_struct.gecko_struct_name} {
|
||||||
gecko: ${style_struct.gecko_ffi_name},
|
gecko: ${style_struct.gecko_ffi_name},
|
||||||
}
|
}
|
||||||
% else:
|
|
||||||
pub struct ${style_struct.gecko_struct_name};
|
|
||||||
% endif
|
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="impl_simple_copy(ident, gecko_ffi_name)">
|
<%def name="impl_simple_copy(ident, gecko_ffi_name)">
|
||||||
|
@ -192,8 +187,10 @@ impl ${style_struct.gecko_struct_name} {
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
pub fn get_gecko(&self) -> &${style_struct.gecko_ffi_name} {
|
||||||
|
&self.gecko
|
||||||
|
}
|
||||||
}
|
}
|
||||||
%if style_struct.gecko_ffi_name:
|
|
||||||
impl Drop for ${style_struct.gecko_struct_name} {
|
impl Drop for ${style_struct.gecko_struct_name} {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -227,7 +224,6 @@ impl Debug for ${style_struct.gecko_ffi_name} {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%endif
|
%endif
|
||||||
%endif
|
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="raw_impl_trait(style_struct, skip_longhands='', skip_additionals='')">
|
<%def name="raw_impl_trait(style_struct, skip_longhands='', skip_additionals='')">
|
||||||
|
@ -406,12 +402,24 @@ for side in SIDES:
|
||||||
|
|
||||||
</%self:impl_trait>
|
</%self:impl_trait>
|
||||||
|
|
||||||
|
<%def name="define_ffi_struct_accessor(style_struct)">
|
||||||
|
#[no_mangle]
|
||||||
|
#[allow(non_snake_case, unused_variables)]
|
||||||
|
pub extern "C" fn Servo_GetStyle${style_struct.gecko_name}(computed_values: *mut ServoComputedValues)
|
||||||
|
-> *const ${style_struct.gecko_ffi_name} {
|
||||||
|
type Helpers = ArcHelpers<ServoComputedValues, GeckoComputedValues>;
|
||||||
|
Helpers::with(computed_values, |values| values.get_${style_struct.trait_name_lower}().get_gecko()
|
||||||
|
as *const ${style_struct.gecko_ffi_name})
|
||||||
|
}
|
||||||
|
</%def>
|
||||||
|
|
||||||
% for style_struct in data.style_structs:
|
% for style_struct in data.style_structs:
|
||||||
${declare_style_struct(style_struct)}
|
${declare_style_struct(style_struct)}
|
||||||
${impl_style_struct(style_struct)}
|
${impl_style_struct(style_struct)}
|
||||||
% if not style_struct.trait_name in data.manual_style_structs:
|
% if not style_struct.trait_name in data.manual_style_structs:
|
||||||
<%self:raw_impl_trait style_struct="${style_struct}"></%self:raw_impl_trait>
|
<%self:raw_impl_trait style_struct="${style_struct}"></%self:raw_impl_trait>
|
||||||
% endif
|
% endif
|
||||||
|
${define_ffi_struct_accessor(style_struct)}
|
||||||
% endfor
|
% endfor
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче