mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Don't reconstruct the layout object when going from no pseudo to pseudo with no content for ::before and ::after.
Fixes Gecko bug 1376073. r=emilio
This commit is contained in:
parent
12a49dc0be
commit
91d4956da5
5 changed files with 70 additions and 12 deletions
|
@ -162,6 +162,13 @@ impl fmt::Debug for EagerPseudoArray {
|
|||
}
|
||||
}
|
||||
|
||||
// Can't use [None; EAGER_PSEUDO_COUNT] here because it complains
|
||||
// about Copy not being implemented for our Arc type.
|
||||
#[cfg(feature = "gecko")]
|
||||
const EMPTY_PSEUDO_ARRAY: &'static EagerPseudoArrayInner = &[None, None, None, None];
|
||||
#[cfg(feature = "servo")]
|
||||
const EMPTY_PSEUDO_ARRAY: &'static EagerPseudoArrayInner = &[None, None, None];
|
||||
|
||||
impl EagerPseudoStyles {
|
||||
/// Returns whether there are any pseudo styles.
|
||||
pub fn is_empty(&self) -> bool {
|
||||
|
@ -169,13 +176,19 @@ impl EagerPseudoStyles {
|
|||
}
|
||||
|
||||
/// Grabs a reference to the list of styles, if they exist.
|
||||
pub fn as_array(&self) -> Option<&EagerPseudoArrayInner> {
|
||||
pub fn as_optional_array(&self) -> Option<&EagerPseudoArrayInner> {
|
||||
match self.0 {
|
||||
None => None,
|
||||
Some(ref x) => Some(&x.0),
|
||||
}
|
||||
}
|
||||
|
||||
/// Grabs a reference to the list of styles or a list of None if
|
||||
/// there are no styles to be had.
|
||||
pub fn as_array(&self) -> &EagerPseudoArrayInner {
|
||||
self.as_optional_array().unwrap_or(EMPTY_PSEUDO_ARRAY)
|
||||
}
|
||||
|
||||
/// Returns a reference to the style for a given eager pseudo, if it exists.
|
||||
pub fn get(&self, pseudo: &PseudoElement) -> Option<&Arc<ComputedValues>> {
|
||||
debug_assert!(pseudo.is_eager());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue