mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
LibWeb+WebContent: Convert BrowsingContext to new pixel units
This fixes a few glitches. We no longer give the page double the width it should have, and we mark the correct area of the page as needing repainting.
This commit is contained in:
parent
8fb7c32ec3
commit
affc8a22ca
23 changed files with 68 additions and 70 deletions
|
@ -116,7 +116,7 @@ float Length::to_px(Layout::Node const& layout_node) const
|
|||
|
||||
if (!layout_node.document().browsing_context())
|
||||
return 0;
|
||||
auto const& viewport_rect = layout_node.document().browsing_context()->viewport_rect();
|
||||
auto const& viewport_rect = layout_node.document().browsing_context()->viewport_rect().to_type<float>().to_type<int>();
|
||||
auto* root_element = layout_node.document().document_element();
|
||||
if (!root_element || !root_element->layout_node())
|
||||
return 0;
|
||||
|
|
|
@ -1440,7 +1440,7 @@ void StyleComputer::invalidate_rule_cache()
|
|||
Gfx::IntRect StyleComputer::viewport_rect() const
|
||||
{
|
||||
if (auto const* browsing_context = document().browsing_context())
|
||||
return browsing_context->viewport_rect();
|
||||
return browsing_context->viewport_rect().to_type<float>().to_type<int>();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -833,7 +833,7 @@ void Document::update_layout()
|
|||
if (!browsing_context())
|
||||
return;
|
||||
|
||||
auto viewport_rect = browsing_context()->viewport_rect();
|
||||
auto viewport_rect = browsing_context()->viewport_rect().to_type<float>();
|
||||
|
||||
if (!m_layout_root) {
|
||||
m_next_layout_node_serial_id = 0;
|
||||
|
@ -1724,7 +1724,7 @@ void Document::run_the_resize_steps()
|
|||
if (!browsing_context())
|
||||
return;
|
||||
|
||||
auto viewport_size = browsing_context()->viewport_rect().size();
|
||||
auto viewport_size = browsing_context()->viewport_rect().size().to_type<float>().to_type<int>();
|
||||
if (m_last_viewport_size == viewport_size)
|
||||
return;
|
||||
m_last_viewport_size = viewport_size;
|
||||
|
|
|
@ -664,7 +664,7 @@ int Element::client_width() const
|
|||
// return the viewport width excluding the size of a rendered scroll bar (if any).
|
||||
if ((is<HTML::HTMLHtmlElement>(*this) && !document().in_quirks_mode())
|
||||
|| (is<HTML::HTMLBodyElement>(*this) && document().in_quirks_mode())) {
|
||||
return document().browsing_context()->viewport_rect().width();
|
||||
return document().browsing_context()->viewport_rect().width().value();
|
||||
}
|
||||
|
||||
// NOTE: Ensure that layout is up-to-date before looking at metrics.
|
||||
|
@ -689,7 +689,7 @@ int Element::client_height() const
|
|||
// return the viewport height excluding the size of a rendered scroll bar (if any).
|
||||
if ((is<HTML::HTMLHtmlElement>(*this) && !document().in_quirks_mode())
|
||||
|| (is<HTML::HTMLBodyElement>(*this) && document().in_quirks_mode())) {
|
||||
return document().browsing_context()->viewport_rect().height();
|
||||
return document().browsing_context()->viewport_rect().height().value();
|
||||
}
|
||||
|
||||
// NOTE: Ensure that layout is up-to-date before looking at metrics.
|
||||
|
|
|
@ -316,7 +316,7 @@ void BrowsingContext::set_active_document(JS::NonnullGCPtr<DOM::Document> docume
|
|||
previously_active_document->did_stop_being_active_document_in_browsing_context({});
|
||||
}
|
||||
|
||||
void BrowsingContext::set_viewport_rect(Gfx::IntRect const& rect)
|
||||
void BrowsingContext::set_viewport_rect(CSSPixelRect const& rect)
|
||||
{
|
||||
bool did_change = false;
|
||||
|
||||
|
@ -345,7 +345,7 @@ void BrowsingContext::set_viewport_rect(Gfx::IntRect const& rect)
|
|||
HTML::main_thread_event_loop().schedule();
|
||||
}
|
||||
|
||||
void BrowsingContext::set_size(Gfx::IntSize size)
|
||||
void BrowsingContext::set_size(CSSPixelSize size)
|
||||
{
|
||||
if (m_size == size)
|
||||
return;
|
||||
|
@ -368,14 +368,14 @@ void BrowsingContext::set_needs_display()
|
|||
set_needs_display(viewport_rect());
|
||||
}
|
||||
|
||||
void BrowsingContext::set_needs_display(Gfx::IntRect const& rect)
|
||||
void BrowsingContext::set_needs_display(CSSPixelRect const& rect)
|
||||
{
|
||||
if (!viewport_rect().intersects(rect))
|
||||
return;
|
||||
|
||||
if (is_top_level()) {
|
||||
if (m_page)
|
||||
m_page->client().page_did_invalidate(to_top_level_rect(rect.to_type<CSSPixels>()));
|
||||
m_page->client().page_did_invalidate(to_top_level_rect(rect));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -383,13 +383,13 @@ void BrowsingContext::set_needs_display(Gfx::IntRect const& rect)
|
|||
container()->layout_node()->set_needs_display();
|
||||
}
|
||||
|
||||
void BrowsingContext::scroll_to(Gfx::IntPoint position)
|
||||
void BrowsingContext::scroll_to(CSSPixelPoint position)
|
||||
{
|
||||
if (active_document())
|
||||
active_document()->force_layout();
|
||||
|
||||
if (m_page)
|
||||
m_page->client().page_did_request_scroll_to(position.to_type<CSSPixels>());
|
||||
m_page->client().page_did_request_scroll_to(position);
|
||||
}
|
||||
|
||||
void BrowsingContext::scroll_to_anchor(DeprecatedString const& fragment)
|
||||
|
@ -419,15 +419,15 @@ void BrowsingContext::scroll_to_anchor(DeprecatedString const& fragment)
|
|||
|
||||
auto& layout_node = *element->layout_node();
|
||||
|
||||
Gfx::FloatRect float_rect { layout_node.box_type_agnostic_position(), { (float)viewport_rect().width(), (float)viewport_rect().height() } };
|
||||
CSSPixelRect target_rect { layout_node.box_type_agnostic_position(), { viewport_rect().width(), viewport_rect().height() } };
|
||||
if (is<Layout::Box>(layout_node)) {
|
||||
auto& layout_box = verify_cast<Layout::Box>(layout_node);
|
||||
auto padding_box = layout_box.box_model().padding_box();
|
||||
float_rect.translate_by(-padding_box.left, -padding_box.top);
|
||||
target_rect.translate_by(-padding_box.left, -padding_box.top);
|
||||
}
|
||||
|
||||
if (m_page)
|
||||
m_page->client().page_did_request_scroll_into_view(float_rect.to_type<CSSPixels>());
|
||||
m_page->client().page_did_request_scroll_into_view(target_rect);
|
||||
}
|
||||
|
||||
CSSPixelRect BrowsingContext::to_top_level_rect(CSSPixelRect const& a_rect)
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
class ViewportClient {
|
||||
public:
|
||||
virtual ~ViewportClient() = default;
|
||||
virtual void browsing_context_did_set_viewport_rect(Gfx::IntRect const&) = 0;
|
||||
virtual void browsing_context_did_set_viewport_rect(CSSPixelRect const&) = 0;
|
||||
};
|
||||
void register_viewport_client(ViewportClient&);
|
||||
void unregister_viewport_client(ViewportClient&);
|
||||
|
@ -134,15 +134,15 @@ public:
|
|||
Page* page() { return m_page; }
|
||||
Page const* page() const { return m_page; }
|
||||
|
||||
Gfx::IntSize size() const { return m_size; }
|
||||
void set_size(Gfx::IntSize);
|
||||
CSSPixelSize size() const { return m_size; }
|
||||
void set_size(CSSPixelSize);
|
||||
|
||||
void set_needs_display();
|
||||
void set_needs_display(Gfx::IntRect const&);
|
||||
void set_needs_display(CSSPixelRect const&);
|
||||
|
||||
Gfx::IntPoint viewport_scroll_offset() const { return m_viewport_scroll_offset; }
|
||||
Gfx::IntRect viewport_rect() const { return { m_viewport_scroll_offset, m_size }; }
|
||||
void set_viewport_rect(Gfx::IntRect const&);
|
||||
CSSPixelPoint viewport_scroll_offset() const { return m_viewport_scroll_offset; }
|
||||
CSSPixelRect viewport_rect() const { return { m_viewport_scroll_offset, m_size }; }
|
||||
void set_viewport_rect(CSSPixelRect const&);
|
||||
|
||||
FrameLoader& loader() { return m_loader; }
|
||||
FrameLoader const& loader() const { return m_loader; }
|
||||
|
@ -150,7 +150,7 @@ public:
|
|||
Web::EventHandler& event_handler() { return m_event_handler; }
|
||||
Web::EventHandler const& event_handler() const { return m_event_handler; }
|
||||
|
||||
void scroll_to(Gfx::IntPoint);
|
||||
void scroll_to(CSSPixelPoint);
|
||||
void scroll_to_anchor(DeprecatedString const&);
|
||||
|
||||
BrowsingContext& top_level_browsing_context()
|
||||
|
@ -297,8 +297,8 @@ private:
|
|||
Optional<HTML::Origin> m_creator_origin;
|
||||
|
||||
JS::GCPtr<HTML::BrowsingContextContainer> m_container;
|
||||
Gfx::IntSize m_size;
|
||||
Gfx::IntPoint m_viewport_scroll_offset;
|
||||
CSSPixelSize m_size;
|
||||
CSSPixelPoint m_viewport_scroll_offset;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsers.html#browsing-context
|
||||
JS::GCPtr<HTML::WindowProxy> m_window_proxy;
|
||||
|
|
|
@ -616,7 +616,7 @@ int Window::inner_width() const
|
|||
// The innerWidth attribute must return the viewport width including the size of a rendered scroll bar (if any),
|
||||
// or zero if there is no viewport.
|
||||
if (auto const* browsing_context = associated_document().browsing_context())
|
||||
return browsing_context->viewport_rect().width();
|
||||
return browsing_context->viewport_rect().width().value();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -626,7 +626,7 @@ int Window::inner_height() const
|
|||
// The innerHeight attribute must return the viewport height including the size of a rendered scroll bar (if any),
|
||||
// or zero if there is no viewport.
|
||||
if (auto const* browsing_context = associated_document().browsing_context())
|
||||
return browsing_context->viewport_rect().height();
|
||||
return browsing_context->viewport_rect().height().value();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -767,7 +767,7 @@ Optional<CSS::MediaFeatureValue> Window::query_media_feature(CSS::MediaFeatureID
|
|||
float Window::scroll_x() const
|
||||
{
|
||||
if (auto* page = this->page())
|
||||
return page->top_level_browsing_context().viewport_scroll_offset().x();
|
||||
return page->top_level_browsing_context().viewport_scroll_offset().x().value();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -775,7 +775,7 @@ float Window::scroll_x() const
|
|||
float Window::scroll_y() const
|
||||
{
|
||||
if (auto* page = this->page())
|
||||
return page->top_level_browsing_context().viewport_scroll_offset().y();
|
||||
return page->top_level_browsing_context().viewport_scroll_offset().y().value();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -823,7 +823,7 @@ int Window::screen_x() const
|
|||
// The screenX and screenLeft attributes must return the x-coordinate, relative to the origin of the Web-exposed screen area,
|
||||
// of the left of the client window as number of CSS pixels, or zero if there is no such thing.
|
||||
if (auto* page = this->page())
|
||||
return page->window_position().x();
|
||||
return page->window_position().x().value();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -833,7 +833,7 @@ int Window::screen_y() const
|
|||
// The screenY and screenTop attributes must return the y-coordinate, relative to the origin of the screen of the Web-exposed screen area,
|
||||
// of the top of the client window as number of CSS pixels, or zero if there is no such thing.
|
||||
if (auto* page = this->page())
|
||||
return page->window_position().y();
|
||||
return page->window_position().y().value();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -842,7 +842,7 @@ int Window::outer_width() const
|
|||
{
|
||||
// The outerWidth attribute must return the width of the client window. If there is no client window this attribute must return zero.
|
||||
if (auto* page = this->page())
|
||||
return page->window_size().width();
|
||||
return page->window_size().width().value();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -851,7 +851,7 @@ int Window::outer_height() const
|
|||
{
|
||||
// The outerHeight attribute must return the height of the client window. If there is no client window this attribute must return zero.
|
||||
if (auto* page = this->page())
|
||||
return page->window_size().height();
|
||||
return page->window_size().height().value();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1703,7 +1703,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::scroll)
|
|||
return JS::js_undefined();
|
||||
auto& page = *impl->page();
|
||||
|
||||
auto viewport_rect = page.top_level_browsing_context().viewport_rect();
|
||||
auto viewport_rect = page.top_level_browsing_context().viewport_rect().to_type<float>();
|
||||
auto x_value = JS::Value(viewport_rect.x());
|
||||
auto y_value = JS::Value(viewport_rect.y());
|
||||
DeprecatedString behavior_string = "auto";
|
||||
|
@ -1778,9 +1778,9 @@ JS_DEFINE_NATIVE_FUNCTION(Window::scroll_by)
|
|||
left = JS::Value(left).is_finite_number() ? left : 0.0;
|
||||
top = JS::Value(top).is_finite_number() ? top : 0.0;
|
||||
|
||||
auto current_scroll_position = page.top_level_browsing_context().viewport_scroll_offset();
|
||||
left = left + current_scroll_position.x();
|
||||
top = top + current_scroll_position.y();
|
||||
auto current_scroll_position = page.top_level_browsing_context().viewport_scroll_offset().to_type<float>();
|
||||
left = left + static_cast<double>(current_scroll_position.x());
|
||||
top = top + static_cast<double>(current_scroll_position.y());
|
||||
|
||||
auto behavior_string_value = TRY(options->get("behavior"));
|
||||
auto behavior_string = behavior_string_value.is_undefined() ? "auto" : TRY(behavior_string_value.to_string(vm));
|
||||
|
|
|
@ -676,7 +676,7 @@ static void measure_scrollable_overflow(LayoutState const& state, Box const& box
|
|||
|
||||
void BlockFormattingContext::layout_initial_containing_block(LayoutMode layout_mode, AvailableSpace const& available_space)
|
||||
{
|
||||
auto viewport_rect = root().browsing_context().viewport_rect();
|
||||
auto viewport_rect = root().browsing_context().viewport_rect().to_type<float>();
|
||||
|
||||
auto& icb = verify_cast<Layout::InitialContainingBlock>(root());
|
||||
auto& icb_state = m_state.get_mutable(icb);
|
||||
|
|
|
@ -31,9 +31,8 @@ Box::~Box()
|
|||
|
||||
void Box::set_needs_display()
|
||||
{
|
||||
// FIXME: Make `set_needs_display` take CSSPixels
|
||||
if (paint_box())
|
||||
browsing_context().set_needs_display(enclosing_int_rect(paint_box()->absolute_rect().to_type<float>()));
|
||||
browsing_context().set_needs_display(paint_box()->absolute_rect());
|
||||
}
|
||||
|
||||
bool Box::is_body() const
|
||||
|
|
|
@ -33,8 +33,7 @@ void FrameBox::did_set_rect()
|
|||
ReplacedBox::did_set_rect();
|
||||
|
||||
VERIFY(dom_node().nested_browsing_context());
|
||||
// FIXME: Pass CSSPixels here instead of int.
|
||||
dom_node().nested_browsing_context()->set_size(paint_box()->content_size().to_type<float>().to_type<int>());
|
||||
dom_node().nested_browsing_context()->set_size(paint_box()->content_size());
|
||||
}
|
||||
|
||||
RefPtr<Painting::Paintable> FrameBox::create_paintable() const
|
||||
|
|
|
@ -92,9 +92,9 @@ bool ImageBox::renders_as_alt_text() const
|
|||
return false;
|
||||
}
|
||||
|
||||
void ImageBox::browsing_context_did_set_viewport_rect(Gfx::IntRect const& viewport_rect)
|
||||
void ImageBox::browsing_context_did_set_viewport_rect(CSSPixelRect const& viewport_rect)
|
||||
{
|
||||
m_image_loader.set_visible_in_viewport(paint_box() && viewport_rect.to_type<CSSPixels>().intersects(paint_box()->absolute_rect()));
|
||||
m_image_loader.set_visible_in_viewport(paint_box() && viewport_rect.intersects(paint_box()->absolute_rect()));
|
||||
}
|
||||
|
||||
RefPtr<Painting::Paintable> ImageBox::create_paintable() const
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
private:
|
||||
// ^BrowsingContext::ViewportClient
|
||||
virtual void browsing_context_did_set_viewport_rect(Gfx::IntRect const&) final;
|
||||
virtual void browsing_context_did_set_viewport_rect(CSSPixelRect const&) final;
|
||||
|
||||
// ^JS::Cell
|
||||
virtual void finalize() override;
|
||||
|
|
|
@ -158,7 +158,7 @@ void Node::set_needs_display()
|
|||
return;
|
||||
containing_block->paint_box()->for_each_fragment([&](auto& fragment) {
|
||||
if (&fragment.layout_node() == this || is_ancestor_of(fragment.layout_node())) {
|
||||
browsing_context().set_needs_display(fragment.absolute_rect().template to_type<float>().template to_type<int>());
|
||||
browsing_context().set_needs_display(fragment.absolute_rect());
|
||||
}
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
|
|
@ -799,7 +799,7 @@ CSSPixelPoint EventHandler::compute_mouse_event_client_offset(CSSPixelPoint even
|
|||
// The clientX attribute must return the x-coordinate of the position where the event occurred relative to the origin of the viewport.
|
||||
|
||||
auto scroll_offset = m_browsing_context.viewport_scroll_offset();
|
||||
return event_page_position.translated(-scroll_offset.to_rounded<CSSPixels>());
|
||||
return event_page_position.translated(-scroll_offset);
|
||||
}
|
||||
|
||||
CSSPixelPoint EventHandler::compute_mouse_event_page_offset(CSSPixelPoint event_client_offset) const
|
||||
|
@ -811,6 +811,6 @@ CSSPixelPoint EventHandler::compute_mouse_event_page_offset(CSSPixelPoint event_
|
|||
auto scroll_offset = m_browsing_context.viewport_scroll_offset();
|
||||
|
||||
// 3. Return the sum of offset and the value of the event’s clientX attribute.
|
||||
return event_client_offset.translated(scroll_offset.to_rounded<CSSPixels>());
|
||||
return event_client_offset.translated(scroll_offset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,11 +87,11 @@ public:
|
|||
bool is_webdriver_active() const { return m_is_webdriver_active; }
|
||||
void set_is_webdriver_active(bool b) { m_is_webdriver_active = b; }
|
||||
|
||||
Gfx::IntPoint window_position() const { return m_window_position; }
|
||||
void set_window_position(Gfx::IntPoint position) { m_window_position = position; }
|
||||
DevicePixelPoint window_position() const { return m_window_position; }
|
||||
void set_window_position(DevicePixelPoint position) { m_window_position = position; }
|
||||
|
||||
Gfx::IntSize window_size() const { return m_window_size; }
|
||||
void set_window_size(Gfx::IntSize size) { m_window_size = size; }
|
||||
DevicePixelSize window_size() const { return m_window_size; }
|
||||
void set_window_size(DevicePixelSize size) { m_window_size = size; }
|
||||
|
||||
void did_request_alert(DeprecatedString const& message);
|
||||
void alert_closed();
|
||||
|
@ -131,8 +131,8 @@ private:
|
|||
// The webdriver-active flag is set to true when the user agent is under remote control. It is initially false.
|
||||
bool m_is_webdriver_active { false };
|
||||
|
||||
Gfx::IntPoint m_window_position {};
|
||||
Gfx::IntSize m_window_size {};
|
||||
DevicePixelPoint m_window_position {};
|
||||
DevicePixelSize m_window_size {};
|
||||
|
||||
PendingDialog m_pending_dialog { PendingDialog::None };
|
||||
Optional<DeprecatedString> m_pending_dialog_text;
|
||||
|
|
|
@ -128,7 +128,7 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
|
|||
// Attachment and Origin
|
||||
switch (layer.attachment) {
|
||||
case CSS::BackgroundAttachment::Fixed:
|
||||
background_positioning_area = layout_node.root().browsing_context().viewport_rect().to_type<CSSPixels>();
|
||||
background_positioning_area = layout_node.root().browsing_context().viewport_rect();
|
||||
break;
|
||||
case CSS::BackgroundAttachment::Local:
|
||||
case CSS::BackgroundAttachment::Scroll:
|
||||
|
|
|
@ -53,7 +53,7 @@ void NestedBrowsingContextPaintable::paint(PaintContext& context, PaintPhase pha
|
|||
context.painter().add_clip_rect(clip_rect.to_type<int>());
|
||||
context.painter().translate(absolute_rect.x().value(), absolute_rect.y().value());
|
||||
|
||||
context.set_device_viewport_rect({ {}, layout_box().dom_node().nested_browsing_context()->size() });
|
||||
context.set_device_viewport_rect({ {}, context.enclosing_device_size(layout_box().dom_node().nested_browsing_context()->size()) });
|
||||
const_cast<Layout::InitialContainingBlock*>(hosted_layout_tree)->paint_all_phases(context);
|
||||
|
||||
context.set_device_viewport_rect(old_viewport_rect);
|
||||
|
|
|
@ -55,7 +55,7 @@ Response capture_element_screenshot(Painter const& painter, Page& page, DOM::Ele
|
|||
|
||||
element.document().window().animation_frame_callback_driver().add([&](auto) {
|
||||
auto viewport_rect = page.top_level_browsing_context().viewport_rect();
|
||||
rect.intersect(viewport_rect);
|
||||
rect.intersect(page.enclosing_device_rect(viewport_rect).to_type<int>());
|
||||
|
||||
auto canvas_element = DOM::create_element(element.document(), HTML::TagNames::canvas, Namespace::HTML);
|
||||
auto& canvas = verify_cast<HTML::HTMLCanvasElement>(*canvas_element);
|
||||
|
|
|
@ -112,7 +112,7 @@ void ConnectionFromClient::load_html(DeprecatedString const& html, const URL& ur
|
|||
void ConnectionFromClient::set_viewport_rect(Gfx::IntRect const& rect)
|
||||
{
|
||||
dbgln_if(SPAM_DEBUG, "handle: WebContentServer::SetViewportRect: rect={}", rect);
|
||||
m_page_host->set_viewport_rect(rect);
|
||||
m_page_host->set_viewport_rect(rect.to_type<Web::DevicePixels>());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::add_backing_store(i32 backing_store_id, Gfx::ShareableBitmap const& bitmap)
|
||||
|
@ -532,12 +532,12 @@ void ConnectionFromClient::set_is_scripting_enabled(bool is_scripting_enabled)
|
|||
|
||||
void ConnectionFromClient::set_window_position(Gfx::IntPoint position)
|
||||
{
|
||||
m_page_host->set_window_position(position);
|
||||
m_page_host->set_window_position(position.to_type<Web::DevicePixels>());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_window_size(Gfx::IntSize size)
|
||||
{
|
||||
m_page_host->set_window_size(size);
|
||||
m_page_host->set_window_size(size.to_type<Web::DevicePixels>());
|
||||
}
|
||||
|
||||
Messages::WebContentServer::GetLocalStorageEntriesResponse ConnectionFromClient::get_local_storage_entries()
|
||||
|
|
|
@ -79,12 +79,12 @@ void PageHost::set_is_scripting_enabled(bool is_scripting_enabled)
|
|||
page().set_is_scripting_enabled(is_scripting_enabled);
|
||||
}
|
||||
|
||||
void PageHost::set_window_position(Gfx::IntPoint position)
|
||||
void PageHost::set_window_position(Web::DevicePixelPoint position)
|
||||
{
|
||||
page().set_window_position(position);
|
||||
}
|
||||
|
||||
void PageHost::set_window_size(Gfx::IntSize size)
|
||||
void PageHost::set_window_size(Web::DevicePixelSize size)
|
||||
{
|
||||
page().set_window_size(size);
|
||||
}
|
||||
|
@ -125,9 +125,9 @@ void PageHost::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& targ
|
|||
layout_root->paint_all_phases(context);
|
||||
}
|
||||
|
||||
void PageHost::set_viewport_rect(Gfx::IntRect const& rect)
|
||||
void PageHost::set_viewport_rect(Web::DevicePixelRect const& rect)
|
||||
{
|
||||
page().top_level_browsing_context().set_viewport_rect(rect);
|
||||
page().top_level_browsing_context().set_viewport_rect(page().device_to_css_rect(rect));
|
||||
}
|
||||
|
||||
void PageHost::page_did_invalidate(Web::CSSPixelRect const& content_rect)
|
||||
|
|
|
@ -30,15 +30,15 @@ public:
|
|||
virtual void paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap&) override;
|
||||
|
||||
void set_palette_impl(Gfx::PaletteImpl const&);
|
||||
void set_viewport_rect(Gfx::IntRect const&);
|
||||
void set_viewport_rect(Web::DevicePixelRect const&);
|
||||
void set_screen_rects(Vector<Gfx::IntRect, 4> const& rects, size_t main_screen_index) { m_screen_rect = rects[main_screen_index].to_type<Web::DevicePixels>(); }
|
||||
void set_screen_display_scale(float device_pixels_per_css_pixel) { m_screen_display_scale = device_pixels_per_css_pixel; }
|
||||
void set_preferred_color_scheme(Web::CSS::PreferredColorScheme);
|
||||
void set_should_show_line_box_borders(bool b) { m_should_show_line_box_borders = b; }
|
||||
void set_has_focus(bool);
|
||||
void set_is_scripting_enabled(bool);
|
||||
void set_window_position(Gfx::IntPoint);
|
||||
void set_window_size(Gfx::IntSize);
|
||||
void set_window_position(Web::DevicePixelPoint);
|
||||
void set_window_size(Web::DevicePixelSize);
|
||||
|
||||
Web::DevicePixelSize content_size() const { return m_content_size; }
|
||||
|
||||
|
|
|
@ -606,7 +606,7 @@ Messages::WebDriverClient::SetWindowRectResponse WebDriverConnection::set_window
|
|||
auto size = m_page_client.page_did_request_resize_window({ *width, *height });
|
||||
window_rect.set_size(size);
|
||||
} else {
|
||||
window_rect.set_size(m_page_client.page().window_size());
|
||||
window_rect.set_size(m_page_client.page().window_size().to_type<int>());
|
||||
}
|
||||
|
||||
// 12. If x and y are not null:
|
||||
|
@ -615,7 +615,7 @@ Messages::WebDriverClient::SetWindowRectResponse WebDriverConnection::set_window
|
|||
auto position = m_page_client.page_did_request_reposition_window({ *x, *y });
|
||||
window_rect.set_location(position);
|
||||
} else {
|
||||
window_rect.set_location(m_page_client.page().window_position());
|
||||
window_rect.set_location(m_page_client.page().window_position().to_type<int>());
|
||||
}
|
||||
|
||||
// 14. Return success with data set to the WindowRect object for the current top-level browsing context.
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
|
||||
void set_viewport_rect(Gfx::IntRect viewport_rect)
|
||||
{
|
||||
page().top_level_browsing_context().set_viewport_rect(viewport_rect);
|
||||
page().top_level_browsing_context().set_viewport_rect(page().device_to_css_rect(viewport_rect.to_type<Web::DevicePixels>()));
|
||||
}
|
||||
|
||||
void set_screen_rect(Web::DevicePixelRect screen_rect)
|
||||
|
|
Loading…
Add table
Reference in a new issue