1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:17:35 +00:00

LibWeb: Make BrowsingContex::page() return a Page&

This exposed a whole slew of now-unnecessary null checks. :^)

Co-Authored-By: Andreas Kling <kling@serenityos.org>
This commit is contained in:
Shannon Booth 2023-12-03 20:29:37 +13:00 committed by Andreas Kling
parent af2bcc3b56
commit 88f8ea7c60
9 changed files with 56 additions and 88 deletions

View file

@ -302,8 +302,7 @@ MediaPaintable::DispatchEventOfSameName MediaPaintable::handle_mouseup(Badge<Eve
break;
case HTML::HTMLMediaElement::MouseTrackingComponent::Volume:
if (auto* page = browsing_context().page())
page->client().page_did_leave_tooltip_area();
browsing_context().page().client().page_did_leave_tooltip_area();
break;
}
@ -351,10 +350,8 @@ MediaPaintable::DispatchEventOfSameName MediaPaintable::handle_mousemove(Badge<E
if (cached_layout_boxes.volume_rect.has_value()) {
set_volume(media_element, *cached_layout_boxes.volume_scrub_rect, position);
if (auto* page = browsing_context().page()) {
auto volume = static_cast<u8>(media_element.volume() * 100.0);
page->client().page_did_enter_tooltip_area(position, DeprecatedString::formatted("{}%", volume));
}
auto volume = static_cast<u8>(media_element.volume() * 100.0);
browsing_context().page().client().page_did_enter_tooltip_area(position, DeprecatedString::formatted("{}%", volume));
}
break;