Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1274232

Browse filesBrowse files
committed
Includes refactoring using clangd
1 parent 2a89d5e commit 1274232
Copy full SHA for 1274232

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

82 files changed

+297
-252
lines changed

‎.clang-format

Copy file name to clipboard
+53Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,60 @@
11
# Options are listed here:
22
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
33
---
4+
Language: Cpp
5+
BasedOnStyle: Microsoft
46
Standard: c++17
57
TabWidth: 4
68
UseTab: Always
79
IndentWidth: 4
10+
PointerAlignment: Left
11+
SpaceAfterCStyleCast: true
12+
SpaceBeforeParens: false
13+
BraceWrapping:
14+
AfterCaseLabel: false
15+
AfterClass: true
16+
AfterControlStatement: Always
17+
AfterEnum: true
18+
AfterFunction: true
19+
AfterNamespace: true
20+
AfterObjCDeclaration: true
21+
AfterStruct: true
22+
AfterUnion: false
23+
AfterExternBlock: true
24+
BeforeCatch: true
25+
BeforeElse: false
26+
BeforeLambdaBody: false
27+
BeforeWhile: false
28+
IndentBraces: false
29+
SplitEmptyFunction: true
30+
SplitEmptyRecord: true
31+
SplitEmptyNamespace: true
32+
NamespaceIndentation: All
33+
AlignConsecutiveDeclarations:
34+
Enabled: true
35+
AcrossEmptyLines: true
36+
AcrossComments: false
37+
AlignConsecutiveAssignments:
38+
Enabled: true
39+
AcrossEmptyLines: true
40+
AcrossComments: true
41+
AlignCompound: true
42+
AlignFunctionPointers: true
43+
PadOperators: true
44+
AlignConsecutiveMacros:
45+
Enabled: true
46+
AcrossEmptyLines: true
47+
AcrossComments: true
48+
AlignCompound: true
49+
AlignFunctionPointers: true
50+
PadOperators: true
51+
SortIncludes: false
52+
IndentCaseBlocks: true
53+
InsertNewlineAtEOF: true
54+
BreakConstructorInitializers: AfterColon
55+
PackConstructorInitializers: Never
56+
AllowShortLambdasOnASingleLine: true
57+
AllowShortIfStatementsOnASingleLine: WithoutElse
58+
AllowShortFunctionsOnASingleLine: Inline
59+
AlignArrayOfStructures: Left
60+
AllowShortBlocksOnASingleLine: true

‎containers/cairo/cairo_borders.h

Copy file name to clipboardExpand all lines: containers/cairo/cairo_borders.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef LITEHTML_CAIRO_BORDERS_H
22
#define LITEHTML_CAIRO_BORDERS_H
33

4+
#include <litehtml.h>
45
#include <cairo.h>
56

67
namespace cairo

‎containers/cairo/container_cairo.h

Copy file name to clipboardExpand all lines: containers/cairo/container_cairo.h
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#ifndef LH_CONTAINER_LINUX_H
22
#define LH_CONTAINER_LINUX_H
33

4-
#include "../../include/litehtml.h"
4+
#include <litehtml.h>
55
#include <cairo.h>
6+
#include <vector>
67

78
struct cairo_clip_box
89
{

‎include/litehtml.h

Copy file name to clipboardExpand all lines: include/litehtml.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
#include <litehtml/stylesheet.h>
88
#include <litehtml/element.h>
99
#include <litehtml/utf8_strings.h>
10+
#include <litehtml/document_container.h>
1011

1112
#endif // LITEHTML_H

‎include/litehtml/codepoint.h

Copy file name to clipboardExpand all lines: include/litehtml/codepoint.h
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
#ifndef LITEHTML_CODEPOINT_H__
3131
#define LITEHTML_CODEPOINT_H__
3232

33-
#include <string>
34-
35-
#include "os_types.h"
36-
3733
namespace litehtml {
3834

3935
bool is_ascii_codepoint(char c);

‎include/litehtml/css_parser.h

Copy file name to clipboardExpand all lines: include/litehtml/css_parser.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "css_tokenizer.h"
55
#include "stylesheet.h"
6+
#include <functional>
67

78
namespace litehtml
89
{

‎include/litehtml/css_properties.h

Copy file name to clipboardExpand all lines: include/litehtml/css_properties.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef LITEHTML_CSS_PROPERTIES_H
22
#define LITEHTML_CSS_PROPERTIES_H
33

4-
#include "os_types.h"
4+
#include "string_id.h"
55
#include "types.h"
66
#include "css_margins.h"
77
#include "borders.h"

‎include/litehtml/css_selector.h

Copy file name to clipboardExpand all lines: include/litehtml/css_selector.h
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef LH_CSS_SELECTOR_H
22
#define LH_CSS_SELECTOR_H
33

4+
#include "string_id.h"
45
#include "style.h"
56
#include "media_query.h"
67
#include "css_tokenizer.h"
@@ -154,7 +155,7 @@ namespace litehtml
154155
string_id prefix; // [prefix|name]
155156
string_id name; // .name, #name, [name], :name
156157
string value; // [name=value], :lang(value)
157-
158+
158159
attr_matcher matcher; // <attr-matcher> = ~= |= ^= $= *=
159160
bool caseless_match; // value is matched ASCII case-insensitively
160161

‎include/litehtml/css_tokenizer.h

Copy file name to clipboardExpand all lines: include/litehtml/css_tokenizer.h
+17-14Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#ifndef LH_CSS_TOKENIZER_H
22
#define LH_CSS_TOKENIZER_H
33

4+
#include "types.h"
5+
#include <cstdio>
6+
47
namespace litehtml
58
{
69

@@ -11,7 +14,7 @@ namespace litehtml
1114
enum css_token_type
1215
{
1316
WHITESPACE = ' ',
14-
17+
1518
// 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'
1619
_EOF = EOF,
1720
LEFT_BRACE = '{',
@@ -26,7 +29,7 @@ enum css_token_type
2629
BANG = '!',
2730
DOT = '.',
2831
AMPERSAND = '&',
29-
32+
3033
IDENT = -20, // do not collide with any unicode chars
3134
FUNCTION, // calc(
3235
AT_KEYWORD, // @media
@@ -62,12 +65,12 @@ enum css_hash_type
6265
};
6366

6467
// css_token: CSS token or component value ("fat" token)
65-
// Tokens exist in uncomponentized form only a short time after tokenization, most of the time they are "fat".
68+
// Tokens exist in uncomponentized form only a short time after tokenization, most of the time they are "fat".
6669
// All functions in css_parser work regardless of whether tokens are fat or not, as per standard.
6770
// All functions outside of css_parser that parse media queries, selectors, property values assume tokens are componentized.
6871
struct css_token
6972
{
70-
css_token(css_token_type type = css_token_type(),
73+
css_token(css_token_type type = css_token_type(),
7174
float number = 0, css_number_type number_type = css_number_integer, string str = "")
7275
: type(type), str(str), n{number, number_type}
7376
{
@@ -87,13 +90,13 @@ struct css_token
8790
case HASH:
8891
hash_type = token.hash_type;
8992
break;
90-
93+
9194
case NUMBER:
9295
case PERCENTAGE:
9396
case DIMENSION:
9497
n = token.n;
9598
break;
96-
99+
97100
case CV_FUNCTION:
98101
case CURLY_BLOCK:
99102
case ROUND_BLOCK:
@@ -104,17 +107,17 @@ struct css_token
104107
default:;
105108
}
106109
}
107-
110+
108111
css_token& operator=(const css_token& token)
109112
{
110113
this->~css_token();
111114
new(this) css_token(token);
112115
return *this;
113116
}
114-
117+
115118
~css_token()
116-
{
117-
str.~string();
119+
{
120+
str.~string();
118121
if (is_component_value()) value.~vector();
119122
}
120123

@@ -132,7 +135,7 @@ struct css_token
132135
};
133136
union {
134137
string str; // STRING, URL
135-
string name; // HASH, IDENT, AT_KEYWORD, FUNCTION, CV_FUNCTION
138+
string name; // HASH, IDENT, AT_KEYWORD, FUNCTION, CV_FUNCTION
136139
string unit; // DIMENSION
137140
};
138141
struct number {
@@ -144,7 +147,7 @@ struct css_token
144147
number n;
145148
vector<css_token> value; // CV_FUNCTION, XXX_BLOCK
146149
};
147-
150+
148151
string repr; // https://www.w3.org/TR/css-syntax-3/#representation
149152
};
150153

@@ -155,7 +158,7 @@ class css_tokenizer
155158
{
156159
public:
157160
css_tokenizer(const string& input) : str(input), index(0), current_char(0) {}
158-
161+
159162
css_token_vector tokenize();
160163

161164
private:
@@ -188,7 +191,7 @@ class css_tokenizer
188191
void consume_comments();
189192
int consume_escaped_code_point();
190193
css_token consume_string_token(int ending_code_point);
191-
194+
192195
static bool would_start_ident_sequence(three_chars chars);
193196
string consume_ident_sequence();
194197

‎include/litehtml/document.h

Copy file name to clipboardExpand all lines: include/litehtml/document.h
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef LH_DOCUMENT_H
22
#define LH_DOCUMENT_H
33

4-
#include "style.h"
4+
#include "stylesheet.h"
55
#include "types.h"
66
#include "master_css.h"
77
#include "encodings.h"
@@ -61,8 +61,8 @@ namespace litehtml
6161
litehtml::size m_size;
6262
litehtml::size m_content_size;
6363
position::vector m_fixed_boxes;
64-
element::ptr m_over_element;
65-
element::ptr m_active_element;
64+
std::shared_ptr<element> m_over_element;
65+
std::shared_ptr<element> m_active_element;
6666
std::list<shared_ptr<render_item>> m_tabular_elements;
6767
media_query_list_list::vector m_media_lists;
6868
media_features m_media;
@@ -92,8 +92,8 @@ namespace litehtml
9292
bool on_lbutton_up(int x, int y, int client_x, int client_y, position::vector& redraw_boxes);
9393
bool on_button_cancel(position::vector& redraw_boxes);
9494
bool on_mouse_leave(position::vector& redraw_boxes);
95-
element::ptr create_element(const char* tag_name, const string_map& attributes);
96-
element::ptr root();
95+
std::shared_ptr<element> create_element(const char* tag_name, const string_map& attributes);
96+
std::shared_ptr<element> root();
9797
std::shared_ptr<render_item> root_render();
9898
void get_fixed_boxes(position::vector& fixed_boxes);
9999
void add_fixed_box(const position& pos);
@@ -102,7 +102,7 @@ namespace litehtml
102102
bool lang_changed();
103103
bool match_lang(const string& lang);
104104
void add_tabular(const std::shared_ptr<render_item>& el);
105-
element::const_ptr get_over_element() const { return m_over_element; }
105+
std::shared_ptr<const element> get_over_element() const { return m_over_element; }
106106

107107
void append_children_from_string(element& parent, const char* str);
108108
void dump(dumper& cout);
@@ -125,7 +125,7 @@ namespace litehtml
125125
void fix_table_parent(const std::shared_ptr<render_item> & el_ptr, style_display disp, const char* disp_str);
126126
};
127127

128-
inline element::ptr document::root()
128+
inline std::shared_ptr<element> document::root()
129129
{
130130
return m_root;
131131
}

‎include/litehtml/document_container.h

Copy file name to clipboardExpand all lines: include/litehtml/document_container.h
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef LH_DOCUMENT_CONTAINER_H
22
#define LH_DOCUMENT_CONTAINER_H
33

4-
#include "os_types.h"
54
#include "types.h"
65
#include "web_color.h"
76
#include "background.h"

‎include/litehtml/el_cdata.h

Copy file name to clipboardExpand all lines: include/litehtml/el_cdata.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef LH_EL_CDATA_H
22
#define LH_EL_CDATA_H
33

4-
#include "html_tag.h"
4+
#include "element.h"
55

66
namespace litehtml
77
{

‎include/litehtml/el_comment.h

Copy file name to clipboardExpand all lines: include/litehtml/el_comment.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef LH_EL_COMMENT_H
22
#define LH_EL_COMMENT_H
33

4-
#include "html_tag.h"
4+
#include "element.h"
55

66
namespace litehtml
77
{

‎include/litehtml/el_image.h

Copy file name to clipboardExpand all lines: include/litehtml/el_image.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define LH_EL_IMAGE_H
33

44
#include "html_tag.h"
5+
#include "document.h"
56

67
namespace litehtml
78
{

‎include/litehtml/el_script.h

Copy file name to clipboardExpand all lines: include/litehtml/el_script.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef LH_EL_SCRIPT_H
22
#define LH_EL_SCRIPT_H
33

4-
#include "html_tag.h"
4+
#include "element.h"
55

66
namespace litehtml
77
{

‎include/litehtml/el_space.h

Copy file name to clipboardExpand all lines: include/litehtml/el_space.h
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef LH_EL_SPACE_H
22
#define LH_EL_SPACE_H
33

4-
#include "html_tag.h"
54
#include "el_text.h"
65

76
namespace litehtml

‎include/litehtml/el_style.h

Copy file name to clipboardExpand all lines: include/litehtml/el_style.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef LH_EL_STYLE_H
22
#define LH_EL_STYLE_H
33

4-
#include "html_tag.h"
4+
#include "element.h"
55

66
namespace litehtml
77
{

‎include/litehtml/el_text.h

Copy file name to clipboardExpand all lines: include/litehtml/el_text.h
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#ifndef LH_EL_TEXT_H
22
#define LH_EL_TEXT_H
33

4-
#include "html_tag.h"
4+
#include "element.h"
5+
#include "document.h"
56

67
namespace litehtml
78
{

‎include/litehtml/element.h

Copy file name to clipboardExpand all lines: include/litehtml/element.h
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#ifndef LH_ELEMENT_H
22
#define LH_ELEMENT_H
33

4+
#include <functional>
45
#include <memory>
56
#include <tuple>
67
#include <list>
78
#include "stylesheet.h"
8-
#include "css_offsets.h"
9-
#include "css_margins.h"
109
#include "css_properties.h"
1110

1211
namespace litehtml

‎include/litehtml/encodings.h

Copy file name to clipboardExpand all lines: include/litehtml/encodings.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef LH_ENCODINGS_H
22
#define LH_ENCODINGS_H
33

4+
#include "types.h"
45
namespace litehtml
56
{
67

‎include/litehtml/flex_item.h

Copy file name to clipboardExpand all lines: include/litehtml/flex_item.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#ifndef LITEHTML_FLEX_ITEM_H
22
#define LITEHTML_FLEX_ITEM_H
33

4-
#include <functional>
54
#include "formatting_context.h"
5+
#include "render_item.h"
66

77
namespace litehtml
88
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.