mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Invalidate style for ::selection.
This patch invalidates the style for `::selection`, which will restore the behavior before the regression. However, it's still not quite correct, because repaint is not triggered. Given that `::selection` requires some major change to implement https://github.com/w3c/csswg-drafts/issues/2474, we can address this problem later. Differential Revision: https://phabricator.services.mozilla.com/D35305
This commit is contained in:
parent
815d189228
commit
6eedebe2c8
3 changed files with 25 additions and 0 deletions
|
@ -116,6 +116,12 @@ impl PseudoElement {
|
||||||
*self == PseudoElement::Marker
|
*self == PseudoElement::Marker
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether this pseudo-element is the ::selection pseudo.
|
||||||
|
#[inline]
|
||||||
|
pub fn is_selection(&self) -> bool {
|
||||||
|
*self == PseudoElement::Selection
|
||||||
|
}
|
||||||
|
|
||||||
/// Whether this pseudo-element is ::first-letter.
|
/// Whether this pseudo-element is ::first-letter.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_first_letter(&self) -> bool {
|
pub fn is_first_letter(&self) -> bool {
|
||||||
|
|
|
@ -805,6 +805,19 @@ where
|
||||||
if pseudo.is_marker() && self.element.marker_pseudo_element().is_none() {
|
if pseudo.is_marker() && self.element.marker_pseudo_element().is_none() {
|
||||||
invalidated_self = true;
|
invalidated_self = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: ::selection doesn't generate elements, so the
|
||||||
|
// regular invalidation doesn't work for it. We store
|
||||||
|
// the cached selection style holding off the originating
|
||||||
|
// element, so we need to restyle it in order to invalidate
|
||||||
|
// it. This is still not quite correct, since nothing
|
||||||
|
// triggers a repaint necessarily, but matches old Gecko
|
||||||
|
// behavior, and the ::selection implementation needs to
|
||||||
|
// change significantly anyway to implement
|
||||||
|
// https://github.com/w3c/csswg-drafts/issues/2474.
|
||||||
|
if pseudo.is_selection() {
|
||||||
|
invalidated_self = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,6 +143,12 @@ impl PseudoElement {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether this pseudo-element is the ::selection pseudo.
|
||||||
|
#[inline]
|
||||||
|
pub fn is_selection(&self) -> bool {
|
||||||
|
*self == PseudoElement::Selection
|
||||||
|
}
|
||||||
|
|
||||||
/// Whether this pseudo-element is the ::before pseudo.
|
/// Whether this pseudo-element is the ::before pseudo.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_before(&self) -> bool {
|
pub fn is_before(&self) -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue