mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Sharing formatting nits.
MozReview-Commit-ID: 3tSiyBquR1v
This commit is contained in:
parent
720b88b028
commit
bd890cc9bc
1 changed files with 14 additions and 8 deletions
|
@ -12,12 +12,14 @@ use dom::TElement;
|
||||||
use selectors::NthIndexCache;
|
use selectors::NthIndexCache;
|
||||||
use sharing::{StyleSharingCandidate, StyleSharingTarget};
|
use sharing::{StyleSharingCandidate, StyleSharingTarget};
|
||||||
|
|
||||||
/// Determines whether a target and a candidate have compatible parents for sharing.
|
/// Determines whether a target and a candidate have compatible parents for
|
||||||
|
/// sharing.
|
||||||
pub fn parents_allow_sharing<E>(
|
pub fn parents_allow_sharing<E>(
|
||||||
target: &mut StyleSharingTarget<E>,
|
target: &mut StyleSharingTarget<E>,
|
||||||
candidate: &mut StyleSharingCandidate<E>
|
candidate: &mut StyleSharingCandidate<E>
|
||||||
) -> bool
|
) -> bool
|
||||||
where E: TElement,
|
where
|
||||||
|
E: TElement,
|
||||||
{
|
{
|
||||||
// If the identity of the parent style isn't equal, we can't share. We check
|
// If the identity of the parent style isn't equal, we can't share. We check
|
||||||
// this first, because the result is cached.
|
// this first, because the result is cached.
|
||||||
|
@ -58,7 +60,8 @@ pub fn have_same_style_attribute<E>(
|
||||||
target: &mut StyleSharingTarget<E>,
|
target: &mut StyleSharingTarget<E>,
|
||||||
candidate: &mut StyleSharingCandidate<E>
|
candidate: &mut StyleSharingCandidate<E>
|
||||||
) -> bool
|
) -> bool
|
||||||
where E: TElement,
|
where
|
||||||
|
E: TElement,
|
||||||
{
|
{
|
||||||
match (target.style_attribute(), candidate.style_attribute()) {
|
match (target.style_attribute(), candidate.style_attribute()) {
|
||||||
(None, None) => true,
|
(None, None) => true,
|
||||||
|
@ -72,7 +75,8 @@ pub fn have_same_presentational_hints<E>(
|
||||||
target: &mut StyleSharingTarget<E>,
|
target: &mut StyleSharingTarget<E>,
|
||||||
candidate: &mut StyleSharingCandidate<E>
|
candidate: &mut StyleSharingCandidate<E>
|
||||||
) -> bool
|
) -> bool
|
||||||
where E: TElement,
|
where
|
||||||
|
E: TElement,
|
||||||
{
|
{
|
||||||
target.pres_hints() == candidate.pres_hints()
|
target.pres_hints() == candidate.pres_hints()
|
||||||
}
|
}
|
||||||
|
@ -80,10 +84,12 @@ pub fn have_same_presentational_hints<E>(
|
||||||
/// Whether a given element has the same class attribute than a given candidate.
|
/// Whether a given element has the same class attribute than a given candidate.
|
||||||
///
|
///
|
||||||
/// We don't try to share style across elements with different class attributes.
|
/// We don't try to share style across elements with different class attributes.
|
||||||
pub fn have_same_class<E>(target: &mut StyleSharingTarget<E>,
|
pub fn have_same_class<E>(
|
||||||
candidate: &mut StyleSharingCandidate<E>)
|
target: &mut StyleSharingTarget<E>,
|
||||||
-> bool
|
candidate: &mut StyleSharingCandidate<E>,
|
||||||
where E: TElement,
|
) -> bool
|
||||||
|
where
|
||||||
|
E: TElement,
|
||||||
{
|
{
|
||||||
target.class_list() == candidate.class_list()
|
target.class_list() == candidate.class_list()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue