@@ -245,18 +245,26 @@ impl StyleQuery {
245245 }
246246 }
247247
248- fn matches ( & self , ctx : & computed:: Context ) -> KleeneValue {
248+ fn matches (
249+ & self ,
250+ ctx : & computed:: Context ,
251+ attribute_tracker : & mut AttributeTracker ,
252+ ) -> KleeneValue {
249253 ctx. builder
250254 . add_flags ( ComputedValueFlags :: DEPENDS_ON_CONTAINER_STYLE_QUERY ) ;
251255 match * self {
252- StyleQuery :: Feature ( ref f) => f. matches ( ctx) ,
253- StyleQuery :: Not ( ref c) => !c. matches ( ctx) ,
254- StyleQuery :: InParens ( ref c) => c. matches ( ctx) ,
256+ StyleQuery :: Feature ( ref f) => f. matches ( ctx, attribute_tracker ) ,
257+ StyleQuery :: Not ( ref c) => !c. matches ( ctx, attribute_tracker ) ,
258+ StyleQuery :: InParens ( ref c) => c. matches ( ctx, attribute_tracker ) ,
255259 StyleQuery :: Operation ( ref conditions, op) => {
256260 debug_assert ! ( !conditions. is_empty( ) , "We never create an empty op" ) ;
257261 match op {
258- Operator :: And => KleeneValue :: any_false ( conditions. iter ( ) , |c| c. matches ( ctx) ) ,
259- Operator :: Or => KleeneValue :: any ( conditions. iter ( ) , |c| c. matches ( ctx) ) ,
262+ Operator :: And => KleeneValue :: any_false ( conditions. iter ( ) , |c| {
263+ c. matches ( ctx, attribute_tracker)
264+ } ) ,
265+ Operator :: Or => {
266+ KleeneValue :: any ( conditions. iter ( ) , |c| c. matches ( ctx, attribute_tracker) )
267+ } ,
260268 }
261269 } ,
262270 StyleQuery :: GeneralEnclosed ( _) => KleeneValue :: Unknown ,
@@ -325,10 +333,14 @@ impl StyleFeature {
325333 Ok ( Self :: Plain ( StyleFeaturePlain :: parse ( context, input) ?) )
326334 }
327335
328- fn matches ( & self , ctx : & computed:: Context ) -> KleeneValue {
336+ fn matches (
337+ & self ,
338+ ctx : & computed:: Context ,
339+ attribute_tracker : & mut AttributeTracker ,
340+ ) -> KleeneValue {
329341 match self {
330- Self :: Plain ( plain) => plain. matches ( ctx) ,
331- Self :: Range ( range) => range. evaluate ( ctx) ,
342+ Self :: Plain ( plain) => plain. matches ( ctx, attribute_tracker ) ,
343+ Self :: Range ( range) => range. evaluate ( ctx, attribute_tracker ) ,
332344 }
333345 }
334346}
@@ -401,6 +413,7 @@ impl StyleFeaturePlain {
401413 registration : & PropertyDescriptors ,
402414 stylist : & Stylist ,
403415 ctx : & computed:: Context ,
416+ attribute_tracker : & mut AttributeTracker ,
404417 current_value : Option < & ComputedRegisteredValue > ,
405418 ) -> bool {
406419 let substitution_functions = custom_properties:: ComputedSubstitutionFunctions :: new (
@@ -413,8 +426,7 @@ impl StyleFeaturePlain {
413426 & substitution_functions,
414427 stylist,
415428 ctx,
416- // FIXME: do we need to pass a real AttributeTracker for the query?
417- & mut AttributeTracker :: new_dummy ( ) ,
429+ attribute_tracker,
418430 ) {
419431 Ok ( sub) => sub,
420432 Err ( _) => return current_value. is_none ( ) ,
@@ -439,7 +451,11 @@ impl StyleFeaturePlain {
439451 computed. as_ref ( ) == current_value
440452 }
441453
442- fn matches ( & self , ctx : & computed:: Context ) -> KleeneValue {
454+ fn matches (
455+ & self ,
456+ ctx : & computed:: Context ,
457+ attribute_tracker : & mut AttributeTracker ,
458+ ) -> KleeneValue {
443459 // FIXME(emilio): Confirm this is the right style to query.
444460 let stylist = ctx
445461 . builder
@@ -457,7 +473,14 @@ impl StyleFeaturePlain {
457473 } else if v. has_references ( ) {
458474 // If there are --var() references in the query value,
459475 // try to substitute them before comparing to current.
460- Self :: substitute_and_compare ( v, registration, stylist, ctx, current_value)
476+ Self :: substitute_and_compare (
477+ v,
478+ registration,
479+ stylist,
480+ ctx,
481+ attribute_tracker,
482+ current_value,
483+ )
461484 } else {
462485 custom_properties:: compute_variable_value ( & v, registration, ctx) . as_ref ( )
463486 == current_value
@@ -799,26 +822,27 @@ impl QueryCondition {
799822 & self ,
800823 context : & computed:: Context ,
801824 custom : & mut CustomMediaEvaluator ,
825+ attribute_tracker : & mut AttributeTracker ,
802826 ) -> KleeneValue {
803827 match * self {
804828 Self :: Custom ( ref f) => custom. matches ( f, context) ,
805829 Self :: Feature ( ref f) => f. matches ( context) ,
806830 Self :: GeneralEnclosed ( ref str, ref url_data) => {
807- self . matches_general ( & str, url_data, context, custom)
831+ self . matches_general ( & str, url_data, context, custom, attribute_tracker )
808832 } ,
809- Self :: InParens ( ref c) => c. matches ( context, custom) ,
810- Self :: Not ( ref c) => !c. matches ( context, custom) ,
811- Self :: Style ( ref c) => c. matches ( context) ,
833+ Self :: InParens ( ref c) => c. matches ( context, custom, attribute_tracker ) ,
834+ Self :: Not ( ref c) => !c. matches ( context, custom, attribute_tracker ) ,
835+ Self :: Style ( ref c) => c. matches ( context, attribute_tracker ) ,
812836 Self :: MozPref ( ref c) => c. matches ( context) ,
813837 Self :: Operation ( ref conditions, op) => {
814838 debug_assert ! ( !conditions. is_empty( ) , "We never create an empty op" ) ;
815839 match op {
816- Operator :: And => {
817- KleeneValue :: any_false ( conditions . iter ( ) , |c| c . matches ( context, custom) )
818- } ,
819- Operator :: Or => {
820- KleeneValue :: any ( conditions . iter ( ) , |c| c . matches ( context, custom) )
821- } ,
840+ Operator :: And => KleeneValue :: any_false ( conditions . iter ( ) , |c| {
841+ c . matches ( context, custom, attribute_tracker )
842+ } ) ,
843+ Operator :: Or => KleeneValue :: any ( conditions . iter ( ) , |c| {
844+ c . matches ( context, custom, attribute_tracker )
845+ } ) ,
822846 }
823847 } ,
824848 }
@@ -832,6 +856,7 @@ impl QueryCondition {
832856 url_data : & UrlExtraData ,
833857 context : & computed:: Context ,
834858 custom : & mut CustomMediaEvaluator ,
859+ attribute_tracker : & mut AttributeTracker ,
835860 ) -> KleeneValue {
836861 // This only applies (currently, at least) to container queries.
837862 if !context. in_container_query {
@@ -872,8 +897,7 @@ impl QueryCondition {
872897 & substitution_functions,
873898 stylist,
874899 context,
875- // FIXME: do we need to pass a real AttributeTracker for the query?
876- & mut AttributeTracker :: new_dummy ( ) ,
900+ attribute_tracker,
877901 ) {
878902 Ok ( sub) => sub,
879903 Err ( _) => return KleeneValue :: Unknown ,
@@ -904,7 +928,7 @@ impl QueryCondition {
904928 // If the result is still GeneralEnclosed, the query is unknown.
905929 KleeneValue :: Unknown
906930 } ,
907- Ok ( query) => query. matches ( context, custom) ,
931+ Ok ( query) => query. matches ( context, custom, attribute_tracker ) ,
908932 Err ( _) => KleeneValue :: Unknown ,
909933 } ;
910934
0 commit comments