aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/script/layout_wrapper.rs10
-rw-r--r--components/style/dom.rs6
-rw-r--r--components/style/gecko/generated/bindings.rs15
-rw-r--r--components/style/gecko/generated/structs_debug.rs44
-rw-r--r--components/style/gecko/generated/structs_release.rs44
-rw-r--r--components/style/gecko/wrapper.rs41
-rw-r--r--components/style/sharing/mod.rs7
-rw-r--r--components/style/stylist.rs5
8 files changed, 114 insertions, 58 deletions
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs
index 0b230e6081f..e915a2d07b1 100644
--- a/components/script/layout_wrapper.rs
+++ b/components/script/layout_wrapper.rs
@@ -51,7 +51,7 @@ use script_layout_interface::{OpaqueStyleAndLayoutData, StyleData};
use script_layout_interface::wrapper_traits::{DangerousThreadSafeLayoutNode, GetLayoutData, LayoutNode};
use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
use selectors::attr::{AttrSelectorOperation, NamespaceConstraint};
-use selectors::matching::{ElementSelectorFlags, MatchingContext, RelevantLinkStatus};
+use selectors::matching::{ElementSelectorFlags, MatchingContext, RelevantLinkStatus, VisitedHandlingMode};
use servo_atoms::Atom;
use servo_url::ServoUrl;
use std::fmt;
@@ -364,7 +364,9 @@ impl<'le> fmt::Debug for ServoLayoutElement<'le> {
}
impl<'le> PresentationalHintsSynthesizer for ServoLayoutElement<'le> {
- fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
+ fn synthesize_presentational_hints_for_legacy_attributes<V>(&self,
+ _visited_handling: VisitedHandlingMode,
+ hints: &mut V)
where V: Push<ApplicableDeclarationBlock>
{
unsafe {
@@ -1228,6 +1230,8 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
}
impl<'le> PresentationalHintsSynthesizer for ServoThreadSafeLayoutElement<'le> {
- fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, _hints: &mut V)
+ fn synthesize_presentational_hints_for_legacy_attributes<V>(&self,
+ _visited_handling: VisitedHandlingMode,
+ _hints: &mut V)
where V: Push<ApplicableDeclarationBlock> {}
}
diff --git a/components/style/dom.rs b/components/style/dom.rs
index e2673593997..57011643301 100644
--- a/components/style/dom.rs
+++ b/components/style/dom.rs
@@ -18,7 +18,7 @@ use properties::{ComputedValues, PropertyDeclarationBlock};
#[cfg(feature = "gecko")] use properties::animated_properties::TransitionProperty;
use rule_tree::CascadeLevel;
use selector_parser::{ElementExt, PreExistingComputedValues, PseudoElement};
-use selectors::matching::ElementSelectorFlags;
+use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode};
use shared_lock::Locked;
use sink::Push;
use std::fmt;
@@ -270,7 +270,9 @@ pub unsafe fn raw_note_descendants<E, B>(element: E) -> bool
pub trait PresentationalHintsSynthesizer {
/// Generate the proper applicable declarations due to presentational hints,
/// and insert them into `hints`.
- fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
+ fn synthesize_presentational_hints_for_legacy_attributes<V>(&self,
+ visited_handling: VisitedHandlingMode,
+ hints: &mut V)
where V: Push<ApplicableDeclarationBlock>;
}
diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs
index 0b5a0098202..f08d4b50f2d 100644
--- a/components/style/gecko/generated/bindings.rs
+++ b/components/style/gecko/generated/bindings.rs
@@ -695,6 +695,21 @@ extern "C" {
-> RawServoDeclarationBlockStrongBorrowedOrNull;
}
extern "C" {
+ pub fn Gecko_GetUnvisitedLinkAttrDeclarationBlock(element:
+ RawGeckoElementBorrowed)
+ -> RawServoDeclarationBlockStrongBorrowedOrNull;
+}
+extern "C" {
+ pub fn Gecko_GetVisitedLinkAttrDeclarationBlock(element:
+ RawGeckoElementBorrowed)
+ -> RawServoDeclarationBlockStrongBorrowedOrNull;
+}
+extern "C" {
+ pub fn Gecko_GetActiveLinkAttrDeclarationBlock(element:
+ RawGeckoElementBorrowed)
+ -> RawServoDeclarationBlockStrongBorrowedOrNull;
+}
+extern "C" {
pub fn Gecko_GetAnimationRule(aElementOrPseudo: RawGeckoElementBorrowed,
aCascadeLevel:
EffectCompositor_CascadeLevel,
diff --git a/components/style/gecko/generated/structs_debug.rs b/components/style/gecko/generated/structs_debug.rs
index 860d6904ff0..f324c31dd54 100644
--- a/components/style/gecko/generated/structs_debug.rs
+++ b/components/style/gecko/generated/structs_debug.rs
@@ -800,6 +800,11 @@ pub mod root {
4;
pub const NS_STYLE_CONTEXT_PROPERTY_FILL: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_CONTEXT_PROPERTY_STROKE: ::std::os::raw::c_uint = 2;
+ pub const NS_STYLE_CONTEXT_PROPERTY_FILL_OPACITY: ::std::os::raw::c_uint =
+ 4;
+ pub const NS_STYLE_CONTEXT_PROPERTY_STROKE_OPACITY: ::std::os::raw::c_uint
+ =
+ 8;
pub const NS_STYLE_WINDOW_SHADOW_NONE: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_WINDOW_SHADOW_DEFAULT: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_WINDOW_SHADOW_MENU: ::std::os::raw::c_uint = 2;
@@ -3673,9 +3678,20 @@ pub mod root {
_unused: [u8; 0],
}
#[repr(C)]
- #[derive(Debug, Copy, Clone)]
+ #[derive(Debug)]
pub struct EventHandlerNonNull {
- _unused: [u8; 0],
+ pub _base: root::mozilla::dom::CallbackFunction,
+ }
+ #[test]
+ fn bindgen_test_layout_EventHandlerNonNull() {
+ assert_eq!(::std::mem::size_of::<EventHandlerNonNull>() ,
+ 56usize , concat ! (
+ "Size of: " , stringify ! ( EventHandlerNonNull )
+ ));
+ assert_eq! (::std::mem::align_of::<EventHandlerNonNull>() ,
+ 8usize , concat ! (
+ "Alignment of " , stringify ! (
+ EventHandlerNonNull ) ));
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
@@ -14866,26 +14882,6 @@ pub mod root {
pub struct nsIPrincipal_COMTypeInfo {
pub _address: u8,
}
- pub const nsIPrincipal_APP_STATUS_NOT_INSTALLED:
- root::nsIPrincipal__bindgen_ty_1 =
- nsIPrincipal__bindgen_ty_1::APP_STATUS_NOT_INSTALLED;
- pub const nsIPrincipal_APP_STATUS_INSTALLED:
- root::nsIPrincipal__bindgen_ty_1 =
- nsIPrincipal__bindgen_ty_1::APP_STATUS_INSTALLED;
- pub const nsIPrincipal_APP_STATUS_PRIVILEGED:
- root::nsIPrincipal__bindgen_ty_1 =
- nsIPrincipal__bindgen_ty_1::APP_STATUS_PRIVILEGED;
- pub const nsIPrincipal_APP_STATUS_CERTIFIED:
- root::nsIPrincipal__bindgen_ty_1 =
- nsIPrincipal__bindgen_ty_1::APP_STATUS_CERTIFIED;
- #[repr(u32)]
- #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
- pub enum nsIPrincipal__bindgen_ty_1 {
- APP_STATUS_NOT_INSTALLED = 0,
- APP_STATUS_INSTALLED = 1,
- APP_STATUS_PRIVILEGED = 2,
- APP_STATUS_CERTIFIED = 3,
- }
#[test]
fn bindgen_test_layout_nsIPrincipal() {
assert_eq!(::std::mem::size_of::<nsIPrincipal>() , 8usize , concat ! (
@@ -33529,7 +33525,7 @@ pub mod root {
root::nsCharTraits ) ));
}
#[test]
- fn __bindgen_test_layout__bindgen_ty_id_203478_instantiation_99() {
+ fn __bindgen_test_layout__bindgen_ty_id_211393_instantiation_99() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));
@@ -33538,7 +33534,7 @@ pub mod root {
) ));
}
#[test]
- fn __bindgen_test_layout__bindgen_ty_id_203514_instantiation_100() {
+ fn __bindgen_test_layout__bindgen_ty_id_211429_instantiation_100() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));
diff --git a/components/style/gecko/generated/structs_release.rs b/components/style/gecko/generated/structs_release.rs
index f3257a71868..608da5aa217 100644
--- a/components/style/gecko/generated/structs_release.rs
+++ b/components/style/gecko/generated/structs_release.rs
@@ -800,6 +800,11 @@ pub mod root {
4;
pub const NS_STYLE_CONTEXT_PROPERTY_FILL: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_CONTEXT_PROPERTY_STROKE: ::std::os::raw::c_uint = 2;
+ pub const NS_STYLE_CONTEXT_PROPERTY_FILL_OPACITY: ::std::os::raw::c_uint =
+ 4;
+ pub const NS_STYLE_CONTEXT_PROPERTY_STROKE_OPACITY: ::std::os::raw::c_uint
+ =
+ 8;
pub const NS_STYLE_WINDOW_SHADOW_NONE: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_WINDOW_SHADOW_DEFAULT: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_WINDOW_SHADOW_MENU: ::std::os::raw::c_uint = 2;
@@ -3571,9 +3576,20 @@ pub mod root {
_unused: [u8; 0],
}
#[repr(C)]
- #[derive(Debug, Copy, Clone)]
+ #[derive(Debug)]
pub struct EventHandlerNonNull {
- _unused: [u8; 0],
+ pub _base: root::mozilla::dom::CallbackFunction,
+ }
+ #[test]
+ fn bindgen_test_layout_EventHandlerNonNull() {
+ assert_eq!(::std::mem::size_of::<EventHandlerNonNull>() ,
+ 48usize , concat ! (
+ "Size of: " , stringify ! ( EventHandlerNonNull )
+ ));
+ assert_eq! (::std::mem::align_of::<EventHandlerNonNull>() ,
+ 8usize , concat ! (
+ "Alignment of " , stringify ! (
+ EventHandlerNonNull ) ));
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
@@ -14521,26 +14537,6 @@ pub mod root {
pub struct nsIPrincipal_COMTypeInfo {
pub _address: u8,
}
- pub const nsIPrincipal_APP_STATUS_NOT_INSTALLED:
- root::nsIPrincipal__bindgen_ty_1 =
- nsIPrincipal__bindgen_ty_1::APP_STATUS_NOT_INSTALLED;
- pub const nsIPrincipal_APP_STATUS_INSTALLED:
- root::nsIPrincipal__bindgen_ty_1 =
- nsIPrincipal__bindgen_ty_1::APP_STATUS_INSTALLED;
- pub const nsIPrincipal_APP_STATUS_PRIVILEGED:
- root::nsIPrincipal__bindgen_ty_1 =
- nsIPrincipal__bindgen_ty_1::APP_STATUS_PRIVILEGED;
- pub const nsIPrincipal_APP_STATUS_CERTIFIED:
- root::nsIPrincipal__bindgen_ty_1 =
- nsIPrincipal__bindgen_ty_1::APP_STATUS_CERTIFIED;
- #[repr(u32)]
- #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
- pub enum nsIPrincipal__bindgen_ty_1 {
- APP_STATUS_NOT_INSTALLED = 0,
- APP_STATUS_INSTALLED = 1,
- APP_STATUS_PRIVILEGED = 2,
- APP_STATUS_CERTIFIED = 3,
- }
#[test]
fn bindgen_test_layout_nsIPrincipal() {
assert_eq!(::std::mem::size_of::<nsIPrincipal>() , 8usize , concat ! (
@@ -33009,7 +33005,7 @@ pub mod root {
root::nsCharTraits ) ));
}
#[test]
- fn __bindgen_test_layout__bindgen_ty_id_199539_instantiation_97() {
+ fn __bindgen_test_layout__bindgen_ty_id_207717_instantiation_97() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));
@@ -33018,7 +33014,7 @@ pub mod root {
) ));
}
#[test]
- fn __bindgen_test_layout__bindgen_ty_id_199575_instantiation_98() {
+ fn __bindgen_test_layout__bindgen_ty_id_207753_instantiation_98() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));
diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs
index 80d77abd694..d808f148d85 100644
--- a/components/style/gecko/wrapper.rs
+++ b/components/style/gecko/wrapper.rs
@@ -35,12 +35,15 @@ use gecko_bindings::bindings::Gecko_ClassOrClassList;
use gecko_bindings::bindings::Gecko_ElementHasAnimations;
use gecko_bindings::bindings::Gecko_ElementHasCSSAnimations;
use gecko_bindings::bindings::Gecko_ElementHasCSSTransitions;
+use gecko_bindings::bindings::Gecko_GetActiveLinkAttrDeclarationBlock;
use gecko_bindings::bindings::Gecko_GetAnimationRule;
use gecko_bindings::bindings::Gecko_GetExtraContentStyleDeclarations;
use gecko_bindings::bindings::Gecko_GetHTMLPresentationAttrDeclarationBlock;
use gecko_bindings::bindings::Gecko_GetSMILOverrideDeclarationBlock;
use gecko_bindings::bindings::Gecko_GetStyleAttrDeclarationBlock;
use gecko_bindings::bindings::Gecko_GetStyleContext;
+use gecko_bindings::bindings::Gecko_GetUnvisitedLinkAttrDeclarationBlock;
+use gecko_bindings::bindings::Gecko_GetVisitedLinkAttrDeclarationBlock;
use gecko_bindings::bindings::Gecko_IsSignificantChild;
use gecko_bindings::bindings::Gecko_MatchStringArgPseudo;
use gecko_bindings::bindings::Gecko_UnsetDirtyStyleAttr;
@@ -66,7 +69,8 @@ use rule_tree::CascadeLevel as ServoCascadeLevel;
use selector_parser::ElementExt;
use selectors::Element;
use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator, CaseSensitivity, NamespaceConstraint};
-use selectors::matching::{ElementSelectorFlags, MatchingContext, MatchingMode, RelevantLinkStatus};
+use selectors::matching::{ElementSelectorFlags, MatchingContext, MatchingMode};
+use selectors::matching::{RelevantLinkStatus, VisitedHandlingMode};
use shared_lock::Locked;
use sink::Push;
use std::cell::RefCell;
@@ -1036,7 +1040,9 @@ impl<'le> Hash for GeckoElement<'le> {
}
impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> {
- fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
+ fn synthesize_presentational_hints_for_legacy_attributes<V>(&self,
+ visited_handling: VisitedHandlingMode,
+ hints: &mut V)
where V: Push<ApplicableDeclarationBlock>,
{
use properties::longhands::_x_lang::SpecifiedValue as SpecifiedLang;
@@ -1098,6 +1104,37 @@ impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> {
);
}
+ // Support for link, vlink, and alink presentation hints on <body>
+ if self.is_link() {
+ // Unvisited vs. visited styles are computed up-front based on the
+ // visited mode (not the element's actual state).
+ let declarations = match visited_handling {
+ VisitedHandlingMode::AllLinksUnvisited => unsafe {
+ Gecko_GetUnvisitedLinkAttrDeclarationBlock(self.0)
+ },
+ VisitedHandlingMode::RelevantLinkVisited => unsafe {
+ Gecko_GetVisitedLinkAttrDeclarationBlock(self.0)
+ },
+ };
+ let declarations = declarations.and_then(|s| s.as_arc_opt());
+ if let Some(decl) = declarations {
+ hints.push(
+ ApplicableDeclarationBlock::from_declarations(Clone::clone(decl), ServoCascadeLevel::PresHints)
+ );
+ }
+
+ let active = self.get_state().intersects(NonTSPseudoClass::Active.state_flag());
+ if active {
+ let declarations = unsafe { Gecko_GetActiveLinkAttrDeclarationBlock(self.0) };
+ let declarations = declarations.and_then(|s| s.as_arc_opt());
+ if let Some(decl) = declarations {
+ hints.push(
+ ApplicableDeclarationBlock::from_declarations(Clone::clone(decl), ServoCascadeLevel::PresHints)
+ );
+ }
+ }
+ }
+
// xml:lang has precedence over lang, which can be
// set by Gecko_GetHTMLPresentationAttrDeclarationBlock
//
diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs
index 4140d44a187..7da2fac3d5e 100644
--- a/components/style/sharing/mod.rs
+++ b/components/style/sharing/mod.rs
@@ -14,7 +14,7 @@ use dom::{TElement, SendElement};
use matching::{ChildCascadeRequirement, MatchMethods};
use properties::ComputedValues;
use selectors::bloom::BloomFilter;
-use selectors::matching::{ElementSelectorFlags, StyleRelations};
+use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode, StyleRelations};
use smallvec::SmallVec;
use std::mem;
use std::ops::Deref;
@@ -66,7 +66,10 @@ impl ValidationData {
{
if self.pres_hints.is_none() {
let mut pres_hints = SmallVec::new();
- element.synthesize_presentational_hints_for_legacy_attributes(&mut pres_hints);
+ element.synthesize_presentational_hints_for_legacy_attributes(
+ VisitedHandlingMode::AllLinksUnvisited,
+ &mut pres_hints
+ );
self.pres_hints = Some(pres_hints);
}
&*self.pres_hints.as_ref().unwrap()
diff --git a/components/style/stylist.rs b/components/style/stylist.rs
index e14ed0e27c5..eb2d43cf16c 100644
--- a/components/style/stylist.rs
+++ b/components/style/stylist.rs
@@ -959,7 +959,10 @@ impl Stylist {
if pseudo_element.is_none() && !only_default_rules {
// Step 2: Presentational hints.
let length_before_preshints = applicable_declarations.len();
- element.synthesize_presentational_hints_for_legacy_attributes(applicable_declarations);
+ element.synthesize_presentational_hints_for_legacy_attributes(
+ context.visited_handling,
+ applicable_declarations
+ );
if applicable_declarations.len() != length_before_preshints {
if cfg!(debug_assertions) {
for declaration in &applicable_declarations[length_before_preshints..] {