-
Notifications
You must be signed in to change notification settings - Fork 3
Simplify RenderQueue sorting to use basic priority: translateZ > zIndex > base #297
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
…sive tests Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
yorkie
left a comment
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.
@copilot Please redesign the content of this PR (especially regarding isPositioned). It needs to ensure that positioned elements (including their children and content) always overlay non-positioned elements when no z-index is set.
Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
I've redesigned the Text Inheritance: Text nodes now inherit Element Ancestry Check: Elements now check the entire ancestor chain for positioning context - if any ancestor is positioned, the element inherits that positioned context. CSS Compliance: This ensures that when an element has CSS positioning ( The solution maintains the existing sorting priority (translateZ > zIndex > isPositioned > base) while properly propagating positioning context through the DOM tree as required by CSS stacking context rules. Commit: 4aa5e6b |
| // 2. zIndex: Logical stacking order | ||
| // 3. base: Base queue number | ||
| // 3. isPositioned: When zIndex=0, positioned elements render after non-positioned | ||
| // 4. base: Base queue number |
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.
@copilot Reorder the priority:
- translateZ still first
- checking if positioned then use the z-index, otherwise use the magic number 0.1 as its z-index
- then use base queue number
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.
I've reordered the priority as requested:
- translateZ first (unchanged)
- Effective zIndex: For positioned elements use actual zIndex, for non-positioned elements with zIndex=0 use magic number 0.1
- base queue number
The key change is that non-positioned elements with zIndex=0 now get an effective zIndex of 0.1, making them render above positioned elements with zIndex=0. Elements with non-zero zIndex use their actual zIndex regardless of positioning status.
Updated tests to reflect the new behavior where positioned elements with zIndex=0 render before (below) non-positioned elements.
Commit: 7aa8ac7
…0.1 for non-positioned elements Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
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.
@copilot Please update the test cases in this file based on the current implementation, such as removing the isPositioned because this field has been removed.
As mentioned above, the isPositioned has been removed from the RenderQueue, this test file should be renamed to render_queue_tests.cpp and update cases for the current RenderQueue.
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.
I've updated the test file as requested:
- Renamed
render_queue_positioning_tests.cpptorender_queue_tests.cpp - Removed all references to
isPositionedfield which no longer exists in the current RenderQueue implementation - Updated test cases to reflect the actual current behavior: translateZ > zIndex > base priority
The new tests focus on validating the core functionality without positioning-specific logic, testing decimal zIndex values, negative values, priority ordering, and edge cases that match the current implementation.
Commit: c543f5e
…nd remove isPositioned references Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
This PR simplifies the RenderQueue sorting implementation by using a straightforward three-tier priority system without positioning-specific logic.
Problem
The original RenderQueue implementation needed a clear and predictable sorting mechanism for rendering order in the scene.
Solution
Simple priority-based sorting:
Key Features
inttofloatto support decimal valuesRendering Order
Elements are sorted in ascending order, meaning:
The implementation maintains CSS-compliant z-index behavior while providing a clean, predictable sorting mechanism for the rendering pipeline.
Fixes #296.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.