Description#
Update the layout and render crates to use computed styles from the style crate instead of hardcoded tag-based defaults. This is the final integration step for Phase 4.
Acceptance Criteria#
- Layout crate changes:
- Remove hardcoded
default_font_size(),default_margin(),display_type()functions - Read
display,margin-*,padding-*,border-*-width,font-size,width,heightfrom ComputedStyle - Resolve
automargins (centering) - Respect
box-sizing: content-box(default) vsborder-box
- Remove hardcoded
- Render crate changes:
- Read
colorfrom computed style for text rendering - Read
background-colorfor box backgrounds - Render borders with correct width and color
- Support
text-decoration: underline
- Read
- Browser crate changes:
- Full pipeline: HTML → DOM → CSS parse → style resolve → layout → render → display
- Both
<style>andstyle=""attributes work
- All existing tests updated or replaced to work with the new style-driven layout
- Add integration tests: render an HTML page with
<style>block and verify layout positions
Dependencies#
- All previous Phase 4 issues
Implementation Notes#
- This ties everything together
- Existing layout tests may need updating since they relied on hardcoded defaults
- The user-agent stylesheet in the style crate should produce equivalent results to the old hardcoded defaults for unstyled pages
Test milestone#
- After this issue, we should be on track toward Acid1 compliance