diff --git a/libs/litehtml b/libs/litehtml
index a4074dd..396678b 160000
--- a/libs/litehtml
+++ b/libs/litehtml
@@ -1 +1 @@
-Subproject commit a4074dddab6e16d14a5933f49c37d335c03c64cb
+Subproject commit 396678b7a820ceae23207433380dda9004dc061e
diff --git a/litebrowser.sln b/litebrowser.sln
index 27f96b2..8799e28 100644
--- a/litebrowser.sln
+++ b/litebrowser.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
-VisualStudioVersion = 12.0.31101.0
+VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "litebrowser", "src\litebrowser.vcxproj", "{54AB6A6E-4B83-4B33-965F-DB8455C8C292}"
ProjectSection(ProjectDependencies) = postProject
@@ -102,7 +102,4 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
- GlobalSection(Performance) = preSolution
- HasPerformanceSessions = true
- EndGlobalSection
EndGlobal
diff --git a/src/HtmlViewWnd.cpp b/src/HtmlViewWnd.cpp
index 215ffd0..5e28dcf 100644
--- a/src/HtmlViewWnd.cpp
+++ b/src/HtmlViewWnd.cpp
@@ -576,23 +576,8 @@ void CHTMLViewWnd::OnMouseMove( int x, int y )
web_page* page = get_page();
if(page)
{
- litehtml::position::vector redraw_boxes;
- if(page->m_doc->on_mouse_over(x + m_left, y + m_top, x, y, redraw_boxes))
- {
- for(litehtml::position::vector::iterator box = redraw_boxes.begin(); box != redraw_boxes.end(); box++)
- {
- box->x -= m_left;
- box->y -= m_top;
- RECT rcRedraw;
- rcRedraw.left = box->left();
- rcRedraw.right = box->right();
- rcRedraw.top = box->top();
- rcRedraw.bottom = box->bottom();
- redraw(&rcRedraw, FALSE);
- }
- UpdateWindow(m_hWnd);
- update_cursor();
- }
+ page->m_doc->on_mouse_over(x + m_left, y + m_top, x, y);
+ update_cursor();
page->release();
}
}
@@ -603,23 +588,7 @@ void CHTMLViewWnd::OnMouseLeave()
if(page)
{
- litehtml::position::vector redraw_boxes;
- if(page->m_doc->on_mouse_leave(redraw_boxes))
- {
- for(litehtml::position::vector::iterator box = redraw_boxes.begin(); box != redraw_boxes.end(); box++)
- {
- box->x -= m_left;
- box->y -= m_top;
- RECT rcRedraw;
- rcRedraw.left = box->left();
- rcRedraw.right = box->right();
- rcRedraw.top = box->top();
- rcRedraw.bottom = box->bottom();
- redraw(&rcRedraw, FALSE);
- }
- UpdateWindow(m_hWnd);
- }
-
+ page->m_doc->on_mouse_leave();
page->release();
}
}
@@ -630,23 +599,7 @@ void CHTMLViewWnd::OnLButtonDown( int x, int y )
if(page)
{
- litehtml::position::vector redraw_boxes;
- if(page->m_doc->on_lbutton_down(x + m_left, y + m_top, x, y, redraw_boxes))
- {
- for(litehtml::position::vector::iterator box = redraw_boxes.begin(); box != redraw_boxes.end(); box++)
- {
- box->x -= m_left;
- box->y -= m_top;
- RECT rcRedraw;
- rcRedraw.left = box->left();
- rcRedraw.right = box->right();
- rcRedraw.top = box->top();
- rcRedraw.bottom = box->bottom();
- redraw(&rcRedraw, FALSE);
- }
- UpdateWindow(m_hWnd);
- }
-
+ page->m_doc->on_lbutton_down(x + m_left, y + m_top, x, y);
page->release();
}
}
@@ -657,23 +610,7 @@ void CHTMLViewWnd::OnLButtonUp( int x, int y )
if(page)
{
- litehtml::position::vector redraw_boxes;
- if(page->m_doc->on_lbutton_up(x + m_left, y + m_top, x, y, redraw_boxes))
- {
- for(litehtml::position::vector::iterator box = redraw_boxes.begin(); box != redraw_boxes.end(); box++)
- {
- box->x -= m_left;
- box->y -= m_top;
- RECT rcRedraw;
- rcRedraw.left = box->left();
- rcRedraw.right = box->right();
- rcRedraw.top = box->top();
- rcRedraw.bottom = box->bottom();
- redraw(&rcRedraw, FALSE);
- }
- UpdateWindow(m_hWnd);
- }
-
+ page->m_doc->on_lbutton_up(x + m_left, y + m_top, x, y);
page->release();
}
}
@@ -871,7 +808,21 @@ void CHTMLViewWnd::update_history()
}
}
-void CHTMLViewWnd::create_dib( int width, int height )
+void CHTMLViewWnd::redraw_boxes(const litehtml::position::vector& boxes)
+{
+ for (auto box : boxes)
+ {
+ RECT rcRedraw;
+ rcRedraw.left = box.left() - m_left;
+ rcRedraw.right = box.right() - m_left;
+ rcRedraw.top = box.top() - m_top;
+ rcRedraw.bottom = box.bottom() - m_top;
+ redraw(&rcRedraw, FALSE);
+ }
+ UpdateWindow(m_hWnd);
+}
+
+void CHTMLViewWnd::create_dib(int width, int height)
{
if(m_dib.width() < width || m_dib.height() < height)
{
diff --git a/src/HtmlViewWnd.h b/src/HtmlViewWnd.h
index 2ff9981..15d5294 100644
--- a/src/HtmlViewWnd.h
+++ b/src/HtmlViewWnd.h
@@ -47,6 +47,7 @@ class CHTMLViewWnd
void get_client_rect(litehtml::position& client) const;
void show_hash(std::wstring& hash);
void update_history();
+ void redraw_boxes(const litehtml::position::vector& boxes);
protected:
virtual void OnCreate();
diff --git a/src/ToolbarWnd.cpp b/src/ToolbarWnd.cpp
index b2b7b44..078db96 100644
--- a/src/ToolbarWnd.cpp
+++ b/src/ToolbarWnd.cpp
@@ -335,11 +335,6 @@ void CToolbarWnd::set_base_url( const litehtml::tchar_t* base_url )
}
-void CToolbarWnd::link(std::shared_ptr& doc, litehtml::element::ptr el)
-{
-
-}
-
int CToolbarWnd::set_width( int width )
{
if(m_doc)
@@ -370,20 +365,7 @@ void CToolbarWnd::OnMouseMove(int x, int y)
}
if (!m_inCapture)
{
- litehtml::position::vector redraw_boxes;
- if (m_doc->on_mouse_over(x, y, x, y, redraw_boxes))
- {
- for (litehtml::position::vector::iterator box = redraw_boxes.begin(); box != redraw_boxes.end(); box++)
- {
- RECT rcRedraw;
- rcRedraw.left = box->left();
- rcRedraw.right = box->right();
- rcRedraw.top = box->top();
- rcRedraw.bottom = box->bottom();
- InvalidateRect(m_hWnd, &rcRedraw, TRUE);
- }
- UpdateWindow(m_hWnd);
- }
+ m_doc->on_mouse_over(x, y, x, y);
}
}
update_cursor();
@@ -393,20 +375,7 @@ void CToolbarWnd::OnMouseLeave()
{
if(m_doc)
{
- litehtml::position::vector redraw_boxes;
- if(m_doc->on_mouse_leave(redraw_boxes))
- {
- for(litehtml::position::vector::iterator box = redraw_boxes.begin(); box != redraw_boxes.end(); box++)
- {
- RECT rcRedraw;
- rcRedraw.left = box->left();
- rcRedraw.right = box->right();
- rcRedraw.top = box->top();
- rcRedraw.bottom = box->bottom();
- InvalidateRect(m_hWnd, &rcRedraw, TRUE);
- }
- UpdateWindow(m_hWnd);
- }
+ m_doc->on_mouse_leave();
}
}
@@ -427,20 +396,7 @@ void CToolbarWnd::OnLButtonDown(int x, int y)
}
if (process && !m_inCapture)
{
- litehtml::position::vector redraw_boxes;
- if (m_doc->on_lbutton_down(x, y, x, y, redraw_boxes))
- {
- for (litehtml::position::vector::iterator box = redraw_boxes.begin(); box != redraw_boxes.end(); box++)
- {
- RECT rcRedraw;
- rcRedraw.left = box->left();
- rcRedraw.right = box->right();
- rcRedraw.top = box->top();
- rcRedraw.bottom = box->bottom();
- InvalidateRect(m_hWnd, &rcRedraw, TRUE);
- }
- UpdateWindow(m_hWnd);
- }
+ m_doc->on_lbutton_down(x, y, x, y);
}
}
}
@@ -457,19 +413,7 @@ void CToolbarWnd::OnLButtonUp( int x, int y )
if (process && !m_inCapture)
{
litehtml::position::vector redraw_boxes;
- if (m_doc->on_lbutton_up(x, y, x, y, redraw_boxes))
- {
- for (litehtml::position::vector::iterator box = redraw_boxes.begin(); box != redraw_boxes.end(); box++)
- {
- RECT rcRedraw;
- rcRedraw.left = box->left();
- rcRedraw.right = box->right();
- rcRedraw.top = box->top();
- rcRedraw.bottom = box->bottom();
- InvalidateRect(m_hWnd, &rcRedraw, TRUE);
- }
- UpdateWindow(m_hWnd);
- }
+ m_doc->on_lbutton_up(x, y, x, y);
}
}
}
@@ -591,6 +535,20 @@ std::shared_ptr CToolbarWnd::create_element(const litehtml::t
return 0;
}
+void CToolbarWnd::redraw(const litehtml::position::vector& redraw_boxes)
+{
+ for (auto box : redraw_boxes)
+ {
+ RECT rcRedraw;
+ rcRedraw.left = box.left();
+ rcRedraw.right = box.right();
+ rcRedraw.top = box.top();
+ rcRedraw.bottom = box.bottom();
+ InvalidateRect(m_hWnd, &rcRedraw, TRUE);
+ }
+ UpdateWindow(m_hWnd);
+}
+
void CToolbarWnd::import_css(litehtml::tstring& text, const litehtml::tstring& url, litehtml::tstring& baseurl)
{
diff --git a/src/ToolbarWnd.h b/src/ToolbarWnd.h
index b3edb14..9dff294 100644
--- a/src/ToolbarWnd.h
+++ b/src/ToolbarWnd.h
@@ -39,13 +39,13 @@ class CToolbarWnd : public cairo_container
virtual cairo_container::image_ptr get_image(LPCWSTR url, bool redraw_on_ready);
// litehtml::document_container members
- virtual void set_caption(const litehtml::tchar_t* caption);
- virtual void set_base_url(const litehtml::tchar_t* base_url);
- virtual void link(std::shared_ptr& doc, litehtml::element::ptr el);
- virtual void import_css(litehtml::tstring& text, const litehtml::tstring& url, litehtml::tstring& baseurl);
- virtual void on_anchor_click(const litehtml::tchar_t* url, const litehtml::element::ptr& el);
- virtual void set_cursor(const litehtml::tchar_t* cursor);
- virtual std::shared_ptr create_element(const litehtml::tchar_t* tag_name, const litehtml::string_map& attributes, const std::shared_ptr& doc);
+ virtual void set_caption(const litehtml::tchar_t* caption) override;
+ virtual void set_base_url(const litehtml::tchar_t* base_url) override;
+ virtual void import_css(litehtml::tstring& text, const litehtml::tstring& url, litehtml::tstring& baseurl) override;
+ virtual void on_anchor_click(const litehtml::tchar_t* url, const litehtml::element::ptr& el) override;
+ virtual void set_cursor(const litehtml::tchar_t* cursor) override;
+ virtual std::shared_ptr create_element(const litehtml::tchar_t* tag_name, const litehtml::string_map& attributes, const std::shared_ptr& doc) override;
+ virtual void redraw(const litehtml::position::vector& redraw_boxes) override;
protected:
virtual void OnCreate();
diff --git a/src/litebrowser.vcxproj b/src/litebrowser.vcxproj
index c6c66fb..6296b6d 100644
--- a/src/litebrowser.vcxproj
+++ b/src/litebrowser.vcxproj
@@ -186,7 +186,7 @@
/MP %(AdditionalOptions)
Disabled
../libs/litehtml/include;../libs/cairo/src;../libs/txdib;../libs/simpledib;%(AdditionalIncludeDirectories)
- WIN32;_DEBUG;_WINDOWS;_NO_TOOLBAR;%(PreprocessorDefinitions)
+ WIN32;_DEBUG;_WINDOWS;NO_TOOLBAR;%(PreprocessorDefinitions)
false
EnableFastChecks
MultiThreadedDebug
diff --git a/src/web_page.cpp b/src/web_page.cpp
index 5f8f571..9466379 100644
--- a/src/web_page.cpp
+++ b/src/web_page.cpp
@@ -191,6 +191,11 @@ void web_page::set_cursor( const litehtml::tchar_t* cursor )
#endif
}
+void web_page::redraw(const litehtml::position::vector& redraw_boxes)
+{
+ m_parent->redraw_boxes(redraw_boxes);
+}
+
cairo_container::image_ptr web_page::get_image(LPCWSTR url, bool redraw_on_ready)
{
cairo_container::image_ptr img;
diff --git a/src/web_page.h b/src/web_page.h
index b472efe..3fe70e7 100644
--- a/src/web_page.h
+++ b/src/web_page.h
@@ -34,15 +34,16 @@ class web_page : public cairo_container
void get_url(std::wstring& url);
// litehtml::document_container members
- virtual void set_caption(const litehtml::tchar_t* caption);
- virtual void set_base_url(const litehtml::tchar_t* base_url);
- virtual void import_css(litehtml::tstring& text, const litehtml::tstring& url, litehtml::tstring& baseurl);
- virtual void on_anchor_click(const litehtml::tchar_t* url, const litehtml::element::ptr& el);
- virtual void set_cursor(const litehtml::tchar_t* cursor);
+ virtual void set_caption(const litehtml::tchar_t* caption) override;
+ virtual void set_base_url(const litehtml::tchar_t* base_url) override;
+ virtual void import_css(litehtml::tstring& text, const litehtml::tstring& url, litehtml::tstring& baseurl) override;
+ virtual void on_anchor_click(const litehtml::tchar_t* url, const litehtml::element::ptr& el) override;
+ virtual void set_cursor(const litehtml::tchar_t* cursor) override;
+ virtual void redraw(const litehtml::position::vector& redraw_boxes) override;
- virtual void make_url(LPCWSTR url, LPCWSTR basepath, std::wstring& out);
- virtual cairo_container::image_ptr get_image(LPCWSTR url, bool redraw_on_ready);
- virtual void get_client_rect(litehtml::position& client) const;
+ virtual void make_url(LPCWSTR url, LPCWSTR basepath, std::wstring& out) override;
+ virtual cairo_container::image_ptr get_image(LPCWSTR url, bool redraw_on_ready) override;
+ virtual void get_client_rect(litehtml::position& client) const override;
private:
LPWSTR load_text_file( LPCWSTR path, bool is_html, LPCWSTR defEncoding = L"UTF-8");
unsigned char* load_utf8_file( LPCWSTR path, bool is_html, LPCWSTR defEncoding = L"UTF-8");