Skip to content

Commit

Permalink
Auto merge of #17429 - emilio:restyle-hints-xbl, r=heycam
Browse files Browse the repository at this point in the history
style: Get restyle hints right in presence of XBL.

Fixes bug 1371130.

<!-- 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/17429)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Jun 20, 2017
2 parents 40a3826 + 59a0d66 commit f5a6168
Show file tree
Hide file tree
Showing 7 changed files with 7,165 additions and 5,138 deletions.
25 changes: 25 additions & 0 deletions components/style/dom.rs
Expand Up @@ -332,6 +332,23 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
self.parent_element()
}

/// The ::before pseudo-element of this element, if it exists.
fn before_pseudo_element(&self) -> Option<Self> {
None
}

/// The ::after pseudo-element of this element, if it exists.
fn after_pseudo_element(&self) -> Option<Self> {
None
}

/// Execute `f` for each anonymous content child (apart from ::before and
/// ::after) whose originating element is `self`.
fn each_anonymous_content_child<F>(&self, _f: F)
where
F: FnMut(Self),
{}

/// For a given NAC element, return the closest non-NAC ancestor, which is
/// guaranteed to exist.
fn closest_non_native_anonymous_ancestor(&self) -> Option<Self> {
Expand Down Expand Up @@ -570,6 +587,14 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
return data.restyle.hint.has_animation_hint()
}

/// Returns the anonymous content for the current element's XBL binding,
/// given if any.
///
/// This is used in Gecko for XBL and shadow DOM.
fn xbl_binding_anonymous_content(&self) -> Option<Self::ConcreteNode> {
None
}

/// Gets declarations from XBL bindings from the element. Only gecko element could have this.
fn get_declarations_from_xbl_bindings<V>(&self,
_pseudo_element: Option<&PseudoElement>,
Expand Down
336 changes: 328 additions & 8 deletions components/style/gecko/generated/atom_macro.rs

Large diffs are not rendered by default.

71 changes: 34 additions & 37 deletions components/style/gecko/generated/bindings.rs
Expand Up @@ -10,6 +10,7 @@ use gecko_bindings::structs::mozilla::css::ImageValue;
use gecko_bindings::structs::mozilla::css::URLValue;
use gecko_bindings::structs::mozilla::MallocSizeOf;
use gecko_bindings::structs::mozilla::Side;
use gecko_bindings::structs::nsIContent;
use gecko_bindings::structs::RawGeckoAnimationPropertySegment;
use gecko_bindings::structs::RawGeckoComputedTiming;
use gecko_bindings::structs::RawGeckoCSSPropertyIDList;
Expand Down Expand Up @@ -506,45 +507,38 @@ extern "C" {
text_is_significant: bool,
whitespace_is_significant: bool) -> bool;
}
extern "C" {
pub fn Gecko_GetFlattenedTreeParentNode(node: RawGeckoNodeBorrowed)
-> RawGeckoNodeBorrowedOrNull;
}
extern "C" {
pub fn Gecko_GetFirstChild(node: RawGeckoNodeBorrowed)
-> RawGeckoNodeBorrowedOrNull;
}
extern "C" {
pub fn Gecko_GetLastChild(node: RawGeckoNodeBorrowed)
-> RawGeckoNodeBorrowedOrNull;
}
extern "C" {
pub fn Gecko_GetPrevSibling(node: RawGeckoNodeBorrowed)
pub fn Gecko_GetFlattenedTreeParentNode(node: RawGeckoNodeBorrowed)
-> RawGeckoNodeBorrowedOrNull;
}
extern "C" {
pub fn Gecko_GetNextSibling(node: RawGeckoNodeBorrowed)
-> RawGeckoNodeBorrowedOrNull;
pub fn Gecko_GetBeforeOrAfterPseudo(element: RawGeckoElementBorrowed,
is_before: bool)
-> RawGeckoElementBorrowedOrNull;
}
extern "C" {
pub fn Gecko_GetFirstChildElement(element: RawGeckoElementBorrowed)
-> RawGeckoElementBorrowedOrNull;
pub fn Gecko_GetAnonymousContentForElement(element:
RawGeckoElementBorrowed)
-> *mut nsTArray<*mut nsIContent>;
}
extern "C" {
pub fn Gecko_GetLastChildElement(element: RawGeckoElementBorrowed)
-> RawGeckoElementBorrowedOrNull;
pub fn Gecko_DestroyAnonymousContentList(anon_content:
*mut nsTArray<*mut nsIContent>);
}
extern "C" {
pub fn Gecko_GetPrevSiblingElement(element: RawGeckoElementBorrowed)
-> RawGeckoElementBorrowedOrNull;
pub fn Gecko_MaybeCreateStyleChildrenIterator(node: RawGeckoNodeBorrowed)
-> StyleChildrenIteratorOwnedOrNull;
}
extern "C" {
pub fn Gecko_GetNextSiblingElement(element: RawGeckoElementBorrowed)
-> RawGeckoElementBorrowedOrNull;
pub fn Gecko_DropStyleChildrenIterator(it: StyleChildrenIteratorOwned);
}
extern "C" {
pub fn Gecko_GetDocumentElement(document: RawGeckoDocumentBorrowed)
-> RawGeckoElementBorrowedOrNull;
pub fn Gecko_GetNextStyleChild(it: StyleChildrenIteratorBorrowedMut)
-> RawGeckoNodeBorrowedOrNull;
}
extern "C" {
pub fn Gecko_LoadStyleSheet(loader: *mut Loader,
Expand All @@ -556,22 +550,6 @@ extern "C" {
url_bytes: *const u8, url_length: u32,
media_list: RawServoMediaListStrong);
}
extern "C" {
pub fn Gecko_MaybeCreateStyleChildrenIterator(node: RawGeckoNodeBorrowed)
-> StyleChildrenIteratorOwnedOrNull;
}
extern "C" {
pub fn Gecko_DropStyleChildrenIterator(it: StyleChildrenIteratorOwned);
}
extern "C" {
pub fn Gecko_GetNextStyleChild(it: StyleChildrenIteratorBorrowedMut)
-> RawGeckoNodeBorrowedOrNull;
}
extern "C" {
pub fn Gecko_ElementHasBindingWithAnonymousContent(element:
RawGeckoElementBorrowed)
-> bool;
}
extern "C" {
pub fn Gecko_ElementState(element: RawGeckoElementBorrowed) -> u64;
}
Expand Down Expand Up @@ -1041,6 +1019,11 @@ extern "C" {
*mut nsStyleGridTemplate,
track_sizes: u32);
}
extern "C" {
pub fn Gecko_SetGridTemplateLineNamesLength(grid_template:
*mut nsStyleGridTemplate,
track_sizes: u32);
}
extern "C" {
pub fn Gecko_CopyStyleGridTemplateValues(grid_template:
*mut nsStyleGridTemplate,
Expand Down Expand Up @@ -1942,6 +1925,17 @@ extern "C" {
RawServoDeclarationBlockBorrowed)
-> ServoComputedValuesStrong;
}
extern "C" {
pub fn Servo_StyleSet_MightHaveAttributeDependency(set:
RawServoStyleSetBorrowed,
local_name:
*mut nsIAtom)
-> bool;
}
extern "C" {
pub fn Servo_StyleSet_HasStateDependency(set: RawServoStyleSetBorrowed,
state: u64) -> bool;
}
extern "C" {
pub fn Servo_CssRules_ListTypes(rules: ServoCssRulesBorrowed,
result: nsTArrayBorrowed_uintptr_t);
Expand Down Expand Up @@ -2683,6 +2677,9 @@ extern "C" {
extern "C" {
pub fn Servo_AssertTreeIsClean(root: RawGeckoElementBorrowed);
}
extern "C" {
pub fn Servo_MaybeGCRuleTree(set: RawServoStyleSetBorrowed);
}
extern "C" {
pub fn Servo_StyleSet_GetBaseComputedValuesForElement(set:
RawServoStyleSetBorrowed,
Expand Down

0 comments on commit f5a6168

Please sign in to comment.