servo: Merge #17429 - style: Get restyle hints right in presence of XBL (from emilio:restyle-hints-xbl); r=heycam

Fixes bug 1371130.

Source-Repo: https://github.com/servo/servo
Source-Revision: f5a61684f4d357e9259cd42d7b626f73cb32faaf

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 91587d2f9afed039199863fa7dd66af00b1fcb76
This commit is contained in:
Emilio Cobos Álvarez 2017-06-20 04:15:57 -07:00
Родитель 8fde759b42
Коммит 83dbe4dfca
7 изменённых файлов: 8913 добавлений и 6886 удалений

Просмотреть файл

@ -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> {
@ -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>,

Просмотреть файл

@ -658,6 +658,84 @@ cfg_if! {
pub static nsGkAtoms_div: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms2dlE"]
pub static nsGkAtoms_dl: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms11docAbstractE"]
pub static nsGkAtoms_docAbstract: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms18docAcknowledgmentsE"]
pub static nsGkAtoms_docAcknowledgments: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms12docAfterwordE"]
pub static nsGkAtoms_docAfterword: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms11docAppendixE"]
pub static nsGkAtoms_docAppendix: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms11docBacklinkE"]
pub static nsGkAtoms_docBacklink: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms14docBiblioentryE"]
pub static nsGkAtoms_docBiblioentry: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms15docBibliographyE"]
pub static nsGkAtoms_docBibliography: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms12docBibliorefE"]
pub static nsGkAtoms_docBiblioref: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms10docChapterE"]
pub static nsGkAtoms_docChapter: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms11docColophonE"]
pub static nsGkAtoms_docColophon: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms13docConclusionE"]
pub static nsGkAtoms_docConclusion: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms8docCoverE"]
pub static nsGkAtoms_docCover: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms9docCreditE"]
pub static nsGkAtoms_docCredit: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms10docCreditsE"]
pub static nsGkAtoms_docCredits: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms13docDedicationE"]
pub static nsGkAtoms_docDedication: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms10docEndnoteE"]
pub static nsGkAtoms_docEndnote: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms11docEndnotesE"]
pub static nsGkAtoms_docEndnotes: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms11docEpigraphE"]
pub static nsGkAtoms_docEpigraph: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms11docEpilogueE"]
pub static nsGkAtoms_docEpilogue: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms9docErrataE"]
pub static nsGkAtoms_docErrata: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms10docExampleE"]
pub static nsGkAtoms_docExample: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms11docFootnoteE"]
pub static nsGkAtoms_docFootnote: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms11docForewordE"]
pub static nsGkAtoms_docForeword: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms11docGlossaryE"]
pub static nsGkAtoms_docGlossary: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms11docGlossrefE"]
pub static nsGkAtoms_docGlossref: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms8docIndexE"]
pub static nsGkAtoms_docIndex: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms15docIntroductionE"]
pub static nsGkAtoms_docIntroduction: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms10docNoterefE"]
pub static nsGkAtoms_docNoteref: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms9docNoticeE"]
pub static nsGkAtoms_docNotice: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms12docPagebreakE"]
pub static nsGkAtoms_docPagebreak: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms11docPagelistE"]
pub static nsGkAtoms_docPagelist: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms7docPartE"]
pub static nsGkAtoms_docPart: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms10docPrefaceE"]
pub static nsGkAtoms_docPreface: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms11docPrologueE"]
pub static nsGkAtoms_docPrologue: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms12docPullquoteE"]
pub static nsGkAtoms_docPullquote: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms6docQnaE"]
pub static nsGkAtoms_docQna: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms11docSubtitleE"]
pub static nsGkAtoms_docSubtitle: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms6docTipE"]
pub static nsGkAtoms_docTip: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms6docTocE"]
pub static nsGkAtoms_docToc: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms13doctypePublicE"]
pub static nsGkAtoms_doctypePublic: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms13doctypeSystemE"]
@ -1076,6 +1154,8 @@ cfg_if! {
pub static nsGkAtoms_kind: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms5labelE"]
pub static nsGkAtoms_label: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms6labelsE"]
pub static nsGkAtoms_labels: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms4langE"]
pub static nsGkAtoms_lang: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms8languageE"]
@ -1298,8 +1378,6 @@ cfg_if! {
pub static nsGkAtoms_moz_action_hint: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms18x_moz_errormessageE"]
pub static nsGkAtoms_x_moz_errormessage: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms17msthemecompatibleE"]
pub static nsGkAtoms_msthemecompatible: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms8multicolE"]
pub static nsGkAtoms_multicol: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms8multipleE"]
@ -2498,6 +2576,8 @@ cfg_if! {
pub static nsGkAtoms_text_decoration: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms9terminateE"]
pub static nsGkAtoms_terminate: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms4termE"]
pub static nsGkAtoms_term: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms4testE"]
pub static nsGkAtoms_test: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms4textE"]
@ -5691,6 +5771,84 @@ cfg_if! {
pub static nsGkAtoms_div: *mut nsIAtom;
#[link_name = "?dl@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_dl: *mut nsIAtom;
#[link_name = "?docAbstract@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docAbstract: *mut nsIAtom;
#[link_name = "?docAcknowledgments@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docAcknowledgments: *mut nsIAtom;
#[link_name = "?docAfterword@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docAfterword: *mut nsIAtom;
#[link_name = "?docAppendix@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docAppendix: *mut nsIAtom;
#[link_name = "?docBacklink@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docBacklink: *mut nsIAtom;
#[link_name = "?docBiblioentry@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docBiblioentry: *mut nsIAtom;
#[link_name = "?docBibliography@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docBibliography: *mut nsIAtom;
#[link_name = "?docBiblioref@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docBiblioref: *mut nsIAtom;
#[link_name = "?docChapter@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docChapter: *mut nsIAtom;
#[link_name = "?docColophon@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docColophon: *mut nsIAtom;
#[link_name = "?docConclusion@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docConclusion: *mut nsIAtom;
#[link_name = "?docCover@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docCover: *mut nsIAtom;
#[link_name = "?docCredit@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docCredit: *mut nsIAtom;
#[link_name = "?docCredits@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docCredits: *mut nsIAtom;
#[link_name = "?docDedication@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docDedication: *mut nsIAtom;
#[link_name = "?docEndnote@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docEndnote: *mut nsIAtom;
#[link_name = "?docEndnotes@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docEndnotes: *mut nsIAtom;
#[link_name = "?docEpigraph@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docEpigraph: *mut nsIAtom;
#[link_name = "?docEpilogue@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docEpilogue: *mut nsIAtom;
#[link_name = "?docErrata@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docErrata: *mut nsIAtom;
#[link_name = "?docExample@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docExample: *mut nsIAtom;
#[link_name = "?docFootnote@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docFootnote: *mut nsIAtom;
#[link_name = "?docForeword@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docForeword: *mut nsIAtom;
#[link_name = "?docGlossary@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docGlossary: *mut nsIAtom;
#[link_name = "?docGlossref@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docGlossref: *mut nsIAtom;
#[link_name = "?docIndex@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docIndex: *mut nsIAtom;
#[link_name = "?docIntroduction@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docIntroduction: *mut nsIAtom;
#[link_name = "?docNoteref@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docNoteref: *mut nsIAtom;
#[link_name = "?docNotice@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docNotice: *mut nsIAtom;
#[link_name = "?docPagebreak@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docPagebreak: *mut nsIAtom;
#[link_name = "?docPagelist@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docPagelist: *mut nsIAtom;
#[link_name = "?docPart@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docPart: *mut nsIAtom;
#[link_name = "?docPreface@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docPreface: *mut nsIAtom;
#[link_name = "?docPrologue@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docPrologue: *mut nsIAtom;
#[link_name = "?docPullquote@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docPullquote: *mut nsIAtom;
#[link_name = "?docQna@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docQna: *mut nsIAtom;
#[link_name = "?docSubtitle@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docSubtitle: *mut nsIAtom;
#[link_name = "?docTip@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docTip: *mut nsIAtom;
#[link_name = "?docToc@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_docToc: *mut nsIAtom;
#[link_name = "?doctypePublic@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_doctypePublic: *mut nsIAtom;
#[link_name = "?doctypeSystem@nsGkAtoms@@2PEAVnsIAtom@@EA"]
@ -6109,6 +6267,8 @@ cfg_if! {
pub static nsGkAtoms_kind: *mut nsIAtom;
#[link_name = "?label@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_label: *mut nsIAtom;
#[link_name = "?labels@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_labels: *mut nsIAtom;
#[link_name = "?lang@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_lang: *mut nsIAtom;
#[link_name = "?language@nsGkAtoms@@2PEAVnsIAtom@@EA"]
@ -6331,8 +6491,6 @@ cfg_if! {
pub static nsGkAtoms_moz_action_hint: *mut nsIAtom;
#[link_name = "?x_moz_errormessage@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_x_moz_errormessage: *mut nsIAtom;
#[link_name = "?msthemecompatible@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_msthemecompatible: *mut nsIAtom;
#[link_name = "?multicol@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_multicol: *mut nsIAtom;
#[link_name = "?multiple@nsGkAtoms@@2PEAVnsIAtom@@EA"]
@ -7531,6 +7689,8 @@ cfg_if! {
pub static nsGkAtoms_text_decoration: *mut nsIAtom;
#[link_name = "?terminate@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_terminate: *mut nsIAtom;
#[link_name = "?term@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_term: *mut nsIAtom;
#[link_name = "?test@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_test: *mut nsIAtom;
#[link_name = "?text@nsGkAtoms@@2PEAVnsIAtom@@EA"]
@ -10724,6 +10884,84 @@ cfg_if! {
pub static nsGkAtoms_div: *mut nsIAtom;
#[link_name = "\x01?dl@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_dl: *mut nsIAtom;
#[link_name = "\x01?docAbstract@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docAbstract: *mut nsIAtom;
#[link_name = "\x01?docAcknowledgments@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docAcknowledgments: *mut nsIAtom;
#[link_name = "\x01?docAfterword@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docAfterword: *mut nsIAtom;
#[link_name = "\x01?docAppendix@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docAppendix: *mut nsIAtom;
#[link_name = "\x01?docBacklink@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docBacklink: *mut nsIAtom;
#[link_name = "\x01?docBiblioentry@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docBiblioentry: *mut nsIAtom;
#[link_name = "\x01?docBibliography@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docBibliography: *mut nsIAtom;
#[link_name = "\x01?docBiblioref@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docBiblioref: *mut nsIAtom;
#[link_name = "\x01?docChapter@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docChapter: *mut nsIAtom;
#[link_name = "\x01?docColophon@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docColophon: *mut nsIAtom;
#[link_name = "\x01?docConclusion@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docConclusion: *mut nsIAtom;
#[link_name = "\x01?docCover@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docCover: *mut nsIAtom;
#[link_name = "\x01?docCredit@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docCredit: *mut nsIAtom;
#[link_name = "\x01?docCredits@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docCredits: *mut nsIAtom;
#[link_name = "\x01?docDedication@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docDedication: *mut nsIAtom;
#[link_name = "\x01?docEndnote@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docEndnote: *mut nsIAtom;
#[link_name = "\x01?docEndnotes@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docEndnotes: *mut nsIAtom;
#[link_name = "\x01?docEpigraph@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docEpigraph: *mut nsIAtom;
#[link_name = "\x01?docEpilogue@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docEpilogue: *mut nsIAtom;
#[link_name = "\x01?docErrata@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docErrata: *mut nsIAtom;
#[link_name = "\x01?docExample@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docExample: *mut nsIAtom;
#[link_name = "\x01?docFootnote@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docFootnote: *mut nsIAtom;
#[link_name = "\x01?docForeword@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docForeword: *mut nsIAtom;
#[link_name = "\x01?docGlossary@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docGlossary: *mut nsIAtom;
#[link_name = "\x01?docGlossref@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docGlossref: *mut nsIAtom;
#[link_name = "\x01?docIndex@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docIndex: *mut nsIAtom;
#[link_name = "\x01?docIntroduction@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docIntroduction: *mut nsIAtom;
#[link_name = "\x01?docNoteref@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docNoteref: *mut nsIAtom;
#[link_name = "\x01?docNotice@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docNotice: *mut nsIAtom;
#[link_name = "\x01?docPagebreak@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docPagebreak: *mut nsIAtom;
#[link_name = "\x01?docPagelist@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docPagelist: *mut nsIAtom;
#[link_name = "\x01?docPart@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docPart: *mut nsIAtom;
#[link_name = "\x01?docPreface@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docPreface: *mut nsIAtom;
#[link_name = "\x01?docPrologue@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docPrologue: *mut nsIAtom;
#[link_name = "\x01?docPullquote@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docPullquote: *mut nsIAtom;
#[link_name = "\x01?docQna@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docQna: *mut nsIAtom;
#[link_name = "\x01?docSubtitle@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docSubtitle: *mut nsIAtom;
#[link_name = "\x01?docTip@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docTip: *mut nsIAtom;
#[link_name = "\x01?docToc@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_docToc: *mut nsIAtom;
#[link_name = "\x01?doctypePublic@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_doctypePublic: *mut nsIAtom;
#[link_name = "\x01?doctypeSystem@nsGkAtoms@@2PAVnsIAtom@@A"]
@ -11142,6 +11380,8 @@ cfg_if! {
pub static nsGkAtoms_kind: *mut nsIAtom;
#[link_name = "\x01?label@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_label: *mut nsIAtom;
#[link_name = "\x01?labels@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_labels: *mut nsIAtom;
#[link_name = "\x01?lang@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_lang: *mut nsIAtom;
#[link_name = "\x01?language@nsGkAtoms@@2PAVnsIAtom@@A"]
@ -11364,8 +11604,6 @@ cfg_if! {
pub static nsGkAtoms_moz_action_hint: *mut nsIAtom;
#[link_name = "\x01?x_moz_errormessage@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_x_moz_errormessage: *mut nsIAtom;
#[link_name = "\x01?msthemecompatible@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_msthemecompatible: *mut nsIAtom;
#[link_name = "\x01?multicol@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_multicol: *mut nsIAtom;
#[link_name = "\x01?multiple@nsGkAtoms@@2PAVnsIAtom@@A"]
@ -12564,6 +12802,8 @@ cfg_if! {
pub static nsGkAtoms_text_decoration: *mut nsIAtom;
#[link_name = "\x01?terminate@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_terminate: *mut nsIAtom;
#[link_name = "\x01?term@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_term: *mut nsIAtom;
#[link_name = "\x01?test@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_test: *mut nsIAtom;
#[link_name = "\x01?text@nsGkAtoms@@2PAVnsIAtom@@A"]
@ -15760,6 +16000,84 @@ macro_rules! atom {
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_div as *mut _) } };
("dl") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_dl as *mut _) } };
("doc-abstract") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docAbstract as *mut _) } };
("doc-acknowledgments") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docAcknowledgments as *mut _) } };
("doc-afterword") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docAfterword as *mut _) } };
("doc-appendix") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docAppendix as *mut _) } };
("doc-backlink") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docBacklink as *mut _) } };
("doc-biblioentry") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docBiblioentry as *mut _) } };
("doc-bibliography") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docBibliography as *mut _) } };
("doc-biblioref") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docBiblioref as *mut _) } };
("doc-chapter") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docChapter as *mut _) } };
("doc-colophon") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docColophon as *mut _) } };
("doc-conclusion") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docConclusion as *mut _) } };
("doc-cover") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docCover as *mut _) } };
("doc-credit") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docCredit as *mut _) } };
("doc-credits") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docCredits as *mut _) } };
("doc-dedication") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docDedication as *mut _) } };
("doc-endnote") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docEndnote as *mut _) } };
("doc-endnotes") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docEndnotes as *mut _) } };
("doc-epigraph") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docEpigraph as *mut _) } };
("doc-epilogue") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docEpilogue as *mut _) } };
("doc-errata") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docErrata as *mut _) } };
("doc-example") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docExample as *mut _) } };
("doc-footnote") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docFootnote as *mut _) } };
("doc-foreword") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docForeword as *mut _) } };
("doc-glossary") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docGlossary as *mut _) } };
("doc-glossref") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docGlossref as *mut _) } };
("doc-index") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docIndex as *mut _) } };
("doc-introduction") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docIntroduction as *mut _) } };
("doc-noteref") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docNoteref as *mut _) } };
("doc-notice") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docNotice as *mut _) } };
("doc-pagebreak") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docPagebreak as *mut _) } };
("doc-pagelist") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docPagelist as *mut _) } };
("doc-part") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docPart as *mut _) } };
("doc-preface") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docPreface as *mut _) } };
("doc-prologue") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docPrologue as *mut _) } };
("doc-pullquote") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docPullquote as *mut _) } };
("doc-qna") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docQna as *mut _) } };
("doc-subtitle") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docSubtitle as *mut _) } };
("doc-tip") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docTip as *mut _) } };
("doc-toc") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_docToc as *mut _) } };
("doctype-public") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_doctypePublic as *mut _) } };
("doctype-system") =>
@ -16178,6 +16496,8 @@ macro_rules! atom {
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_kind as *mut _) } };
("label") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_label as *mut _) } };
("labels") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_labels as *mut _) } };
("lang") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_lang as *mut _) } };
("language") =>
@ -16400,8 +16720,6 @@ macro_rules! atom {
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_moz_action_hint as *mut _) } };
("x-moz-errormessage") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_x_moz_errormessage as *mut _) } };
("msthemecompatible") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_msthemecompatible as *mut _) } };
("multicol") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_multicol as *mut _) } };
("multiple") =>
@ -17600,6 +17918,8 @@ macro_rules! atom {
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_text_decoration as *mut _) } };
("terminate") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_terminate as *mut _) } };
("term") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_term as *mut _) } };
("test") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_test as *mut _) } };
("text") =>

Просмотреть файл

@ -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;
@ -506,55 +507,27 @@ 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;
}
extern "C" {
pub fn Gecko_GetFirstChildElement(element: RawGeckoElementBorrowed)
pub fn Gecko_GetBeforeOrAfterPseudo(element: RawGeckoElementBorrowed,
is_before: bool)
-> RawGeckoElementBorrowedOrNull;
}
extern "C" {
pub fn Gecko_GetLastChildElement(element: RawGeckoElementBorrowed)
-> RawGeckoElementBorrowedOrNull;
pub fn Gecko_GetAnonymousContentForElement(element:
RawGeckoElementBorrowed)
-> *mut nsTArray<*mut nsIContent>;
}
extern "C" {
pub fn Gecko_GetPrevSiblingElement(element: RawGeckoElementBorrowed)
-> RawGeckoElementBorrowedOrNull;
}
extern "C" {
pub fn Gecko_GetNextSiblingElement(element: RawGeckoElementBorrowed)
-> RawGeckoElementBorrowedOrNull;
}
extern "C" {
pub fn Gecko_GetDocumentElement(document: RawGeckoDocumentBorrowed)
-> RawGeckoElementBorrowedOrNull;
}
extern "C" {
pub fn Gecko_LoadStyleSheet(loader: *mut Loader,
parent: *mut ServoStyleSheet,
reusable_sheets:
*mut LoaderReusableStyleSheets,
child_sheet: RawServoStyleSheetBorrowed,
base_url_data: *mut RawGeckoURLExtraData,
url_bytes: *const u8, url_length: u32,
media_list: RawServoMediaListStrong);
pub fn Gecko_DestroyAnonymousContentList(anon_content:
*mut nsTArray<*mut nsIContent>);
}
extern "C" {
pub fn Gecko_MaybeCreateStyleChildrenIterator(node: RawGeckoNodeBorrowed)
@ -568,9 +541,14 @@ extern "C" {
-> RawGeckoNodeBorrowedOrNull;
}
extern "C" {
pub fn Gecko_ElementHasBindingWithAnonymousContent(element:
RawGeckoElementBorrowed)
-> bool;
pub fn Gecko_LoadStyleSheet(loader: *mut Loader,
parent: *mut ServoStyleSheet,
reusable_sheets:
*mut LoaderReusableStyleSheets,
child_sheet: RawServoStyleSheetBorrowed,
base_url_data: *mut RawGeckoURLExtraData,
url_bytes: *const u8, url_length: u32,
media_list: RawServoMediaListStrong);
}
extern "C" {
pub fn Gecko_ElementState(element: RawGeckoElementBorrowed) -> u64;
@ -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,
@ -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);
@ -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,

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -36,7 +36,6 @@ use gecko_bindings::bindings::{Gecko_IsRootElement, Gecko_MatchesElement, Gecko_
use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
use gecko_bindings::bindings::Gecko_ClassOrClassList;
use gecko_bindings::bindings::Gecko_ElementHasAnimations;
use gecko_bindings::bindings::Gecko_ElementHasBindingWithAnonymousContent;
use gecko_bindings::bindings::Gecko_ElementHasCSSAnimations;
use gecko_bindings::bindings::Gecko_ElementHasCSSTransitions;
use gecko_bindings::bindings::Gecko_GetActiveLinkAttrDeclarationBlock;
@ -275,7 +274,10 @@ impl<'ln> TNode for GeckoNode<'ln> {
}
fn children_and_traversal_children_might_differ(&self) -> bool {
self.as_element().map_or(false, |e| unsafe { Gecko_ElementHasBindingWithAnonymousContent(e.0) })
match self.as_element() {
Some(e) => e.xbl_binding_anonymous_content().is_some(),
None => false,
}
}
fn opaque(&self) -> OpaqueNode {
@ -376,6 +378,10 @@ impl<'lb> GeckoXBLBinding<'lb> {
unsafe { self.0.mNextBinding.mRawPtr.as_ref().map(GeckoXBLBinding) }
}
fn anon_content(&self) -> *const nsIContent {
unsafe { self.0.mContent.raw::<nsIContent>() }
}
fn inherits_style(&self) -> bool {
unsafe { bindings::Gecko_XBLBinding_InheritsStyle(self.0) }
}
@ -557,6 +563,25 @@ impl<'le> GeckoElement<'le> {
self.as_node().get_bool_flag(nsINode_BooleanFlag::ElementMayHaveClass)
}
#[inline]
fn has_properties(&self) -> bool {
use gecko_bindings::structs::NODE_HAS_PROPERTIES;
(self.flags() & NODE_HAS_PROPERTIES as u32) != 0
}
#[inline]
fn get_before_or_after_pseudo(&self, is_before: bool) -> Option<Self> {
if !self.has_properties() {
return None;
}
unsafe {
bindings::Gecko_GetBeforeOrAfterPseudo(self.0, is_before)
.map(GeckoElement)
}
}
#[inline]
fn may_have_style_attribute(&self) -> bool {
self.as_node().get_bool_flag(nsINode_BooleanFlag::ElementMayHaveStyle)
@ -689,6 +714,40 @@ impl<'le> TElement for GeckoElement<'le> {
}
}
fn before_pseudo_element(&self) -> Option<Self> {
self.get_before_or_after_pseudo(/* is_before = */ true)
}
fn after_pseudo_element(&self) -> Option<Self> {
self.get_before_or_after_pseudo(/* is_before = */ false)
}
/// Execute `f` for each anonymous content child element (apart from
/// ::before and ::after) whose originating element is `self`.
fn each_anonymous_content_child<F>(&self, mut f: F)
where
F: FnMut(Self),
{
let array: *mut structs::nsTArray<*mut nsIContent> =
unsafe { bindings::Gecko_GetAnonymousContentForElement(self.0) };
if array.is_null() {
return;
}
for content in unsafe { &**array } {
let node = GeckoNode::from_content(unsafe { &**content });
let element = match node.as_element() {
Some(e) => e,
None => continue,
};
f(element);
}
unsafe { bindings::Gecko_DestroyAnonymousContentList(array) };
}
fn closest_non_native_anonymous_ancestor(&self) -> Option<Self> {
debug_assert!(self.is_native_anonymous());
let mut parent = match self.parent_element() {
@ -868,6 +927,10 @@ impl<'le> TElement for GeckoElement<'le> {
return None;
}
if !self.has_properties() {
return None;
}
let pseudo_type =
unsafe { bindings::Gecko_GetImplementedPseudo(self.0) };
PseudoElement::from_pseudo_type(pseudo_type)
@ -982,6 +1045,19 @@ impl<'le> TElement for GeckoElement<'le> {
current.is_some()
}
fn xbl_binding_anonymous_content(&self) -> Option<GeckoNode<'le>> {
if self.flags() & (structs::NODE_MAY_BE_IN_BINDING_MNGR as u32) == 0 {
return None;
}
let anon_content = match self.get_xbl_binding() {
Some(binding) => binding.anon_content(),
None => return None,
};
unsafe { anon_content.as_ref().map(GeckoNode::from_content) }
}
fn get_css_transitions_info(&self)
-> HashMap<TransitionProperty, Arc<AnimationValue>> {
use gecko_bindings::bindings::Gecko_ElementTransitions_EndValueAt;
@ -1323,6 +1399,8 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
type Impl = SelectorImpl;
fn parent_element(&self) -> Option<Self> {
// FIXME(emilio): This will need to jump across if the parent node is a
// shadow root to get the shadow host.
let parent_node = self.as_node().parent_node();
parent_node.and_then(|n| n.as_element())
}

Просмотреть файл

@ -270,6 +270,138 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
any_invalidated
}
fn invalidate_pseudo_element_or_nac(
&mut self,
child: E,
invalidations: &InvalidationVector
) -> bool {
let mut sibling_invalidations = InvalidationVector::new();
let result = self.invalidate_child(
child,
invalidations,
&mut sibling_invalidations
);
// Roots of NAC subtrees can indeed generate sibling invalidations, but
// they can be just ignored, since they have no siblings.
debug_assert!(child.implemented_pseudo_element().is_none() ||
sibling_invalidations.is_empty(),
"pseudos can't generate sibling invalidations, since \
using them in other position that isn't the \
rightmost part of the selector is invalid \
(for now at least)");
result
}
/// Invalidate a child and recurse down invalidating its descendants if
/// needed.
fn invalidate_child(
&mut self,
child: E,
invalidations: &InvalidationVector,
sibling_invalidations: &mut InvalidationVector,
) -> bool {
let mut child_data = child.mutate_data();
let child_data = child_data.as_mut().map(|d| &mut **d);
let mut child_invalidator = TreeStyleInvalidator::new(
child,
child_data,
self.shared_context
);
let mut invalidations_for_descendants = InvalidationVector::new();
let mut invalidated_child = false;
invalidated_child |=
child_invalidator.process_sibling_invalidations(
&mut invalidations_for_descendants,
sibling_invalidations,
);
invalidated_child |=
child_invalidator.process_descendant_invalidations(
invalidations,
&mut invalidations_for_descendants,
sibling_invalidations,
);
// The child may not be a flattened tree child of the current element,
// but may be arbitrarily deep.
//
// Since we keep the traversal flags in terms of the flattened tree,
// we need to propagate it as appropriate.
if invalidated_child && child.parent_element() != Some(self.element) {
let mut current = child.traversal_parent();
while let Some(parent) = current.take() {
if parent == self.element {
break;
}
unsafe { parent.set_dirty_descendants() };
current = parent.traversal_parent();
}
}
let invalidated_descendants = child_invalidator.invalidate_descendants(
&invalidations_for_descendants
);
invalidated_child || invalidated_descendants
}
fn invalidate_nac(
&mut self,
invalidations: &InvalidationVector,
) -> bool {
let mut any_nac_root = false;
let element = self.element;
element.each_anonymous_content_child(|nac| {
any_nac_root |=
self.invalidate_pseudo_element_or_nac(nac, invalidations);
});
any_nac_root
}
// NB: It's important that this operates on DOM children, which is what
// selector-matching operates on.
fn invalidate_dom_descendants_of(
&mut self,
parent: E::ConcreteNode,
invalidations: &InvalidationVector,
) -> bool {
let mut any_descendant = false;
let mut sibling_invalidations = InvalidationVector::new();
for child in parent.children() {
// TODO(emilio): We handle <xbl:children> fine, because they appear
// in selector-matching (note bug 1374247, though).
//
// This probably needs a shadow root check on `child` here, and
// recursing if that's the case.
//
// Also, what's the deal with HTML <content>? We don't need to
// support that for now, though we probably need to recurse into the
// distributed children too.
let child = match child.as_element() {
Some(e) => e,
None => continue,
};
any_descendant |= self.invalidate_child(
child,
invalidations,
&mut sibling_invalidations,
);
}
any_descendant
}
/// Given a descendant invalidation list, go through the current element's
/// descendants, and invalidate style on them.
fn invalidate_descendants(
@ -293,46 +425,36 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
}
}
let mut sibling_invalidations = InvalidationVector::new();
let mut any_descendant = false;
let mut any_children = false;
for child in self.element.as_node().traversal_children() {
let child = match child.as_element() {
Some(e) => e,
None => continue,
};
let mut child_data = child.mutate_data();
let child_data = child_data.as_mut().map(|d| &mut **d);
let mut child_invalidator = TreeStyleInvalidator::new(
child,
child_data,
self.shared_context
);
let mut invalidations_for_descendants = InvalidationVector::new();
any_children |= child_invalidator.process_sibling_invalidations(
&mut invalidations_for_descendants,
&mut sibling_invalidations,
);
any_children |= child_invalidator.process_descendant_invalidations(
invalidations,
&mut invalidations_for_descendants,
&mut sibling_invalidations,
);
any_children |= child_invalidator.invalidate_descendants(
&invalidations_for_descendants
);
if let Some(anon_content) = self.element.xbl_binding_anonymous_content() {
any_descendant |=
self.invalidate_dom_descendants_of(anon_content, invalidations);
}
if any_children {
// TODO(emilio): Having a list of invalidations just for pseudo-elements
// may save some work here and there.
if let Some(before) = self.element.before_pseudo_element() {
any_descendant |=
self.invalidate_pseudo_element_or_nac(before, invalidations);
}
let node = self.element.as_node();
any_descendant |=
self.invalidate_dom_descendants_of(node, invalidations);
if let Some(after) = self.element.after_pseudo_element() {
any_descendant |=
self.invalidate_pseudo_element_or_nac(after, invalidations);
}
any_descendant |= self.invalidate_nac(invalidations);
if any_descendant {
unsafe { self.element.set_dirty_descendants() };
}
any_children
any_descendant
}
/// Process the given sibling invalidations coming from our previous