Commit Graph

187 Commits

Author SHA1 Message Date
Yuri Kobets
d0986f2b24 Conic gradient support for the container_cairo 2025-05-27 03:19:07 +03:00
Yuri Kobets
2d34cb9f09 fixed: elements with 'position:fixed' have issue with draw
* document_container::get_client_rect was renamed to get_viewport.
* updated draw_buffer class to handle fixed elements on scroll
2025-04-11 02:53:37 +03:00
Yuri Kobets
1274232171 Includes refactoring using clangd 2025-04-06 23:10:39 +03:00
Yuri Kobets
c33894eab4 fix: std::array is not defined in container_cairo_pango.cpp 2025-03-30 03:34:51 +03:00
Yuri Kobets
c214c27d2c Destroy cairo_surface_t in container_cairo::draw_list_marker 2025-03-28 04:58:18 +03:00
Yuri Kobets
23751c1421 Support for text-decoration CSS properties
Supported properties:
* text-decoration (as shorthand for other text-decoration properties)
* text-decoration-color
* text-decoration-line
* text-decoration-style
* text-decoration-thickness

Changes in the container::create_font:
```litehtml::uint_ptr create_font(const font_description& descr, const document* doc, litehtml::font_metrics* fm);```

All font parameters are moved to the ```font_description``` structure.
2025-03-12 23:09:56 +03:00
Yuri Kobets
65128c39b3
Updated inline layout rendering (#389)
* Added subscripts/superscripts baseline shift to the font_metrics
* Improved rendering of inline elements with top and bottom vertical align
* Improved rendering of the line-height property
2025-03-07 17:30:32 +03:00
Yuri Kobets
33f12ff153 render2png: Apply render settings from <file>.cfg file
The following settings can be applied:
width - force width to draw
height - force height to draw
bestfit - (true or false) Use false to disable "best fit" feature
2024-10-05 15:22:42 +03:00
Yuri Kobets
071ce868ca pango container: fixed font height calculation and draw 2024-10-05 15:22:42 +03:00
Yuri Kobets
1e9d0be84b render2png: added url decode 2024-10-05 15:22:42 +03:00
Yuri Kobets
1514b1678d Added support for 'ex' and 'ch' units. Improved calculating x-height metric. 2024-10-05 15:22:42 +03:00
Yuri Kobets
3dc2792560 render2png: fixed crash if content width/height is zero 2024-10-05 15:22:42 +03:00
Yuri Kobets
b889fa39e2 render2png: pass clip rect to the doc->draw 2024-10-05 15:22:42 +03:00
Yuri Kobets
78f08f3080 Tests update
1. Using container_cairo_pango for running tests.
2. Added Dockerfile to create docker container for building litehtml
   tests
3. Added script run_render_tests.sh to build litehtml tests in the
   docker container
4. Added render2png target (cmake -DLITEHTML_BUILD_RENDER2PNG). This
   utility allow to render html file into a png file.
5. Tests building are off by default.
   Use "cmake -DLITEHTML_BUILD_TESTING=ON" command to buid tests
6. Added container_cairo_pango::get_font_options. Overwrite this method
   to control fonts rendering.
2024-09-10 02:20:02 +03:00
Andy Maloney
1bd4c59c0d Remove extraneous namespace in test container 2024-08-19 16:41:50 +03:00
Andy Maloney
577367ecc9 Use one callback with enum to avoid extra API (#2) 2024-08-19 16:41:50 +03:00
Andy Maloney
1a54872a46 Add callbacks for mouse entering/leaving elements (#1)
Useful for showing URLs from anchors or for debugging.
2024-08-19 16:41:50 +03:00
Yuri Kobets
32fb235cdd cairo container: improve image scaling 2024-08-19 01:58:21 +03:00
Yuri Kobets
899b2986ce Cairo container: draw image list marker 2024-08-16 01:10:31 +03:00
Yuri Kobets
9e0df0904c Cairo container: Fixed crash on zero length border with style dashed and dotted 2024-08-06 02:37:28 +03:00
stasoid
27696b8d8e test_container: correctly draw multicolor borders 2024-05-20 00:40:31 +03:00
stasoid
863d6fe713 remove outdated comment 2024-05-20 00:40:31 +03:00
stasoid
41d9de3a25 test_container: update readme.txt 2024-05-20 00:40:31 +03:00
stasoid
def2684c1b fix VS warning 2024-05-20 00:40:31 +03:00
stasoid
28bbe74ec9 test_container: support TTF fonts 2024-05-20 00:40:31 +03:00
stasoid
d5426075fa canvas_ity: add get_font_metrics() 2024-05-20 00:40:31 +03:00
stasoid
138f712eb8 canvas_ity: fix font baseline position computation 2024-05-20 00:40:31 +03:00
stasoid
218eb74ae8 make m and w more bold in terminus-16px-bold.yaff
They didn't look bold enough. There is no space, so I made m/w wider. This makes terminus-16px-bold.yaff a variable-width font, which may be confusing because normal weight variant is monospace. I also used this variable-width opportunity to improve NMW glyphs.

Rendering of css-box-justify-content.htm changed because width of nbsp is computed correctly now.
2024-05-20 00:40:31 +03:00
stasoid
6c4e6ef10a test_container: add terminus-16px-bold.yaff 2024-05-20 00:40:31 +03:00
stasoid
8d16a94e32 test_container: support list-style-image 2024-05-16 22:54:49 +03:00
stasoid
30e4fd105c test_container: support list-style-type disc and circle 2024-05-16 22:54:49 +03:00
stasoid
7b7d292b58 fix gcc warning 2024-05-16 22:54:49 +03:00
stasoid
38180d37da fix VS and gcc warnings 2024-05-16 22:54:49 +03:00
stasoid
08c647aea1 simplify things by making background_layer::color_point::offset and hint to always be between 0 and 1, even for conic gradients (so offset and hint for conic gradients are measured in turns instead of degrees now) 2024-05-16 22:54:49 +03:00
stasoid
60bd9f18f1 implement gradient color transition hints 2024-05-16 22:54:49 +03:00
stasoid
d3092ca1a8 test_container: fix gradient position 2024-05-16 22:54:49 +03:00
stasoid
423bb82412 canvas_ity: handle zero radius of radial gradient 2024-05-16 22:54:49 +03:00
stasoid
62de3475f3 test_container: add ability to use background repeat styles with gradient images 2024-05-16 22:54:49 +03:00
stasoid
869a3cd8ea test_container, canvas_ity: implement conic-gradient 2024-05-16 22:54:49 +03:00
stasoid
70fafc0b86 test_container, canvas_ity: implement radial-gradient
Radial gradient supported by canvas_ity is different (two circles vs one ellipse in CSS), so I implemented new brush type, css_radial. It is created with canvas::set_css_radial_gradient().
2024-05-16 22:54:49 +03:00
stasoid
eadeeefbd9 test_container, canvas_ity: do not linearize colors to match Chrome/Firefox gradient rendering
Old behavior is still available with #define CANVAS_ITY_IMPLEMENTATION LINEARIZE_RGB

Comparison of rendering linear-gradient-1.htm with and without LINEARIZE_RGB:
![image](https://github.com/stasoid/test/assets/2577509/074f2593-1beb-49f6-a387-370a8dfedaad)

Browsers don't render gradients identically, so I use max_color_diff() to compare them.
It measures max difference in each RGBA component in each pixel.
                                                 max_color_diff
chrome vs firefox                                1
chrome vs canvas_ity without linearized colors   1
chrome vs canvas_ity with linearized colors      74
2024-05-16 22:54:49 +03:00
stasoid
55e9fef61c test_container: support linear-gradient (no-repeat only) 2024-05-16 22:54:49 +03:00
stasoid
725c4bcbc8 test_container: support image scaling 2024-05-16 22:54:49 +03:00
stasoid
0a07f85f81 test_container: simplify draw_borders 2024-05-16 22:54:49 +03:00
stasoid
7b0d9e33a5 test_container: remove unused code 2024-05-16 22:54:49 +03:00
stasoid
44ac33f825 test_container: convert to using canvas_ity 2024-05-16 22:54:49 +03:00
stasoid
430d5a127f render_test: add ability to run standalone (without gtest) 2024-05-11 13:21:22 +03:00
stasoid
e207a989f9 add media query tests, fix @media not unknown 2024-05-04 23:31:55 +03:00
stasoid
99dd1ffec7 test_container: support images 2024-05-04 23:31:55 +03:00
stasoid
78ad19a0fd test_container: support nbsp 2024-05-04 23:31:55 +03:00