mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWeb: Make Navigable::active_document() const
This commit is contained in:
parent
12cec1bdb3
commit
26b5fa348c
|
|
@ -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…
Reference in New Issue
Block a user