mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #20133 - emilio:kill-xbl, r=xidorn
style: Make Shadow DOM not use XBL anymore. Bug: 1425759 Reviewed-by: xidorn MozReview-Commit-ID: Jf2iGvLC5de <!-- 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/20133) <!-- Reviewable:end -->
This commit is contained in:
commit
a7f38f0f32
4 changed files with 879 additions and 118 deletions
|
@ -2298,6 +2298,19 @@ extern "C" {
|
|||
gecko_sheet: *const ServoStyleSheet,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_AuthorStyles_RemoveStyleSheet(
|
||||
self_: RawServoAuthorStylesBorrowedMut,
|
||||
gecko_sheet: *const ServoStyleSheet,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_AuthorStyles_InsertStyleSheetBefore(
|
||||
self_: RawServoAuthorStylesBorrowedMut,
|
||||
gecko_sheet: *const ServoStyleSheet,
|
||||
before: *const ServoStyleSheet,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_AuthorStyles_ForceDirty(self_: RawServoAuthorStylesBorrowedMut);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -959,7 +959,8 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
// ::before/::after, XBL bindings, or nsIAnonymousContentCreators.
|
||||
if self.is_in_anonymous_subtree() ||
|
||||
self.has_xbl_binding_with_content() ||
|
||||
self.is_in_shadow_tree() ||
|
||||
self.is_html_slot_element() ||
|
||||
self.shadow_root().is_some() ||
|
||||
self.may_have_anonymous_children() {
|
||||
unsafe {
|
||||
let mut iter: structs::StyleChildrenIterator = ::std::mem::zeroed();
|
||||
|
@ -990,7 +991,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
return self.as_node().owner_doc().as_node();
|
||||
}
|
||||
|
||||
if self.xbl_binding().is_some() {
|
||||
if self.xbl_binding().is_some() || self.shadow_root().is_some() {
|
||||
return self.as_node();
|
||||
}
|
||||
|
||||
|
@ -1408,19 +1409,36 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
// If we are a NAC pseudo-element, we want to get rules from our
|
||||
// rule_hash_target, that is, our originating element.
|
||||
let mut current = Some(self.rule_hash_target());
|
||||
|
||||
while let Some(element) = current {
|
||||
// TODO(emilio): Deal with Shadow DOM separately than with XBL
|
||||
// (right now we still rely on get_xbl_binding_parent()).
|
||||
//
|
||||
// That will allow to clean up a bunch in
|
||||
// push_applicable_declarations.
|
||||
if let Some(shadow) = element.shadow_root() {
|
||||
debug_assert!(!shadow.mServoStyles.mPtr.is_null());
|
||||
let author_styles = unsafe {
|
||||
&*(shadow.mServoStyles.mPtr
|
||||
as *const structs::RawServoAuthorStyles
|
||||
as *const bindings::RawServoAuthorStyles)
|
||||
};
|
||||
|
||||
let author_styles: &'a _ = AuthorStyles::<GeckoStyleSheet>::from_ffi(author_styles);
|
||||
f(&author_styles.data, author_styles.quirks_mode);
|
||||
if element != *self {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(binding) = element.xbl_binding() {
|
||||
binding.each_xbl_cascade_data(&mut f);
|
||||
|
||||
// If we're not looking at our original element, allow the
|
||||
// binding to cut off style inheritance.
|
||||
if element != *self {
|
||||
if !binding.inherits_style() {
|
||||
// Go no further; we're not inheriting style from
|
||||
// anything above here.
|
||||
break;
|
||||
}
|
||||
if element != *self && !binding.inherits_style() {
|
||||
// Go no further; we're not inheriting style from
|
||||
// anything above here.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1149,6 +1149,40 @@ pub unsafe extern "C" fn Servo_AuthorStyles_AppendStyleSheet(
|
|||
styles.stylesheets.append_stylesheet(None, sheet, &guard);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn Servo_AuthorStyles_InsertStyleSheetBefore(
|
||||
styles: RawServoAuthorStylesBorrowedMut,
|
||||
sheet: *const ServoStyleSheet,
|
||||
before_sheet: *const ServoStyleSheet,
|
||||
) {
|
||||
let styles = AuthorStyles::<GeckoStyleSheet>::from_ffi_mut(styles);
|
||||
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let guard = global_style_data.shared_lock.read();
|
||||
styles.stylesheets.insert_stylesheet_before(
|
||||
None,
|
||||
GeckoStyleSheet::new(sheet),
|
||||
GeckoStyleSheet::new(before_sheet),
|
||||
&guard,
|
||||
);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn Servo_AuthorStyles_RemoveStyleSheet(
|
||||
styles: RawServoAuthorStylesBorrowedMut,
|
||||
sheet: *const ServoStyleSheet,
|
||||
) {
|
||||
let styles = AuthorStyles::<GeckoStyleSheet>::from_ffi_mut(styles);
|
||||
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let guard = global_style_data.shared_lock.read();
|
||||
styles.stylesheets.remove_stylesheet(
|
||||
None,
|
||||
GeckoStyleSheet::new(sheet),
|
||||
&guard,
|
||||
);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn Servo_AuthorStyles_ForceDirty(
|
||||
styles: RawServoAuthorStylesBorrowedMut,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue