Skip to content

Commit

Permalink
stylo: properly handle ::before/::after rules applying to replaced el…
Browse files Browse the repository at this point in the history
…ements.

Bug: 1376352
Reviewed-By: heycam
MozReview-Commit-ID: FO0TyWsPPG7
  • Loading branch information
emilio committed Jul 3, 2017
1 parent 990c409 commit a4b754c
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions components/style/matching.rs
Expand Up @@ -1576,23 +1576,21 @@ 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.
return StyleDifference::new(RestyleDamage::empty(), StyleChange::Unchanged)
}

if pseudo.map_or(false, |p| p.is_first_letter()) {
Expand Down

0 comments on commit a4b754c

Please sign in to comment.