mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-04 18:23:39 +00:00
LibWeb: Make Document::page() return a Page&
Now that Document always has a Page, and always keeps it alive, we can make this return a Page&, exposing various unnecessary null checks.
This commit is contained in:
parent
70193c0009
commit
7c95ebc302
Notes:
sideshowbarker
2024-07-17 00:53:02 +09:00
Author: https://github.com/awesomekling
Commit: 7c95ebc302
Pull-request: https://github.com/SerenityOS/serenity/pull/22299
Issue: https://github.com/SerenityOS/serenity/issues/22290
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/Lubrsi
17 changed files with 43 additions and 78 deletions
|
@ -57,9 +57,6 @@ void HTMLMetaElement::inserted()
|
|||
auto name = attribute(AttributeNames::name);
|
||||
auto content = attribute(AttributeNames::content);
|
||||
if (name.has_value() && name->bytes_as_string_view().equals_ignoring_ascii_case("theme-color"sv) && content.has_value()) {
|
||||
auto* page = document().page();
|
||||
if (!page)
|
||||
return;
|
||||
auto context = CSS::Parser::ParsingContext { document() };
|
||||
|
||||
// 2. For each element in candidate elements:
|
||||
|
@ -82,7 +79,7 @@ void HTMLMetaElement::inserted()
|
|||
auto color = css_value->as_color().color();
|
||||
|
||||
// 4. If color is not failure, then return color.
|
||||
page->client().page_did_change_theme_color(color);
|
||||
document().page().client().page_did_change_theme_color(color);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue