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 5948c22

Browse filesBrowse files
author
Matthew Allen
committed
Merge remote-tracking branch 'refs/remotes/origin/master'
2 parents 43b3f98 + 09cf93a commit 5948c22
Copy full SHA for 5948c22

File tree

Expand file treeCollapse file tree

11 files changed

+501
-86
lines changed
Filter options
Expand file treeCollapse file tree

11 files changed

+501
-86
lines changed

‎CMakeLists.txt

Copy file name to clipboardExpand all lines: CMakeLists.txt
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ set(HEADER_LITEHTML
146146
)
147147

148148
set(TEST_LITEHTML
149+
test/encodings_test.cpp
149150
test/cssTest.cpp
150151
test/mediaQueryTest.cpp
151152
test/codepoint_test.cpp

‎containers/test/Bitmap.cpp

Copy file name to clipboardExpand all lines: containers/test/Bitmap.cpp
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ void Bitmap::draw_line(int x0, int y0, int x1, int y1, web_color color)
3636
}
3737
}
3838

39-
void Bitmap::draw_rect(int x, int y, int width, int height, web_color color)
39+
void Bitmap::draw_rect(int x, int y, int _width, int _height, web_color color)
4040
{
41-
draw_line(x, y, x + width, y, color); // top
42-
draw_line(x, y + height - 1, x + width, y + height - 1, color); // bottom
43-
draw_line(x, y, x, y + height, color); // left
44-
draw_line(x + width - 1, y, x + width - 1, y + height, color); // right
41+
draw_line(x, y, x + _width, y, color); // top
42+
draw_line(x, y + _height - 1, x + _width, y + _height - 1, color); // bottom
43+
draw_line(x, y, x, y + _height, color); // left
44+
draw_line(x + _width - 1, y, x + _width - 1, y + _height, color); // right
4545
}
4646

4747
void Bitmap::fill_rect(position rect, web_color color)

‎doc/document_createFromString.txt

Copy file name to clipboardExpand all lines: doc/document_createFromString.txt
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,11 @@ by current user locale or smth else. Any such encoding should be passed with con
5454
The precedence of these guesses is specified in the encoding sniffing algorithm, see litehtml::encoding_sniffing_algorithm
5555
and https://html.spec.whatwg.org/multipage/parsing.html#encoding-sniffing-algorithm
5656

57-
litehtml implements only the first and the last step of this algorithm:
58-
it sets encoding to BOM encoding if BOM is present and it tentatively sets encoding to UTF-8 if encoding is unknown.
57+
litehtml implements only the 3 steps of this algorithm:
58+
1. set encoding to BOM encoding if BOM is present
59+
5. prescan the input to determine its encoding - this only called if no BOM found and user didn't specify encoding or specified tentative encoding
60+
9. return an implementation-defined default character encoding (UTF-8) - this only called if there is no BOM, user didn't specify an encoding and
61+
prescan failed.
5962

6063
If your program is displaying html files from the web it is recommended to detect HTTP encoding, because
6164
it is not very unusual for web pages to have encoding specified only in HTTP header or meta encoding be different

‎include/litehtml/html.h

Copy file name to clipboardExpand all lines: include/litehtml/html.h
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace litehtml
4040
bool is_number(const string& string, const bool allow_dot = 1);
4141

4242
// https://infra.spec.whatwg.org/#ascii-whitespace
43-
inline bool is_whitespace(char c)
43+
inline bool is_whitespace(int c)
4444
{
4545
return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f';
4646
}
@@ -59,7 +59,12 @@ namespace litehtml
5959
{
6060
return (c >= 'A' && c <= 'Z' ? c + 'a' - 'A' : c);
6161
}
62-
62+
// https://infra.spec.whatwg.org/#ascii-lowercase
63+
inline int lowcase(int c)
64+
{
65+
return t_tolower(c);
66+
}
67+
6368
inline int round_f(float val)
6469
{
6570
int int_val = (int) val;

‎include/litehtml/types.h

Copy file name to clipboardExpand all lines: include/litehtml/types.h
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ namespace litehtml
108108
height = sz.height;
109109
}
110110

111-
void move_to(int x, int y)
111+
void move_to(int _x, int _y)
112112
{
113-
this->x = x;
114-
this->y = y;
113+
x = _x;
114+
y = _y;
115115
}
116116

117117
bool does_intersect(const position* val) const
@@ -139,9 +139,9 @@ namespace litehtml
139139
return false;
140140
}
141141

142-
bool is_point_inside(int x, int y) const
142+
bool is_point_inside(int _x, int _y) const
143143
{
144-
if(x >= left() && x <= right() && y >= top() && y <= bottom())
144+
if(_x >= left() && _x <= right() && _y >= top() && _y <= bottom())
145145
{
146146
return true;
147147
}

‎src/document_container.cpp

Copy file name to clipboardExpand all lines: src/document_container.cpp
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void litehtml::document_container::split_text(const char* text, const std::funct
1616
on_word(wchar_to_utf8(str.c_str()));
1717
str.clear();
1818
}
19-
str += c;
19+
str += (wchar_t)c;
2020
on_space(wchar_to_utf8(str.c_str()));
2121
str.clear();
2222
}
@@ -28,13 +28,13 @@ void litehtml::document_container::split_text(const char* text, const std::funct
2828
on_word(wchar_to_utf8(str.c_str()));
2929
str.clear();
3030
}
31-
str += c;
31+
str += (wchar_t)c;
3232
on_word(wchar_to_utf8(str.c_str()));
3333
str.clear();
3434
}
3535
else
3636
{
37-
str += c;
37+
str += (wchar_t)c;
3838
}
3939
}
4040
if (!str.empty())

0 commit comments

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