mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-21 08:48:57 +00:00
LibWeb: Make Navigable::active_document() const
This commit is contained in:
parent
12cec1bdb3
commit
26b5fa348c
Notes:
github-actions[bot]
2025-09-12 19:35:36 +00:00
Author: https://github.com/gmta
Commit: 26b5fa348c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6169
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/trflynn89
2 changed files with 4 additions and 4 deletions
|
@ -297,7 +297,7 @@ void Navigable::activate_history_entry(GC::Ptr<SessionHistoryEntry> entry)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#nav-document
|
||||
GC::Ptr<DOM::Document> Navigable::active_document()
|
||||
GC::Ptr<DOM::Document> Navigable::active_document() const
|
||||
{
|
||||
// A navigable's active document is its active session history entry's document.
|
||||
return m_active_session_history_entry->document();
|
||||
|
@ -2549,10 +2549,10 @@ static String visible_text_in_range(DOM::Range const& range)
|
|||
|
||||
String Navigable::selected_text() const
|
||||
{
|
||||
auto document = const_cast<Navigable*>(this)->active_document();
|
||||
auto document = active_document();
|
||||
if (!document)
|
||||
return String {};
|
||||
auto selection = const_cast<DOM::Document&>(*document).get_selection();
|
||||
auto selection = document->get_selection();
|
||||
auto range = selection->range();
|
||||
if (!range)
|
||||
return String {};
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
|
||||
void activate_history_entry(GC::Ptr<SessionHistoryEntry>);
|
||||
|
||||
GC::Ptr<DOM::Document> active_document();
|
||||
GC::Ptr<DOM::Document> active_document() const;
|
||||
GC::Ptr<BrowsingContext> active_browsing_context();
|
||||
GC::Ptr<WindowProxy> active_window_proxy();
|
||||
GC::Ptr<Window> active_window();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue