Compare style attributes rather than rejecting them from the cache.

MozReview-Commit-ID: Jmu7Pie2mBP
This commit is contained in:
Bobby Holley 2017-05-30 17:38:59 -07:00
parent f40c45fe1a
commit 47404cfc4e
4 changed files with 29 additions and 21 deletions

View file

@ -126,6 +126,15 @@ pub struct StyleSharingCandidate<E: TElement> {
validation_data: ValidationData,
}
impl<E: TElement> Deref for StyleSharingCandidate<E> {
type Target = E;
fn deref(&self) -> &Self::Target {
&self.element
}
}
impl<E: TElement> StyleSharingCandidate<E> {
/// Get the classlist of this candidate.
fn class_list(&mut self) -> &[Atom] {
@ -409,12 +418,6 @@ impl<E: TElement> StyleSharingCandidateCache<E> {
return StyleSharingResult::CannotShare;
}
if target.style_attribute().is_some() {
debug!("{:?} Cannot share style: element has style attribute",
target.element);
return StyleSharingResult::CannotShare
}
if target.get_id().is_some() {
debug!("{:?} Cannot share style: element has id", target.element);
return StyleSharingResult::CannotShare
@ -542,7 +545,7 @@ impl<E: TElement> StyleSharingCandidateCache<E> {
miss!(IdAttr)
}
if target.style_attribute().is_some() {
if !checks::have_same_style_attribute(target, candidate) {
miss!(StyleAttr)
}