Skip to content

Conversation

@sleepy-monax
Copy link
Member

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the pseudo selector handling by splitting Pseudo into two distinct types: PseudoElementSelector for pseudo-elements (::before, ::after, ::marker) and PseudoClassSelector for pseudo-classes (:hover, :first-child, etc.). Additionally, it introduces support for generating pseudo-elements in the layout builder and adds a rule indexing system to optimize selector matching.

  • Separated pseudo-class and pseudo-element selectors into distinct types
  • Added pseudo-element generation support in the layout builder with proper content handling
  • Moved style rule lookup logic from rules.cpp to a new rules-index.cpp file
  • Updated all selector matching to support pseudo-elements as a parameter

Reviewed Changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/vaev-engine/values/angle.cpp Added empty line after import statement
src/vaev-engine/style/selector.cpp Split Pseudo into PseudoElementSelector and PseudoClassSelector, updated parsing logic
src/vaev-engine/style/selector-impl.cpp Updated operator== implementation for renamed type
src/vaev-engine/style/rules.cpp Removed StyleRuleLookup code, updated match() signature
src/vaev-engine/style/rules-index.cpp New file containing refactored RuleIndex (formerly StyleRuleLookup)
src/vaev-engine/style/matcher.cpp Updated matching logic to support pseudo-elements, improved variable naming
src/vaev-engine/style/defs/pseudo-class.inc Removed pseudo-elements (BEFORE, AFTER, etc.) from pseudo-class definitions
src/vaev-engine/style/computer.cpp Added pseudo-element generation logic and updated to use RuleIndex
src/vaev-engine/style/page.cpp Simplified lambda with explicit return type
src/vaev-engine/layout/builder/mod.cpp Added pseudo-element building support, removed BR_TAG special handling, fixed table wrapper positioning
src/vaev-engine/dom/element.cpp Added PseudoElement constants and methods to manage pseudo-elements
src/vaev-engine/dom/token-list.cpp Renamed module from token_list to tokenList
src/vaev-engine/dom/mod.cpp Updated import for renamed module
src/vaev-engine/style/tests/*.cpp Updated tests to use new selector types

val = PseudoElementSelector{Dom::PseudoElement::BEFORE};
else if (name == "after")
val = PseudoElementSelector{Dom::PseudoElement::AFTER};
else if (name == "maker")
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'maker' to 'marker'.

Suggested change
else if (name == "maker")
else if (name == "marker")

Copilot uses AI. Check for mistakes.
Copy link
Member

@Louciole Louciole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small step for the dev but a great step for paper-muncher

@Louciole Louciole merged commit 22583fe into main Nov 3, 2025
2 checks passed
@sleepy-monax sleepy-monax deleted the clvb/pseudo-elements branch November 3, 2025 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants