diff options
Diffstat (limited to 'libs/litehtml/include')
35 files changed, 408 insertions, 183 deletions
diff --git a/libs/litehtml/include/litehtml.h b/libs/litehtml/include/litehtml.h index 2537aee839..5687703dff 100644 --- a/libs/litehtml/include/litehtml.h +++ b/libs/litehtml/include/litehtml.h @@ -7,5 +7,6 @@ #include <litehtml/stylesheet.h> #include <litehtml/element.h> #include <litehtml/utf8_strings.h> +#include <litehtml/document_container.h> #endif // LITEHTML_H diff --git a/libs/litehtml/include/litehtml/codepoint.h b/libs/litehtml/include/litehtml/codepoint.h index 52dd495559..3e06e86e00 100644 --- a/libs/litehtml/include/litehtml/codepoint.h +++ b/libs/litehtml/include/litehtml/codepoint.h @@ -30,10 +30,6 @@ #ifndef LITEHTML_CODEPOINT_H__ #define LITEHTML_CODEPOINT_H__ -#include <string> - -#include "os_types.h" - namespace litehtml { bool is_ascii_codepoint(char c); diff --git a/libs/litehtml/include/litehtml/css_parser.h b/libs/litehtml/include/litehtml/css_parser.h index cbd88e3b84..eb49099fb9 100644 --- a/libs/litehtml/include/litehtml/css_parser.h +++ b/libs/litehtml/include/litehtml/css_parser.h @@ -3,6 +3,7 @@ #include "css_tokenizer.h" #include "stylesheet.h" +#include <functional> namespace litehtml { diff --git a/libs/litehtml/include/litehtml/css_properties.h b/libs/litehtml/include/litehtml/css_properties.h index b7f8e7e784..a904b9cced 100644 --- a/libs/litehtml/include/litehtml/css_properties.h +++ b/libs/litehtml/include/litehtml/css_properties.h @@ -1,7 +1,7 @@ #ifndef LITEHTML_CSS_PROPERTIES_H #define LITEHTML_CSS_PROPERTIES_H -#include "os_types.h" +#include "string_id.h" #include "types.h" #include "css_margins.h" #include "borders.h" @@ -13,6 +13,19 @@ namespace litehtml class html_tag; class document; + template<class CssT, class CompT> + class css_property + { + public: + CssT css_value; + CompT computed_value; + + css_property(const CssT& css_val, const CompT& computed_val) : css_value(css_val), computed_value(computed_val) {} + }; + + // CSS Properties types + using css_line_height_t = css_property<css_length, int>; + class css_properties { private: @@ -22,6 +35,7 @@ namespace litehtml white_space m_white_space; style_display m_display; visibility m_visibility; + appearance m_appearance; box_sizing m_box_sizing; css_length m_z_index; vertical_align m_vertical_align; @@ -39,7 +53,7 @@ namespace litehtml css_offsets m_css_offsets; css_length m_css_text_indent; css_length m_css_line_height; - int m_line_height; + css_line_height_t m_line_height {{}, 0}; list_style_type m_list_style_type; list_style_position m_list_style_position; string m_list_style_image; @@ -50,7 +64,13 @@ namespace litehtml string m_font_family; css_length m_font_weight; font_style m_font_style; - string m_text_decoration; + int m_text_decoration_line = text_decoration_line_none; + text_decoration_style m_text_decoration_style = text_decoration_style_solid; + css_length m_text_decoration_thickness; + web_color m_text_decoration_color; + string m_text_emphasis_style; + web_color m_text_emphasis_color; + int m_text_emphasis_position; font_metrics m_font_metrics; text_transform m_text_transform; web_color m_color; @@ -88,6 +108,7 @@ namespace litehtml m_white_space(white_space_normal), m_display(display_inline), m_visibility(visibility_visible), + m_appearance(appearance_none), m_box_sizing(box_sizing_content_box), m_z_index(0), m_vertical_align(va_baseline), @@ -105,7 +126,6 @@ namespace litehtml m_css_offsets(), m_css_text_indent(), m_css_line_height(0), - m_line_height(0), m_list_style_type(list_style_type_none), m_list_style_position(list_style_position_outside), m_bg(), @@ -148,6 +168,9 @@ namespace litehtml visibility get_visibility() const; void set_visibility(visibility mVisibility); + appearance get_appearance() const; + void set_appearance(appearance mAppearance); + box_sizing get_box_sizing() const; void set_box_sizing(box_sizing mBoxSizing); @@ -196,8 +219,8 @@ namespace litehtml const css_length &get_text_indent() const; void set_text_indent(const css_length &mCssTextIndent); - int get_line_height() const; - void set_line_height(int mLineHeight); + const css_line_height_t& line_height() const; + css_line_height_t& line_height_w(); list_style_type get_list_style_type() const; void set_list_style_type(list_style_type mListStyleType); @@ -205,10 +228,10 @@ namespace litehtml list_style_position get_list_style_position() const; void set_list_style_position(list_style_position mListStylePosition); - string get_list_style_image() const; + const string& get_list_style_image() const; void set_list_style_image(const string& url); - string get_list_style_image_baseurl() const; + const string& get_list_style_image_baseurl() const; void set_list_style_image_baseurl(const string& url); const background &get_bg() const; @@ -229,10 +252,10 @@ namespace litehtml web_color get_color() const; void set_color(web_color color); - string get_cursor() const; + const string& get_cursor() const; void set_cursor(const string& cursor); - string get_content() const; + const string& get_content() const; void set_content(const string& content); border_collapse get_border_collapse() const; @@ -259,6 +282,15 @@ namespace litehtml int get_order() const; void set_order(int order); + + int get_text_decoration_line() const; + text_decoration_style get_text_decoration_style() const; + const css_length& get_text_decoration_thickness() const; + const web_color& get_text_decoration_color() const; + + string get_text_emphasis_style() const; + web_color get_text_emphasis_color() const; + int get_text_emphasis_position() const; }; inline element_position css_properties::get_position() const @@ -321,6 +353,16 @@ namespace litehtml m_visibility = mVisibility; } + inline appearance css_properties::get_appearance() const + { + return m_appearance; + } + + inline void css_properties::set_appearance(appearance mAppearance) + { + m_appearance = mAppearance; + } + inline box_sizing css_properties::get_box_sizing() const { return m_box_sizing; @@ -481,14 +523,14 @@ namespace litehtml m_css_text_indent = mCssTextIndent; } - inline int css_properties::get_line_height() const + inline const css_line_height_t& css_properties::line_height() const { return m_line_height; } - inline void css_properties::set_line_height(int mLineHeight) + inline css_line_height_t& css_properties::line_height_w() { - m_line_height = mLineHeight; + return m_line_height; } inline list_style_type css_properties::get_list_style_type() const @@ -511,10 +553,10 @@ namespace litehtml m_list_style_position = mListStylePosition; } - inline string css_properties::get_list_style_image() const { return m_list_style_image; } + inline const string& css_properties::get_list_style_image() const { return m_list_style_image; } inline void css_properties::set_list_style_image(const string& url) { m_list_style_image = url; } - inline string css_properties::get_list_style_image_baseurl() const { return m_list_style_image_baseurl; } + inline const string& css_properties::get_list_style_image_baseurl() const { return m_list_style_image_baseurl; } inline void css_properties::set_list_style_image_baseurl(const string& url) { m_list_style_image_baseurl = url; } inline const background &css_properties::get_bg() const @@ -570,10 +612,10 @@ namespace litehtml inline web_color css_properties::get_color() const { return m_color; } inline void css_properties::set_color(web_color color) { m_color = color; } - inline string css_properties::get_cursor() const { return m_cursor; } + inline const string& css_properties::get_cursor() const { return m_cursor; } inline void css_properties::set_cursor(const string& cursor) { m_cursor = cursor; } - inline string css_properties::get_content() const { return m_content; } + inline const string& css_properties::get_content() const { return m_content; } inline void css_properties::set_content(const string& content) { m_content = content; } inline border_collapse css_properties::get_border_collapse() const @@ -669,6 +711,41 @@ namespace litehtml { m_order = order; } + + inline int css_properties::get_text_decoration_line() const + { + return m_text_decoration_line; + } + + inline text_decoration_style css_properties::get_text_decoration_style() const + { + return m_text_decoration_style; + } + + inline const css_length& css_properties::get_text_decoration_thickness() const + { + return m_text_decoration_thickness; + } + + inline const web_color& css_properties::get_text_decoration_color() const + { + return m_text_decoration_color; + } + + inline string css_properties::get_text_emphasis_style() const + { + return m_text_emphasis_style; + } + + inline web_color css_properties::get_text_emphasis_color() const + { + return m_text_emphasis_color; + } + + inline int css_properties::get_text_emphasis_position() const + { + return m_text_emphasis_position; + } } #endif //LITEHTML_CSS_PROPERTIES_H diff --git a/libs/litehtml/include/litehtml/css_selector.h b/libs/litehtml/include/litehtml/css_selector.h index 042f1691e4..57aa2846b5 100644 --- a/libs/litehtml/include/litehtml/css_selector.h +++ b/libs/litehtml/include/litehtml/css_selector.h @@ -1,6 +1,7 @@ #ifndef LH_CSS_SELECTOR_H #define LH_CSS_SELECTOR_H +#include "string_id.h" #include "style.h" #include "media_query.h" #include "css_tokenizer.h" @@ -154,7 +155,7 @@ namespace litehtml string_id prefix; // [prefix|name] string_id name; // .name, #name, [name], :name string value; // [name=value], :lang(value) - + attr_matcher matcher; // <attr-matcher> = ~= |= ^= $= *= bool caseless_match; // value is matched ASCII case-insensitively diff --git a/libs/litehtml/include/litehtml/css_tokenizer.h b/libs/litehtml/include/litehtml/css_tokenizer.h index 119c925c79..f4a61af49c 100644 --- a/libs/litehtml/include/litehtml/css_tokenizer.h +++ b/libs/litehtml/include/litehtml/css_tokenizer.h @@ -1,6 +1,9 @@ #ifndef LH_CSS_TOKENIZER_H #define LH_CSS_TOKENIZER_H +#include "types.h" +#include <cstdio> + namespace litehtml { @@ -11,7 +14,7 @@ namespace litehtml enum css_token_type { WHITESPACE = ' ', - + // Giving EOF and some chars explicit names to facilitate debugging and to get rid of warning C4063: case '41' is not a valid value for switch of enum 'litehtml::css_token_type' _EOF = EOF, LEFT_BRACE = '{', @@ -26,7 +29,7 @@ enum css_token_type BANG = '!', DOT = '.', AMPERSAND = '&', - + IDENT = -20, // do not collide with any unicode chars FUNCTION, // calc( AT_KEYWORD, // @media @@ -62,12 +65,12 @@ enum css_hash_type }; // css_token: CSS token or component value ("fat" token) -// Tokens exist in uncomponentized form only a short time after tokenization, most of the time they are "fat". +// Tokens exist in uncomponentized form only a short time after tokenization, most of the time they are "fat". // All functions in css_parser work regardless of whether tokens are fat or not, as per standard. // All functions outside of css_parser that parse media queries, selectors, property values assume tokens are componentized. struct css_token { - css_token(css_token_type type = css_token_type(), + css_token(css_token_type type = css_token_type(), float number = 0, css_number_type number_type = css_number_integer, string str = "") : type(type), str(str), n{number, number_type} { @@ -87,13 +90,13 @@ struct css_token case HASH: hash_type = token.hash_type; break; - + case NUMBER: case PERCENTAGE: case DIMENSION: n = token.n; break; - + case CV_FUNCTION: case CURLY_BLOCK: case ROUND_BLOCK: @@ -104,17 +107,17 @@ struct css_token default:; } } - + css_token& operator=(const css_token& token) { this->~css_token(); new(this) css_token(token); return *this; } - + ~css_token() - { - str.~string(); + { + str.~string(); if (is_component_value()) value.~vector(); } @@ -132,7 +135,7 @@ struct css_token }; union { string str; // STRING, URL - string name; // HASH, IDENT, AT_KEYWORD, FUNCTION, CV_FUNCTION + string name; // HASH, IDENT, AT_KEYWORD, FUNCTION, CV_FUNCTION string unit; // DIMENSION }; struct number { @@ -144,7 +147,7 @@ struct css_token number n; vector<css_token> value; // CV_FUNCTION, XXX_BLOCK }; - + string repr; // https://www.w3.org/TR/css-syntax-3/#representation }; @@ -155,7 +158,7 @@ class css_tokenizer { public: css_tokenizer(const string& input) : str(input), index(0), current_char(0) {} - + css_token_vector tokenize(); private: @@ -188,7 +191,7 @@ private: void consume_comments(); int consume_escaped_code_point(); css_token consume_string_token(int ending_code_point); - + static bool would_start_ident_sequence(three_chars chars); string consume_ident_sequence(); diff --git a/libs/litehtml/include/litehtml/document.h b/libs/litehtml/include/litehtml/document.h index 7119636ffe..9be8465411 100644 --- a/libs/litehtml/include/litehtml/document.h +++ b/libs/litehtml/include/litehtml/document.h @@ -1,10 +1,12 @@ #ifndef LH_DOCUMENT_H #define LH_DOCUMENT_H -#include "style.h" +#include "stylesheet.h" #include "types.h" #include "master_css.h" #include "encodings.h" +#include "font_description.h" + typedef struct GumboInternalOutput GumboOutput; namespace litehtml @@ -16,7 +18,7 @@ namespace litehtml string text; string baseurl; string media; - + css_text() = default; css_text(const char* txt, const char* url, const char* media_str) @@ -50,6 +52,7 @@ namespace litehtml std::shared_ptr<element> m_root; std::shared_ptr<render_item> m_root_render; document_container* m_container; + fonts_map m_fonts; css_text::vector m_css; litehtml::css m_styles; litehtml::web_color m_def_color; @@ -58,7 +61,8 @@ namespace litehtml litehtml::size m_size; litehtml::size m_content_size; position::vector m_fixed_boxes; - element::ptr m_over_element; + std::shared_ptr<element> m_over_element; + std::shared_ptr<element> m_active_element; std::list<shared_ptr<render_item>> m_tabular_elements; media_query_list_list::vector m_media_lists; media_features m_media; @@ -72,7 +76,7 @@ namespace litehtml document_container* container() { return m_container; } document_mode mode() const { return m_mode; } - uint_ptr get_font(const char* name, int size, const char* weight, const char* style, const char* decoration, font_metrics* fm); + uint_ptr get_font(const font_description& descr, font_metrics* fm); int render(int max_width, render_type rt = render_all); void draw(uint_ptr hdc, int x, int y, const position* clip); web_color get_def_color() { return m_def_color; } @@ -86,9 +90,10 @@ namespace litehtml bool on_mouse_over(int x, int y, int client_x, int client_y, position::vector& redraw_boxes); bool on_lbutton_down(int x, int y, int client_x, int client_y, position::vector& redraw_boxes); bool on_lbutton_up(int x, int y, int client_x, int client_y, position::vector& redraw_boxes); + bool on_button_cancel(position::vector& redraw_boxes); bool on_mouse_leave(position::vector& redraw_boxes); - element::ptr create_element(const char* tag_name, const string_map& attributes); - element::ptr root(); + std::shared_ptr<element> create_element(const char* tag_name, const string_map& attributes); + std::shared_ptr<element> root(); std::shared_ptr<render_item> root_render(); void get_fixed_boxes(position::vector& fixed_boxes); void add_fixed_box(const position& pos); @@ -97,7 +102,7 @@ namespace litehtml bool lang_changed(); bool match_lang(const string& lang); void add_tabular(const std::shared_ptr<render_item>& el); - element::const_ptr get_over_element() const { return m_over_element; } + std::shared_ptr<const element> get_over_element() const { return m_over_element; } void append_children_from_string(element& parent, const char* str); void dump(dumper& cout); @@ -108,9 +113,9 @@ namespace litehtml document_container* container, const string& master_styles = litehtml::master_css, const string& user_styles = ""); - + private: - uint_ptr add_font(const char* name, int size, const char* weight, const char* style, const char* decoration, font_metrics* fm); + uint_ptr add_font(const font_description& descr, font_metrics* fm); GumboOutput* parse_html(estring str); void create_node(void* gnode, elements_list& elements, bool parseTextNode); @@ -120,7 +125,7 @@ namespace litehtml void fix_table_parent(const std::shared_ptr<render_item> & el_ptr, style_display disp, const char* disp_str); }; - inline element::ptr document::root() + inline std::shared_ptr<element> document::root() { return m_root; } diff --git a/libs/litehtml/include/litehtml/document_container.h b/libs/litehtml/include/litehtml/document_container.h index 95efe1eb6b..47cdc4b9d3 100644 --- a/libs/litehtml/include/litehtml/document_container.h +++ b/libs/litehtml/include/litehtml/document_container.h @@ -1,12 +1,12 @@ #ifndef LH_DOCUMENT_CONTAINER_H #define LH_DOCUMENT_CONTAINER_H -#include "os_types.h" #include "types.h" #include "web_color.h" #include "background.h" #include "borders.h" #include "element.h" +#include "font_description.h" #include <memory> #include <functional> @@ -22,7 +22,7 @@ namespace litehtml int index; uint_ptr font; }; - + enum mouse_event { mouse_event_enter, @@ -35,7 +35,7 @@ namespace litehtml public: fonts_map m_fonts; - virtual litehtml::uint_ptr create_font(const char* faceName, int size, int weight, litehtml::font_style italic, unsigned int decoration, litehtml::font_metrics* fm) = 0; + virtual litehtml::uint_ptr create_font(const font_description& descr, const document* doc, litehtml::font_metrics* fm) = 0; virtual void delete_font(litehtml::uint_ptr hFont) = 0; virtual int text_width(const char* text, litehtml::uint_ptr hFont) = 0; virtual void draw_text(litehtml::uint_ptr hdc, const char* text, litehtml::uint_ptr hFont, litehtml::web_color color, const litehtml::position& pos) = 0; @@ -56,13 +56,14 @@ namespace litehtml virtual void set_base_url(const char* base_url) = 0; virtual void link(const std::shared_ptr<litehtml::document>& doc, const litehtml::element::ptr& el) = 0; virtual void on_anchor_click(const char* url, const litehtml::element::ptr& el) = 0; + virtual bool on_element_click(const litehtml::element::ptr& /*el*/) { return false; }; virtual void on_mouse_event(const litehtml::element::ptr& el, litehtml::mouse_event event) = 0; virtual void set_cursor(const char* cursor) = 0; virtual void transform_text(litehtml::string& text, litehtml::text_transform tt) = 0; virtual void import_css(litehtml::string& text, const litehtml::string& url, litehtml::string& baseurl) = 0; virtual void set_clip(const litehtml::position& pos, const litehtml::border_radiuses& bdr_radius) = 0; virtual void del_clip() = 0; - virtual void get_client_rect(litehtml::position& client) const = 0; + virtual void get_viewport(litehtml::position& viewport) const = 0; virtual litehtml::element::ptr create_element( const char* tag_name, const litehtml::string_map& attributes, const std::shared_ptr<litehtml::document>& doc) = 0; diff --git a/libs/litehtml/include/litehtml/el_cdata.h b/libs/litehtml/include/litehtml/el_cdata.h index 838cd92b1e..3e9db43b88 100644 --- a/libs/litehtml/include/litehtml/el_cdata.h +++ b/libs/litehtml/include/litehtml/el_cdata.h @@ -1,7 +1,7 @@ #ifndef LH_EL_CDATA_H #define LH_EL_CDATA_H -#include "html_tag.h" +#include "element.h" namespace litehtml { diff --git a/libs/litehtml/include/litehtml/el_comment.h b/libs/litehtml/include/litehtml/el_comment.h index 379318ffbe..fa8e72fc91 100644 --- a/libs/litehtml/include/litehtml/el_comment.h +++ b/libs/litehtml/include/litehtml/el_comment.h @@ -1,7 +1,7 @@ #ifndef LH_EL_COMMENT_H #define LH_EL_COMMENT_H -#include "html_tag.h" +#include "element.h" namespace litehtml { diff --git a/libs/litehtml/include/litehtml/el_image.h b/libs/litehtml/include/litehtml/el_image.h index 2b73940815..b67de11941 100644 --- a/libs/litehtml/include/litehtml/el_image.h +++ b/libs/litehtml/include/litehtml/el_image.h @@ -2,6 +2,7 @@ #define LH_EL_IMAGE_H #include "html_tag.h" +#include "document.h" namespace litehtml { diff --git a/libs/litehtml/include/litehtml/el_script.h b/libs/litehtml/include/litehtml/el_script.h index e0a0374057..0353b15796 100644 --- a/libs/litehtml/include/litehtml/el_script.h +++ b/libs/litehtml/include/litehtml/el_script.h @@ -1,7 +1,7 @@ #ifndef LH_EL_SCRIPT_H #define LH_EL_SCRIPT_H -#include "html_tag.h" +#include "element.h" namespace litehtml { diff --git a/libs/litehtml/include/litehtml/el_space.h b/libs/litehtml/include/litehtml/el_space.h index 53c170f13a..6d447f7103 100644 --- a/libs/litehtml/include/litehtml/el_space.h +++ b/libs/litehtml/include/litehtml/el_space.h @@ -1,7 +1,6 @@ #ifndef LH_EL_SPACE_H #define LH_EL_SPACE_H -#include "html_tag.h" #include "el_text.h" namespace litehtml diff --git a/libs/litehtml/include/litehtml/el_style.h b/libs/litehtml/include/litehtml/el_style.h index 62f1546259..60c0b50c67 100644 --- a/libs/litehtml/include/litehtml/el_style.h +++ b/libs/litehtml/include/litehtml/el_style.h @@ -1,7 +1,7 @@ #ifndef LH_EL_STYLE_H #define LH_EL_STYLE_H -#include "html_tag.h" +#include "element.h" namespace litehtml { @@ -13,6 +13,7 @@ namespace litehtml void parse_attributes() override; bool appendChild(const ptr &el) override; + void compute_styles(bool recursive) override; string_id tag() const override; const char* get_tagName() const override; }; diff --git a/libs/litehtml/include/litehtml/el_text.h b/libs/litehtml/include/litehtml/el_text.h index ea54cc9c66..f3da930825 100644 --- a/libs/litehtml/include/litehtml/el_text.h +++ b/libs/litehtml/include/litehtml/el_text.h @@ -1,7 +1,8 @@ #ifndef LH_EL_TEXT_H #define LH_EL_TEXT_H -#include "html_tag.h" +#include "element.h" +#include "document.h" namespace litehtml { diff --git a/libs/litehtml/include/litehtml/element.h b/libs/litehtml/include/litehtml/element.h index 67dd1ae251..d18976c9f0 100644 --- a/libs/litehtml/include/litehtml/element.h +++ b/libs/litehtml/include/litehtml/element.h @@ -1,12 +1,12 @@ #ifndef LH_ELEMENT_H #define LH_ELEMENT_H +#include <functional> #include <memory> #include <tuple> #include <list> +#include "types.h" #include "stylesheet.h" -#include "css_offsets.h" -#include "css_margins.h" #include "css_properties.h" namespace litehtml @@ -94,7 +94,7 @@ namespace litehtml virtual bool on_mouse_over(); virtual bool on_mouse_leave(); virtual bool on_lbutton_down(); - virtual bool on_lbutton_up(); + virtual bool on_lbutton_up(bool is_click = true); virtual void on_click(); virtual bool set_pseudo_class(string_id cls, bool add); virtual bool set_class(const char* pclass, bool add); @@ -155,7 +155,9 @@ namespace litehtml inline bool litehtml::element::in_normal_flow() const { - if(css().get_position() != element_position_absolute && css().get_display() != display_none) + if(css().get_position() != element_position_absolute && + css().get_display() != display_none && + css().get_position() != element_position_fixed) { return true; } @@ -207,8 +209,7 @@ namespace litehtml if (css().get_display() == display_block || css().get_display() == display_flex || css().get_display() == display_table || - css().get_display() == display_list_item || - css().get_display() == display_flex) + css().get_display() == display_list_item) { return true; } diff --git a/libs/litehtml/include/litehtml/encodings.h b/libs/litehtml/include/litehtml/encodings.h index 2dd9d5e0f5..ec5cb03e83 100644 --- a/libs/litehtml/include/litehtml/encodings.h +++ b/libs/litehtml/include/litehtml/encodings.h @@ -1,6 +1,7 @@ #ifndef LH_ENCODINGS_H #define LH_ENCODINGS_H +#include "types.h" namespace litehtml { diff --git a/libs/litehtml/include/litehtml/flex_item.h b/libs/litehtml/include/litehtml/flex_item.h index 0c4244ae2d..4ad53ac11a 100644 --- a/libs/litehtml/include/litehtml/flex_item.h +++ b/libs/litehtml/include/litehtml/flex_item.h @@ -1,8 +1,8 @@ #ifndef LITEHTML_FLEX_ITEM_H #define LITEHTML_FLEX_ITEM_H -#include <functional> #include "formatting_context.h" +#include "render_item.h" namespace litehtml { diff --git a/libs/litehtml/include/litehtml/font_description.h b/libs/litehtml/include/litehtml/font_description.h new file mode 100644 index 0000000000..c4c3ee7224 --- /dev/null +++ b/libs/litehtml/include/litehtml/font_description.h @@ -0,0 +1,45 @@ +#ifndef LITEHTML_FONT_DESCRIPTION +#define LITEHTML_FONT_DESCRIPTION + +#include <string> +#include "types.h" +#include "css_length.h" +#include "web_color.h" + +namespace litehtml +{ + struct font_description + { + std::string family; // Font Family + int size = 0; // Font size + font_style style = font_style_normal; // Font stype, see the enum font_style + int weight; // Font weight. + int decoration_line = text_decoration_line_none; // Decoration line. A bitset of flags of the enum text_decoration_line + css_length decoration_thickness; // Decoration line thickness in pixels. See predefined values in enumtext_decoration_thickness + text_decoration_style decoration_style = text_decoration_style_solid; // Decoration line style. See enum text_decoration_style + web_color decoration_color = web_color::current_color; // Decoration line color + std::string emphasis_style; // Text emphasis style + web_color emphasis_color = web_color::current_color; // Text emphasis color + int emphasis_position = text_emphasis_position_over; // Text emphasis position + + std::string hash() const + { + std::string out; + out += family; + out += ":sz=" + std::to_string(size); + out += ":st=" + std::to_string(style); + out += ":w=" + std::to_string(weight); + out += ":dl=" + std::to_string(decoration_line); + out += ":dt=" + decoration_thickness.to_string(); + out += ":ds=" + std::to_string(decoration_style); + out += ":dc=" + decoration_color.to_string(); + out += ":ephs=" + emphasis_style; + out += ":ephc=" + emphasis_color.to_string(); + out += ":ephp=" + std::to_string(emphasis_position); + + return out; + } + }; +} + +#endif
\ No newline at end of file diff --git a/libs/litehtml/include/litehtml/gradient.h b/libs/litehtml/include/litehtml/gradient.h index 6313eb75b2..1bfe77cde0 100644 --- a/libs/litehtml/include/litehtml/gradient.h +++ b/libs/litehtml/include/litehtml/gradient.h @@ -1,6 +1,11 @@ #ifndef LITEHTML_GRADIENT_H #define LITEHTML_GRADIENT_H +#include "css_length.h" +#include "string_id.h" +#include "types.h" +#include "web_color.h" + namespace litehtml { enum gradient_side @@ -129,7 +134,7 @@ namespace litehtml explicit gradient(string_id type = empty_id) { m_type = type; - + // linear gradient: m_side default is gradient_side_none (use angle) // radial,conic gradient: m_side default is gradient_side_x_center | gradient_side_y_center (see parse_gradient) m_side = gradient_side_none; @@ -144,7 +149,7 @@ namespace litehtml // <radial-size> https://drafts.csswg.org/css-images-3/#valdef-radial-gradient-radial-size // if radius is specified radial_extent will be set to none, see parse_radial_size - radial_extent = radial_extent_farthest_corner; + radial_extent = radial_extent_farthest_corner; radial_radius_x.predef(0); radial_radius_y.predef(0); @@ -182,7 +187,7 @@ namespace litehtml gradient m_gradient; image() : type(type_none) {} - + bool is_empty() const { switch (type) diff --git a/libs/litehtml/include/litehtml/html.h b/libs/litehtml/include/litehtml/html.h index cd0500aabe..9b725d9a66 100644 --- a/libs/litehtml/include/litehtml/html.h +++ b/libs/litehtml/include/litehtml/html.h @@ -6,19 +6,8 @@ #include <cctype> #include <cstring> #include <algorithm> -#include <functional> -#include "os_types.h" #include "types.h" -#include "string_id.h" -#include "utf8_strings.h" -#include "background.h" -#include "borders.h" -#include "web_color.h" #include "media_query.h" -#include "html_microsyntaxes.h" -#include "html_tag.h" -#include "document_container.h" -#include "document.h" namespace litehtml { @@ -36,15 +25,10 @@ namespace litehtml double t_strtod(const char* string, char** endPtr = nullptr); string get_escaped_string(const string& in_str); - template<typename X, typename A> - bool is_one_of(X x, A a) + template<typename T, typename... Opts> + bool is_one_of(T val, Opts ...opts) { - return x == a; - } - template<typename X, typename A, typename... AA> - bool is_one_of(X x, A a, AA... aa) - { - return x == a || is_one_of(x, aa...); + return (... || (val == opts)); } template<class T> const T& at(const vector<T>& vec, int index /*may be negative*/) @@ -155,7 +139,7 @@ namespace litehtml return (c >= '0' && c <= '9'); } const auto is_digit = t_isdigit; - + inline bool is_hex_digit(int ch) { return is_digit(ch) || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'); } diff --git a/libs/litehtml/include/litehtml/html_microsyntaxes.h b/libs/litehtml/include/litehtml/html_microsyntaxes.h index 193dd20d62..04c7445ee5 100644 --- a/libs/litehtml/include/litehtml/html_microsyntaxes.h +++ b/libs/litehtml/include/litehtml/html_microsyntaxes.h @@ -1,20 +1,22 @@ #ifndef LH_HTML_MICROSYNTAXES_H #define LH_HTML_MICROSYNTAXES_H +#include "types.h" + namespace litehtml { -bool html_parse_integer(const string& str, int& val); -bool html_parse_non_negative_integer(const string& str, int& val); + bool html_parse_integer(const string& str, int& val); + bool html_parse_non_negative_integer(const string& str, int& val); -enum html_dimension_type -{ - html_length, - html_percentage -}; + enum html_dimension_type + { + html_length, + html_percentage + }; -bool html_parse_dimension_value(const string& str, float& val, html_dimension_type& type); -bool html_parse_nonzero_dimension_value(const string& str, float& val, html_dimension_type& type); + bool html_parse_dimension_value(const string& str, float& val, html_dimension_type& type); + bool html_parse_nonzero_dimension_value(const string& str, float& val, html_dimension_type& type); } // namespace litehtml diff --git a/libs/litehtml/include/litehtml/html_tag.h b/libs/litehtml/include/litehtml/html_tag.h index 63cd64498a..d8c9dfa40b 100644 --- a/libs/litehtml/include/litehtml/html_tag.h +++ b/libs/litehtml/include/litehtml/html_tag.h @@ -4,8 +4,6 @@ #include "element.h" #include "style.h" #include "background.h" -#include "css_margins.h" -#include "borders.h" #include "css_selector.h" #include "stylesheet.h" #include "line_box.h" @@ -61,7 +59,7 @@ namespace litehtml bool on_mouse_over() override; bool on_mouse_leave() override; bool on_lbutton_down() override; - bool on_lbutton_up() override; + bool on_lbutton_up(bool is_click) override; void on_click() override; bool set_pseudo_class(string_id cls, bool add) override; bool set_class(const char* pclass, bool add) override; diff --git a/libs/litehtml/include/litehtml/iterators.h b/libs/litehtml/include/litehtml/iterators.h index b1a678d7b4..b7e1887c16 100644 --- a/libs/litehtml/include/litehtml/iterators.h +++ b/libs/litehtml/include/litehtml/iterators.h @@ -2,7 +2,6 @@ #define LH_ITERATORS_H #include "types.h" -#include <list> #include <functional> namespace litehtml @@ -45,7 +44,7 @@ namespace litehtml ~elements_iterator() = default; void process(const std::shared_ptr<render_item>& container, const std::function<void (std::shared_ptr<render_item>&, iterator_item_type)>& func); - + private: void next_idx(); }; diff --git a/libs/litehtml/include/litehtml/line_box.h b/libs/litehtml/include/litehtml/line_box.h index 6e945c9fdc..eac00d13d3 100644 --- a/libs/litehtml/include/litehtml/line_box.h +++ b/libs/litehtml/include/litehtml/line_box.h @@ -1,9 +1,8 @@ #ifndef LH_LINE_BOX_H #define LH_LINE_BOX_H -#include <vector> #include <memory> -#include "os_types.h" +#include "css_properties.h" #include "types.h" namespace litehtml @@ -40,15 +39,16 @@ namespace litehtml }; protected: std::shared_ptr<render_item> m_element; - int m_rendered_min_width; + int m_rendered_min_width = 0; + int m_items_top = 0; + int m_items_bottom = 0; public: - explicit line_box_item(const std::shared_ptr<render_item>& element) : m_element(element), m_rendered_min_width(0) {} - line_box_item() : m_element(), m_rendered_min_width(0) {}; + explicit line_box_item(const std::shared_ptr<render_item>& element) : m_element(element) {} line_box_item(const line_box_item& el) = default; line_box_item(line_box_item&&) = default; virtual ~line_box_item(); - int height() const { return right() - left(); } + virtual int height() const; const std::shared_ptr<render_item>& get_el() const { return m_element; } virtual position& pos(); virtual void place_to(int x, int y); @@ -60,6 +60,15 @@ namespace litehtml virtual element_type get_type() const { return type_text_part; } virtual int get_rendered_min_width() const { return m_rendered_min_width; } virtual void set_rendered_min_width(int min_width) { m_rendered_min_width = min_width; } + + void reset_items_height() { m_items_top = m_items_bottom = 0; } + void add_item_height(int item_top, int item_bottom) + { + m_items_top = std::min(m_items_top, item_top); + m_items_bottom = std::max(m_items_bottom, item_bottom); + } + int get_items_top() const { return m_items_top; } + int get_items_bottom() const { return m_items_bottom; } }; class lbi_start : public line_box_item @@ -68,9 +77,10 @@ namespace litehtml position m_pos; public: explicit lbi_start(const std::shared_ptr<render_item>& element); - virtual ~lbi_start() override; + ~lbi_start() override; void place_to(int x, int y) override; + int height() const override; int width() const override; position& pos() override { return m_pos; } int top() const override; @@ -110,10 +120,10 @@ namespace litehtml { struct va_context { - int baseline; + int line_height = 0; + int baseline = 0; font_metrics fm; - - va_context() : baseline(0) {} + line_box_item* start_lbi = nullptr; }; int m_top; @@ -121,21 +131,19 @@ namespace litehtml int m_right; int m_height; int m_width; - int m_line_height; - int m_default_line_height; + css_line_height_t m_default_line_height; font_metrics m_font_metrics; int m_baseline; text_align m_text_align; int m_min_width; std::list< std::unique_ptr<line_box_item> > m_items; public: - line_box(int top, int left, int right, int line_height, const font_metrics& fm, text_align align) : + line_box(int top, int left, int right, const css_line_height_t& line_height, const font_metrics& fm, text_align align) : m_top(top), m_left(left), m_right(right), m_height(0), m_width(0), - m_line_height(0), m_default_line_height(line_height), m_font_metrics(fm), m_baseline(0), diff --git a/libs/litehtml/include/litehtml/media_query.h b/libs/litehtml/include/litehtml/media_query.h index 94ed205e52..163191a512 100644 --- a/libs/litehtml/include/litehtml/media_query.h +++ b/libs/litehtml/include/litehtml/media_query.h @@ -1,6 +1,10 @@ #ifndef LH_MEDIA_QUERY_H #define LH_MEDIA_QUERY_H +#include "css_tokenizer.h" +#include "string_id.h" +#include "types.h" + namespace litehtml { // https://drafts.csswg.org/mediaqueries/#evaluating @@ -53,7 +57,7 @@ namespace litehtml { string_id op = _and_; // _not_ _and_ _or_ vector<media_in_parens> m_conditions; - + trilean check(const media_features& features) const; }; @@ -68,7 +72,7 @@ namespace litehtml short op2 = 0; bool verify_and_convert_units(string_id syntax, css_token val[2] = 0, css_token val2[2] = 0, shared_ptr<document> doc = 0); - + bool compare(int x) const { return compare((float)x); } bool compare(float x) const; bool check(const media_features& features) const; @@ -92,7 +96,7 @@ namespace litehtml media_query_list parse_media_query_list(const css_token_vector& tokens, shared_ptr<document> doc); media_query_list parse_media_query_list(const string& str, shared_ptr<document> doc); - + class media_query_list_list { public: diff --git a/libs/litehtml/include/litehtml/render_item.h b/libs/litehtml/include/litehtml/render_item.h index d67fc42624..fedc1f3887 100644 --- a/libs/litehtml/include/litehtml/render_item.h +++ b/libs/litehtml/include/litehtml/render_item.h @@ -2,13 +2,14 @@ #define LH_RENDER_ITEM_H #include <memory> -#include <utility> #include <list> #include <tuple> +#include "html.h" #include "types.h" #include "line_box.h" #include "table.h" #include "formatting_context.h" +#include "element.h" namespace litehtml { @@ -348,7 +349,8 @@ namespace litehtml m_element->css().get_float() == float_none && m_margins.top >= 0 && !is_flex_item() && - !is_root(); + !is_root() && + !is_one_of(css().get_overflow(), overflow_hidden, overflow_scroll, overflow_auto); } bool collapse_bottom_margin() const @@ -358,7 +360,8 @@ namespace litehtml m_element->in_normal_flow() && m_element->css().get_float() == float_none && m_margins.bottom >= 0 && - !is_root(); + !is_root() && + !is_one_of(css().get_overflow(), overflow_hidden, overflow_scroll, overflow_auto); } bool is_visible() const diff --git a/libs/litehtml/include/litehtml/string_id.h b/libs/litehtml/include/litehtml/string_id.h index a488b32792..6373ec9e4d 100644 --- a/libs/litehtml/include/litehtml/string_id.h +++ b/libs/litehtml/include/litehtml/string_id.h @@ -1,6 +1,8 @@ #ifndef LH_STRING_ID_H #define LH_STRING_ID_H +#include <string> + namespace litehtml { @@ -252,6 +254,14 @@ STRING_ID( _font_size_, _line_height_, _text_decoration_, + _text_decoration_style_, + _text_decoration_line_, + _text_decoration_color_, + _text_decoration_thickness_, + _text_emphasis_, + _text_emphasis_style_, + _text_emphasis_color_, + _text_emphasis_position_, _white_space_, _text_align_, @@ -267,6 +277,7 @@ STRING_ID( _overflow_, _display_, _visibility_, + _appearance_, _box_sizing_, _z_index_, _float_, @@ -346,8 +357,8 @@ STRING_ID( extern const string_id empty_id; // _id("") extern const string_id star_id; // _id("*") -string_id _id(const string& str); -const string& _s(string_id id); +string_id _id(const std::string& str); +const std::string& _s(string_id id); } // namespace litehtml diff --git a/libs/litehtml/include/litehtml/style.h b/libs/litehtml/include/litehtml/style.h index 256fd8f3ca..e68a05b725 100644 --- a/libs/litehtml/include/litehtml/style.h +++ b/libs/litehtml/include/litehtml/style.h @@ -1,7 +1,12 @@ #ifndef LH_STYLE_H #define LH_STYLE_H +#include "background.h" +#include "css_length.h" +#include "css_position.h" #include "css_tokenizer.h" +#include "gradient.h" +#include "web_color.h" namespace litehtml { @@ -28,7 +33,7 @@ namespace litehtml bool m_has_var = false; // css_token_vector, parsing is delayed because of var() property_value() {} - template<class T> property_value(const T& val, bool important, bool has_var = false) + template<class T> property_value(const T& val, bool important, bool has_var = false) : base(val), m_important(important), m_has_var(has_var) {} }; @@ -73,26 +78,33 @@ namespace litehtml void parse_keyword_comma_list(string_id name, const css_token_vector& tokens, bool important); void parse_background_position(const css_token_vector& tokens, bool important); void parse_background_size(const css_token_vector& tokens, bool important); - + void parse_border(const css_token_vector& tokens, bool important, document_container* container); void parse_border_side(string_id name, const css_token_vector& tokens, bool important, document_container* container); void parse_border_radius(const css_token_vector& tokens, bool important); - + bool parse_list_style_image(const css_token& tok, string& url); void parse_list_style(const css_token_vector& tokens, string baseurl, bool important); void parse_font(css_token_vector tokens, bool important); - + void parse_text_decoration(const css_token_vector& tokens, bool important, document_container* container); + bool parse_text_decoration_color(const css_token& token, bool important, document_container* container); + void parse_text_decoration_line(const css_token_vector& tokens, bool important); + + void parse_text_emphasis(const css_token_vector& tokens, bool important, document_container* container); + bool parse_text_emphasis_color(const css_token& token, bool important, document_container* container); + void parse_text_emphasis_position(const css_token_vector& tokens, bool important); + void parse_flex_flow(const css_token_vector& tokens, bool important); void parse_flex(const css_token_vector& tokens, bool important); void parse_align_self(string_id name, const css_token_vector& tokens, bool important); - + void add_parsed_property(string_id name, const property_value& propval); void add_length_property(string_id name, css_token val, string keywords, int options, bool important); template<class T> void add_four_properties(string_id top_name, T val[4], int n, bool important); void remove_property(string_id name, bool important); }; - + bool parse_url(const css_token& token, string& url); bool parse_length(const css_token& tok, css_length& length, int options, string keywords = ""); bool parse_angle(const css_token& tok, float& angle, bool percents_allowed = false); diff --git a/libs/litehtml/include/litehtml/stylesheet.h b/libs/litehtml/include/litehtml/stylesheet.h index 179f2de69b..f81bac7121 100644 --- a/libs/litehtml/include/litehtml/stylesheet.h +++ b/libs/litehtml/include/litehtml/stylesheet.h @@ -1,7 +1,6 @@ #ifndef LH_STYLESHEET_H #define LH_STYLESHEET_H -#include "style.h" #include "css_selector.h" #include "css_tokenizer.h" @@ -28,7 +27,7 @@ public: using vector = std::vector<ptr>; enum rule_type { qualified, at }; - + raw_rule(rule_type type, string name = "") : type(type), name(name) {} rule_type type; diff --git a/libs/litehtml/include/litehtml/tstring_view.h b/libs/litehtml/include/litehtml/tstring_view.h index 74bf5d3241..9c3c74f5fe 100644 --- a/libs/litehtml/include/litehtml/tstring_view.h +++ b/libs/litehtml/include/litehtml/tstring_view.h @@ -33,8 +33,6 @@ #include <cstddef> #include <ostream> -#include "types.h" - namespace litehtml { // tstring_view is a string reference type that provides a view into a string diff --git a/libs/litehtml/include/litehtml/types.h b/libs/litehtml/include/litehtml/types.h index c92998cd43..43cafc3bff 100644 --- a/libs/litehtml/include/litehtml/types.h +++ b/libs/litehtml/include/litehtml/types.h @@ -7,7 +7,6 @@ #include <vector> #include <map> #include <list> -#include <set> #include <variant> #include <optional> #include <algorithm> @@ -50,10 +49,46 @@ namespace litehtml limited_quirks_mode }; - const unsigned int font_decoration_none = 0x00; - const unsigned int font_decoration_underline = 0x01; - const unsigned int font_decoration_linethrough = 0x02; - const unsigned int font_decoration_overline = 0x04; + #define style_text_decoration_line_strings "none;underline;overline;line-through" + + enum text_decoration_line + { + text_decoration_line_none = 0x00, + text_decoration_line_underline = 0x01, + text_decoration_line_overline = 0x02, + text_decoration_line_line_through = 0x04, + }; + + #define style_text_decoration_style_strings "solid;double;dotted;dashed;wavy" + + enum text_decoration_style + { + text_decoration_style_solid, + text_decoration_style_double, + text_decoration_style_dotted, + text_decoration_style_dashed, + text_decoration_style_wavy, + text_decoration_style_max, + }; + + #define style_text_decoration_thickness_strings "auto;from-font" + + enum text_decoration_thickness + { + text_decoration_thickness_auto, + text_decoration_thickness_from_font, + }; + + #define style_text_emphasis_position_strings "over;under;left;right" + + enum text_emphasis_position + { + text_emphasis_position_over = 0x00, + text_emphasis_position_under = 0x01, + text_emphasis_position_left = 0x02, + text_emphasis_position_right = 0x04, + }; + using byte = unsigned char; using ucode_t = unsigned int; @@ -103,23 +138,19 @@ namespace litehtml { using vector = std::vector<position>; - int x; - int y; - int width; - int height; + int x = 0; + int y = 0; + int width = 0; + int height = 0; - position() - { - x = y = width = height = 0; - } + position() = default; - position(int x, int y, int width, int height) - { - this->x = x; - this->y = y; - this->width = width; - this->height = height; - } + position(int _x, int _y, int _width, int _height) : + x(_x), + y(_y), + width(_width), + height(_height) + {} int right() const { return x + width; } int bottom() const { return y + height; } @@ -152,12 +183,18 @@ namespace litehtml height = sz.height; } + bool operator==(const position& val) + { + return x == val.x && y == val.y && width == val.width && height == val.height; + } + void move_to(int _x, int _y) { x = _x; y = _y; } + [[nodiscard]] bool does_intersect(const position* val) const { if(!val) return true; @@ -174,45 +211,56 @@ namespace litehtml val->top() <= bottom() ); } - bool empty() const + [[nodiscard]] + position intersect(const position& src) const { - if(!width && !height) + position dest; + int dest_x = std::max(src.x, x); + int dest_y = std::max(src.y, y); + int dest_x2 = std::min(src.right(), right()); + int dest_y2 = std::min(src.bottom(), bottom()); + + if (dest_x2 > dest_x && dest_y2 > dest_y) { - return true; + dest.x = dest_x; + dest.y = dest_y; + dest.width = dest_x2 - dest_x; + dest.height = dest_y2 - dest_y; } - return false; + else + { + dest.width = 0; + dest.height = 0; + } + + return dest; } + [[nodiscard]] + bool empty() const + { + return !width && !height; + } + + [[nodiscard]] bool is_point_inside(int _x, int _y) const { - if(_x >= left() && _x < right() && _y >= top() && _y < bottom()) - { - return true; - } - return false; + return (_x >= left() && _x < right() && _y >= top() && _y < bottom()); } }; struct font_metrics { - int font_size; - int height; - int ascent; - int descent; - int x_height; - int ch_width; - bool draw_spaces; - - font_metrics() - { - font_size = 0; - height = 0; - ascent = 0; - descent = 0; - x_height = 0; - ch_width = 0; - draw_spaces = true; - } + int font_size = 0; // Font size in pixels. The same as size argument of the create_font function + int height = 0; // Font height in pixels. + int ascent = 0; // The distance from the baseline to the top of a line of text. + int descent = 0; // The distance from the baseline to the bottom of a line of text. + int x_height = 0; // Height of the symbol x + int ch_width = 0; // Height of the symbol 0 + bool draw_spaces = true; // True to call draw text function for spaces. If False, just use space width without draw. + int sub_shift = 0; // The baseline shift for subscripts. + int super_shift = 0; // The baseline shift for superscripts. + int base_line() const { return descent; } }; @@ -830,6 +878,27 @@ namespace litehtml _baseline_type m_type; }; +#define appearance_strings "none;auto;menulist-button;textfield;button;checkbox;listbox;menulist;meter;progress-bar;push-button;radio;searchfield;slider-horizontal;square-button;textarea" + + enum appearance + { + appearance_none, + appearance_auto, + appearance_menulist_button, + appearance_textfield, + appearance_button, + appearance_checkbox, + appearance_listbox, + appearance_menulist, + appearance_meter, + appearance_progress_bar, + appearance_push_button, + appearance_radio, + appearance_searchfield, + appearance_slider_horizontal, + appearance_square_button, + appearance_textarea, + }; #define box_sizing_strings "content-box;border-box" diff --git a/libs/litehtml/include/litehtml/url.h b/libs/litehtml/include/litehtml/url.h index 83f98a752e..fae3db0a01 100644 --- a/libs/litehtml/include/litehtml/url.h +++ b/libs/litehtml/include/litehtml/url.h @@ -30,8 +30,6 @@ #ifndef LITEHTML_URL_H__ #define LITEHTML_URL_H__ -#include <ostream> - #include "types.h" // https://datatracker.ietf.org/doc/html/rfc3986 diff --git a/libs/litehtml/include/litehtml/url_path.h b/libs/litehtml/include/litehtml/url_path.h index 6ba68b03b8..f936659186 100644 --- a/libs/litehtml/include/litehtml/url_path.h +++ b/libs/litehtml/include/litehtml/url_path.h @@ -30,8 +30,6 @@ #ifndef LITEHTML_URL_PATH_H__ #define LITEHTML_URL_PATH_H__ -#include <ostream> - #include "types.h" namespace litehtml { diff --git a/libs/litehtml/include/litehtml/web_color.h b/libs/litehtml/include/litehtml/web_color.h index 9bc198dbcd..ba59ae66db 100644 --- a/libs/litehtml/include/litehtml/web_color.h +++ b/libs/litehtml/include/litehtml/web_color.h @@ -1,6 +1,9 @@ #ifndef LH_WEB_COLOR_H #define LH_WEB_COLOR_H +#include "css_tokenizer.h" +#include "types.h" + namespace litehtml { class document_container; |