Optimize CSS attribute selector matching:

Resolve standard property definitions and data-attribute classification
  when selectors are parsed, avoiding repeated specification lookups and
  attribute-name checks during matching.

  Fast-path existence-only data selectors without retrieving their values,
  while preserving all attribute operator behavior. Add standard-property
  coverage and an attribute-focused benchmark showing a 41.7% reduction
  in matching time.
This commit is contained in:
Martín Lucas Golini
2026-07-10 20:01:56 -03:00
parent 660d64c823
commit edf316a5b6
5 changed files with 120 additions and 44 deletions

View File

@@ -1552,6 +1552,10 @@ UTEST( UIHTML, DataProperties ) {
EXPECT_EQ( sceneNode->getRoot()->querySelectorAll( "[data-id*=\"ser\"]" ).size(), (size_t)1 );
EXPECT_EQ( sceneNode->getRoot()->querySelectorAll( "[data-empty]" ).size(), (size_t)1 );
EXPECT_EQ( sceneNode->getRoot()->querySelectorAll( "[data-missing]" ).size(), (size_t)0 );
EXPECT_TRUE( StyleSheetSelector( "[width]" ).select( target, false ) );
EXPECT_TRUE( StyleSheetSelector( "[width=\"" + target->getPropertyString( "width" ) + "\"]" )
.select( target, false ) );
EXPECT_FALSE( StyleSheetSelector( "[unknown-property]" ).select( target, false ) );
EXPECT_TRUE( target->getDataPropertyString( "data-language" ) == "cpp" );