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.
Move css property parsing from css_properties::parse (which is called from html_tag::parse_styles for every tree node)
to style::add_property (which is called during stylesheet parsing).
document::createFromString: 1287 ms -> 1048 ms on Obama wiki
apply_stylesheet: 1050 ms
I've changed _s to return const string& instead of string not because of performance, but because of this code in get_tagName:
return _s(m_tag).c_str();
I've kept m_str_classes too for convenience.
apply_stylesheet: 1300 ms -> 1200 ms
I don't understand why the gain is so small. This commit replaces string comparisons with int comparisons on a very hot path.
this also speeds up apply_stylesheet: 1710 ms -> 1550 ms on Obama wiki
About 2/3 of the speedup is because parent() is not called every time. I don't know where the rest of the speedup comes from.
* 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
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>
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
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.