mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-20 06:59:47 +00:00
LibWebView: Generate hyperlinks for attributes that represent links
On the view-source page, generate anchor tags for any 'href' or 'src' attribute value we come across. This handles both when the attribute contains an absolute URL and a URL relative to the page. This requires sending the document's base URL over IPC to resolve relative URLs.
This commit is contained in:
parent
0703ba118b
commit
1aab7b51ea
Notes:
github-actions[bot]
2024-10-20 06:50:51 +00:00
Author: https://github.com/trflynn89
Commit: 1aab7b51ea
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1861
10 changed files with 60 additions and 26 deletions
|
@ -128,8 +128,8 @@ InspectorClient::InspectorClient(ViewImplementation& content_web_view, ViewImple
|
|||
m_inspector_web_view.run_javascript(builder.string_view());
|
||||
};
|
||||
|
||||
m_content_web_view.on_received_style_sheet_source = [this](Web::CSS::StyleSheetIdentifier const& identifier, String const& source) {
|
||||
auto html = highlight_source(identifier.url.value_or({}), source, Syntax::Language::CSS, HighlightOutputMode::SourceOnly);
|
||||
m_content_web_view.on_received_style_sheet_source = [this](Web::CSS::StyleSheetIdentifier const& identifier, auto const& base_url, String const& source) {
|
||||
auto html = highlight_source(identifier.url.value_or({}), base_url, source, Syntax::Language::CSS, HighlightOutputMode::SourceOnly);
|
||||
auto script = MUST(String::formatted("inspector.setStyleSheetSource({}, \"{}\");",
|
||||
style_sheet_identifier_to_json(identifier),
|
||||
MUST(encode_base64(html.bytes()))));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue