mirror of
https://github.com/servo/servo.git
synced 2025-08-23 14:25:33 +01:00
[OH] Provide correct geometry offset and fix available screen dimensions (#36915)
This commit corrects the geometry details provided under the OH platform by getting the offset from the OS. OH port provides correct offset and available space. Fixes: #36466 --------- Signed-off-by: Astraea Quinn Skoutelli <astraea.quinn.skoutelli@huawei.com> Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com> Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
This commit is contained in:
parent
2aaf9695df
commit
366515f256
3 changed files with 47 additions and 6 deletions
|
@ -38,6 +38,14 @@ impl Coordinates {
|
|||
viewport: Rect::new(Point2D::new(x, y), Size2D::new(width, height)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn origin(&self) -> Point2D<i32, DevicePixel> {
|
||||
self.viewport.origin
|
||||
}
|
||||
|
||||
pub fn size(&self) -> Size2D<i32, DevicePixel> {
|
||||
self.viewport.size
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct ServoWindowCallbacks {
|
||||
|
@ -115,11 +123,13 @@ impl ServoDelegate for ServoShellServoDelegate {
|
|||
impl WebViewDelegate for RunningAppState {
|
||||
fn screen_geometry(&self, _webview: WebView) -> Option<ScreenGeometry> {
|
||||
let coord = self.callbacks.coordinates.borrow();
|
||||
let screen_size = DeviceIntSize::new(coord.viewport.size.width, coord.viewport.size.height);
|
||||
let offset = coord.origin();
|
||||
let available_size = coord.size();
|
||||
let screen_size = coord.size();
|
||||
Some(ScreenGeometry {
|
||||
size: screen_size,
|
||||
available_size: screen_size,
|
||||
offset: Point2D::zero(),
|
||||
available_size,
|
||||
offset,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue