style: Push visited style computation a bit further down.

Bug: 1474959
Reviewed-by: xidorn
MozReview-Commit-ID: 1DILenWIw4D
This commit is contained in:
Emilio Cobos Álvarez 2018-07-17 14:08:17 +02:00
parent 45435a57e9
commit 4e1606bfaf
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
6 changed files with 155 additions and 140 deletions

View file

@ -7,7 +7,7 @@
use app_units::Au;
use dom::TElement;
use properties::{self, CascadeFlags, ComputedValues, StyleBuilder};
use properties::{self, ComputedValues, StyleBuilder};
use properties::computed_value_flags::ComputedValueFlags;
use properties::longhands::display::computed_value::T as Display;
use properties::longhands::float::computed_value::T as Float;
@ -681,10 +681,14 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
&mut self,
layout_parent_style: &ComputedValues,
element: Option<E>,
flags: CascadeFlags,
) where
E: TElement,
{
debug_assert!(
!self.style.flags.contains(ComputedValueFlags::IS_STYLE_IF_VISITED),
"Adjusting visited styles is wasted work"
);
if cfg!(debug_assertions) {
if element
.and_then(|e| e.implemented_pseudo_element())
@ -705,15 +709,6 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
// "Should always have an element around for non-pseudo styles"
// );
// Don't adjust visited styles, visited-dependent properties aren't
// affected by these adjustments and it'd be just wasted work anyway.
//
// It also doesn't make much sense to adjust them, since we don't
// cascade most properties anyway, and they wouldn't be looked up.
if flags.contains(CascadeFlags::VISITED_DEPENDENT_ONLY) {
return;
}
self.adjust_for_visited(element);
#[cfg(feature = "gecko")]
{