mirror of
https://github.com/RGBCube/serenity
synced 2025-05-21 15:55:07 +00:00
LibWeb: Fix incorrect check in BrowsingContext::is_top_level
A top level browsing context is a browsing context with no parent browsing context. However, we considered a top level browsing context to be a browsing context with no associated browsing context container.
This commit is contained in:
parent
f0ac1bcaf8
commit
0f660760ed
2 changed files with 8 additions and 1 deletions
|
@ -57,6 +57,13 @@ void BrowsingContext::reset_cursor_blink_cycle()
|
||||||
m_cursor_position.node()->layout_node()->set_needs_display();
|
m_cursor_position.node()->layout_node()->set_needs_display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/browsers.html#top-level-browsing-context
|
||||||
|
bool BrowsingContext::is_top_level() const
|
||||||
|
{
|
||||||
|
// A browsing context that has no parent browsing context is the top-level browsing context for itself and all of the browsing contexts for which it is an ancestor browsing context.
|
||||||
|
return !parent();
|
||||||
|
}
|
||||||
|
|
||||||
bool BrowsingContext::is_focused_context() const
|
bool BrowsingContext::is_focused_context() const
|
||||||
{
|
{
|
||||||
return m_page && &m_page->focused_context() == this;
|
return m_page && &m_page->focused_context() == this;
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
void register_viewport_client(ViewportClient&);
|
void register_viewport_client(ViewportClient&);
|
||||||
void unregister_viewport_client(ViewportClient&);
|
void unregister_viewport_client(ViewportClient&);
|
||||||
|
|
||||||
bool is_top_level() const { return !container(); }
|
bool is_top_level() const;
|
||||||
bool is_focused_context() const;
|
bool is_focused_context() const;
|
||||||
|
|
||||||
DOM::Document const* active_document() const { return m_active_document; }
|
DOM::Document const* active_document() const { return m_active_document; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue