File tree Expand file tree Collapse file tree 5 files changed +9
-15
lines changed Expand file tree Collapse file tree 5 files changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ namespace litehtml
55
55
virtual void set_base_url (const char * base_url) = 0;
56
56
virtual void link (const std::shared_ptr<litehtml::document>& doc, const litehtml::element::ptr& el) = 0;
57
57
virtual void on_anchor_click (const char * url, const litehtml::element::ptr& el) = 0;
58
- virtual void on_image_click (const char * /* src */ , const litehtml::element::ptr& /* el*/ ) {};
58
+ virtual bool on_element_click (const litehtml::element::ptr& /* el*/ ) { return false ; };
59
59
virtual void on_mouse_event (const litehtml::element::ptr& el, litehtml::mouse_event event) = 0;
60
60
virtual void set_cursor (const char * cursor) = 0;
61
61
virtual void transform_text (litehtml::string& text, litehtml::text_transform tt) = 0;
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ namespace litehtml
12
12
public:
13
13
el_image (const document::ptr& doc);
14
14
15
- void on_click () override ;
16
15
bool is_replaced () const override ;
17
16
void parse_attributes () override ;
18
17
void compute_styles (bool recursive = true ) override ;
Original file line number Diff line number Diff line change @@ -767,6 +767,7 @@ bool document::on_button_cancel(position::vector& redraw_boxes) {
767
767
{
768
768
return false ;
769
769
}
770
+ m_active_element = nullptr ;
770
771
if (m_over_element)
771
772
{
772
773
if (m_over_element->on_mouse_leave ())
Original file line number Diff line number Diff line change @@ -82,13 +82,4 @@ std::shared_ptr<litehtml::render_item> litehtml::el_image::create_render_item(co
82
82
auto ret = std::make_shared<render_item_image>(shared_from_this ());
83
83
ret->parent (parent_ri);
84
84
return ret;
85
- }
86
-
87
- void litehtml::el_image::on_click () {
88
- const char * src = get_attr (" src" );
89
-
90
- if (src)
91
- {
92
- get_document ()->container ()->on_image_click (src, shared_from_this ());
93
- }
94
- }
85
+ }
Original file line number Diff line number Diff line change @@ -839,10 +839,13 @@ void litehtml::html_tag::on_click()
839
839
{
840
840
if (!is_root ())
841
841
{
842
- element::ptr el_parent = parent ();
843
- if (el_parent)
842
+ if (!get_document ()->container ()->on_element_click (shared_from_this ()))
844
843
{
845
- el_parent->on_click ();
844
+ element::ptr el_parent = parent ();
845
+ if (el_parent)
846
+ {
847
+ el_parent->on_click ();
848
+ }
846
849
}
847
850
}
848
851
}
You can’t perform that action at this time.
0 commit comments