mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:07:35 +00:00
LibWeb: Add Paintable::dom_node() convenience accessor
This commit is contained in:
parent
b64b5fa8bd
commit
f7cfd47b48
2 changed files with 9 additions and 6 deletions
|
@ -182,7 +182,7 @@ bool EventHandler::handle_mouseup(const Gfx::IntPoint& position, unsigned button
|
||||||
if (paintable) {
|
if (paintable) {
|
||||||
RefPtr<DOM::Node> node = paintable->mouse_event_target();
|
RefPtr<DOM::Node> node = paintable->mouse_event_target();
|
||||||
if (!node)
|
if (!node)
|
||||||
node = paintable->layout_node().dom_node();
|
node = paintable->dom_node();
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
if (is<HTML::HTMLIFrameElement>(*node)) {
|
if (is<HTML::HTMLIFrameElement>(*node)) {
|
||||||
|
@ -235,7 +235,7 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt
|
||||||
|
|
||||||
node = paintable->mouse_event_target();
|
node = paintable->mouse_event_target();
|
||||||
if (!node)
|
if (!node)
|
||||||
node = paintable->layout_node().dom_node();
|
node = paintable->dom_node();
|
||||||
document->set_hovered_node(node);
|
document->set_hovered_node(node);
|
||||||
|
|
||||||
if (paintable->wants_mouse_events()) {
|
if (paintable->wants_mouse_events()) {
|
||||||
|
@ -357,7 +357,7 @@ bool EventHandler::handle_mousemove(const Gfx::IntPoint& position, unsigned butt
|
||||||
const HTML::HTMLAnchorElement* hovered_link_element = nullptr;
|
const HTML::HTMLAnchorElement* hovered_link_element = nullptr;
|
||||||
if (paintable) {
|
if (paintable) {
|
||||||
if (paintable->wants_mouse_events()) {
|
if (paintable->wants_mouse_events()) {
|
||||||
document.set_hovered_node(paintable->layout_node().dom_node());
|
document.set_hovered_node(paintable->dom_node());
|
||||||
if (paintable->handle_mousemove({}, position, buttons, modifiers) == Painting::Paintable::DispatchEventOfSameName::No)
|
if (paintable->handle_mousemove({}, position, buttons, modifiers) == Painting::Paintable::DispatchEventOfSameName::No)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ bool EventHandler::handle_mousemove(const Gfx::IntPoint& position, unsigned butt
|
||||||
|
|
||||||
RefPtr<DOM::Node> node = paintable->mouse_event_target();
|
RefPtr<DOM::Node> node = paintable->mouse_event_target();
|
||||||
if (!node)
|
if (!node)
|
||||||
node = paintable->layout_node().dom_node();
|
node = paintable->dom_node();
|
||||||
|
|
||||||
if (node && is<HTML::HTMLIFrameElement>(*node)) {
|
if (node && is<HTML::HTMLIFrameElement>(*node)) {
|
||||||
if (auto* nested_browsing_context = static_cast<HTML::HTMLIFrameElement&>(*node).nested_browsing_context())
|
if (auto* nested_browsing_context = static_cast<HTML::HTMLIFrameElement&>(*node).nested_browsing_context())
|
||||||
|
|
|
@ -74,6 +74,9 @@ public:
|
||||||
Layout::Node const& layout_node() const { return m_layout_node; }
|
Layout::Node const& layout_node() const { return m_layout_node; }
|
||||||
Layout::Node& layout_node() { return const_cast<Layout::Node&>(m_layout_node); }
|
Layout::Node& layout_node() { return const_cast<Layout::Node&>(m_layout_node); }
|
||||||
|
|
||||||
|
DOM::Node* dom_node() { return layout_node().dom_node(); }
|
||||||
|
DOM::Node const* dom_node() const { return layout_node().dom_node(); }
|
||||||
|
|
||||||
auto const& computed_values() const { return m_layout_node.computed_values(); }
|
auto const& computed_values() const { return m_layout_node.computed_values(); }
|
||||||
|
|
||||||
HTML::BrowsingContext const& browsing_context() const { return m_layout_node.browsing_context(); }
|
HTML::BrowsingContext const& browsing_context() const { return m_layout_node.browsing_context(); }
|
||||||
|
@ -101,12 +104,12 @@ private:
|
||||||
|
|
||||||
inline DOM::Node* HitTestResult::dom_node()
|
inline DOM::Node* HitTestResult::dom_node()
|
||||||
{
|
{
|
||||||
return paintable->layout_node().dom_node();
|
return paintable->dom_node();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline DOM::Node const* HitTestResult::dom_node() const
|
inline DOM::Node const* HitTestResult::dom_node() const
|
||||||
{
|
{
|
||||||
return paintable->layout_node().dom_node();
|
return paintable->dom_node();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue