mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
This reverts commit 8e15389cae
.
This commit is contained in:
parent
8e15389cae
commit
d6ae8dc112
152 changed files with 4622 additions and 5862 deletions
|
@ -66,8 +66,6 @@ use crate::stylist::CascadeData;
|
|||
use crate::values::{AtomIdent, AtomString};
|
||||
use crate::CaseSensitivityExt;
|
||||
use crate::LocalName;
|
||||
use app_units::Au;
|
||||
use euclid::default::Size2D;
|
||||
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
||||
use fxhash::FxHashMap;
|
||||
use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator};
|
||||
|
@ -323,11 +321,6 @@ impl<'ln> GeckoNode<'ln> {
|
|||
self.flags() & (NODE_IS_IN_SHADOW_TREE as u32) != 0
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_connected(&self) -> bool {
|
||||
self.get_bool_flag(nsINode_BooleanFlag::IsConnected)
|
||||
}
|
||||
|
||||
/// WARNING: This logic is duplicated in Gecko's FlattenedTreeParentIsParent.
|
||||
/// Make sure to mirror any modifications in both places.
|
||||
#[inline]
|
||||
|
@ -1037,21 +1030,6 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn primary_box_size(&self) -> Size2D<Au> {
|
||||
if !self.as_node().is_connected() {
|
||||
return Size2D::zero();
|
||||
}
|
||||
|
||||
unsafe {
|
||||
let frame = self.0._base._base._base.__bindgen_anon_1.mPrimaryFrame.as_ref();
|
||||
if frame.is_null() {
|
||||
return Size2D::zero();
|
||||
}
|
||||
Size2D::new(Au((**frame).mRect.width), Au((**frame).mRect.height))
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the list of slotted nodes of this node.
|
||||
#[inline]
|
||||
fn slotted_nodes(&self) -> &[Self::ConcreteNode] {
|
||||
|
@ -1415,6 +1393,16 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
self.is_root_of_native_anonymous_subtree()
|
||||
}
|
||||
|
||||
unsafe fn set_selector_flags(&self, flags: ElementSelectorFlags) {
|
||||
debug_assert!(!flags.is_empty());
|
||||
self.set_flags(selector_flags_to_node_flags(flags));
|
||||
}
|
||||
|
||||
fn has_selector_flags(&self, flags: ElementSelectorFlags) -> bool {
|
||||
let node_flags = selector_flags_to_node_flags(flags);
|
||||
(self.flags() & node_flags) == node_flags
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn may_have_animations(&self) -> bool {
|
||||
if let Some(pseudo) = self.implemented_pseudo_element() {
|
||||
|
@ -1513,7 +1501,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
) -> bool {
|
||||
use crate::properties::LonghandIdSet;
|
||||
|
||||
let after_change_ui_style = after_change_style.get_ui();
|
||||
let after_change_box_style = after_change_style.get_box();
|
||||
let existing_transitions = self.css_transitions_info();
|
||||
let mut transitions_to_keep = LonghandIdSet::new();
|
||||
for transition_property in after_change_style.transition_properties() {
|
||||
|
@ -1523,7 +1511,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
transitions_to_keep.insert(physical_longhand);
|
||||
if self.needs_transitions_update_per_property(
|
||||
physical_longhand,
|
||||
after_change_ui_style.transition_combined_duration_at(transition_property.index),
|
||||
after_change_box_style.transition_combined_duration_at(transition_property.index),
|
||||
before_change_style,
|
||||
after_change_style,
|
||||
&existing_transitions,
|
||||
|
@ -1605,9 +1593,23 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
use crate::properties::longhands::_x_lang::SpecifiedValue as SpecifiedLang;
|
||||
use crate::properties::longhands::_x_text_zoom::SpecifiedValue as SpecifiedZoom;
|
||||
use crate::properties::longhands::color::SpecifiedValue as SpecifiedColor;
|
||||
use crate::properties::longhands::text_align::SpecifiedValue as SpecifiedTextAlign;
|
||||
use crate::stylesheets::layer_rule::LayerOrder;
|
||||
use crate::values::specified::color::Color;
|
||||
lazy_static! {
|
||||
static ref TH_RULE: ApplicableDeclarationBlock = {
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let pdb = PropertyDeclarationBlock::with_one(
|
||||
PropertyDeclaration::TextAlign(SpecifiedTextAlign::MozCenterOrInherit),
|
||||
Importance::Normal,
|
||||
);
|
||||
let arc = Arc::new_leaked(global_style_data.shared_lock.wrap(pdb));
|
||||
ApplicableDeclarationBlock::from_declarations(
|
||||
arc,
|
||||
ServoCascadeLevel::PresHints,
|
||||
LayerOrder::root(),
|
||||
)
|
||||
};
|
||||
static ref TABLE_COLOR_RULE: ApplicableDeclarationBlock = {
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let pdb = PropertyDeclarationBlock::with_one(
|
||||
|
@ -1652,7 +1654,9 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
let ns = self.namespace_id();
|
||||
// <th> elements get a default MozCenterOrInherit which may get overridden
|
||||
if ns == structs::kNameSpaceID_XHTML as i32 {
|
||||
if self.local_name().as_ptr() == atom!("table").as_ptr() &&
|
||||
if self.local_name().as_ptr() == atom!("th").as_ptr() {
|
||||
hints.push(TH_RULE.clone());
|
||||
} else if self.local_name().as_ptr() == atom!("table").as_ptr() &&
|
||||
self.as_node().owner_doc().quirks_mode() == QuirksMode::Quirks
|
||||
{
|
||||
hints.push(TABLE_COLOR_RULE.clone());
|
||||
|
@ -1844,11 +1848,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
None
|
||||
}
|
||||
|
||||
fn set_selector_flags(&self, flags: ElementSelectorFlags) {
|
||||
debug_assert!(!flags.is_empty());
|
||||
self.set_flags(selector_flags_to_node_flags(flags));
|
||||
}
|
||||
|
||||
fn attr_matches(
|
||||
&self,
|
||||
ns: &NamespaceConstraint<&Namespace>,
|
||||
|
@ -1961,11 +1960,15 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
self.local_name() == other.local_name() && self.namespace() == other.namespace()
|
||||
}
|
||||
|
||||
fn match_non_ts_pseudo_class(
|
||||
fn match_non_ts_pseudo_class<F>(
|
||||
&self,
|
||||
pseudo_class: &NonTSPseudoClass,
|
||||
context: &mut MatchingContext<Self::Impl>,
|
||||
) -> bool {
|
||||
flags_setter: &mut F,
|
||||
) -> bool
|
||||
where
|
||||
F: FnMut(&Self, ElementSelectorFlags),
|
||||
{
|
||||
use selectors::matching::*;
|
||||
match *pseudo_class {
|
||||
NonTSPseudoClass::Autofill |
|
||||
|
@ -2006,7 +2009,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
NonTSPseudoClass::MozDirAttrRTL |
|
||||
NonTSPseudoClass::MozDirAttrLikeAuto |
|
||||
NonTSPseudoClass::MozModalDialog |
|
||||
NonTSPseudoClass::MozTopmostModal |
|
||||
NonTSPseudoClass::MozTopmostModalDialog |
|
||||
NonTSPseudoClass::Active |
|
||||
NonTSPseudoClass::Hover |
|
||||
NonTSPseudoClass::MozAutofillPreview |
|
||||
|
@ -2021,9 +2024,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
self.is_link() && context.visited_handling().matches_visited()
|
||||
},
|
||||
NonTSPseudoClass::MozFirstNode => {
|
||||
if context.needs_selector_flags() {
|
||||
self.apply_selector_flags(ElementSelectorFlags::HAS_EDGE_CHILD_SELECTOR);
|
||||
}
|
||||
flags_setter(self, ElementSelectorFlags::HAS_EDGE_CHILD_SELECTOR);
|
||||
let mut elem = self.as_node();
|
||||
while let Some(prev) = elem.prev_sibling() {
|
||||
if prev.contains_non_whitespace_content() {
|
||||
|
@ -2034,9 +2035,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
true
|
||||
},
|
||||
NonTSPseudoClass::MozLastNode => {
|
||||
if context.needs_selector_flags() {
|
||||
self.apply_selector_flags(ElementSelectorFlags::HAS_EDGE_CHILD_SELECTOR);
|
||||
}
|
||||
flags_setter(self, ElementSelectorFlags::HAS_EDGE_CHILD_SELECTOR);
|
||||
let mut elem = self.as_node();
|
||||
while let Some(next) = elem.next_sibling() {
|
||||
if next.contains_non_whitespace_content() {
|
||||
|
@ -2047,9 +2046,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
true
|
||||
},
|
||||
NonTSPseudoClass::MozOnlyWhitespace => {
|
||||
if context.needs_selector_flags() {
|
||||
self.apply_selector_flags(ElementSelectorFlags::HAS_EMPTY_SELECTOR);
|
||||
}
|
||||
flags_setter(self, ElementSelectorFlags::HAS_EMPTY_SELECTOR);
|
||||
if self
|
||||
.as_node()
|
||||
.dom_children()
|
||||
|
@ -2071,6 +2068,8 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
NonTSPseudoClass::MozIsHTML => self.is_html_element_in_html_document(),
|
||||
|
||||
NonTSPseudoClass::MozLWTheme |
|
||||
NonTSPseudoClass::MozLWThemeBrightText |
|
||||
NonTSPseudoClass::MozLWThemeDarkText |
|
||||
NonTSPseudoClass::MozLocaleDir(..) |
|
||||
NonTSPseudoClass::MozWindowInactive => {
|
||||
let state_bit = pseudo_class.document_state_flag();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue