- **Link Detection and Navigation**: Added functionality to detect if a mouse click falls within a link area. If a link is clicked, the browser now navigates to the corresponding URL while logging the action. This also includes handling relative URLs based on the current page context.
- **Line Layout Enhancements**: The `LayoutLine` class now includes optional attributes for color and href, allowing links to maintain their designated colors in the rendered output.
- **Color Parsing**: Implemented a new `_parse_color` method in the `RenderPipeline` class to convert various color formats (hex and named colors) to Skia-compatible values. This ensures that default link colors are correctly applied and that extremely light colors are rendered as black for visibility.
- **Rendering Links**: During the rendering process, links in the text layout are now rendered with their specified colors, and an underline is drawn under links to indicate interactivity.
- **Document Layout Updates**: The document parsing system has been updated to extract link information correctly while preserving text hierarchy.
- **Tests**: A comprehensive suite of tests has been added, including tests for link parsing, layout characteristics, styling application, and default color handling for links.
This commit introduces support for loading and rendering images in the Bowser web browser, enhancing the rendering engine to handle various image sources. Key changes include:
- Updated README.md to reflect the new milestone status and added features for image support.
- Added `ImageLayout` class to manage image layout and loading.
- Implemented synchronous and asynchronous image loading in `src/network/images.py`, including caching mechanisms.
- Expanded the DOM parsing capabilities in `DocumentLayout` to handle `<img>` tags and manage their layout directives.
- Created a new `DrawImage` command in the rendering pipeline, which handles the drawing of both loaded images and placeholders for unloaded images.
- Introduced a task queue for managing asynchronous image loads, ensuring UI remains responsive during image fetching.
- Added unit tests for image loading, layout management, and the async task queue to ensure robust functionality and prevent regressions.
- Added a comprehensive CSS parser with support for tag, class, and ID selectors.
- Implemented property declaration parsing and inline style handling.
- Introduced a Selector class for specificity calculation and matching against HTML elements.
- Created a CSSRule class to represent individual CSS rules.
- Developed a StyleResolver class to compute final styles for elements, considering cascade and inheritance.
- Added integration tests for CSS parsing and style application in HTML documents.
- Updated HTML parser to retain <style> tags for CSS extraction.
- Enhanced tests for CSS parsing, inline styles, and computed styles.
- Removed unused imports from various test files to streamline code.
- Cleaned up whitespace in test cases for better consistency.
- Updated dependency management in `uv.lock` to reflect changes in optional dependencies.
- Ensured all tests maintain functionality while enhancing clarity and organization.
- Introduced a new feature to visualize the Document Object Model (DOM) tree of the loaded web page.
- Implemented keyboard shortcut (Ctrl+Shift+D) for generating and displaying the DOM graph.
- Added core implementation files:
- src/debug/dom_graph.py: Handles generation and rendering of graphs in DOT and SVG formats.
- Created templates and documentation for the new feature, including:
- docs/DOM_VISUALIZATION.md: Overview and usage instructions.
- docs/DOM_GRAPH_UX.md: User experience design documentation.
- Allowed the visualization to open in a new browser tab instead of an external viewer.
- Enhanced visual representation through color coding of different HTML elements.
- Implemented comprehensive tests for graph generation and page rendering.
- Updated README.md to include usage instructions for DOM visualization.
- Included test_holder.html as an example test page.
- Modified various components in the browser to integrate tab management and enhance the graphical rendering experience.
- Support for 301, 302, 303, 307, 308 redirects
- Automatic Location header following
- Relative URL resolution for redirects
- Max redirect limit (default 10) to prevent infinite loops
- 303 (See Other) automatically changes method to GET
- 4 new unit tests for redirect functionality
- All 73 tests passing
- Add tests for URL parsing, cookies, HTML/CSS parsing
- Add tests for browser/tab management and history
- Add tests for layout and rendering components
- Configure pytest with coverage reporting
- Add test documentation and runner commands
- All 54 tests passing