mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Fix relevant-link-visited logic in presence of nested links.
MozReview-Commit-ID: LIjpTAgrPBY
This commit is contained in:
parent
aea24fa81e
commit
04e855c38d
3 changed files with 19 additions and 7 deletions
|
@ -2837,9 +2837,13 @@ bitflags! {
|
|||
/// Whether we're styling the ::-moz-fieldset-content anonymous box.
|
||||
const IS_FIELDSET_CONTENT = 1 << 5,
|
||||
|
||||
/// Whether we're computing the style of a link, either visited or
|
||||
/// unvisited.
|
||||
const IS_LINK = 1 << 6,
|
||||
|
||||
/// Whether we're computing the style of a link element that happens to
|
||||
/// be visited.
|
||||
const IS_VISITED_LINK = 1 << 6,
|
||||
const IS_VISITED_LINK = 1 << 7,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -436,15 +436,20 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// FIXME(emilio): This isn't technically a style adjustment thingie, could
|
||||
/// it move somewhere else?
|
||||
fn adjust_for_visited(&mut self, flags: CascadeFlags) {
|
||||
use properties::IS_VISITED_LINK;
|
||||
use properties::{IS_LINK, IS_VISITED_LINK};
|
||||
use properties::computed_value_flags::IS_RELEVANT_LINK_VISITED;
|
||||
|
||||
if !self.style.has_visited_style() {
|
||||
return;
|
||||
}
|
||||
|
||||
if flags.contains(IS_VISITED_LINK) ||
|
||||
self.style.inherited_style().flags.contains(IS_RELEVANT_LINK_VISITED) {
|
||||
let relevant_link_visited = if flags.contains(IS_LINK) {
|
||||
flags.contains(IS_VISITED_LINK)
|
||||
} else {
|
||||
self.style.inherited_style().flags.contains(IS_RELEVANT_LINK_VISITED)
|
||||
};
|
||||
|
||||
if relevant_link_visited {
|
||||
self.style.flags.insert(IS_RELEVANT_LINK_VISITED);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ use dom::TElement;
|
|||
use log::LogLevel::Trace;
|
||||
use matching::{CascadeVisitedMode, MatchMethods};
|
||||
use properties::{AnimationRules, CascadeFlags, ComputedValues};
|
||||
use properties::{IS_ROOT_ELEMENT, IS_VISITED_LINK, PROHIBIT_DISPLAY_CONTENTS, SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP};
|
||||
use properties::{IS_LINK, IS_ROOT_ELEMENT, IS_VISITED_LINK, PROHIBIT_DISPLAY_CONTENTS, SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP};
|
||||
use properties::{VISITED_DEPENDENT_ONLY, cascade};
|
||||
use rule_tree::StrongRuleNode;
|
||||
use selector_parser::{PseudoElement, SelectorImpl};
|
||||
|
@ -474,8 +474,11 @@ where
|
|||
cascade_flags.insert(SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP);
|
||||
}
|
||||
|
||||
if pseudo.is_none() && self.element.is_visited_link() {
|
||||
cascade_flags.insert(IS_VISITED_LINK);
|
||||
if pseudo.is_none() && self.element.is_link() {
|
||||
cascade_flags.insert(IS_LINK);
|
||||
if self.element.is_visited_link() {
|
||||
cascade_flags.insert(IS_VISITED_LINK);
|
||||
}
|
||||
}
|
||||
|
||||
if cascade_visited.visited_dependent_only() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue