Commit Graph

951 Commits

Author SHA1 Message Date
stasoid
d9565ee928 deduplicate prepare_color_points 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
c80a2a08e9 use optional<css_length> in gradient::color_stop
unitless 0 is a valid length value, stop using it as a <no length> value
2024-05-16 22:54:49 +03:00
stasoid
bb60063a62 fix repeating-conic-gradient 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
3af10950e7 fix conic-gradient-2.htm 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
d8a612adc6 add 2 linear-gradient tests 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
b256f6bcb5 fix unitless width/height attributes of <img> 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
Yuri Kobets
c268ac29e8 Revert "undo some recent style changes"
This reverts commit 3c72715e6c.
2024-05-11 17:58:02 +03:00
stasoid
f429a3a101 disable gumbo warnings in VS
`add_compile_options(/wd4244 /wd4267)` is deliberately placed separately from `target_include_directories(${PROJECT_NAME} PRIVATE visualc/include)`:
- if `add_compile_options` is placed after `target_include_directories`, options are not applied
- if `target_include_directories` is placed together with `add_compile_options` (before `add_library`) then cmake fails
Looks like `add_compile_options` should be called before `add_library`,
and `target_include_directories` should be called after `add_library`.
2024-05-11 13:21:22 +03:00
stasoid
966e24a561 handle height attribute of table, tr, td/th 2024-05-11 13:21:22 +03:00
stasoid
1611b789f1 don't ignore @import after bad rules 2024-05-11 13:21:22 +03:00
stasoid
c51f0defba render_test: getcwd is redundant 2024-05-11 13:21:22 +03:00
stasoid
ddbdf8a67a add padding test 2024-05-11 13:21:22 +03:00
stasoid
430d5a127f render_test: add ability to run standalone (without gtest) 2024-05-11 13:21:22 +03:00
stasoid
3c72715e6c undo some recent style changes 2024-05-11 13:21:22 +03:00
David Cheng
953f40b2ef Update to latest gumbo-parser
from https://codeberg.org/gumbo-parser/gumbo-parser
2024-05-07 03:40:06 +03:00
stasoid
e3f481f705 spaces -> tabs in some places 2024-05-04 23:31:55 +03:00
stasoid
9136086b2c fix subtest d in media.htm failing when compiled with gcc
abs() in eval_op() in media_query.cpp is abs(int) instead of abs(float) after switching from <math.h> to <cmath>
Minimal example: https://tio.run/##RYuxCsIwEEBn7ysOXNqhjoJt7Chk6SSI43lJayBJS3MVQfx1Y8HB5T148HiaqoE5562L7BdjUbkxyWwptPBvHEjuLUDvRxJ8kF8sHlF3J93p87UBcFEwkItFiS/YJDF1zeMiqBTSLRWH/Q6r31c28M75w72nIeXqQt6vtE@ZafVkDUVx/AU

Note that gcc doesn't display any warning, but clang does: https://tio.run/##Sy4o0E3OScxL//9fOTMvOac0JVXBJjO/uKQoNTHXjgshlpybWJJhx8WVlpOfWKJQlphTmqpgq@Dp5@bp5xkSac3FlZlXopCbmJmnoalQzcVZXJJiZZWcX1qiYGOjkJhUrGFppqegC9Gnac1V@/8/AA
2024-05-04 23:31:55 +03:00
stasoid
402288c2cb add comment 2024-05-04 23:31:55 +03:00
stasoid
28c46cdaf7 don't test unused functionality 2024-05-04 23:31:55 +03:00
stasoid
0e2dd95528 remove cssTest.cpp and mediaQueryTest.cpp, they are covered by render tests now 2024-05-04 23:31:55 +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
stasoid
3c2ca4fbbc render_test: remove redundant resize 2024-05-04 23:31:55 +03:00
Yuri Kobets
c09be97184
Merge pull request #347 from stasoid/master
Fix a bunch of css selector issues
2024-04-29 21:00:40 +03:00
stasoid
59cdf6b5a7 Fix this gcc error:
litehtml/include/litehtml/document.h:75:14: error: declaration of ‘litehtml::mode litehtml::document::mode() const’ changes meaning of ‘mode’ [-fpermissive]
   75 |   mode       mode() const { return m_mode; }
      |              ^~~~

Note: this error is specific to gcc, clang and VS don't display it.
Minimal example:
gcc: https://tio.run/##Sy4o0E1PTv7/PzWvNFchNz8lVaG6otaaKzknsbhYwZGrmosTLAgiNDSri1JLSovyFCqsa7mAijLzShRyEzPzgBK1//8DAA
clang: https://tio.run/##Sy4o0E3OScxL//8/Na80VyE3PyVVobqi1poLKFpcrODIVc3FCRYEERqa1UWpJaVFeQoV1rVcQEWZeSUKuYmZeUCJ2v//AQ
2024-04-29 21:26:27 +05:00
stasoid
98e1ed5d46 s.empty() -> s == "" 2024-04-29 20:52:32 +05:00
stasoid
9e96cd0e25 Revert "{style} Prefer .empty() for readability"
This reverts commit feb47e3c5b.
2024-04-29 20:48:14 +05:00
stasoid
621c0ad9a3 Merge remote-tracking branch 'upstream/master' 2024-04-29 20:43:15 +05:00
stasoid
4c3e774bbf add selector tests for 8 previous commits 2024-04-29 20:24:16 +05:00
stasoid
ca693a290e support selector_list in :nth-child(an+b of selector_list) 2024-04-29 19:16:30 +05:00
stasoid
2fdfbdfcdc fix matching selector :nth-child(an+b) when a < 0 2024-04-29 18:38:10 +05:00
Andy Maloney
feb47e3c5b {style} Prefer .empty() for readability
https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/readability/container-size-empty.html

(Also sneak in removal of a redundant initialization.)

Part of #336
2024-04-26 18:45:48 +03:00
Andy Maloney
3c6d4e8c81 {style} Prefer range-based loops
https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/modernize/loop-convert.html

Part of #336
2024-04-26 17:41:48 +03:00
Andy Maloney
412fdc227e Use parens in macro
https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/bugprone/macro-parentheses.html
2024-04-26 17:37:18 +03:00
Andy Maloney
c25af5240b Ensure border style is initialized 2024-04-26 17:27:39 +03:00