Auto merge of #18800 - hiikezoe:fix-mismatched-arguments-for-servo-selector-list, r=emilio

Fix mismatched arguments for servo selector list

<!-- Please describe your changes on the following line: -->
https://bugzilla.mozilla.org/show_bug.cgi?id=1406811

This needs to be fixed to update binding files.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

<!-- 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/18800)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-10-10 01:20:38 -05:00 committed by GitHub
commit 2cd9dcebee
5 changed files with 677 additions and 520 deletions

View file

@ -1122,6 +1122,8 @@ cfg_if! {
pub static nsGkAtoms_integrity: *mut nsAtom; pub static nsGkAtoms_integrity: *mut nsAtom;
#[link_name = "_ZN9nsGkAtoms12intersectionE"] #[link_name = "_ZN9nsGkAtoms12intersectionE"]
pub static nsGkAtoms_intersection: *mut nsAtom; pub static nsGkAtoms_intersection: *mut nsAtom;
#[link_name = "_ZN9nsGkAtoms24intersectionobserverlistE"]
pub static nsGkAtoms_intersectionobserverlist: *mut nsAtom;
#[link_name = "_ZN9nsGkAtoms2isE"] #[link_name = "_ZN9nsGkAtoms2isE"]
pub static nsGkAtoms_is: *mut nsAtom; pub static nsGkAtoms_is: *mut nsAtom;
#[link_name = "_ZN9nsGkAtoms11iscontainerE"] #[link_name = "_ZN9nsGkAtoms11iscontainerE"]
@ -6291,6 +6293,8 @@ cfg_if! {
pub static nsGkAtoms_integrity: *mut nsAtom; pub static nsGkAtoms_integrity: *mut nsAtom;
#[link_name = "?intersection@nsGkAtoms@@2PEAVnsAtom@@EA"] #[link_name = "?intersection@nsGkAtoms@@2PEAVnsAtom@@EA"]
pub static nsGkAtoms_intersection: *mut nsAtom; pub static nsGkAtoms_intersection: *mut nsAtom;
#[link_name = "?intersectionobserverlist@nsGkAtoms@@2PEAVnsAtom@@EA"]
pub static nsGkAtoms_intersectionobserverlist: *mut nsAtom;
#[link_name = "?is@nsGkAtoms@@2PEAVnsAtom@@EA"] #[link_name = "?is@nsGkAtoms@@2PEAVnsAtom@@EA"]
pub static nsGkAtoms_is: *mut nsAtom; pub static nsGkAtoms_is: *mut nsAtom;
#[link_name = "?iscontainer@nsGkAtoms@@2PEAVnsAtom@@EA"] #[link_name = "?iscontainer@nsGkAtoms@@2PEAVnsAtom@@EA"]
@ -11460,6 +11464,8 @@ cfg_if! {
pub static nsGkAtoms_integrity: *mut nsAtom; pub static nsGkAtoms_integrity: *mut nsAtom;
#[link_name = "\x01?intersection@nsGkAtoms@@2PAVnsAtom@@A"] #[link_name = "\x01?intersection@nsGkAtoms@@2PAVnsAtom@@A"]
pub static nsGkAtoms_intersection: *mut nsAtom; pub static nsGkAtoms_intersection: *mut nsAtom;
#[link_name = "\x01?intersectionobserverlist@nsGkAtoms@@2PAVnsAtom@@A"]
pub static nsGkAtoms_intersectionobserverlist: *mut nsAtom;
#[link_name = "\x01?is@nsGkAtoms@@2PAVnsAtom@@A"] #[link_name = "\x01?is@nsGkAtoms@@2PAVnsAtom@@A"]
pub static nsGkAtoms_is: *mut nsAtom; pub static nsGkAtoms_is: *mut nsAtom;
#[link_name = "\x01?iscontainer@nsGkAtoms@@2PAVnsAtom@@A"] #[link_name = "\x01?iscontainer@nsGkAtoms@@2PAVnsAtom@@A"]
@ -16632,6 +16638,8 @@ macro_rules! atom {
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_integrity as *mut _) } }; { unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_integrity as *mut _) } };
("intersection") => ("intersection") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_intersection as *mut _) } }; { unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_intersection as *mut _) } };
("intersectionobserverlist") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_intersectionobserverlist as *mut _) } };
("is") => ("is") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_is as *mut _) } }; { unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_is as *mut _) } };
("iscontainer") => ("iscontainer") =>

View file

@ -45,6 +45,7 @@ use gecko_bindings::structs::RawGeckoStyleChildrenIterator;
use gecko_bindings::structs::RawGeckoServoStyleRuleList; use gecko_bindings::structs::RawGeckoServoStyleRuleList;
use gecko_bindings::structs::RawGeckoURLExtraData; use gecko_bindings::structs::RawGeckoURLExtraData;
use gecko_bindings::structs::RawGeckoXBLBinding; use gecko_bindings::structs::RawGeckoXBLBinding;
use gecko_bindings::structs::RawServoSelectorList;
use gecko_bindings::structs::RefPtr; use gecko_bindings::structs::RefPtr;
use gecko_bindings::structs::RustString; use gecko_bindings::structs::RustString;
use gecko_bindings::structs::CSSPseudoClassType; use gecko_bindings::structs::CSSPseudoClassType;
@ -250,6 +251,12 @@ pub type RawServoStyleSetBorrowedMut<'a> = &'a mut RawServoStyleSet;
pub type RawServoStyleSetBorrowedMutOrNull<'a> = Option<&'a mut RawServoStyleSet>; pub type RawServoStyleSetBorrowedMutOrNull<'a> = Option<&'a mut RawServoStyleSet>;
enum RawServoStyleSetVoid { } enum RawServoStyleSetVoid { }
pub struct RawServoStyleSet(RawServoStyleSetVoid); pub struct RawServoStyleSet(RawServoStyleSetVoid);
pub type RawServoSelectorListOwned = ::gecko_bindings::sugar::ownership::Owned<RawServoSelectorList>;
pub type RawServoSelectorListOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<RawServoSelectorList>;
pub type RawServoSelectorListBorrowed<'a> = &'a RawServoSelectorList;
pub type RawServoSelectorListBorrowedOrNull<'a> = Option<&'a RawServoSelectorList>;
pub type RawServoSelectorListBorrowedMut<'a> = &'a mut RawServoSelectorList;
pub type RawServoSelectorListBorrowedMutOrNull<'a> = Option<&'a mut RawServoSelectorList>;
pub type ServoElementSnapshotOwned = ::gecko_bindings::sugar::ownership::Owned<ServoElementSnapshot>; pub type ServoElementSnapshotOwned = ::gecko_bindings::sugar::ownership::Owned<ServoElementSnapshot>;
pub type ServoElementSnapshotOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<ServoElementSnapshot>; pub type ServoElementSnapshotOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<ServoElementSnapshot>;
pub type ServoElementSnapshotBorrowed<'a> = &'a ServoElementSnapshot; pub type ServoElementSnapshotBorrowed<'a> = &'a ServoElementSnapshot;
@ -514,6 +521,9 @@ extern "C" {
extern "C" { extern "C" {
pub fn Servo_StyleSet_Drop(ptr: RawServoStyleSetOwned); pub fn Servo_StyleSet_Drop(ptr: RawServoStyleSetOwned);
} }
extern "C" {
pub fn Servo_SelectorList_Drop(ptr: RawServoSelectorListOwned);
}
extern "C" { extern "C" {
pub fn Gecko_IsInDocument(node: RawGeckoNodeBorrowed) -> bool; pub fn Gecko_IsInDocument(node: RawGeckoNodeBorrowed) -> bool;
} }
@ -628,9 +638,9 @@ extern "C" {
name: *mut nsAtom) -> bool; name: *mut nsAtom) -> bool;
} }
extern "C" { extern "C" {
pub fn Gecko_AttrEquals(element: RawGeckoElementBorrowed, pub fn Gecko_AttrEquals(element: RawGeckoElementBorrowed, ns: *mut nsAtom,
ns: *mut nsAtom, name: *mut nsAtom, name: *mut nsAtom, str: *mut nsAtom,
str: *mut nsAtom, ignoreCase: bool) -> bool; ignoreCase: bool) -> bool;
} }
extern "C" { extern "C" {
pub fn Gecko_AttrDashEquals(element: RawGeckoElementBorrowed, pub fn Gecko_AttrDashEquals(element: RawGeckoElementBorrowed,
@ -665,8 +675,7 @@ extern "C" {
} }
extern "C" { extern "C" {
pub fn Gecko_SnapshotAtomAttrValue(element: *const ServoElementSnapshot, pub fn Gecko_SnapshotAtomAttrValue(element: *const ServoElementSnapshot,
attribute: *mut nsAtom) attribute: *mut nsAtom) -> *mut nsAtom;
-> *mut nsAtom;
} }
extern "C" { extern "C" {
pub fn Gecko_SnapshotLangValue(element: *const ServoElementSnapshot) pub fn Gecko_SnapshotLangValue(element: *const ServoElementSnapshot)
@ -674,8 +683,7 @@ extern "C" {
} }
extern "C" { extern "C" {
pub fn Gecko_SnapshotHasAttr(element: *const ServoElementSnapshot, pub fn Gecko_SnapshotHasAttr(element: *const ServoElementSnapshot,
ns: *mut nsAtom, name: *mut nsAtom) ns: *mut nsAtom, name: *mut nsAtom) -> bool;
-> bool;
} }
extern "C" { extern "C" {
pub fn Gecko_SnapshotAttrEquals(element: *const ServoElementSnapshot, pub fn Gecko_SnapshotAttrEquals(element: *const ServoElementSnapshot,
@ -698,10 +706,9 @@ extern "C" {
extern "C" { extern "C" {
pub fn Gecko_SnapshotAttrHasSubstring(element: pub fn Gecko_SnapshotAttrHasSubstring(element:
*const ServoElementSnapshot, *const ServoElementSnapshot,
ns: *mut nsAtom, ns: *mut nsAtom, name: *mut nsAtom,
name: *mut nsAtom, str: *mut nsAtom, ignore_case: bool)
str: *mut nsAtom, -> bool;
ignore_case: bool) -> bool;
} }
extern "C" { extern "C" {
pub fn Gecko_SnapshotAttrHasPrefix(element: *const ServoElementSnapshot, pub fn Gecko_SnapshotAttrHasPrefix(element: *const ServoElementSnapshot,
@ -1015,8 +1022,7 @@ extern "C" {
aImageValue: *mut ImageValue); aImageValue: *mut ImageValue);
} }
extern "C" { extern "C" {
pub fn Gecko_SetImageElement(image: *mut nsStyleImage, pub fn Gecko_SetImageElement(image: *mut nsStyleImage, atom: *mut nsAtom);
atom: *mut nsAtom);
} }
extern "C" { extern "C" {
pub fn Gecko_CopyImageValueFrom(image: *mut nsStyleImage, pub fn Gecko_CopyImageValueFrom(image: *mut nsStyleImage,
@ -1580,9 +1586,6 @@ extern "C" {
extern "C" { extern "C" {
pub fn Gecko_ShouldCreateStyleThreadPool() -> bool; pub fn Gecko_ShouldCreateStyleThreadPool() -> bool;
} }
extern "C" {
pub fn Gecko_GetSystemPageSize() -> usize;
}
extern "C" { extern "C" {
pub fn Gecko_Construct_Default_nsStyleFont(ptr: *mut nsStyleFont, pub fn Gecko_Construct_Default_nsStyleFont(ptr: *mut nsStyleFont,
pres_context: pres_context:
@ -1902,6 +1905,10 @@ extern "C" {
extern "C" { extern "C" {
pub fn Gecko_SetJemallocThreadLocalArena(enabled: bool); pub fn Gecko_SetJemallocThreadLocalArena(enabled: bool);
} }
extern "C" {
pub fn Gecko_AddBufferToCrashReport(addr: *const ::std::os::raw::c_void,
len: usize);
}
extern "C" { extern "C" {
pub fn Servo_Element_ClearData(node: RawGeckoElementBorrowed); pub fn Servo_Element_ClearData(node: RawGeckoElementBorrowed);
} }
@ -2090,6 +2097,15 @@ extern "C" {
RawServoDeclarationBlockBorrowed) RawServoDeclarationBlockBorrowed)
-> ServoStyleContextStrong; -> ServoStyleContextStrong;
} }
extern "C" {
pub fn Servo_SelectorList_Parse(selector_list: *const nsACString)
-> *mut RawServoSelectorList;
}
extern "C" {
pub fn Servo_SelectorList_Matches(arg1: RawGeckoElementBorrowed,
arg2: RawServoSelectorListBorrowed)
-> bool;
}
extern "C" { extern "C" {
pub fn Servo_StyleSet_AddSizeOfExcludingThis(malloc_size_of: MallocSizeOf, pub fn Servo_StyleSet_AddSizeOfExcludingThis(malloc_size_of: MallocSizeOf,
malloc_enclosing_size_of: malloc_enclosing_size_of:

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,10 @@
use cssparser::{BasicParseError, Parser, ToCss, Token, CowRcStr}; use cssparser::{BasicParseError, Parser, ToCss, Token, CowRcStr};
use element_state::ElementState; use element_state::ElementState;
use gecko_bindings::structs::CSSPseudoClassType; use gecko_bindings::structs::CSSPseudoClassType;
use gecko_bindings::structs::RawServoSelectorList;
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use selector_parser::{SelectorParser, PseudoElementCascadeType}; use selector_parser::{SelectorParser, PseudoElementCascadeType};
use selectors::SelectorList;
use selectors::parser::{Selector, SelectorMethods, SelectorParseError}; use selectors::parser::{Selector, SelectorMethods, SelectorParseError};
use selectors::visitor::SelectorVisitor; use selectors::visitor::SelectorVisitor;
use std::fmt; use std::fmt;
@ -438,3 +441,9 @@ fn utf16_to_ascii_lowercase(unit: u16) -> u16 {
_ => unit _ => unit
} }
} }
unsafe impl HasFFI for SelectorList<SelectorImpl> {
type FFIType = RawServoSelectorList;
}
unsafe impl HasSimpleFFI for SelectorList<SelectorImpl> {}
unsafe impl HasBoxFFI for SelectorList<SelectorImpl> {}

View file

@ -43,6 +43,7 @@ use style::gecko_bindings::bindings::{RawServoMediaListBorrowed, RawServoMediaLi
use style::gecko_bindings::bindings::{RawServoMediaRule, RawServoMediaRuleBorrowed}; use style::gecko_bindings::bindings::{RawServoMediaRule, RawServoMediaRuleBorrowed};
use style::gecko_bindings::bindings::{RawServoNamespaceRule, RawServoNamespaceRuleBorrowed}; use style::gecko_bindings::bindings::{RawServoNamespaceRule, RawServoNamespaceRuleBorrowed};
use style::gecko_bindings::bindings::{RawServoPageRule, RawServoPageRuleBorrowed}; use style::gecko_bindings::bindings::{RawServoPageRule, RawServoPageRuleBorrowed};
use style::gecko_bindings::bindings::{RawServoSelectorListBorrowed, RawServoSelectorListOwned};
use style::gecko_bindings::bindings::{RawServoStyleSetBorrowed, RawServoStyleSetOwned}; use style::gecko_bindings::bindings::{RawServoStyleSetBorrowed, RawServoStyleSetOwned};
use style::gecko_bindings::bindings::{RawServoStyleSheetContentsBorrowed, ServoComputedDataBorrowed}; use style::gecko_bindings::bindings::{RawServoStyleSheetContentsBorrowed, ServoComputedDataBorrowed};
use style::gecko_bindings::bindings::{RawServoStyleSheetContentsStrong, ServoStyleContextBorrowed}; use style::gecko_bindings::bindings::{RawServoStyleSheetContentsStrong, ServoStyleContextBorrowed};
@ -91,6 +92,7 @@ use style::gecko_bindings::structs::OriginFlags_User;
use style::gecko_bindings::structs::OriginFlags_UserAgent; use style::gecko_bindings::structs::OriginFlags_UserAgent;
use style::gecko_bindings::structs::RawGeckoGfxMatrix4x4; use style::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
use style::gecko_bindings::structs::RawGeckoPresContextOwned; use style::gecko_bindings::structs::RawGeckoPresContextOwned;
use style::gecko_bindings::structs::RawServoSelectorList;
use style::gecko_bindings::structs::SeenPtrs; use style::gecko_bindings::structs::SeenPtrs;
use style::gecko_bindings::structs::ServoElementSnapshotTable; use style::gecko_bindings::structs::ServoElementSnapshotTable;
use style::gecko_bindings::structs::ServoStyleSetSizes; use style::gecko_bindings::structs::ServoStyleSetSizes;
@ -1521,8 +1523,10 @@ pub extern "C" fn Servo_StyleRule_SelectorMatchesElement(rule: RawServoStyleRule
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn Servo_SelectorList_Matches( pub unsafe extern "C" fn Servo_SelectorList_Matches(
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
selectors: &::selectors::SelectorList<SelectorImpl>, selectors: RawServoSelectorListBorrowed,
) -> bool { ) -> bool {
use std::borrow::Borrow;
let element = GeckoElement(element); let element = GeckoElement(element);
let mut context = MatchingContext::new( let mut context = MatchingContext::new(
MatchingMode::Normal, MatchingMode::Normal,
@ -1532,7 +1536,8 @@ pub unsafe extern "C" fn Servo_SelectorList_Matches(
); );
context.scope_element = Some(element.opaque()); context.scope_element = Some(element.opaque());
selectors::matching::matches_selector_list(selectors, &element, &mut context) let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow();
selectors::matching::matches_selector_list(&selectors, &element, &mut context)
} }
#[no_mangle] #[no_mangle]
@ -4113,7 +4118,7 @@ pub extern "C" fn Servo_HasPendingRestyleAncestor(element: RawGeckoElementBorrow
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn Servo_SelectorList_Parse( pub unsafe extern "C" fn Servo_SelectorList_Parse(
selector_list: *const nsACString, selector_list: *const nsACString,
) -> *mut ::selectors::SelectorList<SelectorImpl> { ) -> *mut RawServoSelectorList {
use style::selector_parser::SelectorParser; use style::selector_parser::SelectorParser;
debug_assert!(!selector_list.is_null()); debug_assert!(!selector_list.is_null());
@ -4124,10 +4129,10 @@ pub unsafe extern "C" fn Servo_SelectorList_Parse(
Err(..) => return ptr::null_mut(), Err(..) => return ptr::null_mut(),
}; };
Box::into_raw(Box::new(selector_list)) Box::into_raw(Box::new(selector_list)) as *mut RawServoSelectorList
} }
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn Servo_SelectorList_Drop(list: *mut ::selectors::SelectorList<SelectorImpl>) { pub unsafe extern "C" fn Servo_SelectorList_Drop(list: RawServoSelectorListOwned) {
let _ = Box::from_raw(list); let _ = list.into_box::<::selectors::SelectorList<SelectorImpl>>();
} }