stylo: Reformat a bunch of signatures.

This commit is contained in:
Emilio Cobos Álvarez 2017-10-13 15:24:32 +02:00
parent 09d3a11c86
commit 271d2b4ecd
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -2135,15 +2135,17 @@ pub extern "C" fn Servo_StyleSet_CompatModeChanged(raw_data: RawServoStyleSetBor
data.stylist.set_quirks_mode(quirks_mode.into()); data.stylist.set_quirks_mode(quirks_mode.into());
} }
fn parse_property_into<R>(declarations: &mut SourcePropertyDeclaration, fn parse_property_into<R>(
property_id: PropertyId, declarations: &mut SourcePropertyDeclaration,
value: *const nsACString, property_id: PropertyId,
data: *mut URLExtraData, value: *const nsACString,
parsing_mode: structs::ParsingMode, data: *mut URLExtraData,
quirks_mode: QuirksMode, parsing_mode: structs::ParsingMode,
reporter: &R) quirks_mode: QuirksMode,
-> Result<(), ()> reporter: &R
where R: ParseErrorReporter ) -> Result<(), ()>
where
R: ParseErrorReporter
{ {
use style_traits::ParsingMode; use style_traits::ParsingMode;
let value = unsafe { value.as_ref().unwrap().as_str_unchecked() }; let value = unsafe { value.as_ref().unwrap().as_str_unchecked() };
@ -2161,12 +2163,13 @@ fn parse_property_into<R>(declarations: &mut SourcePropertyDeclaration,
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ParseProperty(property: nsCSSPropertyID, value: *const nsACString, pub extern "C" fn Servo_ParseProperty(
data: *mut URLExtraData, property: nsCSSPropertyID, value: *const nsACString,
parsing_mode: structs::ParsingMode, data: *mut URLExtraData,
quirks_mode: nsCompatibility, parsing_mode: structs::ParsingMode,
loader: *mut Loader) quirks_mode: nsCompatibility,
-> RawServoDeclarationBlockStrong { loader: *mut Loader,
) -> RawServoDeclarationBlockStrong {
let id = get_property_id_from_nscsspropertyid!(property, let id = get_property_id_from_nscsspropertyid!(property,
RawServoDeclarationBlockStrong::null()); RawServoDeclarationBlockStrong::null());
let mut declarations = SourcePropertyDeclaration::new(); let mut declarations = SourcePropertyDeclaration::new();
@ -2184,10 +2187,11 @@ pub extern "C" fn Servo_ParseProperty(property: nsCSSPropertyID, value: *const n
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ParseEasing(easing: *const nsAString, pub extern "C" fn Servo_ParseEasing(
data: *mut URLExtraData, easing: *const nsAString,
output: nsTimingFunctionBorrowedMut) data: *mut URLExtraData,
-> bool { output: nsTimingFunctionBorrowedMut
) -> bool {
use style::properties::longhands::transition_timing_function; use style::properties::longhands::transition_timing_function;
let url_data = unsafe { RefPtr::from_ptr_ref(&data) }; let url_data = unsafe { RefPtr::from_ptr_ref(&data) };
@ -2269,11 +2273,12 @@ pub extern "C" fn Servo_MatrixTransform_Operate(matrix_operator: MatrixTransform
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ParseStyleAttribute(data: *const nsACString, pub extern "C" fn Servo_ParseStyleAttribute(
raw_extra_data: *mut URLExtraData, data: *const nsACString,
quirks_mode: nsCompatibility, raw_extra_data: *mut URLExtraData,
loader: *mut Loader) quirks_mode: nsCompatibility,
-> RawServoDeclarationBlockStrong { loader: *mut Loader,
) -> RawServoDeclarationBlockStrong {
let global_style_data = &*GLOBAL_STYLE_DATA; let global_style_data = &*GLOBAL_STYLE_DATA;
let value = unsafe { data.as_ref().unwrap().as_str_unchecked() }; let value = unsafe { data.as_ref().unwrap().as_str_unchecked() };
let reporter = ErrorReporter::new(ptr::null_mut(), loader, raw_extra_data); let reporter = ErrorReporter::new(ptr::null_mut(), loader, raw_extra_data);
@ -2301,9 +2306,10 @@ pub extern "C" fn Servo_DeclarationBlock_Clone(declarations: RawServoDeclaration
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_Equals(a: RawServoDeclarationBlockBorrowed, pub extern "C" fn Servo_DeclarationBlock_Equals(
b: RawServoDeclarationBlockBorrowed) a: RawServoDeclarationBlockBorrowed,
-> bool { b: RawServoDeclarationBlockBorrowed,
) -> bool {
let global_style_data = &*GLOBAL_STYLE_DATA; let global_style_data = &*GLOBAL_STYLE_DATA;
let guard = global_style_data.shared_lock.read(); let guard = global_style_data.shared_lock.read();
*Locked::<PropertyDeclarationBlock>::as_arc(&a).read_with(&guard).declarations() == *Locked::<PropertyDeclarationBlock>::as_arc(&a).read_with(&guard).declarations() ==
@ -2323,8 +2329,8 @@ pub extern "C" fn Servo_DeclarationBlock_SerializeOneValue(
declarations: RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
property_id: nsCSSPropertyID, buffer: *mut nsAString, property_id: nsCSSPropertyID, buffer: *mut nsAString,
computed_values: ServoStyleContextBorrowedOrNull, computed_values: ServoStyleContextBorrowedOrNull,
custom_properties: RawServoDeclarationBlockBorrowedOrNull) custom_properties: RawServoDeclarationBlockBorrowedOrNull,
{ ) {
let property_id = get_property_id_from_nscsspropertyid!(property_id, ()); let property_id = get_property_id_from_nscsspropertyid!(property_id, ());
let global_style_data = &*GLOBAL_STYLE_DATA; let global_style_data = &*GLOBAL_STYLE_DATA;
@ -2346,7 +2352,8 @@ pub extern "C" fn Servo_DeclarationBlock_SerializeOneValue(
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_SerializeFontValueForCanvas( pub extern "C" fn Servo_SerializeFontValueForCanvas(
declarations: RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
buffer: *mut nsAString) { buffer: *mut nsAString,
) {
use style::properties::shorthands::font; use style::properties::shorthands::font;
read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| { read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
@ -2375,8 +2382,11 @@ pub extern "C" fn Servo_DeclarationBlock_Count(declarations: RawServoDeclaration
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_GetNthProperty(declarations: RawServoDeclarationBlockBorrowed, pub extern "C" fn Servo_DeclarationBlock_GetNthProperty(
index: u32, result: *mut nsAString) -> bool { declarations: RawServoDeclarationBlockBorrowed,
index: u32,
result: *mut nsAString,
) -> bool {
read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| { read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
if let Some(decl) = decls.declarations().get(index as usize) { if let Some(decl) = decls.declarations().get(index as usize) {
let result = unsafe { result.as_mut().unwrap() }; let result = unsafe { result.as_mut().unwrap() };
@ -2444,11 +2454,16 @@ pub unsafe extern "C" fn Servo_DeclarationBlock_GetPropertyIsImportant(
}) })
} }
fn set_property(declarations: RawServoDeclarationBlockBorrowed, property_id: PropertyId, fn set_property(
value: *const nsACString, is_important: bool, data: *mut URLExtraData, declarations: RawServoDeclarationBlockBorrowed,
parsing_mode: structs::ParsingMode, property_id: PropertyId,
quirks_mode: QuirksMode, value: *const nsACString,
loader: *mut Loader) -> bool { is_important: bool,
data: *mut URLExtraData,
parsing_mode: structs::ParsingMode,
quirks_mode: QuirksMode,
loader: *mut Loader
) -> bool {
let mut source_declarations = SourcePropertyDeclaration::new(); let mut source_declarations = SourcePropertyDeclaration::new();
let reporter = ErrorReporter::new(ptr::null_mut(), loader, data); let reporter = ErrorReporter::new(ptr::null_mut(), loader, data);
match parse_property_into(&mut source_declarations, property_id, value, data, match parse_property_into(&mut source_declarations, property_id, value, data,
@ -2545,9 +2560,10 @@ pub extern "C" fn Servo_MediaList_DeepClone(list: RawServoMediaListBorrowed) ->
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_MediaList_Matches(list: RawServoMediaListBorrowed, pub extern "C" fn Servo_MediaList_Matches(
raw_data: RawServoStyleSetBorrowed) list: RawServoMediaListBorrowed,
-> bool { raw_data: RawServoStyleSetBorrowed,
) -> bool {
let per_doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow(); let per_doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
read_locked_arc(list, |list: &MediaList| { read_locked_arc(list, |list: &MediaList| {
list.evaluate(per_doc_data.stylist.device(), per_doc_data.stylist.quirks_mode()) list.evaluate(per_doc_data.stylist.device(), per_doc_data.stylist.quirks_mode())
@ -2555,8 +2571,10 @@ pub extern "C" fn Servo_MediaList_Matches(list: RawServoMediaListBorrowed,
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_HasCSSWideKeyword(declarations: RawServoDeclarationBlockBorrowed, pub extern "C" fn Servo_DeclarationBlock_HasCSSWideKeyword(
property: nsCSSPropertyID) -> bool { declarations: RawServoDeclarationBlockBorrowed,
property: nsCSSPropertyID,
) -> bool {
let property_id = get_property_id_from_nscsspropertyid!(property, false); let property_id = get_property_id_from_nscsspropertyid!(property, false);
read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| { read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
decls.has_css_wide_keyword(&property_id) decls.has_css_wide_keyword(&property_id)
@ -2590,8 +2608,11 @@ pub extern "C" fn Servo_MediaList_GetLength(list: RawServoMediaListBorrowed) ->
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_MediaList_GetMediumAt(list: RawServoMediaListBorrowed, index: u32, pub extern "C" fn Servo_MediaList_GetMediumAt(
result: *mut nsAString) -> bool { list: RawServoMediaListBorrowed,
index: u32,
result: *mut nsAString,
) -> bool {
read_locked_arc(list, |list: &MediaList| { read_locked_arc(list, |list: &MediaList| {
if let Some(media_query) = list.media_queries.get(index as usize) { if let Some(media_query) = list.media_queries.get(index as usize) {
media_query.to_css(unsafe { result.as_mut().unwrap() }).unwrap(); media_query.to_css(unsafe { result.as_mut().unwrap() }).unwrap();
@ -2603,8 +2624,10 @@ pub extern "C" fn Servo_MediaList_GetMediumAt(list: RawServoMediaListBorrowed, i
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_MediaList_AppendMedium(list: RawServoMediaListBorrowed, pub extern "C" fn Servo_MediaList_AppendMedium(
new_medium: *const nsACString) { list: RawServoMediaListBorrowed,
new_medium: *const nsACString,
) {
let new_medium = unsafe { new_medium.as_ref().unwrap().as_str_unchecked() }; let new_medium = unsafe { new_medium.as_ref().unwrap().as_str_unchecked() };
let url_data = unsafe { dummy_url_data() }; let url_data = unsafe { dummy_url_data() };
let context = ParserContext::new_for_cssom(url_data, Some(CssRuleType::Media), let context = ParserContext::new_for_cssom(url_data, Some(CssRuleType::Media),
@ -2616,8 +2639,10 @@ pub extern "C" fn Servo_MediaList_AppendMedium(list: RawServoMediaListBorrowed,
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_MediaList_DeleteMedium(list: RawServoMediaListBorrowed, pub extern "C" fn Servo_MediaList_DeleteMedium(
old_medium: *const nsACString) -> bool { list: RawServoMediaListBorrowed,
old_medium: *const nsACString,
) -> bool {
let old_medium = unsafe { old_medium.as_ref().unwrap().as_str_unchecked() }; let old_medium = unsafe { old_medium.as_ref().unwrap().as_str_unchecked() };
let url_data = unsafe { dummy_url_data() }; let url_data = unsafe { dummy_url_data() };
let context = ParserContext::new_for_cssom(url_data, Some(CssRuleType::Media), let context = ParserContext::new_for_cssom(url_data, Some(CssRuleType::Media),
@ -2661,12 +2686,11 @@ pub extern "C" fn Servo_DeclarationBlock_PropertyIsSet(declarations:
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_SetIdentStringValue(declarations: pub extern "C" fn Servo_DeclarationBlock_SetIdentStringValue(
RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
property: property: nsCSSPropertyID,
nsCSSPropertyID, value: *mut nsAtom,
value: ) {
*mut nsAtom) {
use style::properties::{PropertyDeclaration, LonghandId}; use style::properties::{PropertyDeclaration, LonghandId};
use style::properties::longhands::_x_lang::computed_value::T as Lang; use style::properties::longhands::_x_lang::computed_value::T as Lang;
@ -2681,10 +2705,11 @@ pub extern "C" fn Servo_DeclarationBlock_SetIdentStringValue(declarations:
#[no_mangle] #[no_mangle]
#[allow(unreachable_code)] #[allow(unreachable_code)]
pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(declarations: pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(
RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
property: nsCSSPropertyID, property: nsCSSPropertyID,
value: i32) { value: i32
) {
use style::properties::{PropertyDeclaration, LonghandId}; use style::properties::{PropertyDeclaration, LonghandId};
use style::properties::longhands; use style::properties::longhands;
use style::values::specified::BorderStyle; use style::values::specified::BorderStyle;
@ -2725,9 +2750,11 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(declarations:
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_SetIntValue(declarations: RawServoDeclarationBlockBorrowed, pub extern "C" fn Servo_DeclarationBlock_SetIntValue(
property: nsCSSPropertyID, declarations: RawServoDeclarationBlockBorrowed,
value: i32) { property: nsCSSPropertyID,
value: i32
) {
use style::properties::{PropertyDeclaration, LonghandId}; use style::properties::{PropertyDeclaration, LonghandId};
use style::properties::longhands::_moz_script_level::SpecifiedValue as MozScriptLevel; use style::properties::longhands::_moz_script_level::SpecifiedValue as MozScriptLevel;
use style::properties::longhands::_x_span::computed_value::T as Span; use style::properties::longhands::_x_span::computed_value::T as Span;
@ -2744,10 +2771,11 @@ pub extern "C" fn Servo_DeclarationBlock_SetIntValue(declarations: RawServoDecla
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_SetPixelValue(declarations: pub extern "C" fn Servo_DeclarationBlock_SetPixelValue(
RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
property: nsCSSPropertyID, property: nsCSSPropertyID,
value: f32) { value: f32
) {
use style::properties::{PropertyDeclaration, LonghandId}; use style::properties::{PropertyDeclaration, LonghandId};
use style::properties::longhands::border_spacing::SpecifiedValue as BorderSpacing; use style::properties::longhands::border_spacing::SpecifiedValue as BorderSpacing;
use style::properties::longhands::height::SpecifiedValue as Height; use style::properties::longhands::height::SpecifiedValue as Height;
@ -2801,11 +2829,12 @@ pub extern "C" fn Servo_DeclarationBlock_SetPixelValue(declarations:
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_SetLengthValue(declarations: pub extern "C" fn Servo_DeclarationBlock_SetLengthValue(
RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
property: nsCSSPropertyID, property: nsCSSPropertyID,
value: f32, value: f32,
unit: structs::nsCSSUnit) { unit: structs::nsCSSUnit,
) {
use style::properties::{PropertyDeclaration, LonghandId}; use style::properties::{PropertyDeclaration, LonghandId};
use style::properties::longhands::_moz_script_min_size::SpecifiedValue as MozScriptMinSize; use style::properties::longhands::_moz_script_min_size::SpecifiedValue as MozScriptMinSize;
use style::properties::longhands::width::SpecifiedValue as Width; use style::properties::longhands::width::SpecifiedValue as Width;
@ -2839,10 +2868,11 @@ pub extern "C" fn Servo_DeclarationBlock_SetLengthValue(declarations:
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_SetNumberValue(declarations: pub extern "C" fn Servo_DeclarationBlock_SetNumberValue(
RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
property: nsCSSPropertyID, property: nsCSSPropertyID,
value: f32) { value: f32,
) {
use style::properties::{PropertyDeclaration, LonghandId}; use style::properties::{PropertyDeclaration, LonghandId};
use style::properties::longhands::_moz_script_level::SpecifiedValue as MozScriptLevel; use style::properties::longhands::_moz_script_level::SpecifiedValue as MozScriptLevel;
@ -2859,10 +2889,11 @@ pub extern "C" fn Servo_DeclarationBlock_SetNumberValue(declarations:
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_SetPercentValue(declarations: pub extern "C" fn Servo_DeclarationBlock_SetPercentValue(
RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
property: nsCSSPropertyID, property: nsCSSPropertyID,
value: f32) { value: f32,
) {
use style::properties::{PropertyDeclaration, LonghandId}; use style::properties::{PropertyDeclaration, LonghandId};
use style::properties::longhands::height::SpecifiedValue as Height; use style::properties::longhands::height::SpecifiedValue as Height;
use style::properties::longhands::width::SpecifiedValue as Width; use style::properties::longhands::width::SpecifiedValue as Width;
@ -2888,9 +2919,10 @@ pub extern "C" fn Servo_DeclarationBlock_SetPercentValue(declarations:
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_SetAutoValue(declarations: pub extern "C" fn Servo_DeclarationBlock_SetAutoValue(
RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
property: nsCSSPropertyID) { property: nsCSSPropertyID,
) {
use style::properties::{PropertyDeclaration, LonghandId}; use style::properties::{PropertyDeclaration, LonghandId};
use style::properties::longhands::height::SpecifiedValue as Height; use style::properties::longhands::height::SpecifiedValue as Height;
use style::properties::longhands::width::SpecifiedValue as Width; use style::properties::longhands::width::SpecifiedValue as Width;
@ -2913,9 +2945,10 @@ pub extern "C" fn Servo_DeclarationBlock_SetAutoValue(declarations:
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_SetCurrentColor(declarations: pub extern "C" fn Servo_DeclarationBlock_SetCurrentColor(
RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
property: nsCSSPropertyID) { property: nsCSSPropertyID,
) {
use style::properties::{PropertyDeclaration, LonghandId}; use style::properties::{PropertyDeclaration, LonghandId};
use style::values::specified::Color; use style::values::specified::Color;
@ -2934,10 +2967,11 @@ pub extern "C" fn Servo_DeclarationBlock_SetCurrentColor(declarations:
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_SetColorValue(declarations: pub extern "C" fn Servo_DeclarationBlock_SetColorValue(
RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
property: nsCSSPropertyID, property: nsCSSPropertyID,
value: structs::nscolor) { value: structs::nscolor,
) {
use style::gecko::values::convert_nscolor_to_rgba; use style::gecko::values::convert_nscolor_to_rgba;
use style::properties::{PropertyDeclaration, LonghandId}; use style::properties::{PropertyDeclaration, LonghandId};
use style::properties::longhands; use style::properties::longhands;
@ -2961,9 +2995,10 @@ pub extern "C" fn Servo_DeclarationBlock_SetColorValue(declarations:
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_SetFontFamily(declarations: pub extern "C" fn Servo_DeclarationBlock_SetFontFamily(
RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
value: *const nsAString) { value: *const nsAString,
) {
use cssparser::{Parser, ParserInput}; use cssparser::{Parser, ParserInput};
use style::properties::PropertyDeclaration; use style::properties::PropertyDeclaration;
use style::properties::longhands::font_family::SpecifiedValue as FontFamily; use style::properties::longhands::font_family::SpecifiedValue as FontFamily;
@ -2983,10 +3018,11 @@ pub extern "C" fn Servo_DeclarationBlock_SetFontFamily(declarations:
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_SetBackgroundImage(declarations: pub extern "C" fn Servo_DeclarationBlock_SetBackgroundImage(
RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
value: *const nsAString, value: *const nsAString,
raw_extra_data: *mut URLExtraData) { raw_extra_data: *mut URLExtraData,
) {
use style::properties::PropertyDeclaration; use style::properties::PropertyDeclaration;
use style::properties::longhands::background_image::SpecifiedValue as BackgroundImage; use style::properties::longhands::background_image::SpecifiedValue as BackgroundImage;
use style::values::Either; use style::values::Either;
@ -3010,8 +3046,9 @@ pub extern "C" fn Servo_DeclarationBlock_SetBackgroundImage(declarations:
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_SetTextDecorationColorOverride(declarations: pub extern "C" fn Servo_DeclarationBlock_SetTextDecorationColorOverride(
RawServoDeclarationBlockBorrowed) { declarations: RawServoDeclarationBlockBorrowed,
) {
use style::properties::PropertyDeclaration; use style::properties::PropertyDeclaration;
use style::properties::longhands::text_decoration_line; use style::properties::longhands::text_decoration_line;
@ -3066,16 +3103,19 @@ pub extern "C" fn Servo_CSSSupports(cond: *const nsACString) -> bool {
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_NoteExplicitHints(element: RawGeckoElementBorrowed, pub extern "C" fn Servo_NoteExplicitHints(
restyle_hint: nsRestyleHint, element: RawGeckoElementBorrowed,
change_hint: nsChangeHint) { restyle_hint: nsRestyleHint,
change_hint: nsChangeHint,
) {
GeckoElement(element).note_explicit_hints(restyle_hint, change_hint); GeckoElement(element).note_explicit_hints(restyle_hint, change_hint);
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_TakeChangeHint(element: RawGeckoElementBorrowed, pub extern "C" fn Servo_TakeChangeHint(
was_restyled: *mut bool) -> u32 element: RawGeckoElementBorrowed,
{ was_restyled: *mut bool
) -> u32 {
let was_restyled = unsafe { was_restyled.as_mut().unwrap() }; let was_restyled = unsafe { was_restyled.as_mut().unwrap() };
let element = GeckoElement(element); let element = GeckoElement(element);
@ -3102,10 +3142,10 @@ pub extern "C" fn Servo_TakeChangeHint(element: RawGeckoElementBorrowed,
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ResolveStyle(element: RawGeckoElementBorrowed, pub extern "C" fn Servo_ResolveStyle(
_raw_data: RawServoStyleSetBorrowed) element: RawGeckoElementBorrowed,
-> ServoStyleContextStrong _raw_data: RawServoStyleSetBorrowed,
{ ) -> ServoStyleContextStrong {
let element = GeckoElement(element); let element = GeckoElement(element);
debug!("Servo_ResolveStyle: {:?}", element); debug!("Servo_ResolveStyle: {:?}", element);
let data = let data =
@ -3119,9 +3159,9 @@ pub extern "C" fn Servo_ResolveStyle(element: RawGeckoElementBorrowed,
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ResolveStyleAllowStale(element: RawGeckoElementBorrowed) pub extern "C" fn Servo_ResolveStyleAllowStale(
-> ServoStyleContextStrong element: RawGeckoElementBorrowed,
{ ) -> ServoStyleContextStrong {
let element = GeckoElement(element); let element = GeckoElement(element);
debug!("Servo_ResolveStyleAllowStale: {:?}", element); debug!("Servo_ResolveStyleAllowStale: {:?}", element);
let data = let data =
@ -3131,14 +3171,14 @@ pub extern "C" fn Servo_ResolveStyleAllowStale(element: RawGeckoElementBorrowed)
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ResolveStyleLazily(element: RawGeckoElementBorrowed, pub extern "C" fn Servo_ResolveStyleLazily(
pseudo_type: CSSPseudoElementType, element: RawGeckoElementBorrowed,
rule_inclusion: StyleRuleInclusion, pseudo_type: CSSPseudoElementType,
snapshots: *const ServoElementSnapshotTable, rule_inclusion: StyleRuleInclusion,
raw_data: RawServoStyleSetBorrowed, snapshots: *const ServoElementSnapshotTable,
ignore_existing_styles: bool) raw_data: RawServoStyleSetBorrowed,
-> ServoStyleContextStrong ignore_existing_styles: bool
{ ) -> ServoStyleContextStrong {
debug_assert!(!snapshots.is_null()); debug_assert!(!snapshots.is_null());
let global_style_data = &*GLOBAL_STYLE_DATA; let global_style_data = &*GLOBAL_STYLE_DATA;
let guard = global_style_data.shared_lock.read(); let guard = global_style_data.shared_lock.read();
@ -3214,14 +3254,14 @@ pub extern "C" fn Servo_ResolveStyleLazily(element: RawGeckoElementBorrowed,
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ReparentStyle(style_to_reparent: ServoStyleContextBorrowed, pub extern "C" fn Servo_ReparentStyle(
parent_style: ServoStyleContextBorrowed, style_to_reparent: ServoStyleContextBorrowed,
parent_style_ignoring_first_line: ServoStyleContextBorrowed, parent_style: ServoStyleContextBorrowed,
layout_parent_style: ServoStyleContextBorrowed, parent_style_ignoring_first_line: ServoStyleContextBorrowed,
element: RawGeckoElementBorrowedOrNull, layout_parent_style: ServoStyleContextBorrowed,
raw_data: RawServoStyleSetBorrowed) element: RawGeckoElementBorrowedOrNull,
-> ServoStyleContextStrong raw_data: RawServoStyleSetBorrowed,
{ ) -> ServoStyleContextStrong {
let global_style_data = &*GLOBAL_STYLE_DATA; let global_style_data = &*GLOBAL_STYLE_DATA;
let guard = global_style_data.shared_lock.read(); let guard = global_style_data.shared_lock.read();
let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow(); let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
@ -3353,12 +3393,13 @@ impl<'a> Iterator for PrioritizedPropertyIter<'a> {
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_GetComputedKeyframeValues(keyframes: RawGeckoKeyframeListBorrowed, pub extern "C" fn Servo_GetComputedKeyframeValues(
element: RawGeckoElementBorrowed, keyframes: RawGeckoKeyframeListBorrowed,
style: ServoStyleContextBorrowed, element: RawGeckoElementBorrowed,
raw_data: RawServoStyleSetBorrowed, style: ServoStyleContextBorrowed,
computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut) raw_data: RawServoStyleSetBorrowed,
{ computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut
) {
use std::mem; use std::mem;
use style::properties::LonghandIdSet; use style::properties::LonghandIdSet;
@ -3464,11 +3505,13 @@ pub extern "C" fn Servo_GetComputedKeyframeValues(keyframes: RawGeckoKeyframeLis
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_GetAnimationValues(declarations: RawServoDeclarationBlockBorrowed, pub extern "C" fn Servo_GetAnimationValues(
element: RawGeckoElementBorrowed, declarations: RawServoDeclarationBlockBorrowed,
style: ServoStyleContextBorrowed, element: RawGeckoElementBorrowed,
raw_data: RawServoStyleSetBorrowed, style: ServoStyleContextBorrowed,
animation_values: RawGeckoServoAnimationValueListBorrowedMut) { raw_data: RawServoStyleSetBorrowed,
animation_values: RawGeckoServoAnimationValueListBorrowedMut,
) {
let data = PerDocumentStyleData::from_ffi(raw_data).borrow(); let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
let metrics = get_metrics_provider_for_product(); let metrics = get_metrics_provider_for_product();
@ -3507,11 +3550,12 @@ pub extern "C" fn Servo_GetAnimationValues(declarations: RawServoDeclarationBloc
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_AnimationValue_Compute(element: RawGeckoElementBorrowed, pub extern "C" fn Servo_AnimationValue_Compute(
declarations: RawServoDeclarationBlockBorrowed, element: RawGeckoElementBorrowed,
style: ServoStyleContextBorrowed, declarations: RawServoDeclarationBlockBorrowed,
raw_data: RawServoStyleSetBorrowed) style: ServoStyleContextBorrowed,
-> RawServoAnimationValueStrong { raw_data: RawServoStyleSetBorrowed,
) -> RawServoAnimationValueStrong {
let data = PerDocumentStyleData::from_ffi(raw_data).borrow(); let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
let metrics = get_metrics_provider_for_product(); let metrics = get_metrics_provider_for_product();
@ -3622,10 +3666,12 @@ fn fill_in_missing_keyframe_values(
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_StyleSet_GetKeyframesForName(raw_data: RawServoStyleSetBorrowed, pub extern "C" fn Servo_StyleSet_GetKeyframesForName(
name: *mut nsAtom, raw_data: RawServoStyleSetBorrowed,
inherited_timing_function: nsTimingFunctionBorrowed, name: *mut nsAtom,
keyframes: RawGeckoKeyframeListBorrowedMut) -> bool { inherited_timing_function: nsTimingFunctionBorrowed,
keyframes: RawGeckoKeyframeListBorrowedMut,
) -> bool {
debug_assert!(keyframes.len() == 0, debug_assert!(keyframes.len() == 0,
"keyframes should be initially empty"); "keyframes should be initially empty");
@ -3795,8 +3841,10 @@ pub extern "C" fn Servo_StyleSet_GetKeyframesForName(raw_data: RawServoStyleSetB
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_StyleSet_GetFontFaceRules(raw_data: RawServoStyleSetBorrowed, pub extern "C" fn Servo_StyleSet_GetFontFaceRules(
rules: RawGeckoFontFaceRuleListBorrowedMut) { raw_data: RawServoStyleSetBorrowed,
rules: RawGeckoFontFaceRuleListBorrowedMut,
) {
let data = PerDocumentStyleData::from_ffi(raw_data).borrow(); let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
debug_assert!(rules.len() == 0); debug_assert!(rules.len() == 0);
@ -3824,8 +3872,10 @@ pub extern "C" fn Servo_StyleSet_GetFontFaceRules(raw_data: RawServoStyleSetBorr
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_StyleSet_GetCounterStyleRule(raw_data: RawServoStyleSetBorrowed, pub extern "C" fn Servo_StyleSet_GetCounterStyleRule(
name: *mut nsAtom) -> *mut nsCSSCounterStyleRule { raw_data: RawServoStyleSetBorrowed,
name: *mut nsAtom,
) -> *mut nsCSSCounterStyleRule {
let data = PerDocumentStyleData::from_ffi(raw_data).borrow(); let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
unsafe { unsafe {
@ -3844,7 +3894,8 @@ pub extern "C" fn Servo_StyleSet_GetCounterStyleRule(raw_data: RawServoStyleSetB
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_StyleSet_BuildFontFeatureValueSet( pub extern "C" fn Servo_StyleSet_BuildFontFeatureValueSet(
raw_data: RawServoStyleSetBorrowed) -> *mut gfxFontFeatureValueSet { raw_data: RawServoStyleSetBorrowed,
) -> *mut gfxFontFeatureValueSet {
let data = PerDocumentStyleData::from_ffi(raw_data).borrow(); let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
let global_style_data = &*GLOBAL_STYLE_DATA; let global_style_data = &*GLOBAL_STYLE_DATA;
@ -3979,9 +4030,11 @@ pub extern "C" fn Servo_StyleSet_HasStateDependency(
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_GetCustomPropertyValue(computed_values: ServoStyleContextBorrowed, pub extern "C" fn Servo_GetCustomPropertyValue(
name: *const nsAString, computed_values: ServoStyleContextBorrowed,
value: *mut nsAString) -> bool { name: *const nsAString,
value: *mut nsAString,
) -> bool {
let custom_properties = match computed_values.custom_properties() { let custom_properties = match computed_values.custom_properties() {
Some(p) => p, Some(p) => p,
None => return false, None => return false,
@ -4006,9 +4059,11 @@ pub extern "C" fn Servo_GetCustomPropertiesCount(computed_values: ServoStyleCont
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_GetCustomPropertyNameAt(computed_values: ServoStyleContextBorrowed, pub extern "C" fn Servo_GetCustomPropertyNameAt(
index: u32, computed_values: ServoStyleContextBorrowed,
name: *mut nsAString) -> bool { index: u32,
name: *mut nsAString,
) -> bool {
let custom_properties = match computed_values.custom_properties() { let custom_properties = match computed_values.custom_properties() {
Some(p) => p, Some(p) => p,
None => return false, None => return false,
@ -4033,27 +4088,31 @@ pub unsafe extern "C" fn Servo_ReleaseArcStringData(string: *const RawOffsetArc<
} }
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn Servo_CloneArcStringData(string: *const RawOffsetArc<RustString>) pub unsafe extern "C" fn Servo_CloneArcStringData(
-> RawOffsetArc<RustString> { string: *const RawOffsetArc<RustString>,
) -> RawOffsetArc<RustString> {
let string = string as *const RawOffsetArc<String>; let string = string as *const RawOffsetArc<String>;
let cloned = (*string).clone(); let cloned = (*string).clone();
mem::transmute::<_, RawOffsetArc<RustString>>(cloned) mem::transmute::<_, RawOffsetArc<RustString>>(cloned)
} }
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn Servo_GetArcStringData(string: *const RustString, pub unsafe extern "C" fn Servo_GetArcStringData(
utf8_chars: *mut *const u8, string: *const RustString,
utf8_len: *mut u32) utf8_chars: *mut *const u8,
{ utf8_len: *mut u32,
) {
let string = &*(string as *const String); let string = &*(string as *const String);
*utf8_len = string.len() as u32; *utf8_len = string.len() as u32;
*utf8_chars = string.as_ptr(); *utf8_chars = string.as_ptr();
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ProcessInvalidations(set: RawServoStyleSetBorrowed, pub extern "C" fn Servo_ProcessInvalidations(
element: RawGeckoElementBorrowed, set: RawServoStyleSetBorrowed,
snapshots: *const ServoElementSnapshotTable) { element: RawGeckoElementBorrowed,
snapshots: *const ServoElementSnapshotTable,
) {
debug_assert!(!snapshots.is_null()); debug_assert!(!snapshots.is_null());
let element = GeckoElement(element); let element = GeckoElement(element);