Skip to content

Truly independent web browser

Everywhere: Rework the engine's side of the browser chrome

Andreas Kling175813754acc
diff --git a/Libraries/LibCompositing/PictureInPictureControls.h b/Libraries/LibCompositing/PictureInPictureControls.h
index eea540d1403..4768ac9e1c7 100644
--- a/Libraries/LibCompositing/PictureInPictureControls.h
+++ b/Libraries/LibCompositing/PictureInPictureControls.h
@@ -47,12 +47,13 @@ struct PictureInPictureControlsGeometry {
inline PictureInPictureControlsGeometry picture_in_picture_controls_geometry(Gfx::IntSize viewport_size, double device_pixel_ratio)
{
+ // Close is in the top left corner, and the way back to the tab in the top right one.
auto button_size = scaled_overlay_length(28, device_pixel_ratio);
- auto inset = scaled_overlay_length(8, device_pixel_ratio);
+ auto inset = scaled_overlay_length(10, device_pixel_ratio);
return {
- .back_to_tab_button = { inset, inset, button_size, button_size },
- .close_button = { viewport_size.width() - inset - button_size, inset, button_size, button_size },
+ .back_to_tab_button = { viewport_size.width() - inset - button_size, inset, button_size, button_size },
+ .close_button = { inset, inset, button_size, button_size },
};
}
diff --git a/Libraries/LibCompositing/Rust/src/display_list/commands.rs b/Libraries/LibCompositing/Rust/src/display_list/commands.rs
index 1d865d52fc5..6843cecd09f 100644
--- a/Libraries/LibCompositing/Rust/src/display_list/commands.rs
+++ b/Libraries/LibCompositing/Rust/src/display_list/commands.rs
@@ -1688,14 +1688,10 @@ pub struct CompositorScrollbar {
pub track_rect: IntRect,
pub expanded_gutter_rect: IntRect,
pub expanded_thumb_rect: IntRect,
- // The thumb is clipped to this rounded rect, which follows the rounded corners the UI may give the viewport.
- // A radius of zero means no clip.
- pub corner_clip_rect: IntRect,
pub scroll_size: f64,
pub expanded_scroll_size: f64,
pub min_scroll_offset: f32,
pub max_scroll_offset: f32,
- pub corner_clip_radius: i32,
pub thumb_color: Color,
pub track_color: Color,
pub vertical: bool,
@@ -1710,12 +1706,10 @@ ffi_bytes_fields!(CompositorScrollbar {
track_rect,
expanded_gutter_rect,
expanded_thumb_rect,
- corner_clip_rect,
scroll_size,
expanded_scroll_size,
min_scroll_offset,
max_scroll_offset,
- corner_clip_radius,
thumb_color,
track_color,
vertical,
diff --git a/Libraries/LibCompositing/Rust/src/display_list/damage.rs b/Libraries/LibCompositing/Rust/src/display_list/damage.rs
index 621c1fd668f..09eb759138a 100644
--- a/Libraries/LibCompositing/Rust/src/display_list/damage.rs
+++ b/Libraries/LibCompositing/Rust/src/display_list/damage.rs
@@ -2422,12 +2422,10 @@ mod tests {
track_rect: IntRect::new(96, 0, 4, 100),
expanded_gutter_rect: IntRect::new(92, 0, 8, 100),
expanded_thumb_rect: IntRect::new(94, 0, 6, 20),
- corner_clip_rect: IntRect::default(),
scroll_size: 0.8,
expanded_scroll_size: 0.8,
min_scroll_offset: 0.0,
max_scroll_offset: 100.0,
- corner_clip_radius: 0,
thumb_color: RED,
track_color: Color::TRANSPARENT,
vertical: true,
diff --git a/Libraries/LibCompositing/Scrolling/AsyncScrollingState.cpp b/Libraries/LibCompositing/Scrolling/AsyncScrollingState.cpp
index 18908847a8b..faa90630ee7 100644
--- a/Libraries/LibCompositing/Scrolling/AsyncScrollingState.cpp
+++ b/Libraries/LibCompositing/Scrolling/AsyncScrollingState.cpp
@@ -154,8 +154,6 @@ AsyncScrollingState async_scrolling_state_from_display_list(Compositing::Display
.track_rect = command.track_rect,
.expanded_gutter_rect = command.expanded_gutter_rect,
.expanded_thumb_rect = command.expanded_thumb_rect,
- .corner_clip_rect = command.corner_clip_rect,
- .corner_clip_radius = command.corner_clip_radius,
.scroll_size = command.scroll_size,
.expanded_scroll_size = command.expanded_scroll_size,
.min_scroll_offset = command.min_scroll_offset,
diff --git a/Libraries/LibCompositing/Scrolling/AsyncScrollingState.h b/Libraries/LibCompositing/Scrolling/AsyncScrollingState.h
index ed08f852517..cd3e6f60c9f 100644
--- a/Libraries/LibCompositing/Scrolling/AsyncScrollingState.h
+++ b/Libraries/LibCompositing/Scrolling/AsyncScrollingState.h
@@ -131,9 +131,6 @@ struct AsyncScrollbar {
Gfx::IntRect track_rect;
Gfx::IntRect expanded_gutter_rect;
Gfx::IntRect expanded_thumb_rect;
- // The compositor clips the thumb to this rounded rect when the radius is not zero.
- Gfx::IntRect corner_clip_rect;
- i32 corner_clip_radius { 0 };
double scroll_size { 0 };
double expanded_scroll_size { 0 };
float min_scroll_offset { 0 };
diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp
index 85609d3b481..78acb45ca99 100644
--- a/Libraries/LibWeb/DOM/Document.cpp
+++ b/Libraries/LibWeb/DOM/Document.cpp
@@ -7142,6 +7142,16 @@ void Document::make_active()
auto current_navigable = this->navigable();
if (current_navigable && current_navigable->is_top_level_traversable()) {
page().client().page_did_change_active_document_in_top_level_browsing_context(*this);
+ // NB: A document whose title element was parsed before it became active, such as an error page made from
+ // inline content, hasn't reported its title yet. It's reported in a task, after the page has learned of
+ // the new active document, which resets the title it shows.
+ HTML::queue_global_task(HTML::Task::Source::NavigationAndTraversal, relevant_global_object(*this), GC::create_function(heap(), [document = GC::Ref { *this }] {
+ auto navigable = document->navigable();
+ if (!navigable || !navigable->is_top_level_traversable() || !document->is_active())
+ return;
+ if (auto title = document->title(); !title.is_empty())
+ document->page().client().page_did_change_title(title);
+ }));
}
// 4. Set window's relevant settings object's execution ready flag.
@@ -11360,7 +11370,7 @@ Optional<Painting::HitTestQuery> Document::prepare_hit_test_query(Layout::BegunR
paint_state().visual_context_tree_without_update(read, *this),
scroll_state_snapshot(),
page().client().device_pixels_per_css_pixel(),
- page().chrome_metrics(*this),
+ page().chrome_metrics(),
};
}
diff --git a/Libraries/LibWeb/HTML/EventLoop/ClockPlan.cpp b/Libraries/LibWeb/HTML/EventLoop/ClockPlan.cpp
index 92043646216..7bb4f486b45 100644
--- a/Libraries/LibWeb/HTML/EventLoop/ClockPlan.cpp
+++ b/Libraries/LibWeb/HTML/EventLoop/ClockPlan.cpp
@@ -281,7 +281,7 @@ bool seal_clock_plan(DOM::Document& document, bool may_plan, u64 update_serial)
.device_pixels_per_css_pixel = document.page().client().device_pixels_per_css_pixel(),
.scroll_offsets = scroll_offsets.data(),
.scroll_offset_count = scroll_offsets.size(),
- .chrome_metrics = document.page().chrome_metrics(document),
+ .chrome_metrics = document.page().chrome_metrics(),
.page_cursor = ffi_page_cursor(document.page().cursor()),
.effect_timing_nodes = effect_timing_nodes.data(),
.effect_timing_identities = effect_timing_identities.data(),
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.cpp b/Libraries/LibWeb/HTML/LocalNavigable.cpp
index c342da5f3f9..2e8fbd0ac06 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.cpp
+++ b/Libraries/LibWeb/HTML/LocalNavigable.cpp
@@ -6619,13 +6619,6 @@ void LocalNavigable::set_force_dark_thresholds(i32 foreground, i32 background)
child_navigable->set_force_dark_thresholds(foreground, background);
}
-// The viewport's scrollbars are recorded with a clip that follows its corners.
-void LocalNavigable::viewport_corner_radius_did_change()
-{
- if (auto document = active_document())
- document->set_needs_repaint(Badge<HTML::LocalNavigable> {}, InvalidateDisplayList::PaintCommands);
-}
-
void LocalNavigable::set_should_show_caret_hit_test_debug_overlay(bool value)
{
m_should_show_caret_hit_test_debug_overlay = value;
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.h b/Libraries/LibWeb/HTML/LocalNavigable.h
index 14c1ad8579f..60d7db4d957 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.h
+++ b/Libraries/LibWeb/HTML/LocalNavigable.h
@@ -365,7 +365,6 @@ public:
bool force_dark_enabled() const { return m_force_dark_enabled; }
PaintConfig stamp_paint_config(PaintConfig) const;
void set_should_show_caret_hit_test_debug_overlay(bool);
- void viewport_corner_radius_did_change();
bool should_show_caret_hit_test_debug_overlay() const { return m_should_show_caret_hit_test_debug_overlay; }
bool is_svg_page() const { return m_is_svg_page; }
diff --git a/Libraries/LibWeb/HTML/MediaControls.cpp b/Libraries/LibWeb/HTML/MediaControls.cpp
index e4a7279dcbd..e33774bdf61 100644
--- a/Libraries/LibWeb/HTML/MediaControls.cpp
+++ b/Libraries/LibWeb/HTML/MediaControls.cpp
@@ -26,6 +26,7 @@
#include <LibWeb/HTML/TimeRanges.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Page/Page.h>
+#include <LibWeb/PictureInPicture/PictureInPictureController.h>
#include <LibWeb/UIEvents/EventNames.h>
#include <LibWeb/UIEvents/KeyboardEvent.h>
#include <LibWeb/UIEvents/MouseEvent.h>
@@ -90,6 +91,8 @@ void MediaControls::create_shadow_tree()
MUST(m_dom->container->class_list()->add("video"_utf16));
else
MUST(m_dom->container->class_list()->add("audio"_utf16));
+ if (is_picture_in_picture_player())
+ MUST(m_dom->container->class_list()->add("picture-in-picture-player"_utf16));
// Initialize state
update_play_pause_icon();
@@ -391,6 +394,16 @@ void MediaControls::set_up_event_listeners()
return true;
});
+ // The placeholder of a video playing in Picture-in-Picture brings it back to the page.
+ if (m_dom->exit_picture_in_picture_button) {
+ add_event_listener(realm, *m_dom->exit_picture_in_picture_button, UIEvents::EventNames::click, [this] {
+ auto& document = m_host->document();
+ if (m_host->is_picture_in_picture_element())
+ document.page().picture_in_picture_controller().enqueue_exit(document, nullptr);
+ return true;
+ });
+ }
+
// Fullscreen button
if (m_dom->fullscreen_button) {
add_event_listener(realm, *m_dom->fullscreen_button, UIEvents::EventNames::click, [this] {
@@ -678,6 +691,17 @@ void MediaControls::request_timeline_update()
});
}
+// A time as minutes and seconds, such as 4:10, with the hours before them when there are any.
+static String compact_digital_time(i64 time_in_seconds)
+{
+ auto hours = time_in_seconds / 3600;
+ auto minutes = (time_in_seconds % 3600) / 60;
+ auto seconds = time_in_seconds % 60;
+ if (hours > 0)
+ return MUST(String::formatted("{}:{:02}:{:02}", hours, minutes, seconds));
+ return MUST(String::formatted("{}:{:02}", minutes, seconds));
+}
+
void MediaControls::update_timestamp()
{
VERIFY(m_media_element);
@@ -705,6 +729,14 @@ void MediaControls::set_timestamp(double time, double duration)
m_last_timestamp_time = rounded_time;
m_last_timestamp_duration = rounded_duration;
+ // A Picture-in-Picture window's player shows the time and the duration on either side of its timeline.
+ if (is_picture_in_picture_player()) {
+ VERIFY(m_dom->duration_element);
+ MUST(m_dom->timestamp_element->set_text_content(Utf16String::from_utf8(compact_digital_time(rounded_time))));
+ MUST(m_dom->duration_element->set_text_content(rounded_duration.has_value() ? Utf16String::from_utf8(compact_digital_time(*rounded_duration)) : Utf16String {}));
+ return;
+ }
+
auto timestamp_builder = Utf16StringBuilder();
timestamp_builder.appendff("{}", human_readable_digital_time(rounded_time));
if (rounded_duration.has_value())
diff --git a/Libraries/LibWeb/HTML/MediaControls.css b/Libraries/LibWeb/HTML/MediaControls.css
index 67af74b1a82..2cedca7312a 100644
--- a/Libraries/LibWeb/HTML/MediaControls.css
+++ b/Libraries/LibWeb/HTML/MediaControls.css
@@ -147,6 +147,12 @@
font-variant-numeric: tabular-nums;
}
+.duration {
+ display: none;
+ white-space: nowrap;
+ font-variant-numeric: tabular-nums;
+}
+
.volume-area {
max-width: 60px;
flex-grow: 1;
@@ -187,18 +193,23 @@
display: none;
}
+/* NB: The overlay would cover the placeholder's button, and the video it plays or pauses is in its own window. */
+.container.picture-in-picture > .video-overlay {
+ display: none;
+}
+
.picture-in-picture-placeholder {
display: none;
flex-direction: column;
align-items: center;
justify-content: center;
- gap: 8px;
+ gap: 14px;
width: 100%;
height: 100%;
- background-color: rgb(12, 12, 13);
- color: white;
- font-family: sans-serif;
- font-size: 14px;
+ background-color: rgb(17, 17, 20);
+ color: rgb(220, 220, 225);
+ font-family: system-ui, sans-serif;
+ font-size: 15px;
text-align: center;
}
@@ -207,10 +218,124 @@
}
.picture-in-picture-placeholder-icon {
- width: 48px;
- height: 48px;
- fill: currentColor;
- fill-rule: evenodd;
+ width: 40px;
+ height: 30px;
+}
+
+.picture-in-picture-placeholder-frame {
+ fill: none;
+ stroke: rgb(172, 172, 180);
+ stroke-width: 2px;
+}
+
+.picture-in-picture-placeholder-window {
+ fill: rgb(172, 172, 180);
+}
+
+.exit-picture-in-picture-button {
+ height: 32px;
+ padding: 0 16px;
+ border: none;
+ border-radius: 8px;
+ background: rgba(255, 255, 255, 0.12);
+ color: rgb(242, 242, 245);
+ font: inherit;
+ font-size: 13px;
+ cursor: pointer;
+}
+
+.exit-picture-in-picture-button:hover {
+ background: rgba(255, 255, 255, 0.18);
+}
+
+/* The player in a Picture-in-Picture window has its play button in the middle, and a row of the time, the timeline,
+ the duration and the mute button along its bottom, over a shade at its top and bottom. Only the controls take the
+ pointer, so that the shade between them leaves the controls to fade. */
+.container.picture-in-picture-player > .controls {
+ top: 0;
+ flex-direction: row;
+ flex-wrap: wrap;
+ align-content: flex-end;
+ align-items: center;
+ gap: 10px;
+ padding: 12px;
+ background: linear-gradient(
+ rgba(0, 0, 0, 0.45) 0%,
+ rgba(0, 0, 0, 0) 30%,
+ rgba(0, 0, 0, 0) 60%,
+ rgba(0, 0, 0, 0.55) 100%
+ );
+}
+
+.container.picture-in-picture-player > .controls,
+.container.picture-in-picture-player > .controls.visible {
+ pointer-events: none;
+}
+
+.container.picture-in-picture-player > .controls.visible > * {
+ pointer-events: auto;
+}
+
+.container.picture-in-picture-player .button-bar {
+ display: contents;
+}
+
+.container.picture-in-picture-player .timestamp {
+ order: 1;
+}
+
+.container.picture-in-picture-player > .controls > .timeline {
+ order: 2;
+ flex: 1;
+ margin: -5px 0;
+}
+
+.container.picture-in-picture-player .timeline-track {
+ height: 4px;
+ border-radius: 2px;
+ overflow: hidden;
+ background: rgba(255, 255, 255, 0.3);
+}
+
+.container.picture-in-picture-player .timeline-fill {
+ background: var(--foreground-color);
+}
+
+.container.picture-in-picture-player .duration {
+ display: inline;
+ order: 3;
+}
+
+.container.picture-in-picture-player .mute-button {
+ order: 4;
+ margin-left: 0;
+ width: 22px;
+ height: 22px;
+}
+
+.container.picture-in-picture-player .mute-button .icon {
+ width: 18px;
+ height: 18px;
+}
+
+.container.picture-in-picture-player .volume-area {
+ display: none;
+}
+
+.container.picture-in-picture-player .play-pause-button {
+ position: fixed;
+ left: 50%;
+ top: 50%;
+ width: 56px;
+ height: 56px;
+ margin: -28px 0 0 -28px;
+ border-radius: 50%;
+ background: rgba(0, 0, 0, 0.45);
+}
+
+.container.picture-in-picture-player .play-pause-button .icon {
+ width: 22px;
+ height: 22px;
}
.fullscreen-icon path {
diff --git a/Libraries/LibWeb/HTML/MediaControls.html b/Libraries/LibWeb/HTML/MediaControls.html
index 23e3b41da8b..6132efa7b7a 100644
--- a/Libraries/LibWeb/HTML/MediaControls.html
+++ b/Libraries/LibWeb/HTML/MediaControls.html
@@ -1,10 +1,12 @@
<link rel="stylesheet" href="MediaControls.css">
<div data-name="container" class="container">
<div data-option="video" class="picture-in-picture-placeholder">
- <svg class="picture-in-picture-placeholder-icon" viewBox="0 0 24 24">
- <path d="M2 4h20v16H2Zm2 2v12h16V6Zm7 5h8v6h-8Z"/>
+ <svg class="picture-in-picture-placeholder-icon" viewBox="0 0 40 30">
+ <rect class="picture-in-picture-placeholder-frame" x="1" y="1" width="38" height="28" rx="4"/>
+ <rect class="picture-in-picture-placeholder-window" x="20" y="15" width="16" height="11" rx="2"/>
</svg>
- <span>Playing in Picture-in-Picture</span>
+ <span>Playing in picture-in-picture</span>
+ <button data-name="exit-picture-in-picture-button" class="exit-picture-in-picture-button">Bring video back</button>
</div>
<div data-name="video-overlay" data-option="video" class="video-overlay">
<div data-name="placeholder-circle" class="placeholder-circle">
@@ -27,6 +29,7 @@
</svg>
</button>
<span data-name="timestamp-element" class="timestamp"></span>
+ <span data-name="duration-element" class="duration"></span>
<button data-name="mute-button" class="control-button mute-button">
<svg class="icon" viewBox="0 0 24 24">
<defs><clipPath id="muted-clip">
diff --git a/Libraries/LibWeb/Loader/GeneratedPagesLoader.cpp b/Libraries/LibWeb/Loader/GeneratedPagesLoader.cpp
index cadf0fa3e32..1e148d87ba5 100644
--- a/Libraries/LibWeb/Loader/GeneratedPagesLoader.cpp
+++ b/Libraries/LibWeb/Loader/GeneratedPagesLoader.cpp
@@ -24,6 +24,13 @@ ErrorOr<String> load_error_page(URL::URL const& url, StringView error_message)
StringBuilder builder;
SourceGenerator generator { builder, '%', '%' };
generator.set("failed_url", escape_html_entities(url.to_byte_string()));
+ // NB: The page names the site it could not reach by its host, with the port when the URL has one, or by the whole URL
+ // when it has no host.
+ auto host = url.host().has_value() ? url.serialized_host() : StringView {};
+ ByteString failed_host = host.is_empty() ? url.to_byte_string() : ByteString { host };
+ if (!host.is_empty() && url.port().has_value())
+ failed_host = ByteString::formatted("{}:{}", failed_host, *url.port());
+ generator.set("failed_host", escape_html_entities(failed_host));
generator.set("error_message", escape_html_entities(error_message));
generator.append(template_file->data());
return TRY(String::from_utf8(generator.as_string_view()));
diff --git a/Libraries/LibWeb/Loader/ResourceLoader.cpp b/Libraries/LibWeb/Loader/ResourceLoader.cpp
index 451e2b0ac3d..a88cecdcda3 100644
--- a/Libraries/LibWeb/Loader/ResourceLoader.cpp
+++ b/Libraries/LibWeb/Loader/ResourceLoader.cpp
@@ -257,6 +257,47 @@ static void log_filtered_request(LoadRequest const& request)
dbgln("ResourceLoader: Filtered request to: \"{}\"", url_for_logging);
}
+// What kind of resource a blocked request was for, as the browser names it to the user.
+static StringView blocked_resource_kind(LoadRequest const& request)
+{
+ using Destination = Fetch::Infrastructure::Request::Destination;
+ if (!request.destination().has_value())
+ return "Request"sv;
+ switch (*request.destination()) {
+ case Destination::Script:
+ case Destination::AudioWorklet:
+ case Destination::PaintWorklet:
+ case Destination::ServiceWorker:
+ case Destination::SharedWorker:
+ case Destination::Worker:
+ return "Script"sv;
+ case Destination::Image:
+ return "Image"sv;
+ case Destination::Style:
+ case Destination::XSLT:
+ return "Stylesheet"sv;
+ case Destination::Font:
+ return "Font"sv;
+ case Destination::Audio:
+ case Destination::Track:
+ case Destination::Video:
+ return "Media"sv;
+ case Destination::Document:
+ case Destination::Embed:
+ case Destination::Frame:
+ case Destination::IFrame:
+ case Destination::Object:
+ return "Frame"sv;
+ case Destination::JSON:
+ case Destination::Manifest:
+ case Destination::Report:
+ case Destination::Text:
+ case Destination::WebIdentity:
+ return "Request"sv;
+ }
+ VERIFY_NOT_REACHED();
+}
+
static bool should_block_request(LoadRequest const& request)
{
auto const& url = request.url().value();
@@ -280,7 +321,7 @@ static bool should_block_request(LoadRequest const& request)
if (ContentBlocker::the().is_filtered(url, source_url, request.destination(), request.initiator_type(), request.request_mode())) {
log_filtered_request(request);
if (page)
- page->client().page_did_block_resource();
+ page->client().page_did_block_resource(url, blocked_resource_kind(request));
return true;
}
}
diff --git a/Libraries/LibWeb/Page/Page.cpp b/Libraries/LibWeb/Page/Page.cpp
index 742031f3f88..110ad03fd6a 100644
--- a/Libraries/LibWeb/Page/Page.cpp
+++ b/Libraries/LibWeb/Page/Page.cpp
@@ -426,12 +426,9 @@ DevicePixelRect Page::rounded_device_rect(CSSPixelRect rect) const
};
}
-ChromeMetrics Page::chrome_metrics(DOM::Document const& document) const
+ChromeMetrics Page::chrome_metrics() const
{
- // Only the top-level viewport is the one the UI shows with rounded corners.
- auto navigable = document.navigable();
- auto is_top_level = navigable && navigable->is_top_level_traversable();
- return ChromeMetrics { m_client->zoom_level(), is_top_level ? m_client->viewport_corner_radius() : 0 };
+ return ChromeMetrics { m_client->zoom_level() };
}
EventResult Page::handle_mouseup(HTML::LocalNavigable& root, DevicePixelPoint position, DevicePixelPoint screen_position, unsigned button, unsigned buttons, unsigned modifiers, Optional<RemoteInputEventTarget>* remote_target)
diff --git a/Libraries/LibWeb/Page/Page.h b/Libraries/LibWeb/Page/Page.h
index 6971b8a5cf5..16cace48b60 100644
--- a/Libraries/LibWeb/Page/Page.h
+++ b/Libraries/LibWeb/Page/Page.h
@@ -188,7 +188,7 @@ public:
CSSPixelSize device_to_css_size(DevicePixelSize) const;
DevicePixelRect enclosing_device_rect(CSSPixelRect) const;
DevicePixelRect rounded_device_rect(CSSPixelRect) const;
- ChromeMetrics chrome_metrics(DOM::Document const&) const;
+ ChromeMetrics chrome_metrics() const;
EventResult handle_mouseup(HTML::LocalNavigable& root, DevicePixelPoint, DevicePixelPoint screen_position, unsigned button, unsigned buttons, unsigned modifiers, Optional<RemoteInputEventTarget>* remote_target);
EventResult handle_mousedown(HTML::LocalNavigable& root, DevicePixelPoint, DevicePixelPoint screen_position, unsigned button, unsigned buttons, unsigned modifiers, int click_count, Optional<Web::ScrollbarDraggedByCompositor> const&, Optional<RemoteInputEventTarget>* remote_target);
@@ -703,7 +703,6 @@ public:
// a menu bar or a dock. A client that doesn't know it reports the whole screen.
virtual DevicePixelRect available_screen_rect() const { return screen_rect(); }
virtual double zoom_level() const = 0;
- virtual double viewport_corner_radius() const { return 0; }
virtual double device_pixel_ratio() const = 0;
virtual double device_pixels_per_css_pixel() const = 0;
virtual double maximum_frames_per_second() const { return 60.0; }
@@ -909,7 +908,7 @@ public:
virtual Gamepad::ReceivedRumbleEffects virtual_gamepad_received_rumble_effects([[maybe_unused]] Gamepad::GamepadHandle handle) { return {}; }
virtual void pump_gamepad_events() { }
- virtual void page_did_block_resource() { }
+ virtual void page_did_block_resource([[maybe_unused]] URL::URL const& url, [[maybe_unused]] StringView kind) { }
virtual void page_did_start_network_request([[maybe_unused]] u64 request_id, [[maybe_unused]] URL::URL const& url, [[maybe_unused]] ByteString const& method, [[maybe_unused]] Vector<HTTP::Header> const& request_headers, [[maybe_unused]] ReadonlyBytes request_body, [[maybe_unused]] Optional<String> initiator_type, [[maybe_unused]] String const& referrer_policy, [[maybe_unused]] bool is_navigation_request, [[maybe_unused]] Fetch::Infrastructure::Request::Priority priority) { }
virtual void page_did_receive_network_response_headers([[maybe_unused]] u64 request_id, [[maybe_unused]] u32 status_code, [[maybe_unused]] Optional<String> reason_phrase, [[maybe_unused]] Vector<HTTP::Header> const& response_headers, [[maybe_unused]] Requests::CacheState cache_state) { }
virtual void page_did_receive_network_response_body([[maybe_unused]] u64 request_id, [[maybe_unused]] ReadonlyBytes data) { }
diff --git a/Libraries/LibWeb/Painting/ChromeMetrics.h b/Libraries/LibWeb/Painting/ChromeMetrics.h
index 7e017a91ef1..ef9993e3485 100644
--- a/Libraries/LibWeb/Painting/ChromeMetrics.h
+++ b/Libraries/LibWeb/Painting/ChromeMetrics.h
@@ -21,7 +21,7 @@ struct ChromeMetrics {
static constexpr CSSPixels ZOOM_INVARIANT_RESIZE_GRIPPER_PADDING { 2 };
ChromeMetrics() = default;
- explicit ChromeMetrics(double zoom_factor, double viewport_corner_radius = 0)
+ explicit ChromeMetrics(double zoom_factor)
{
VERIFY(zoom_factor > 0);
// So we can still use device_pixels_per_css_pixel transforms at paint time.
@@ -33,7 +33,6 @@ struct ChromeMetrics {
scroll_gutter_thickness = ZOOM_INVARIANT_SCROLL_GUTTER_THICKNESS * inverse_zoom;
resize_gripper_size = ZOOM_INVARIANT_RESIZE_GRIPPER_SIZE * inverse_zoom;
resize_gripper_padding = ZOOM_INVARIANT_RESIZE_GRIPPER_PADDING * inverse_zoom;
- this->viewport_corner_radius = CSSPixels { viewport_corner_radius } * inverse_zoom;
}
CSSPixels scroll_thumb_min_length;
CSSPixels scroll_thumb_padding_thin;
@@ -42,8 +41,6 @@ struct ChromeMetrics {
CSSPixels scroll_gutter_thickness;
CSSPixels resize_gripper_size;
CSSPixels resize_gripper_padding;
- // The UI may round the corners of the top-level viewport with circular arcs. Its scrollbars follow them.
- CSSPixels viewport_corner_radius;
};
}
diff --git a/Libraries/LibWeb/Painting/PaintingRustBridge.cpp b/Libraries/LibWeb/Painting/PaintingRustBridge.cpp
index 4dbeee43811..f79a66b7076 100644
--- a/Libraries/LibWeb/Painting/PaintingRustBridge.cpp
+++ b/Libraries/LibWeb/Painting/PaintingRustBridge.cpp
@@ -138,7 +138,7 @@ VERIFY_SHARED_FFI_TYPE(Gfx::ScalingMode);
VERIFY_SHARED_FFI_TYPE(Gfx::InterpolationColorSpace);
VERIFY_SHARED_FFI_TYPE(Compositing::ClipMode);
VERIFY_SHARED_FFI_TYPE(ChromeMetrics);
-static_assert(sizeof(ChromeMetrics) == 8 * sizeof(CSSPixels));
+static_assert(sizeof(ChromeMetrics) == 7 * sizeof(CSSPixels));
static_assert(offsetof(ChromeMetrics, scroll_thumb_min_length) == 0);
static_assert(offsetof(ChromeMetrics, scroll_thumb_padding_thin) == sizeof(CSSPixels));
static_assert(offsetof(ChromeMetrics, scroll_thumb_thickness_thin) == 2 * sizeof(CSSPixels));
@@ -146,7 +146,6 @@ static_assert(offsetof(ChromeMetrics, scroll_thumb_thickness) == 3 * sizeof(CSSP
static_assert(offsetof(ChromeMetrics, scroll_gutter_thickness) == 4 * sizeof(CSSPixels));
static_assert(offsetof(ChromeMetrics, resize_gripper_size) == 5 * sizeof(CSSPixels));
static_assert(offsetof(ChromeMetrics, resize_gripper_padding) == 6 * sizeof(CSSPixels));
-static_assert(offsetof(ChromeMetrics, viewport_corner_radius) == 7 * sizeof(CSSPixels));
VERIFY_SHARED_FFI_TYPE(Optional<CSSPixels>);
VERIFY_SHARED_FFI_TYPE(Optional<CSSPixelRect>);
VERIFY_SHARED_FFI_TYPE(Optional<Gfx::IntRect>);
@@ -596,7 +595,7 @@ Optional<DisplayListRecording> start_rust_display_list_recording(Layout::BegunRe
inputs.document_id = document.unique_id().value();
inputs.has_blocking_wheel_event_region_covering_viewport = wheel_event_region_state.has_blocking_wheel_event_region_covering_viewport;
inputs.wheel_event_listener_state_generation = document.page().wheel_event_listener_state_generation();
- inputs.chrome_metrics = document.page().chrome_metrics(document);
+ inputs.chrome_metrics = document.page().chrome_metrics();
inputs.paint_viewport_scrollbars = should_paint_viewport_scrollbars();
if (auto navigable = document.navigable()) {
if (auto handler = navigable->event_handler().middle_button_scroll_handler(); handler.has_value()) {
diff --git a/Libraries/LibWeb/Painting/Scrollbar.cpp b/Libraries/LibWeb/Painting/Scrollbar.cpp
index 3087c648317..1926bf69d5a 100644
--- a/Libraries/LibWeb/Painting/Scrollbar.cpp
+++ b/Libraries/LibWeb/Painting/Scrollbar.cpp
@@ -114,7 +114,7 @@ bool Scrollbar::scroll_to_mouse_position(CSSPixelPoint position)
auto* node = layout_node();
if (!node)
return false;
- ChromeMetrics metrics = node->document().page().chrome_metrics(node->document());
+ ChromeMetrics metrics = node->document().page().chrome_metrics();
auto const& scroll_state = node->document().scroll_state_snapshot();
auto scrollbar_data = compute_scrollbar_data(*node, m_direction, metrics, &scroll_state,
diff --git a/Libraries/LibWeb/Rust/src/painting/ffi.rs b/Libraries/LibWeb/Rust/src/painting/ffi.rs
index a5a036e4852..96d0488d187 100644
--- a/Libraries/LibWeb/Rust/src/painting/ffi.rs
+++ b/Libraries/LibWeb/Rust/src/painting/ffi.rs
@@ -75,7 +75,6 @@ pub struct FfiChromeMetrics {
pub scroll_gutter_thickness: CssPixels,
pub resize_gripper_size: CssPixels,
pub resize_gripper_padding: CssPixels,
- pub viewport_corner_radius: CssPixels,
}
#[derive(Clone, Copy, Debug, Default)]
diff --git a/Libraries/LibWeb/Rust/src/painting/record/async_scroll_metadata.rs b/Libraries/LibWeb/Rust/src/painting/record/async_scroll_metadata.rs
index d0e491ff4c5..86f77b350e3 100644
--- a/Libraries/LibWeb/Rust/src/painting/record/async_scroll_metadata.rs
+++ b/Libraries/LibWeb/Rust/src/painting/record/async_scroll_metadata.rs
@@ -7,7 +7,7 @@
use crate::painting::paint_read::{GeometryRead, PaintRead};
use crate::painting::record::trace::Observer;
-use crate::css::css_pixels::{CssPixelPoint, CssPixelRect, CssPixelSize, CssPixels};
+use crate::css::css_pixels::{CssPixelPoint, CssPixelRect, CssPixelSize};
use crate::layout::node_data::{DomPaintFact, NodeKind, NodeSlotId};
use crate::painting::chrome_geometry::{
ChromeGeometry, maximum_scroll_offset, minimum_scroll_offset, scrollbar_colors_for_paint,
@@ -355,7 +355,6 @@ impl<O: Observer> PaintRecorder<'_, O> {
let min_scroll_offset = css_point_to_device_point(minimum_scroll_offset(self.source, paintable), scale);
let max_scroll_offset = css_point_to_device_point(maximum_scroll_offset(self.source, paintable), scale);
let vertical = direction == ScrollDirection::Vertical;
- let (corner_clip_rect, corner_clip_radius) = self.viewport_scrollbar_corner_clip(paintable);
Some(CompositorScrollbar {
document_id: self.inputs.uncaptured.document_id,
scroll_node_index: self.data(paintable).own_scroll_node_index,
@@ -364,7 +363,6 @@ impl<O: Observer> PaintRecorder<'_, O> {
track_rect: self.converter.rounded_device_rect(scrollbar.track_rect),
expanded_gutter_rect: self.converter.rounded_device_rect(expanded.gutter_rect),
expanded_thumb_rect: self.converter.rounded_device_rect(expanded.thumb_rect),
- corner_clip_rect,
scroll_size: scrollbar.thumb_travel_to_scroll_ratio.to_double(),
expanded_scroll_size: expanded.thumb_travel_to_scroll_ratio.to_double(),
min_scroll_offset: if vertical {
@@ -377,7 +375,6 @@ impl<O: Observer> PaintRecorder<'_, O> {
} else {
max_scroll_offset.x
},
- corner_clip_radius,
thumb_color,
track_color,
vertical,
@@ -386,28 +383,6 @@ impl<O: Observer> PaintRecorder<'_, O> {
})
}
- // The UI may round the viewport's corners. The thumbs of its scrollbars are then clipped to a rounded rect inset by
- // the gap they keep to the viewport's edges, so that a thumb's end follows a corner with that same gap.
- fn viewport_scrollbar_corner_clip(&self, paintable: NodeSlotId) -> (IntRect, i32) {
- let metrics = &self.inputs.uncaptured.chrome_metrics;
- if metrics.viewport_corner_radius <= CssPixels::from_raw(0)
- || self.source.node_kind_if_live(paintable) != Some(NodeKind::Viewport)
- {
- return (IntRect::default(), 0);
- }
- let scale = self.inputs.device_pixels_per_css_pixel;
- let gap = (metrics.scroll_thumb_padding_thin.to_double() * scale).round() as i32;
- let radius = (metrics.viewport_corner_radius.to_double() * scale).round() as i32 - gap;
- let size = self.inputs.uncaptured.device_viewport_size;
- if radius <= 0 || size.width <= 2 * gap || size.height <= 2 * gap {
- return (IntRect::default(), 0);
- }
- (
- IntRect::new(gap, gap, size.width - 2 * gap, size.height - 2 * gap),
- radius,
- )
- }
-
fn record_viewport_scrollbar_state(&mut self, paintable: NodeSlotId) {
let records_viewport_scrollbars = self.source.node_kind_if_live(paintable) == Some(NodeKind::Viewport)
&& self.inputs.uncaptured.paint_viewport_scrollbars
diff --git a/Services/Compositor/DisplayListPlayerSkia.cpp b/Services/Compositor/DisplayListPlayerSkia.cpp
index 36c44ee9b72..a072ae2140c 100644
--- a/Services/Compositor/DisplayListPlayerSkia.cpp
+++ b/Services/Compositor/DisplayListPlayerSkia.cpp
@@ -196,7 +196,7 @@ static bool rect_is_pixel_aligned(SkRect const& rect)
return rect.left() == roundf(rect.left()) && rect.top() == roundf(rect.top()) && rect.right() == roundf(rect.right()) && rect.bottom() == roundf(rect.bottom());
}
-static void paint_scrollbar_into_surface(Gfx::PaintingSurface& surface, ScrollbarController::PresentedScrollbar const& scrollbar, Optional<SkRRect> const& corner_clip = {})
+static void paint_scrollbar_into_surface(Gfx::PaintingSurface& surface, ScrollbarController::PresentedScrollbar const& scrollbar)
{
auto opacity = scrollbar.opacity;
if (opacity <= 0)
@@ -220,28 +220,12 @@ static void paint_scrollbar_into_surface(Gfx::PaintingSurface& surface, Scrollba
if (thumb_rect.isEmpty())
return;
- // A thumb reaching into a rounded corner takes the shape of its part inside the corner clip, so that its outline
- // follows the corner too.
- Optional<SkPath> clipped_thumb;
- if (corner_clip.has_value() && !corner_clip->contains(thumb_rect)) {
- auto result = Op(SkPath::RRect(thumb_rrect), SkPath::RRect(*corner_clip), SkPathOp::kIntersect_SkPathOp);
- if (!result.has_value() || result->isEmpty())
- return;
- clipped_thumb = *std::move(result);
- }
- auto draw_thumb = [&](SkPaint const& paint) {
- if (clipped_thumb.has_value())
- canvas.drawPath(*clipped_thumb, paint);
- else
- canvas.drawRRect(thumb_rrect, paint);
- };
-
SkPaint thumb_fill_paint;
thumb_fill_paint.setColor(to_skia_color(scrollbar.thumb_color));
thumb_fill_paint.setAlphaf(thumb_fill_paint.getAlphaf() * opacity);
// A thumb that is growing or shrinking has edges between pixels.
- thumb_fill_paint.setAntiAlias(clipped_thumb.has_value() || !rect_is_pixel_aligned(thumb_rect));
- draw_thumb(thumb_fill_paint);
+ thumb_fill_paint.setAntiAlias(!rect_is_pixel_aligned(thumb_rect));
+ canvas.drawRRect(thumb_rrect, thumb_fill_paint);
auto stroke_color = scrollbar.thumb_color.lightened();
SkPaint stroke_paint;
@@ -250,17 +234,12 @@ static void paint_scrollbar_into_surface(Gfx::PaintingSurface& surface, Scrollba
stroke_paint.setAntiAlias(true);
stroke_paint.setColor(to_skia_color(stroke_color));
stroke_paint.setAlphaf(stroke_paint.getAlphaf() * opacity);
- draw_thumb(stroke_paint);
+ canvas.drawRRect(thumb_rrect, stroke_paint);
}
-void DisplayListPlayerSkia::paint_scrollbar(Gfx::PaintingSurface& surface, ScrollbarController::PresentedScrollbar const& scrollbar, Gfx::IntRect const& corner_clip_rect, int corner_clip_radius)
+void DisplayListPlayerSkia::paint_scrollbar(Gfx::PaintingSurface& surface, ScrollbarController::PresentedScrollbar const& scrollbar)
{
- Optional<SkRRect> corner_clip;
- if (corner_clip_radius > 0) {
- auto radius = static_cast<SkScalar>(corner_clip_radius);
- corner_clip = SkRRect::MakeRectXY(to_skia_rect(corner_clip_rect), radius, radius);
- }
- paint_scrollbar_into_surface(surface, scrollbar, corner_clip);
+ paint_scrollbar_into_surface(surface, scrollbar);
}
static SkMatrix vertical_glyph_run_rotation(Gfx::IntRect const& rect)
diff --git a/Services/Compositor/DisplayListPlayerSkia.h b/Services/Compositor/DisplayListPlayerSkia.h
index cc990bd7956..5c603a8bd1d 100644
--- a/Services/Compositor/DisplayListPlayerSkia.h
+++ b/Services/Compositor/DisplayListPlayerSkia.h
@@ -54,8 +54,7 @@ public:
void flush(Gfx::PaintingSurface&) override;
void flush_async(Gfx::PaintingSurface&, Function<void()>&&);
- // A corner clip radius that is not zero shapes the thumb to the corner clip rect with that radius.
- void paint_scrollbar(Gfx::PaintingSurface&, ScrollbarController::PresentedScrollbar const&, Gfx::IntRect const& corner_clip_rect = {}, int corner_clip_radius = 0);
+ void paint_scrollbar(Gfx::PaintingSurface&, ScrollbarController::PresentedScrollbar const&);
private:
#define DECLARE_PLAY_COMMAND(command_type) \
diff --git a/Services/Compositor/PictureInPictureControls.cpp b/Services/Compositor/PictureInPictureControls.cpp
index 2a654787105..b3379e3e8d3 100644
--- a/Services/Compositor/PictureInPictureControls.cpp
+++ b/Services/Compositor/PictureInPictureControls.cpp
@@ -4,7 +4,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <AK/Span.h>
#include <Compositor/PaintingSurface.h>
#include <Compositor/PictureInPictureControls.h>
#include <Compositor/SkiaUtils.h>
@@ -15,46 +14,9 @@
namespace Compositor {
-// The icons are drawn on a grid of 24 units.
-static constexpr SkPoint back_to_tab_frame_outside[] = { { 3, 3 }, { 21, 3 }, { 21, 21 }, { 3, 21 } };
-static constexpr SkPoint back_to_tab_frame_inside[] = { { 5, 5 }, { 5, 19 }, { 19, 19 }, { 19, 5 } };
-static constexpr SkPoint back_to_tab_arrow[] = {
- { 16.6f, 6 },
- { 9, 13.6f },
- { 9, 9 },
- { 7, 9 },
- { 7, 17 },
- { 15, 17 },
- { 15, 15 },
- { 10.4f, 15 },
- { 18, 7.4f },
-};
-static constexpr SkPoint close_cross[] = {
- { 6.4f, 5 },
- { 12, 10.6f },
- { 17.6f, 5 },
- { 19, 6.4f },
- { 13.4f, 12 },
- { 19, 17.6f },
- { 17.6f, 19 },
- { 12, 13.4f },
- { 6.4f, 19 },
- { 5, 17.6f },
- { 10.6f, 12 },
- { 5, 6.4f },
-};
-
-static void add_polygon(SkPathBuilder& path, ReadonlySpan<SkPoint> points)
-{
- path.moveTo(points.first());
- for (auto const& point : points.slice(1))
- path.lineTo(point);
- path.close();
-}
-
void paint_picture_in_picture_controls(Gfx::PaintingSurface& surface, Gfx::IntSize viewport_size, double device_pixel_ratio, Compositing::PictureInPictureControlsState const& state, float opacity)
{
- static constexpr auto button_color = Color(0, 0, 0, 153);
+ static constexpr auto button_color = Color(0, 0, 0, 115);
static constexpr auto icon_color = Color(0xff, 0xff, 0xff);
static constexpr auto hovered_icon_color = Color(0xe0, 0xd4, 0xff);
@@ -66,29 +28,49 @@ void paint_picture_in_picture_controls(Gfx::PaintingSurface& surface, Gfx::IntSi
SkPaint paint;
paint.setAntiAlias(true);
- auto paint_button = [&](Gfx::IntRect const& button, Compositing::PictureInPictureControl control, SkPathBuilder& icon) {
+ // The icons are stroked on a grid of 16 units, and drawn at the given size in points.
+ auto paint_button = [&](Gfx::IntRect const& button, Compositing::PictureInPictureControl control, SkPathBuilder& icon, float icon_points, float stroke_units) {
auto center = button.to_type<float>().center();
+ paint.setStyle(SkPaint::kFill_Style);
paint.setColor(Gfx::to_skia_color(button_color));
canvas.drawCircle(center.x(), center.y(), button.width() / 2.0f, paint);
- auto icon_size = static_cast<float>(20 * device_pixel_ratio);
+ auto icon_size = static_cast<float>(icon_points * device_pixel_ratio);
canvas.save();
canvas.translate(center.x() - icon_size / 2, center.y() - icon_size / 2);
- canvas.scale(icon_size / 24, icon_size / 24);
+ canvas.scale(icon_size / 16, icon_size / 16);
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setStrokeWidth(stroke_units);
+ paint.setStrokeCap(SkPaint::kRound_Cap);
+ paint.setStrokeJoin(SkPaint::kRound_Join);
paint.setColor(Gfx::to_skia_color(state.hovered_control == control ? hovered_icon_color : icon_color));
canvas.drawPath(icon.detach(), paint);
canvas.restore();
};
- SkPathBuilder back_to_tab_icon { SkPathFillType::kEvenOdd };
- add_polygon(back_to_tab_icon, back_to_tab_frame_outside);
- add_polygon(back_to_tab_icon, back_to_tab_frame_inside);
- add_polygon(back_to_tab_icon, back_to_tab_arrow);
- paint_button(geometry.back_to_tab_button, Compositing::PictureInPictureControl::BackToTab, back_to_tab_icon);
+ // An arrow out of a box, toward its top right corner.
+ SkPathBuilder back_to_tab_icon;
+ back_to_tab_icon.moveTo(9.5f, 2.5f);
+ back_to_tab_icon.lineTo(13.5f, 2.5f);
+ back_to_tab_icon.lineTo(13.5f, 6.5f);
+ back_to_tab_icon.moveTo(13.5f, 2.5f);
+ back_to_tab_icon.lineTo(8, 8);
+ back_to_tab_icon.moveTo(12, 9.5f);
+ back_to_tab_icon.lineTo(12, 12.5f);
+ back_to_tab_icon.quadTo(12, 13.5f, 11, 13.5f);
+ back_to_tab_icon.lineTo(3.5f, 13.5f);
+ back_to_tab_icon.quadTo(2.5f, 13.5f, 2.5f, 12.5f);
+ back_to_tab_icon.lineTo(2.5f, 5);
+ back_to_tab_icon.quadTo(2.5f, 4, 3.5f, 4);
+ back_to_tab_icon.lineTo(6.5f, 4);
+ paint_button(geometry.back_to_tab_button, Compositing::PictureInPictureControl::BackToTab, back_to_tab_icon, 14, 1.6f);
SkPathBuilder close_icon;
- add_polygon(close_icon, close_cross);
- paint_button(geometry.close_button, Compositing::PictureInPictureControl::Close, close_icon);
+ close_icon.moveTo(4, 4);
+ close_icon.lineTo(12, 12);
+ close_icon.moveTo(12, 4);
+ close_icon.lineTo(4, 12);
+ paint_button(geometry.close_button, Compositing::PictureInPictureControl::Close, close_icon, 11, 2);
canvas.restore();
}
diff --git a/Services/Compositor/ScrollbarController.cpp b/Services/Compositor/ScrollbarController.cpp
index 349c215d166..b84b6051f79 100644
--- a/Services/Compositor/ScrollbarController.cpp
+++ b/Services/Compositor/ScrollbarController.cpp
@@ -499,7 +499,7 @@ bool ScrollbarController::paint(Gfx::PaintingSurface& surface, DisplayListPlayer
continue;
if (opacity(i) <= 0)
continue;
- display_list_player.paint_scrollbar(surface, presented_scrollbar(i, scroll_state_snapshot, scrollbar.thumb_color, scrollbar.track_color), scrollbar.corner_clip_rect, scrollbar.corner_clip_radius);
+ display_list_player.paint_scrollbar(surface, presented_scrollbar(i, scroll_state_snapshot, scrollbar.thumb_color, scrollbar.track_color));
painted_a_scrollbar = true;
}
return painted_a_scrollbar;
diff --git a/Services/WebContent/ConnectionFromClient.cpp b/Services/WebContent/ConnectionFromClient.cpp
index f2c427aa09b..2bc7634fd5f 100644
--- a/Services/WebContent/ConnectionFromClient.cpp
+++ b/Services/WebContent/ConnectionFromClient.cpp
@@ -3263,12 +3263,6 @@ void ConnectionFromClient::set_frame_rate_capped(Web::PageId page_id, bool cappe
page->set_frame_rate_capped(capped);
}
-void ConnectionFromClient::set_viewport_corner_radius(Web::PageId page_id, double radius)
-{
- if (auto page = this->page(page_id); page.has_value())
- page->set_viewport_corner_radius(radius);
-}
-
void ConnectionFromClient::set_window_position(Web::PageId page_id, Web::DevicePixelPoint position)
{
if (auto page = this->page(page_id); page.has_value())
diff --git a/Services/WebContent/ConnectionFromClient.h b/Services/WebContent/ConnectionFromClient.h
index e52a9b7ecaa..e7e653d33c7 100644
--- a/Services/WebContent/ConnectionFromClient.h
+++ b/Services/WebContent/ConnectionFromClient.h
@@ -262,7 +262,6 @@ private:
virtual void set_zoom_level(Web::PageId page_id, double zoom_level) override;
virtual void set_maximum_frames_per_second(Web::PageId page_id, double) override;
virtual void set_frame_rate_capped(Web::PageId page_id, bool) override;
- virtual void set_viewport_corner_radius(Web::PageId page_id, double) override;
virtual void set_window_position(Web::PageId page_id, Web::DevicePixelPoint) override;
virtual void set_window_size(Web::PageId page_id, Web::DevicePixelSize) override;
virtual void did_complete_window_rect_request(Web::PageId page_id, u64 completion_id) override;
diff --git a/Services/WebContent/PageClient.cpp b/Services/WebContent/PageClient.cpp
index 05f014e630f..40de7b9f511 100644
--- a/Services/WebContent/PageClient.cpp
+++ b/Services/WebContent/PageClient.cpp
@@ -878,20 +878,6 @@ void PageClient::inject_rendering_opportunity(double frame_time)
grant_rendering_opportunity(frame_time, Web::HTML::EventLoop::RenderingOpportunitySource::Manual);
}
-void PageClient::set_viewport_corner_radius(double radius)
-{
- static constexpr double maximum_viewport_corner_radius = 64;
- if (!isfinite(radius) || radius < 0)
- return;
- radius = min(radius, maximum_viewport_corner_radius);
- if (m_viewport_corner_radius == radius)
- return;
- m_viewport_corner_radius = radius;
-
- if (page().has_local_traversable())
- page().local_traversable()->viewport_corner_radius_did_change();
-}
-
void PageClient::set_maximum_frames_per_second(double maximum_frames_per_second)
{
if (!isfinite(maximum_frames_per_second) || maximum_frames_per_second <= 0)
@@ -2228,9 +2214,9 @@ void PageClient::received_message_from_web_ui(Utf16String const& name, JS::Value
m_web_ui->received_message_from_web_ui(name, data);
}
-void PageClient::page_did_block_resource()
+void PageClient::page_did_block_resource(URL::URL const& url, StringView kind)
{
- client().async_did_block_resource(id());
+ client().async_did_block_resource(id(), url, MUST(String::from_utf8(kind)));
}
void PageClient::page_did_start_network_request(u64 request_id, URL::URL const& url, ByteString const& method, Vector<HTTP::Header> const& request_headers, ReadonlyBytes request_body, Optional<String> initiator_type, String const& referrer_policy, bool is_navigation_request, Web::Fetch::Infrastructure::Request::Priority priority)
diff --git a/Services/WebContent/PageClient.h b/Services/WebContent/PageClient.h
index 36503b5c05b..37526aa609f 100644
--- a/Services/WebContent/PageClient.h
+++ b/Services/WebContent/PageClient.h
@@ -88,8 +88,6 @@ public:
void set_zoom_level(double zoom_level);
void set_maximum_frames_per_second(double maximum_frames_per_second);
void set_frame_rate_capped(bool capped) { m_frame_rate_capped = capped; }
- void set_viewport_corner_radius(double radius);
- virtual double viewport_corner_radius() const override { return m_viewport_corner_radius; }
virtual double maximum_frames_per_second() const override { return m_maximum_frames_per_second; }
void set_preferred_color_scheme(Web::CSS::PreferredColorScheme);
void set_preferred_contrast(Web::CSS::PreferredContrast);
@@ -381,7 +379,7 @@ private:
virtual void page_did_change_accessibility_tree() override;
virtual void page_did_take_screenshot(Gfx::ShareableBitmap const& screenshot) override;
virtual void received_message_from_web_ui(Utf16String const& name, JS::Value data) override;
- virtual void page_did_block_resource() override;
+ virtual void page_did_block_resource(URL::URL const&, StringView kind) override;
virtual void page_did_start_network_request(u64 request_id, URL::URL const&, ByteString const&, Vector<HTTP::Header> const&, ReadonlyBytes, Optional<String>, String const& referrer_policy, bool is_navigation_request, Web::Fetch::Infrastructure::Request::Priority) override;
virtual void page_did_receive_network_response_headers(u64 request_id, u32 status_code, Optional<String>, Vector<HTTP::Header> const&, Requests::CacheState) override;
virtual void page_did_receive_network_response_body(u64 request_id, ReadonlyBytes) override;
@@ -407,7 +405,6 @@ private:
double m_zoom_level { 1.0 };
double m_maximum_frames_per_second { 60.0 };
bool m_frame_rate_capped { false };
- double m_viewport_corner_radius { 0 };
Web::PageId m_id { 0 };
u64 m_next_delete_all_cookies_request_id { 1 };
u64 m_next_text_fragment_generation_id { 1 };
diff --git a/Services/WebContent/WebContentClient.ipc b/Services/WebContent/WebContentClient.ipc
index 302f0945680..abc96929415 100644
--- a/Services/WebContent/WebContentClient.ipc
+++ b/Services/WebContent/WebContentClient.ipc
@@ -286,7 +286,7 @@ endpoint WebContentClient routed by Web::PageId page_id
did_execute_js_console_input(Web::PageId page_id, JsonValue result) =|
did_output_js_console_message(Web::PageId page_id, WebView::ConsoleOutput console_output) =|
- did_block_resource(Web::PageId page_id) =|
+ did_block_resource(Web::PageId page_id, URL::URL url, String kind) =|
did_start_network_request(Web::PageId page_id, u64 request_id, URL::URL url, ByteString method, Vector<HTTP::Header> request_headers, ByteBuffer request_body, Optional<String> initiator_type, String referrer_policy, bool is_navigation_request, Web::Fetch::Infrastructure::RequestPriority priority) =|
did_receive_network_response_headers(Web::PageId page_id, u64 request_id, u32 status_code, Optional<String> reason_phrase, Vector<HTTP::Header> response_headers, Requests::CacheState cache_state) =|
did_receive_network_response_body(Web::PageId page_id, u64 request_id, ByteBuffer data) =|
diff --git a/Services/WebContent/WebContentServer.ipc b/Services/WebContent/WebContentServer.ipc
index e2fd68f3f6a..567ab05616c 100644
--- a/Services/WebContent/WebContentServer.ipc
+++ b/Services/WebContent/WebContentServer.ipc
@@ -268,7 +268,6 @@ endpoint WebContentServer routed by Web::PageId page_id
set_zoom_level(Web::PageId page_id, double zoom_level) =|
set_maximum_frames_per_second(Web::PageId page_id, double maximum_frames_per_second) =|
set_frame_rate_capped(Web::PageId page_id, bool capped) =|
- set_viewport_corner_radius(Web::PageId page_id, double radius) =|
set_window_position(Web::PageId page_id, Web::DevicePixelPoint position) =|
set_window_size(Web::PageId page_id, Web::DevicePixelSize size) =|
diff --git a/Tests/Compositor/TestScrollbarController.cpp b/Tests/Compositor/TestScrollbarController.cpp
index 2af190322d3..7efdb0d6595 100644
--- a/Tests/Compositor/TestScrollbarController.cpp
+++ b/Tests/Compositor/TestScrollbarController.cpp
@@ -65,8 +65,6 @@ static Compositor::ScrollbarController::Drag begin_scrollbar_drag(Gfx::Orientati
.track_rect = vertical ? Gfx::IntRect { 96, 0, 4, 100 } : Gfx::IntRect { 0, 96, 100, 4 },
.expanded_gutter_rect = vertical ? Gfx::IntRect { 92, 0, 8, 100 } : Gfx::IntRect { 0, 92, 100, 8 },
.expanded_thumb_rect = expanded_thumb_rect.value_or(vertical ? Gfx::IntRect { 94, 20, 6, 20 } : Gfx::IntRect { 20, 94, 20, 6 }),
- .corner_clip_rect = {},
- .corner_clip_radius = 0,
.scroll_size = 0.8,
.expanded_scroll_size = 0.8,
.min_scroll_offset = 0,
@@ -141,8 +139,6 @@ static Compositing::AsyncScrollbar scrollbar_painted_by_display_list(bool displa
.track_rect = { 96, 0, 4, 100 },
.expanded_gutter_rect = { 92, 0, 8, 100 },
.expanded_thumb_rect = { 94, 20, 6, 20 },
- .corner_clip_rect = {},
- .corner_clip_radius = 0,
.scroll_size = 0.8,
.expanded_scroll_size = 0.8,
.min_scroll_offset = 0,
diff --git a/Tests/LibCompositing/TestPictureInPictureControls.cpp b/Tests/LibCompositing/TestPictureInPictureControls.cpp
index 63d087a4b68..0243517de81 100644
--- a/Tests/LibCompositing/TestPictureInPictureControls.cpp
+++ b/Tests/LibCompositing/TestPictureInPictureControls.cpp
@@ -13,16 +13,16 @@ TEST_CASE(buttons_sit_in_the_top_corners)
{
auto geometry = picture_in_picture_controls_geometry({ 800, 600 }, 1.0);
- EXPECT_EQ(geometry.back_to_tab_button, (Gfx::IntRect { 8, 8, 28, 28 }));
- EXPECT_EQ(geometry.close_button, (Gfx::IntRect { 764, 8, 28, 28 }));
+ EXPECT_EQ(geometry.back_to_tab_button, (Gfx::IntRect { 762, 10, 28, 28 }));
+ EXPECT_EQ(geometry.close_button, (Gfx::IntRect { 10, 10, 28, 28 }));
}
TEST_CASE(geometry_scales_with_device_pixel_ratio)
{
auto geometry = picture_in_picture_controls_geometry({ 1600, 1200 }, 2.0);
- EXPECT_EQ(geometry.back_to_tab_button, (Gfx::IntRect { 16, 16, 56, 56 }));
- EXPECT_EQ(geometry.close_button, (Gfx::IntRect { 1528, 16, 56, 56 }));
+ EXPECT_EQ(geometry.back_to_tab_button, (Gfx::IntRect { 1524, 20, 56, 56 }));
+ EXPECT_EQ(geometry.close_button, (Gfx::IntRect { 20, 20, 56, 56 }));
}
TEST_CASE(controls_are_round)
diff --git a/Tests/LibWeb/Crash/HTML/navigation-error-page-for-url-without-host.html b/Tests/LibWeb/Crash/HTML/navigation-error-page-for-url-without-host.html
new file mode 100644
index 00000000000..a1684f90a84
--- /dev/null
+++ b/Tests/LibWeb/Crash/HTML/navigation-error-page-for-url-without-host.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<!-- A data: URL has no host, and the error page for one that fails to load must still name it. -->
+<html class="test-wait">
+<iframe id="target"></iframe>
+<script>
+ const iframe = document.getElementById("target");
+ iframe.onload = () => document.documentElement.classList.remove("test-wait");
+ iframe.src = "data:text/html;base64,%";
+</script>
+</html>
diff --git a/Tests/LibWeb/Layout/expected/PictureInPicture/placeholder-replaces-video-without-controls.txt b/Tests/LibWeb/Layout/expected/PictureInPicture/placeholder-replaces-video-without-controls.txt
index 847f840c703..3e333443afb 100644
--- a/Tests/LibWeb/Layout/expected/PictureInPicture/placeholder-replaces-video-without-controls.txt
+++ b/Tests/LibWeb/Layout/expected/PictureInPicture/placeholder-replaces-video-without-controls.txt
@@ -6,12 +6,19 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <(anonymous)> at [8,8] [0+0+0 854 0+0+0] [0+0+0 480 0+0+0] children: not-inline
BlockContainer <div.container.video.controls-hidden.picture-in-picture> at [8,8] positioned [0+0+0 854 0+0+0] [0+0+0 480 0+0+0] [BFC] children: not-inline
Box <div.picture-in-picture-placeholder> at [8,8] flex-container(column) [0+0+0 854 0+0+0] [0+0+0 480 0+0+0] [FFC] children: not-inline
- SVGSVGBox <svg.picture-in-picture-placeholder-icon> at [411,213] flex-item [0+0+0 48 0+0+0] [0+0+0 48 0+0+0] viewport-transform=[2 0 0 2 0 0] [SVG] children: not-inline
- SVGGeometryBox <path> at [2,4] [0+0+0 20 0+0+0] [0+0+0 16 0+0+0] children: not-inline
- BlockContainer <span> at [334.515625,269] flex-item [0+0+0 200.96875 0+0+0] [0+0+0 14 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 29, rect: [334.515625,269 200.96875x14] baseline: 11.203125
- "Playing in Picture-in-Picture"
+ SVGSVGBox <svg.picture-in-picture-placeholder-icon> at [415,195.5] flex-item [0+0+0 40 0+0+0] [0+0+0 30 0+0+0] viewport-transform=[1 0 0 1 0 0] [SVG] children: not-inline
+ SVGGeometryBox <rect.picture-in-picture-placeholder-frame> at [0,0] [0+0+0 40 0+0+0] [0+0+0 30 0+0+0] children: not-inline
+ SVGGeometryBox <rect.picture-in-picture-placeholder-window> at [20,15] [0+0+0 16 0+0+0] [0+0+0 11 0+0+0] children: not-inline
+ BlockContainer <span> at [329.3125,239.5] flex-item [0+0+0 211.375 0+0+0] [0+0+0 15 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 29, rect: [329.3125,239.5 211.375x15] baseline: 12
+ "Playing in picture-in-picture"
TextNode <#text> (not painted)
+ BlockContainer <button.exit-picture-in-picture-button> at [381.78125,268.5] flex-item [0+0+16 106.453125 16+0+0] [0+0+0 32 0+0+0] [BFC] children: not-inline
+ BlockContainer <(anonymous)> at [381.78125,268.5] flex-container(column) [0+0+0 106.453125 0+0+0] [0+0+0 32 0+0+0] [FFC] children: not-inline
+ BlockContainer <(anonymous)> at [381.78125,278] flex-item [0+0+0 106.453125 0+0+0] [0+0+0 13 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 16, rect: [381.78125,278 106.453125x13] baseline: 10.390625
+ "Bring video back"
+ TextNode <#text> (not painted)
TextNode <#text> (not painted)
TextNode <#text> (not painted)
diff --git a/Tests/LibWeb/Layout/expected/PictureInPicture/placeholder-stays-after-controls-are-removed.txt b/Tests/LibWeb/Layout/expected/PictureInPicture/placeholder-stays-after-controls-are-removed.txt
index 366337f49ec..f53265e7a89 100644
--- a/Tests/LibWeb/Layout/expected/PictureInPicture/placeholder-stays-after-controls-are-removed.txt
+++ b/Tests/LibWeb/Layout/expected/PictureInPicture/placeholder-stays-after-controls-are-removed.txt
@@ -6,12 +6,19 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <(anonymous)> at [8,8] [0+0+0 854 0+0+0] [0+0+0 480 0+0+0] children: not-inline
BlockContainer <div.container.video.picture-in-picture.controls-hidden> at [8,8] positioned [0+0+0 854 0+0+0] [0+0+0 480 0+0+0] [BFC] children: not-inline
Box <div.picture-in-picture-placeholder> at [8,8] flex-container(column) [0+0+0 854 0+0+0] [0+0+0 480 0+0+0] [FFC] children: not-inline
- SVGSVGBox <svg.picture-in-picture-placeholder-icon> at [411,213] flex-item [0+0+0 48 0+0+0] [0+0+0 48 0+0+0] viewport-transform=[2 0 0 2 0 0] [SVG] children: not-inline
- SVGGeometryBox <path> at [2,4] [0+0+0 20 0+0+0] [0+0+0 16 0+0+0] children: not-inline
- BlockContainer <span> at [334.515625,269] flex-item [0+0+0 200.96875 0+0+0] [0+0+0 14 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 29, rect: [334.515625,269 200.96875x14] baseline: 11.203125
- "Playing in Picture-in-Picture"
+ SVGSVGBox <svg.picture-in-picture-placeholder-icon> at [415,195.5] flex-item [0+0+0 40 0+0+0] [0+0+0 30 0+0+0] viewport-transform=[1 0 0 1 0 0] [SVG] children: not-inline
+ SVGGeometryBox <rect.picture-in-picture-placeholder-frame> at [0,0] [0+0+0 40 0+0+0] [0+0+0 30 0+0+0] children: not-inline
+ SVGGeometryBox <rect.picture-in-picture-placeholder-window> at [20,15] [0+0+0 16 0+0+0] [0+0+0 11 0+0+0] children: not-inline
+ BlockContainer <span> at [329.3125,239.5] flex-item [0+0+0 211.375 0+0+0] [0+0+0 15 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 29, rect: [329.3125,239.5 211.375x15] baseline: 12
+ "Playing in picture-in-picture"
TextNode <#text> (not painted)
+ BlockContainer <button.exit-picture-in-picture-button> at [381.78125,268.5] flex-item [0+0+16 106.453125 16+0+0] [0+0+0 32 0+0+0] [BFC] children: not-inline
+ BlockContainer <(anonymous)> at [381.78125,268.5] flex-container(column) [0+0+0 106.453125 0+0+0] [0+0+0 32 0+0+0] [FFC] children: not-inline
+ BlockContainer <(anonymous)> at [381.78125,278] flex-item [0+0+0 106.453125 0+0+0] [0+0+0 13 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 16, rect: [381.78125,278 106.453125x13] baseline: 10.390625
+ "Bring video back"
+ TextNode <#text> (not painted)
TextNode <#text> (not painted)
TextNode <#text> (not painted)
diff --git a/Tests/LibWeb/Layout/expected/PictureInPicture/placeholder-stays-when-controls-are-added.txt b/Tests/LibWeb/Layout/expected/PictureInPicture/placeholder-stays-when-controls-are-added.txt
index 17842aba66f..4676a34d9f8 100644
--- a/Tests/LibWeb/Layout/expected/PictureInPicture/placeholder-stays-when-controls-are-added.txt
+++ b/Tests/LibWeb/Layout/expected/PictureInPicture/placeholder-stays-when-controls-are-added.txt
@@ -6,13 +6,19 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <(anonymous)> at [8,8] [0+0+0 854 0+0+0] [0+0+0 480 0+0+0] children: not-inline
BlockContainer <div.container.video.picture-in-picture> at [8,8] positioned [0+0+0 854 0+0+0] [0+0+0 480 0+0+0] [BFC] children: not-inline
Box <div.picture-in-picture-placeholder> at [8,8] flex-container(column) [0+0+0 854 0+0+0] [0+0+0 480 0+0+0] [FFC] children: not-inline
- SVGSVGBox <svg.picture-in-picture-placeholder-icon> at [411,213] flex-item [0+0+0 48 0+0+0] [0+0+0 48 0+0+0] viewport-transform=[2 0 0 2 0 0] [SVG] children: not-inline
- SVGGeometryBox <path> at [2,4] [0+0+0 20 0+0+0] [0+0+0 16 0+0+0] children: not-inline
- BlockContainer <span> at [334.515625,269] flex-item [0+0+0 200.96875 0+0+0] [0+0+0 14 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 29, rect: [334.515625,269 200.96875x14] baseline: 11.203125
- "Playing in Picture-in-Picture"
+ SVGSVGBox <svg.picture-in-picture-placeholder-icon> at [415,195.5] flex-item [0+0+0 40 0+0+0] [0+0+0 30 0+0+0] viewport-transform=[1 0 0 1 0 0] [SVG] children: not-inline
+ SVGGeometryBox <rect.picture-in-picture-placeholder-frame> at [0,0] [0+0+0 40 0+0+0] [0+0+0 30 0+0+0] children: not-inline
+ SVGGeometryBox <rect.picture-in-picture-placeholder-window> at [20,15] [0+0+0 16 0+0+0] [0+0+0 11 0+0+0] children: not-inline
+ BlockContainer <span> at [329.3125,239.5] flex-item [0+0+0 211.375 0+0+0] [0+0+0 15 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 29, rect: [329.3125,239.5 211.375x15] baseline: 12
+ "Playing in picture-in-picture"
TextNode <#text> (not painted)
- Box <div.video-overlay> at [8,8] positioned flex-container(row) [0+0+0 854 0+0+0] [0+0+0 480 0+0+0] [FFC] children: not-inline
+ BlockContainer <button.exit-picture-in-picture-button> at [381.78125,268.5] flex-item [0+0+16 106.453125 16+0+0] [0+0+0 32 0+0+0] [BFC] children: not-inline
+ BlockContainer <(anonymous)> at [381.78125,268.5] flex-container(column) [0+0+0 106.453125 0+0+0] [0+0+0 32 0+0+0] [FFC] children: not-inline
+ BlockContainer <(anonymous)> at [381.78125,278] flex-item [0+0+0 106.453125 0+0+0] [0+0+0 13 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 16, rect: [381.78125,278 106.453125x13] baseline: 10.390625
+ "Bring video back"
+ TextNode <#text> (not painted)
Box <div.controls.visible> at [8,445] positioned flex-container(column) [0+0+0 854 0+0+0] [0+0+0 43 0+0+0] [FFC] children: not-inline
BlockContainer <div.timeline> at [8,445] flex-item [0+0+0 854 0+0+0] [-5+0+5 5 5+0+-5] [BFC] children: not-inline
BlockContainer <div.timeline-track> at [8,445] positioned [0+0+0 854 0+0+0] [0+0+0 5 0+0+0] children: not-inline
diff --git a/Tests/LibWeb/Text/input/navigation/error-page-after-failed-redirected-navigation.html b/Tests/LibWeb/Text/input/navigation/error-page-after-failed-redirected-navigation.html
index 7433b074369..d526f0cb3b3 100644
--- a/Tests/LibWeb/Text/input/navigation/error-page-after-failed-redirected-navigation.html
+++ b/Tests/LibWeb/Text/input/navigation/error-page-after-failed-redirected-navigation.html
@@ -24,14 +24,17 @@
// Bound the wait well inside the harness's 30-second per-test timeout — so a missing error page fails with a
// diagnosable message, instead of a bare test timeout.
const deadline = performance.now() + 15_000;
- while (!dumpContains("Failed to load")) {
+ while (!dumpContains("reach")) {
if (performance.now() > deadline)
throw new Error("Timed out waiting for the error page to appear in the layout dump");
await new Promise(resolve => setTimeout(resolve, 50));
}
- println(`error page names the redirect target that failed: ${dumpContains(failingURL)}`);
- println(`error page names the pre-redirect URL: ${dumpContains(redirectURL)}`);
+ // The page names the site it could not reach by its host and port, and the two URLs differ in their ports.
+ const failingSite = new URL(failingURL).host;
+ const redirectSite = new URL(redirectURL).host;
+ println(`error page names the redirect target that failed: ${dumpContains(failingSite)}`);
+ println(`error page names the pre-redirect URL: ${dumpContains(redirectSite)}`);
done();
});
</script>
diff --git a/Tests/LibWeb/test-webdriver-http-error-responses.py b/Tests/LibWeb/test-webdriver-http-error-responses.py
index 173b897ccec..b7e5e587dbe 100755
--- a/Tests/LibWeb/test-webdriver-http-error-responses.py
+++ b/Tests/LibWeb/test-webdriver-http-error-responses.py
@@ -150,7 +150,8 @@ def check_responses(webdriver_port, session_id, page_port):
expect(script("return [document.URL, window.origin, document.body.innerText];"), [url, origin, text])
def expect_error(url, status):
- state = script("return [document.URL, window.origin, document.body.innerText];")
+ # NB: The failed URL is in the error page's details, which are collapsed, so it isn't part of innerText.
+ state = script("return [document.URL, window.origin, document.body.textContent];")
if state[:2] != ["about:error", "null"] or f"HTTP error: {status}" not in state[2] or url not in state[2]:
raise AssertionError(f"Expected an HTTP {status} error document for {url}, got {state!r}")