mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +00:00
LibWebView: Add simple ID tracking to WebViews
For Firefox DevTools, we will need to track WebViews by a numerical ID. Here, we just increment a static 64-bit counter. We can switch to using IDAllocator if we ever have an issue with this. This patch adds such an ID to the views and a couple of APIs to access WebViews after creation.
This commit is contained in:
parent
82206d2abb
commit
3904765c4f
Notes:
github-actions[bot]
2025-02-19 13:47:36 +00:00
Author: https://github.com/trflynn89
Commit: 3904765c4f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3589
Reviewed-by: https://github.com/ADKaster
2 changed files with 33 additions and 1 deletions
|
@ -43,6 +43,11 @@ public:
|
|||
String fonts_json;
|
||||
};
|
||||
|
||||
static void for_each_view(Function<IterationDecision(ViewImplementation&)>);
|
||||
static Optional<ViewImplementation&> find_view_by_id(u64);
|
||||
|
||||
u64 view_id() const { return m_view_id; }
|
||||
|
||||
void set_url(Badge<WebContentClient>, URL::URL url) { m_url = move(url); }
|
||||
URL::URL const& url() const { return m_url; }
|
||||
|
||||
|
@ -304,6 +309,10 @@ protected:
|
|||
size_t m_number_of_elements_playing_audio { 0 };
|
||||
|
||||
Web::HTML::MuteState m_mute_state { Web::HTML::MuteState::Unmuted };
|
||||
|
||||
// FIXME: Reconcile this ID with `page_id`. The latter is only unique per WebContent connection, whereas the view ID
|
||||
// is required to be globally unique for Firefox DevTools.
|
||||
u64 m_view_id { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue