Commit Graph

135 Commits

Author SHA1 Message Date
Yuri Kobets
cca054779b flexbox: some tests are resolved 2024-01-31 02:36:05 +03:00
Yuri Kobets
ef70eefe4f flexbox rendering fixes 2024-01-28 02:38:20 +03:00
Yuri Kobets
f195ffbd08 flex: refactoring flexbox redering 2024-01-25 23:46:30 +03:00
Yuri Kobets
7f77236246 flex: support for auto-margins in the cross direction 2024-01-11 03:08:38 +03:00
Yuri Kobets
b6e60a6803 flex: added support for align-items: baseline 2024-01-09 02:44:04 +03:00
Yuri Kobets
3e03b6c228 flex: apply max-height to the flex container 2024-01-07 03:16:32 +03:00
Yuri Kobets
d06f95b82b flex: Added support for flex-grow/flex-shring with values less then 1 2024-01-07 02:55:16 +03:00
Yuri Kobets
ca4eed0c85 flex: added validation for flex-grow and flex-shrink (must be positive number) 2024-01-07 01:45:01 +03:00
Yuri Kobets
d5354e69f1 flex: fixed the height calc in size_mode_content mode 2024-01-07 01:33:36 +03:00
Yuri Kobets
2289e1be28 flex: "flex-basis: 0" is valid value 2024-01-07 01:12:13 +03:00
Yuri Kobets
531eddccc6 flex: some passed tests added 2024-01-06 04:12:32 +03:00
Yuri Kobets
88e255c37c flex: support for items max-width/max-height and auto-margins 2024-01-06 03:19:02 +03:00
Yuri Kobets
691965bf2e flex: fix auto-shrink tests 2024-01-04 16:08:49 +03:00
Yuri Kobets
96c79a0847 flex: fixed parsing of the flex shorthand 2023-12-30 00:47:59 +03:00
Yuri Kobets
3bfe3f22f3 flex: Distribute remaining after algorithm space 2023-12-29 12:49:10 +03:00
Yuri Kobets
a230188b31 flex: fixes in rendering of the justify-content css property 2023-12-29 03:46:49 +03:00
MichelCalonder
683a0ab108 Added tests for css counters 2023-12-28 19:27:42 +01:00
Yuri Kobets
76ffcfa841 flex: more flex tests passed 2023-12-28 02:54:09 +03:00
Yuri Kobets
33407c6cc9 flex test: some tests were fixed 2023-12-25 03:35:44 +03:00
Yuri Kobets
85da5869cb Added tests for Flexible Box Layout
All tests are copied from:
http://test.csswg.org/suites/css-flexbox-1_dev/nightly-unstable/html/toc.htm

Prefixes:
"-" - test is using features that litehtml doesn't support yet
"--" - all featured should be supported but test failed because of flex
       rendering implementation issues
2023-12-25 01:16:42 +03:00
Yuri Kobets
ce7d5a16fc flex: added support for align-content property 2023-12-23 17:31:09 +03:00
Yuri Kobets
709855c1dc fix test container base path 2023-12-21 23:53:36 +03:00
Yuri Kobets
95434551e9 tests: support for subfolders in rendering test 2023-12-20 13:50:06 +03:00
Yuri Kobets
dbe19ccb61 flex layout: remake disrtibute free space algorithm
REF: https://www.w3.org/TR/css-flexbox-1/#resolve-flexible-lengths
2023-11-06 23:31:59 +03:00
stasoid
95dc02f6ee test for commit 330e1241 2023-09-12 04:09:43 +06:00
Yuri Kobets
29c0df7e67 added "content: none" support for ::before/::after elements 2023-06-08 19:30:00 +03:00
Yuri Kobets
14b31106c3 fixed rendering of ::before and ::after elements
* now ::before and ::after elements are created if content is not
  defined
* styles ::before and ::after without other selectors are applied
  to the already created before/after elements
2023-06-08 04:28:18 +03:00
Yuri Kobets
7ec04267b1 Fixed calculating min with for elements with floats
Fixes issue #99
2023-06-07 02:52:59 +03:00
Yuri Kobets
87c622789a blocks re-rendering refactor
moved display property based re-rendering from render_item_block::render
to the top functions: place_float, place_inline and
render_item_block_context::_render_content
2023-05-28 18:53:39 +03:00
Yuri Kobets
03104d39e0 fixed floating boxes rendering, apply box-sizing to min/max width/height 2023-05-13 02:24:36 +03:00
Yuri Kobets
ec2d94639f fixed rendering of <html> and <body> tags
* Removed "width: 100%; height: 100%" from <html> style
* extend <html> and <body> elements to the client rectangle if
  width/height is auto
* Reverse inherit for <html> background is working again
* Always draw <html> element background into document clipping area to
  fill entire "browser window".
* Added document::content_width and document::content_height. These
  methodts return the document size without <html> and <body> tags for
  using in tests and other applications
2023-05-12 00:06:54 +03:00
Yuri Kobets
0a1b32aedb Rendering refactoring
* max_width argument removed from _render function
* added render_width into containing_block_context structure. This
  member should be used to render element instead of max_width
* _render protected function is replaced with render function
* apply auto-margins from parent element. Auto margins must not be
  applied inside render function
2023-05-09 02:51:03 +03:00
Yuri Kobets
46bbc0a98e Fixed rendered document size calculating.
document::height() now returns minimum height. This was used in the
render_test.cpp to find the bitmap height. Most of tests were updated
to to match real document size.

Also added ACID1 test.
2023-05-05 03:31:05 +03:00
Yuri Kobets
0dd4b48709 fixed table rendering with width defined as percent 2023-04-28 03:12:46 +03:00
Yuri Kobets
dea6f7fad5 fix re-render table into returned min width in block context 2023-04-25 02:26:21 +03:00
Yuri Kobets
714d234090 fixed support for box-sizing: border-box 2023-04-24 00:20:26 +03:00
Yuri Kobets
f3b2fc03c6 fixed: incorrect floated block position 2023-04-17 02:12:55 +03:00
Yuri Kobets
24e622ed55 table rendering fix 2023-04-15 18:45:22 +03:00
Yuri Kobets
180529bd5c fixed rendering issue with fixed block size 2023-04-14 15:04:24 +03:00
Yuri Kobets
109a837ef6 fixed table rendering 2023-04-14 00:40:39 +03:00
Yuri Kobets
61e89e5059 process zero font-size 2023-04-02 04:53:30 +03:00
Yuri Kobets
ebda06e786 fixed positioned elements rendering (absolute, fixed) 2023-04-02 03:05:21 +03:00
Yuri Kobets
9bc386df9b Fixed: (min/max) width/height calculating with percent units. 2023-03-29 02:28:18 +03:00
Yuri Kobets
1a544160a3 revert table-3-width.htm rendering test 2023-02-21 03:51:08 +03:00
Yuri Kobets
a858b82c24 fix: Unicode escape sequences with lower case are processed incorrenly in the content property 2023-02-21 03:46:07 +03:00
Yuri Kobets
4f6952ac83 fixed: elements ":after" ":before" are not rendered 2023-02-19 00:00:55 +03:00
Yuri Kobets
eca6a7439d don't inherit font-size, font-weight and font-style properties for table
Related to the issue #233
2023-02-18 16:00:25 +03:00
Yuri Kobets
6935de2836 fixed: Bug in margin / padding with position: absolute #79 2023-02-18 14:39:08 +03:00
stasoid
65d58b22f0 remove outdated comments 2023-02-18 08:29:48 +06:00
stasoid
ff7c449016 update render test results 2023-02-18 07:56:09 +06:00
stasoid
d788efb131 sort render tests 2023-02-18 07:53:17 +06:00
stasoid
742aa8e8a0 render_test: increase rendering height for test1.htm 2023-02-18 07:39:54 +06:00
Yuri Kobets
0d91021f28 fix: line height is calculated incorrectly
related to the issue #233
2023-02-17 13:14:19 +03:00
Yuri Kobets
dbc90a7216 fixed: float overlays table #251 2023-02-17 11:18:51 +03:00
Yuri Kobets
4500b2d175 New tests and fixes for inline rendering
* test10.htm - test for issue #247
 * test11.htm - test for issue #249
 * test12.htm - inline text rendering
 * test13.htm - vertical align test
2023-02-16 18:40:17 +03:00
Yuri Kobets
4ab14c9ccb Added new rendering tests
Also all rendering tests are moved to the folder test/render
2023-02-08 23:52:04 +03:00
Yuri Kobets
8820b150ba fixed reference samples for rendering tests
Tables now don't have extra space at the end of text
2023-02-07 02:57:49 +03:00
Yuri Kobets
636ba5163a fixed: line-height calculation for line box. (#243) 2023-01-05 03:55:58 +03:00
stasoid
348bced729 add table-4-td-width.htm test 2022-12-20 19:41:27 +06:00
stasoid
f497c360cb add table-3-width.htm test 2022-12-20 19:31:43 +06:00
stasoid
23109da384 add table-2-width.htm test 2022-12-20 18:48:25 +06:00
stasoid
cb36b5bc66 add line-height inheritance test 2022-12-20 18:27:54 +06:00
stasoid
f0ec9d18f2 cosmetics 2022-12-14 23:41:52 +06:00
stasoid
fcd32a9b7f test_container: implement import_css 2022-12-12 06:03:29 +06:00
stasoid
e8c0e3627a readfile: C -> C++ 2022-12-11 08:31:20 +06:00
stasoid
778a6e2c63 Add render tests
Render tests are .htm files in litehtml/test directory.
Tests starting with "-" are disabled.

Correct rendering is in corresponding .htm.png file.
To generate .png file, run ctest from litehtml/build. The test will fail
and create xxx.htm-FAILED.png file. Rename it to xxx.htm.png

One ASCII raster font with 3 sizes is supported, see litehtml/containers/test/fonts. This should be enough for tests.
Border painting is supported, only solid borders.
Backgrounds, images and list markers are not supported.
2022-12-11 04:20:48 +06:00
stasoid
6ff77337fd remove tests that don't test anything 2022-11-27 13:26:56 +06:00
stasoid
3798ad6cf4 fix cssTest.cpp 2022-11-16 14:54:57 +06:00
stasoid
d1179d5167 more wchar cleanup 2022-11-07 23:21:32 +06:00
stasoid
8c7621034f parse_styles optimization: use string_id for CSS property names
decreases parse_styles time by 37% (750 ms -> 468 ms on Obama wiki on my machine)
2022-11-07 22:11:00 +06:00
stasoid
8927a44515 Remove litehtml::context, replace master.css -> master_css.h and make document::createFromString receive master/user css as strings
closes issue #219
2022-10-30 16:25:56 +06:00
stasoid
a6177d1d5e remove wchar support
closes issue #217
2022-10-21 17:51:29 +06:00
Yuri Kobets
e56cd9b730
Internal refactoring (#212)
* Refactored CSS properties

All CSS related properties are moved into the separate class css_properties.
Getters and setters are removed from classes element and html_tag.
Access to the css_properties rleased via css() [ro] and css_w() [rw] methods

* fix: el_text don't have to copy all css properties from parent

* Refactored rendering code

* Added flex and inline_flex values for display css property

* Implementing box generation

https://www.w3.org/TR/CSS22/visuren.html#box-gen

* Split inlines on block box inside

* Split parsing and rendering trees.

* Fixed some bugs

* Fixed: impossible to click urls on Obama wiki's toc

* Make element::get_placement work again

* Fixed: incorrect rendering table captions

* find_styles_changes function returned to the element class

* set parent correctly during render items split

* fixed urls on https://en.cppreference.com/w/cpp/container/vector

* fixed rendering blocks with width in percents

Example:
https://web.archive.org/web/20110101155107/http://www.unicode.org/
Issue #208

* Fixed placement of blocks with "overflow: hidden" with floating boxes.

* refactoring of rendering block

* Selectors :before and :after returned back with fixed behaviour.

* fixed render_item::is_last_child_inline

* fixed: text inside nested inlines has extra paddings/margins

* fixed documet test
2022-09-14 00:39:44 +03:00
stasoid
9c2c6fffa2 fix test 2022-03-19 09:30:22 +06:00
stasoid
0d8b75f3bd remove xxd
Use pure CMake solution as described here: https://stackoverflow.com/questions/410980/include-a-text-file-in-a-c-program-as-a-char/47801116#47801116
2022-03-17 21:53:01 +06:00
John Poole
463cfc2de1
Merge branch 'master' into url-class 2021-09-25 20:26:05 -04:00
John Poole
5460deec6b
Merge pull request #3 from primatelabs/tstring_view
Add tstring_view, a string reference type
2021-09-25 20:24:38 -04:00
John Poole
8bbf9afed6 Disable test that only fails on GitHub Actions
CSSTest.SelectorParse fails on GitHub Actions but not on Travis or on
any developer systems.  Disable the test until we can determine what's
going on here.
2021-09-25 19:51:12 -04:00
John Poole
527fbe3413 Extend URL path resolution to handle relative paths
This is implemented using several URL path helper functions.  The
functions aren't strictly necessary, but the functions make it easier
to implement and test the resolution functionality.
2021-09-25 13:52:56 -04:00
John Poole
d3c368458d Add a url class
The url class is a URL parser and container class that makes working
with URLs easier.  In particular, the resolve() function makes working
with base URLs and possibly relative URLs easier.

url instances are meant to be immutable.  If users need to modify a
url instance they can do so by creating a new url instance.  See the
resolve() implementation for a non-trivial example of how to build a
new url instance using existing url instances.

Note that the current implementation is inefficient due to each URL
component requiring its own separate memory allocation.  We should
consider re-writing this to use tstring_view once that branch is
merged into master.
2021-09-25 11:58:31 -04:00
John Poole
3147b4fc78 Add codepoint utility functions, tests
Add codepoint utility functions that test whether a codepoint belongs
to a set of codepoints (e.g., the valid codepoints for a URL scheme).
Most of these functions are implemented using a compact lookup table
so should be reasonably fast.

The functions are based on similar functions from the css-parser branch
that were introduced in commit 1698324920.  We'll want to merge these
sets of functions together once the branches are merged.
2021-09-25 11:57:52 -04:00
John Poole
14e2001376 Add tstring_view, a string reference type
tstring_view is a string reference type that provides a view into a
string that is owned elsewhere (e.g., by a std::string object).

tstring_view implements the same interface as std::base_string_view in
the standard library.  When litehtml moves to C++17 consider replacing
the tstring_view implementation with the standard library
implementations (e.g., via a using statement).
2021-09-23 14:56:34 -04:00
John Poole
7501793675 Convert litehtml tests to use GoogleTest
GoogleTest provides a number of nice features (such as autodiscovery)
that make writing and running tests easier and less tedious.  This
patch converts the litehtml tests over to use GoogleTest.  Note that
the conversion is mostly mechanical -- no attempt has been made to
make the tests "idiomatic" GoogleTests.

Most of the CMake changes are based on code from the GoogleTest
documentation, specifically the "Quickstart: Building with CMake"
guide:

  https://google.github.io/googletest/quickstart-cmake.html
2021-08-25 17:51:12 -04:00
Sky Morey
04d8b410c1 added tests, optimized text parsing for <script> 2019-08-18 15:58:26 -05:00
Sky Morey
cd15b54730 Added testing 2019-08-17 20:26:08 -05:00