-
Notifications
You must be signed in to change notification settings - Fork 31
vaev-style: Add running positions, content element() and counter(page) #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b26f4a6
to
6741be9
Compare
There was a problem hiding this 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 adds support for running positions, content element() function and counter(page) function to the CSS styling engine. These features enable advanced page layout capabilities for print media, allowing elements to be positioned in page margins and content to be dynamically inserted based on page context.
- Adds
RunningPosition
struct and updatesPosition
type to supportrunning()
CSS function - Implements
Content
union type with support forelement()
andcounter()
functions - Adds
RunningPositionMap
for tracking elements across pages during pagination
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
src/vaev-engine/values/primitives.cpp | Adds comparison operators and repr method to CustomIdent |
src/vaev-engine/values/mod.cpp | Exports new content values module |
src/vaev-engine/values/insets.cpp | Refactors Position from enum to Union with RunningPosition support |
src/vaev-engine/values/defs/keywords.inc | Adds position-related keywords (Fixed, Sticky, etc.) |
src/vaev-engine/values/content.cpp | New module implementing Content, ElementContent, and Counter types |
src/vaev-engine/style/specified.cpp | Updates content field from String to Content type |
src/vaev-engine/style/props.cpp | Updates ContentProp to use Content type instead of String |
src/vaev-engine/style/props-impl.cpp | Minor formatting fix for function call |
src/vaev-engine/layout/positioned.cpp | Updates position comparisons to use Keywords |
src/vaev-engine/layout/paint.cpp | Updates position comparisons and adds RunningPosition handling |
src/vaev-engine/layout/layout-impl.cpp | Adds early return for RunningPosition elements |
src/vaev-engine/layout/inline.cpp | Adds running position tracking during inline layout |
src/vaev-engine/layout/flex.cpp | Adds running position tracking during flex layout |
src/vaev-engine/layout/builder.cpp | Updates buildForPseudoElement to handle new Content types |
src/vaev-engine/layout/block.cpp | Adds running position tracking during block layout |
src/vaev-engine/layout/base.cpp | Implements RunningPositionMap and related structures |
src/vaev-engine/driver/print.cpp | Major refactor to support two-pass pagination with running position collection |
dda1085
to
16fb616
Compare
16fb616
to
e5cf3c5
Compare
e5cf3c5
to
dda1085
Compare
1dd29a0
to
66d8e89
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
} | ||
|
||
Slice<RunningPositionInfo> _searchPage(Slice<RunningPositionInfo> list, usize page) { | ||
page++; // pages are 1-indexed |
Copilot
AI
Oct 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic number increment without clear context. The comment indicates pages are 1-indexed, but the function parameter name and usage suggest it's 0-indexed. Consider renaming the parameter to pageIndexZeroBased
or adjusting the logic to accept 1-indexed pages directly for clarity.
Copilot generated this review using guidance from repository custom instructions.
Type type = Type::PAGE; | ||
|
||
void repr(Io::Emit& e) const { | ||
e("counter (type:'{}')", type); |
Copilot
AI
Oct 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spacing in debug output format string from 'counter (type' to 'counter(type'.
e("counter (type:'{}')", type); | |
e("counter(type:'{}')", type); |
Copilot uses AI. Check for mistakes.
|
||
Box element = buildElement(infos.unwrap().structure); | ||
element.style->position = Keywords::STATIC; | ||
marginBox.add(std::move(element)); |
Copilot
AI
Oct 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable name element
shadows the parameter name used earlier in the function. Consider renaming to elementBox
for clarity.
Copilot generated this review using guidance from repository custom instructions.
}); | ||
|
||
if (not res) { | ||
return sub(list, 0, 1); |
Copilot
AI
Oct 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic numbers 0 and 1 are unclear in this context. Consider using a named constant or adding a comment explaining why the first element is returned when binary search fails.
Copilot generated this review using guidance from repository custom instructions.
…ge to allow beautiful margins.
66d8e89
to
2ee43c7
Compare
No description provided.