mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #18841 - jryans:stylo-visited-first-line, r=emilio
Clear visited rules for text inheritance https://bugzilla.mozilla.org/show_bug.cgi?id=1406254 <!-- 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/18841) <!-- Reviewable:end -->
This commit is contained in:
commit
dbf0991f8c
2 changed files with 15 additions and 3 deletions
|
@ -251,7 +251,7 @@ impl ops::DerefMut for ComputedValues {
|
|||
|
||||
impl ComputedValuesInner {
|
||||
/// Clone the visited style. Used for inheriting parent styles in
|
||||
/// StyleBuilder::for_inheritance.
|
||||
/// StyleBuilder::for_derived_style.
|
||||
pub fn clone_visited_style(&self) -> Option<Arc<ComputedValues>> {
|
||||
self.visited_style.as_ref().map(|x| x.clone_arc())
|
||||
}
|
||||
|
|
|
@ -2211,7 +2211,7 @@ impl ComputedValuesInner {
|
|||
pub fn has_moz_binding(&self) -> bool { false }
|
||||
|
||||
/// Clone the visited style. Used for inheriting parent styles in
|
||||
/// StyleBuilder::for_inheritance.
|
||||
/// StyleBuilder::for_derived_style.
|
||||
pub fn clone_visited_style(&self) -> Option<Arc<ComputedValues>> {
|
||||
self.visited_style.clone()
|
||||
}
|
||||
|
@ -2842,6 +2842,18 @@ impl<'a> StyleBuilder<'a> {
|
|||
parent: &'a ComputedValues,
|
||||
pseudo: Option<<&'a PseudoElement>,
|
||||
) -> Self {
|
||||
// Rebuild the visited style from the parent, ensuring that it will also
|
||||
// not have rules. This matches the unvisited style that will be
|
||||
// produced by this builder. This assumes that the caller doesn't need
|
||||
// to adjust or process visited style, so we can just build visited
|
||||
// style here for simplicity.
|
||||
let visited_style = parent.visited_style().map(|style| {
|
||||
Self::for_inheritance(
|
||||
device,
|
||||
style,
|
||||
pseudo,
|
||||
).build()
|
||||
});
|
||||
// FIXME(emilio): This Some(parent) here is inconsistent with what we
|
||||
// usually do if `parent` is the default computed values, but that's
|
||||
// fine, and we want to eventually get rid of it.
|
||||
|
@ -2855,7 +2867,7 @@ impl<'a> StyleBuilder<'a> {
|
|||
parent.custom_properties().cloned(),
|
||||
parent.writing_mode,
|
||||
parent.flags,
|
||||
parent.clone_visited_style()
|
||||
visited_style,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue