Commit graph

17 commits

Author SHA1 Message Date
Benedikt Willi
99a3a4c145 Implement render pipeline for layout and painting, enhancing document rendering and debug capabilities 2026-01-11 23:54:50 +01:00
Benedikt Willi
21e779d281 Add comprehensive tests for layout and rendering components, enhancing coverage for layout lines, blocks, and document structures 2026-01-11 23:41:20 +01:00
Benedikt Willi
8d2fd3b16e Enhance layout and rendering features with new document and block layout implementations 2026-01-11 23:34:27 +01:00
Benedikt Willi
39b03bf9cc Enable debug mode in Chrome when the --debug flag is set and add detailed rendering profiling 2026-01-11 23:17:23 +01:00
Benedikt Willi
e5e281dfc2 Add profiling and layout caching to improve rendering performance 2026-01-11 23:02:52 +01:00
Benedikt Willi
c2533a33c0 Add FPS tracking and character-level text selection as well as enhancements in debug mode 2026-01-11 22:47:42 +01:00
Benedikt Willi
cc9b1157be Enhance DOM rendering and selection features with debug mode support 2026-01-11 22:35:56 +01:00
Benedikt Willi
3838aa17af Add DOM Visualization Feature with Integrated Browser Support
- 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.
2026-01-10 00:19:21 +01:00
Benedikt Willi
d3119f0b10 Add automatic HTTPS protocol assumption for URLs
Feature: Smart protocol handling
- If no protocol is provided, assume https://
- URLs like 'example.com' become 'https://example.com'
- 'example.com/path' becomes 'https://example.com/path'
- Special 'about:' URLs are preserved as-is

Implementation:
- Added _normalize_url() method to Browser class
- Checks for '://' in URL to detect existing protocol
- Strips whitespace from URLs
- Applied in both new_tab() and navigate_to() methods
- Supports all URL formats (subdomains, ports, paths, queries)

URL Normalization Logic:
1. Strip leading/trailing whitespace
2. Check if URL already has a protocol ('://')
3. Check for special about: URLs
4. Otherwise prepend 'https://'

Examples:
- 'example.com' → 'https://example.com'
- 'https://example.com' → 'https://example.com' (unchanged)
- 'about:startpage' → 'about:startpage' (unchanged)
- 'www.example.com:8080' → 'https://www.example.com:8080'
- 'localhost:3000' → 'https://localhost:3000'

Tests added (10 test cases):
- test_normalize_url_with_https
- test_normalize_url_with_http
- test_normalize_url_without_protocol
- test_normalize_url_with_path
- test_normalize_url_with_about
- test_normalize_url_strips_whitespace
- test_normalize_url_with_query_string
- test_normalize_url_with_subdomain
- test_normalize_url_with_port
- test_normalize_url_localhost

Existing tests still passing (15/15)
2026-01-09 14:52:05 +01:00
Benedikt Willi
cb6103ce04 Reimplement tab bar from scratch with simplified, working design
Simplified tab bar implementation:
- Remove complex CSS provider logic that was causing issues
- Simple box-based layout with tab label + close button per tab
- Direct button click handlers with tab reference stored on widget
- Much simpler and more reliable event handling

Tab bar features:
- Each tab shown as: [tab label button] [close button ✕]
- Active tab highlighted with suggested-action style
- Inactive tabs use flat style for cleaner look
- Close button is small and flat (36px width)
- New tab button with + symbol (48px width)

Event handling:
- _on_tab_clicked: Activates the clicked tab
- _on_close_clicked: Closes the clicked tab
- _on_new_tab_clicked: Opens new tab to about:startpage
- Tab reference stored directly on button widget for easy access

Benefits:
- Much simpler codebase
- No complex CSS provider per widget
- Reliable event handling
- Easy to debug and maintain
- No style context issues

All tests passing (15/15)
2026-01-09 14:36:49 +01:00
Benedikt Willi
a9d52e49c8 Improve tab bar visual integration with modern browser-like styling
Enhanced tab widget design:
- Unified tab widget with integrated close button (no visual separation)
- Close button on the right with rounded right corners
- Tab button with rounded left corners for seamless integration
- Custom CSS styling for professional appearance
- Hover effects: close button highlights in warning color
- Tab highlights as suggested-action when active

Visual improvements:
- Tabs have rounded corners (4px radius)
- Proper borders matching theme colors
- Better padding and spacing
- Flat buttons by default except active tab
- Close button marked with ✕ instead of ×
- Better visual feedback on hover

UX improvements:
- Tooltips on all buttons (tab URL, close tab, new tab)
- Small square close button (32px) for easy clicking
- Active tab uses blue suggested-action styling
- Tabs show full URL on hover
- New tab uses about:startpage instead of example.com

CSS styling:
- Theme-aware colors using @view_bg_color, @borders, @warning_color
- Proper border-radius on tab and close button
- Visual separation between tab and close button
- Hover state for better feedback

All tests passing (15/15)
2026-01-09 14:34:48 +01:00
Benedikt Willi
3bad301bcc Refactor browser chrome to use libadwaita for modern GNOME UI
Benefits of libadwaita:
- Modern, polished UI following GNOME Human Interface Guidelines
- Professional HeaderBar with proper navigation button grouping
- Better visual hierarchy and spacing
- Consistent with modern GNOME applications
- Built on GTK 4, same foundation as before

Changes:
- Replace Gtk.ApplicationWindow with Adw.ApplicationWindow
- Use Gtk.HeaderBar for professional top bar with navigation buttons
- Improve address bar presentation (placeholder text, better sizing)
- Add CSS classes for consistent styling (linked, suggested-action, toolbar)
- Better tooltip support for navigation buttons
- Add visual frame around tabs bar
- Improved status bar styling with toolbar class
- Adw.init() called during window creation

UI Improvements:
- Navigation buttons (Back/Forward/Reload) now grouped with linked styling
- Go button highlighted with suggested-action styling
- Address bar uses placeholder text instead of default value
- Better spacing and margins throughout
- More professional appearance overall

All tests passing (23/23 in core modules)
2026-01-09 14:31:55 +01:00
Benedikt Willi
fab66d1528 Implement Jinja2 templates for startpage and error pages
Features:
- Add Jinja2 template engine for page rendering
- Create startpage with Bowser branding and version info
- Create error page templates for 404, 500, and network errors
- Support for about:startpage special URL
- Custom error message support in templates
- Graceful fallback rendering if template fails
- Browser now starts with startpage when no URL provided

Templates:
- assets/pages/startpage.html - Beautiful purple gradient intro page
- assets/pages/error_404.html - Pink gradient 404 error page
- assets/pages/error_500.html - Red gradient 500 error page
- assets/pages/error_network.html - Orange gradient network error page

Code:
- src/templates.py - Template rendering utilities with Jinja2
- Updated main.py to use startpage as default
- Updated Frame.load() to handle about: URLs and render errors with templates
- Added 7 comprehensive template tests

All 62 core tests passing (excluding GTK-dependent tests)
2026-01-09 14:24:01 +01:00
Benedikt Willi
283dae295c Implement HTTP redirect following
- 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
2026-01-09 14:11:46 +01:00
Benedikt Willi
ae6fcbfab4 Add comprehensive test suite with pytest
- 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
2026-01-09 13:37:21 +01:00
Benedikt Willi
f1e4957e70 Initial commit: Setup Bowser educational web browser
- Added README.md with project description, building instructions, and development milestones.
- Created the project structure with directories for source code, assets, and tests.
- Implemented a basic entry point in main.py with argument parsing and logging configuration.
- Developed preliminary browser orchestration in browser.py, including tab management and navigation.
- Established a GTK-based UI framework in chrome.py, integrating key UI components including the address bar and navigation buttons.
- Incorporated HTTP request handling in http.py, with enhanced logging of requests and responses.
- Added initial assets: logo and images for browser UI.
- Configured dependencies in pyproject.toml for development and runtime environments.
- Initialized version control with uv.lock for dependency management.
2026-01-09 13:31:48 +01:00
Benedikt Willi
b0e693e50c Initial bowser project scaffold 2026-01-09 12:20:46 +01:00