Commit Graph

951 Commits

Author SHA1 Message Date
Yuri Kobets
dbc90a7216 fixed: float overlays table #251 2023-02-17 11:18:51 +03:00
Yuri Kobets
2c5077f351
Merge pull request #253 from litehtml/inline_render_fix
Inline render improvements
2023-02-16 18:59:46 +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
40d2071bd8 Improved support for the vertical-align property (inline elements)
Supported values:
  * baseline
  * top
  * bottom
  * text-top
  * text-bottom
  * middle
  * sub
  * super
It works for text as well as for inline boxes.
2023-02-16 03:50:12 +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
ededf2166e fix: render_item_table::_render must return minimum width including paddings/borders/margins 2023-02-07 02:55:01 +03:00
Yuri Kobets
10fb697ff2 fixes in calculating line box width 2023-02-06 03:53:07 +03:00
Yuri Kobets
9cfe3aae04 remove trailing spaces from the last line box 2023-02-06 00:49:10 +03:00
Yuri Kobets
fbe68e1676 optimization: removing std::dynamic_pointer_cast 2023-02-05 16:51:07 +03:00
Yuri Kobets
4ea92870e8 optimizing inline rendering 2023-02-05 04:36:07 +03:00
Yuri Kobets
e01ca8ebdc fixed line box base line calculating 2023-02-05 02:30:44 +03:00
Yuri Kobets
8f1d923d52 fix: vertical-align css property is not inherited
For reference:
https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align
2023-02-05 01:49:12 +03:00
Yuri Kobets
a0c5fe8edd Fixed: use font height instead line height for inline boxes
Also some issues with line box rendering
2023-02-03 03:08:19 +03:00
Yuri Kobets
756b247ecd Redesigned inline elements rendering 2023-02-01 03:42:58 +03:00
Yuri Kobets
388a06dfcc fixed bug in inline elements rendering (#247) 2023-01-07 01:37:36 +03:00
Ryan Schmidt
1e803393bd Add styles for ins, del, s, and strike elements 2023-01-05 21:12:19 +03:00
Ryan Schmidt
89a7d36df8 Add styles for cite element 2023-01-05 19:58:33 +03:00
Ryan Schmidt
d8f23728a8 Add styles for u element 2023-01-05 19:58:16 +03:00
Yuri Kobets
636ba5163a fixed: line-height calculation for line box. (#243) 2023-01-05 03:55:58 +03:00
Yuri Kobets
cd17480551
Merge pull request #241 from stasoid/master
small fixes, add some tests
2022-12-20 18:46:39 +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
7c13c2ce65 fix t_strncasecmp
t_strncasecmp("a\0a", "a\0b", 3) should be 0, not -1
2022-12-15 00:51:21 +06:00
stasoid
a75a38df71 stop using std::stringstream because it is actually slower than std::string
proof: https://tio.run/##rVPLbtswEDyLX7FlkICE5cDtUVJ876kf0BSCyofK2iINkkrRBv71qstQjmUEKFKkJ0n7mNmZXYnDYd0LMU1Xxor9KBU0D0pE57fkHAnRG9tfRDCkumEZEt@8s25LxoC1EKKsqtxXE3IllTZWwbALzHaDKjE/as3vSfFUmHtTg@rkz1bsndhVVTSDag/O2AhfVW8s3MFfqq37wXj9hIjQ9auhlZWvBD6gmqgZvQ4VXH@USc29pSWcFC0Q5Oi7aJxtRRdic5EajPAuKOGsDFuW2NdZHr8VbrSRcY6OkQdnJHzHCdvsYhsCy283SOVLQIAQM2ve2GlNNxDdTtlwLsldUu3NwMnjbEwO5z1CCDUptPPAgvml2ggGPdnU@GhmtNuUQB/ArFacFIhSGA3MwDss5AgATZMpEKnIn7nzs/mCoWOi9clphIoekcjxpcr/KDFxUfpWWQizulvoyt@XwlDHDI@3nk5q6IxlZ6cvZ5@b2fvNpgQqg9ZSB6lp2nr6P@hyMbSc50@wi@GxebOcOfekcdOUL8@mfDaMQmIqij7pwMzJgCSEE/K4GOHN5P/AjOfhVRy9TR4eyTT9Fnrf9WFaf/rwBw
The situation is similar in clang and VS.
2022-12-15 00:23:04 +06:00
stasoid
f0ec9d18f2 cosmetics 2022-12-14 23:41:52 +06:00
Yuri Kobets
5da4e69127
Merge pull request #239 from TobiasBohnen/TobiasBohnen-patch-text-indent
fixed text-indent
2022-12-12 22:48:18 +03:00
TobiasBohnen
bea96f188c
fixed text-indent
text-indent currently skips the first line and indents subsequent lines. But it should be the other way around.
2022-12-12 20:07:22 +01:00
Yuri Kobets
64ca561c49
Merge pull request #238 from stasoid/master
Add render tests
2022-12-12 19:46:49 +03:00
stasoid
fd8f7e9fee test_container: update fonts/readme.txt 2022-12-12 13:04:02 +06:00
stasoid
3ee3977bce test_container: implement draw_list_marker (only square bullets) 2022-12-12 07:31:26 +06:00
stasoid
4f92aa42f0 test_container: implement draw_background
only color, no images
only 2 values of opacity are supported:
   color.alpha == 0  fully transparent
   color.alpha != 0  fully opaque
2022-12-12 06:31:35 +06:00
stasoid
fcd32a9b7f test_container: implement import_css 2022-12-12 06:03:29 +06:00
stasoid
522524220f test_container: update fonts/readme.txt 2022-12-11 15:29:02 +06:00
stasoid
e8c0e3627a readfile: C -> C++ 2022-12-11 08:31:20 +06:00
stasoid
ad868a77f4 fix VS2019 warning about incorrect _errno dll linkage when compiling tests 2022-12-11 04:36:23 +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
Yuri Kobets
314e5a5893
Merge pull request #237 from stasoid/master
fix line-height inheritance and fix table width on Obama wiki
2022-12-10 01:03:57 +03:00
stasoid
d1380c9f60 fix #236 (incorrect table width)
The return value of render() is "max" element width (when formatting the content without breaking lines) given particular container width.

If max_table_width is less than table_width, that's fine. It means the table is stretched to fit its container, but its contents is smaller.
So we return max_table_width.

However, if max_table_width is greater than table_width, we should return table_width, because by doing table layout we found out that table_width
is the maximum width the table can have *given this container width*. (Well, not quite, but something like that.)
2022-12-09 22:32:25 +06:00
stasoid
c46240eb7c distinguish between computed and used line-height (fixes #232) 2022-12-09 21:58:44 +06:00
Yuri Kobets
ae9fe10f48 Fix: font size without units (font-size: 20) is ignored
Issue #234
2022-12-06 00:41:29 +03:00
Yuri Kobets
315ff22304
Merge pull request #235 from stasoid/master
fix links with black background on Obama wiki + some other changes
2022-12-06 00:04:30 +03:00
stasoid
de78f4b06c fix comments 2022-12-05 15:39:58 +06:00
stasoid
2660bcff03 create html_tag constructor for anonymous wrapper boxes
changed css_properties::compute signature because shared_from_this cannot be called during construction of *this
2022-12-05 15:28:37 +06:00
stasoid
18fc38e66e add functions for easier debugging
it is now possible to write el->select("#a") or el->id() == _a_
2022-12-05 14:43:40 +06:00
stasoid
b60c18be32 spaces -> tabs 2022-12-05 14:25:35 +06:00
Yuri Kobets
5ba6f8265a
Merge pull request #230 from mgambrell/gumbo-fix-msc-ver
gumbo.h (and others) has two problems among them:
2022-12-03 14:53:14 +03:00
Yuri Kobets
3c2cf6406e
Merge pull request #231 from mgambrell/virtual-dtor
add missing virtual destructors
2022-12-03 14:53:00 +03:00