mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
servo: Merge #17593 - stylo: properly handle ::before/::after rules applying to replaced elements (from emilio:pseudo-replaced); r=heycam
Bug: 1376352 Reviewed-By: heycam MozReview-Commit-ID: FO0TyWsPPG7 Source-Repo: https://github.com/servo/servo Source-Revision: c17134ce485453ff124cc337fa68b9a981106a45 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : ed0ab5676dd2b6c60b83e5b9ddb338500975a9f0
This commit is contained in:
parent
9477477b99
commit
1d21b08ae8
@ -1576,23 +1576,30 @@ pub trait MatchMethods : TElement {
|
||||
}
|
||||
|
||||
if pseudo.map_or(false, |p| p.is_before_or_after()) {
|
||||
if (old_style_is_display_none ||
|
||||
old_values.ineffective_content_property()) &&
|
||||
(new_style_is_display_none ||
|
||||
new_values.ineffective_content_property()) {
|
||||
// The pseudo-element will remain undisplayed, so just avoid
|
||||
// triggering any change.
|
||||
return StyleDifference::new(RestyleDamage::empty(), StyleChange::Unchanged)
|
||||
let old_style_generates_no_pseudo =
|
||||
old_style_is_display_none ||
|
||||
old_values.ineffective_content_property();
|
||||
|
||||
let new_style_generates_no_pseudo =
|
||||
new_style_is_display_none ||
|
||||
new_values.ineffective_content_property();
|
||||
|
||||
if old_style_generates_no_pseudo != new_style_generates_no_pseudo {
|
||||
return StyleDifference::new(RestyleDamage::reconstruct(), StyleChange::Changed)
|
||||
}
|
||||
// FIXME(bz): This will keep reframing replaced elements. Do we
|
||||
// need this at all? Seems like if we add/remove ::before or
|
||||
// ::after styles we would get reframed over in match_pseudos and if
|
||||
// that part didn't change and we had no frame for the
|
||||
// ::before/::after then we don't care. Need to double-check that
|
||||
// we handle the "content" and "display" properties changing
|
||||
// correctly, though.
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1376352
|
||||
return StyleDifference::new(RestyleDamage::reconstruct(), StyleChange::Changed)
|
||||
|
||||
// The pseudo-element will remain undisplayed, so just avoid
|
||||
// triggering any change.
|
||||
//
|
||||
// NOTE(emilio): We will only arrive here for pseudo-elements that
|
||||
// aren't generated (see the is_existing_before_or_after check in
|
||||
// accumulate_damage).
|
||||
//
|
||||
// However, it may be the case that the style of this element would
|
||||
// make us think we need a pseudo, but we don't, like for pseudos in
|
||||
// replaced elements, that's why we need the old != new instead of
|
||||
// just check whether the new style would generate a pseudo.
|
||||
return StyleDifference::new(RestyleDamage::empty(), StyleChange::Unchanged)
|
||||
}
|
||||
|
||||
if pseudo.map_or(false, |p| p.is_first_letter()) {
|
||||
|
Loading…
Reference in New Issue
Block a user