Commit Graph

267 Commits

Author SHA1 Message Date
Yuri Kobets
b418ffa60e Windows: replace _snwprintf/snprintf with _snwprintf_s/_snprintf_s 2022-09-17 23:55:42 +03:00
Yuri Kobets
ff0e7c73bd Fixed: compilation is failed on Windows 2022-09-17 23:44:43 +03:00
Yuri Kobets
a4aae391fa
Merge pull request #211 from tig/fix_litehtmlsharp
Fixes LiteHtmlSharp build
2022-09-14 00:57:45 +03: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
Tig Kindel
acd5615383 Fixes building LiteHtmlSharp post separating src/indlude dirs 2022-08-10 16:35:13 -06:00
stasoid
6b55a1b852 cosmetics 2022-03-26 20:36:05 +06:00
stasoid
5a00888bbc var() 2022-03-17 10:37:42 +06:00
stasoid
315738cc4d fix blockquote 2022-03-08 20:48:26 +06:00
stasoid
c8a4ee6f72 fix #194
Also fixes rendering of this HTML:
<table width=100px border=1>
<tr><td>aaa<td style="display:none">bbb<td>ccc

and this HTML:
<style>p{display:table-cell}</style>
<p>aaa</p><!----><p>bbb</p>

and improves rendering of this HTML:
<style>
p{display:table-cell}
span{white-space:pre}
</style>
<span>
<p>aaa</p>  <p>bbb</p>
2022-03-04 21:21:24 +06:00
cotn666
f27e69b0b3
Fix MinGW build 2022-02-22 10:44:25 +01:00
wih1hi
e91823d438 fixed style property 'white-space: pre-wrap' 2021-12-28 13:13:06 +01:00
Yuri Kobets
b4903811fc Fixed compilation error on Windows 2021-11-15 01:31:54 +03:00
Yuri Kobets
6617ab7188 Refactoring 2021-11-11 00:12:38 +03:00
Yuri Kobets
7d234d9a7e Use pango library as text renderer for container_linux 2021-11-07 03:53:00 +03:00
Yuri Kobets
cd72813881 Fixed parsing of escape sequence for :before and :after classes 2021-11-05 20:20:26 +03:00
Yuri Kobets
d4209476bc Add t_ prefix for functions litehtml::strcasecmp, litehtml::strncasecmp, litehtml::tolower and litehtml::isdigit 2021-11-05 02:32:49 +03:00
g4mba5
4dc1a18fc3
Add custom implementations of 'strcasecmp', 'strncasecmp', 'tolower' and 'isdigit' that ignore the current locale (#178)
Add custom implementations of 'strcasecmp', 'strncasecmp', 'tolower' and 'isdigit' that ignore the current locale
2021-11-05 02:16:30 +03:00
Yuri Kobets
bb04a50f93 Add a custom 'strtod' implementation that ignores the current locale. 2021-11-04 23:22:54 +03:00
Yuri Kobets
f00bc949f7 Revert "Add a custom 'strtod' implementation that ignores the current locale." 2021-11-04 16:54:12 +03:00
Yuri Kobets
d45cbbb558
Merge branch 'master' into g4mba5-patch-strtod 2021-11-04 16:44:19 +03:00
Yuri Kobets
1f36d26f30 Added document_container::split_text to use custom text splitting engines 2021-11-01 02:53:40 +03:00
Yuri Kobets
ac6bbc7d2a Added table caption support 2021-11-01 01:25:35 +03:00
g4mba5
0fea186f0e
'strtod' declaration 2021-10-30 21:56:41 +02:00
g4mba5
2164e69327
The custom 'strtod' will be implemented directly in 'litehtml' namespace 2021-10-30 21:55:46 +02:00
g4mba5
626f5a34a0
Make 't_strtod' points at its implementation in 'document.cpp' 2021-10-30 21:11:19 +02:00
Evgeniy A. Dushistov
971eadced8 fix "scaring" warnings
1. usage of virtual functions without destructor,
   not public not-virtual destructor + final convinced compiler that
   all ok
2. couple of unused variables and arguments (the most noisy one)
3. extra copy in cycle
4. std::move prevent copy elision warning
2021-10-28 13:56:59 +03:00
ericLemanissier
af9061a2c8
include cstdint int os_types
it is needed for uintptr_t
2021-10-27 14:02:23 +02:00
Mark Jan van Kampen
131f207e01
Adds ptrdiff_t include to tstring_view.h
On some platforms ptrdiff_t is included through other system headers, on
others not. By including cstddef the code should compile on all platforms
that comply with the standard.
2021-10-27 10:43:50 +02:00
Mark Jan van Kampen
bb01af1c36
Adds missing includes to utf8_strings.h 2021-10-27 06:49:11 +02:00
John Poole
463cfc2de1
Merge branch 'master' into url-class 2021-09-25 20:26:05 -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
Unknown
da53571a47 Added support for loading HTML into an existing element 2020-06-14 01:13:51 +01:00
Yuri Kobets
58e92d6dc6 Extended support for ordered lists.
Supported list-style-type: decimal, decimal-leading-zero, lower/upper-latin, lower/upper-alpha, lower/upper-roman, lower-greek
2020-05-10 02:55:34 +03:00
Alex Zhondin
259d96c2e1 added missing files 2020-05-09 13:44:24 +03:00
Alex Zhondin
948930ad35 support ordered lists 2020-05-09 13:44:24 +03:00
Eike Ziller
42ceb48b4b Fix build with MSVC 2019 and CMake
The WIN32 define is missing with MSVC 2019, use _WIN32
2019-10-28 14:10:50 +01:00
great90
c218b3153e delete repeated include
delete repeated include of "litehtml/stylesheet.h" and "litehtml/html_tag.h"
2019-10-12 09:52:15 +08:00
Yuri Kobets
72fcde2dd3 Fixed: image with max-height percent causes 0 height
Closes #93
2019-09-29 17:34:09 +03:00
Yuri Kobets
94996b27af Removed gumbo.h from document.h, moved VS project into top directory, compile fix in src/html_tag.cpp 2019-09-29 14:30:14 +03:00
Martin Miralles-Cordal
fa610010b3 Moved src headers into discrete folders and updated include paths. 2019-09-22 16:59:03 -04:00
NikitaFeodonit
3320aa4898 Fixes for compilation for many platforms.
Split gubmo and litehtml to different CMake projects with different
compile languages.
Move 'src/strings.h' to 'src/gumbo/visualc/include/strings.h'.
Remove '../src/' in '#include' directive in litehtml.h and
add target_include_directories() in CMake project.
Set C/C++ standard flags by set_target_properties() in CMake project.
Do not set build type and C/C++ compiler flags in library project.
2018-05-25 20:24:53 +03:00
NikitaFeodonit
5515b347a4 Replace '#pragme once' to '#ifndef' because of Eclipse code parser. 2018-05-25 18:21:58 +03:00
NikitaFeodonit
3104c078dc Convert line delimiters to Unix style. 2018-05-25 17:05:49 +03:00
Yuri Kobets
30409bd842 Rollback the pull request #13 - hardcoded styles are not very good.
The same effect can be achieved via master.css. When render html into the source with calculated
width/height (like tooltips) we can set width/height into "auto" to get valid width instead of the maximum width.
2015-06-06 04:45:57 +03:00
Yuri Kobets
81207e27b7 Fix for tag <br clear="all"> 2015-05-22 22:49:59 +03:00
Yuri Kobets
4da59f1a89 tokenize function is replaced to split_string.
some fixes in CSS parsing.
2014-10-21 00:10:16 +04:00
yuri.kobets@gmail.com
9dd887c109 Position of floating boxes is incorrect inside inline/float boxes
Relative positioning is fixed
2014-08-24 15:28:13 +00:00
yuri.kobets@gmail.com
909e17b1d7 * Added support for CSS selectors:
:first-of-type
:last-of-type
:only-of-type
:only-child
:nth-of-type(n)
:nth-last-of-type(n)
:not(selector)
:link
2014-01-21 19:40:39 +00:00
yuri.kobets@gmail.com
ce278122ce Improved tables rendering. Added border-collapse CSS property. 2014-01-06 04:50:25 +00:00
yuri.kobets@gmail.com
827af63f58 Fixed some layout rendering bugs to show web page https://mail.google.com/mail/ correctly.
Half handling of CSS pseudo-elements (started with ::) - currently just removed from processing.
Added document_container::create_element - here you can create own implementation for elements.
2013-09-17 11:28:09 +00:00
yuri.kobets@gmail.com
30fc0c1527 Calculating heights, margins and padding with percentages value are brought into compliance CSS standards.
Fixed the position calculating of absolute positioned elements.
2013-08-31 22:00:08 +00:00
yuri.kobets@gmail.com
b7ed5e573c some changes in master.css 2013-08-11 00:19:57 +00:00
yuri.kobets@gmail.com
c8ec750368 Reduced memory usage.
litehtml::element is now lightweight. litehtml::el_text is inherited from litehtml::element. The old code with pre-parsed styles implementation was moved into litehtml::html_tag class.
2013-08-09 21:22:07 +00:00
yuri.kobets@gmail.com
c04df5716d Improved font sizes. Added <font> tag and align property of <div> tag. 2013-07-14 23:42:00 +00:00
yuri.kobets@gmail.com
857f909fcd Fixed: Some links are not working because element::get_inline_boxes don't ignore the skipped elements.
Added the "nowrap" styles into <td> and <th> tags (see master.css).
2013-07-12 22:26:55 +00:00
yuri.kobets@gmail.com
cd77c14ea3 Added support for white-space CSS property. 2013-07-10 21:15:50 +00:00
yuri.kobets@gmail.com
cc4e5b02fa Added external projects for litebrowser. Some changes in the folder structure. 2013-06-11 23:42:02 +00:00
yuri.kobets@gmail.com
b8d0631334 * The litebrowser is switched to cairo engine (including fonts)
* Added handling the !important in CSS
2013-06-09 01:37:06 +00:00
yuri.kobets@gmail.com
5d213c98b0 1. Removed m_inlines array, now elements are rendered from m_children array.
2. Improved positions of the absolute elements: correct handling auto value for left, top, right, bottom
3. Calculating CSS selectors specificity and sorting selectors with by specificity.
2012-07-21 10:23:31 +00:00
yuri.kobets@gmail.com
900ac9dd95 2012-06-24 00:28:03 +00:00
yuri.kobets@gmail.com
b3b2dc7252 2012-06-17 23:40:01 +00:00
yuri.kobets@gmail.com
f44c6acd80 2012-05-27 21:02:20 +00:00
yuri.kobets@gmail.com
eca5cfca94 2012-05-19 19:34:59 +00:00
yuri.kobets@gmail.com
b5417526f2 2012-05-01 22:08:37 +00:00