mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
libservo: Start moving WindowMethods
to WebViewDelegate
(#36223)
`WindowMethods` is used by the embedding layer to get information from the embedder. This change moves the functionality for getting screen size and `WebView` offsets to `WebViewDelegate`. This is important because `WebView`s might be on different screens or have different offsets on the screen itself, so it makes sense for this to be per-`WebView` and not global to the embedder. HiDPI and animation state functionality will move to the embedder in subsequent changes. Signed-off-by: Martin Robinson <mrobinson@igalia.com> <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because they just modify the `WebView` API surface a bit. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
520a7f7bc5
commit
b925c31424
17 changed files with 235 additions and 183 deletions
|
@ -23,6 +23,7 @@ use webrender_api::units::{DeviceIntPoint, DevicePoint, DeviceRect, LayoutVector
|
|||
use webrender_api::{
|
||||
ExternalScrollId, HitTestFlags, RenderReasons, SampledScrollOffset, ScrollLocation,
|
||||
};
|
||||
use webrender_traits::RendererWebView;
|
||||
|
||||
use crate::IOCompositor;
|
||||
use crate::compositor::{PipelineDetails, ServoRenderer};
|
||||
|
@ -50,6 +51,10 @@ enum ScrollZoomEvent {
|
|||
pub(crate) struct WebView {
|
||||
/// The [`WebViewId`] of the `WebView` associated with this [`WebViewDetails`].
|
||||
pub id: WebViewId,
|
||||
/// The renderer's view of the embedding layer `WebView` as a trait implementation,
|
||||
/// so that the renderer doesn't need to depend on the embedding layer. This avoids
|
||||
/// a dependency cycle.
|
||||
pub renderer_webview: Box<dyn RendererWebView>,
|
||||
/// The root [`PipelineId`] of the currently displayed page in this WebView.
|
||||
pub root_pipeline_id: Option<PipelineId>,
|
||||
pub rect: DeviceRect,
|
||||
|
@ -73,9 +78,14 @@ impl Drop for WebView {
|
|||
}
|
||||
|
||||
impl WebView {
|
||||
pub(crate) fn new(id: WebViewId, rect: DeviceRect, global: Rc<RefCell<ServoRenderer>>) -> Self {
|
||||
pub(crate) fn new(
|
||||
renderer_webview: Box<dyn RendererWebView>,
|
||||
rect: DeviceRect,
|
||||
global: Rc<RefCell<ServoRenderer>>,
|
||||
) -> Self {
|
||||
Self {
|
||||
id,
|
||||
id: renderer_webview.id(),
|
||||
renderer_webview,
|
||||
root_pipeline_id: None,
|
||||
rect,
|
||||
pipelines: Default::default(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue