Skip to content

servoshell: Flip width and height to correct order - #46477

Merged
sagudev merged 1 commit into
servo:mainfrom
janeoa:flipped-resize
Jul 13, 2026
Merged

servoshell: Flip width and height to correct order#46477
sagudev merged 1 commit into
servo:mainfrom
janeoa:flipped-resize

Conversation

@janeoa

@janeoa janeoa commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

When setting window size to 800x600 using webdriver, the final size became 765x635. Which is weird.

Turns out, in the headed_window.rs

fn request_resize(&self, _: &WebView, new_outer_size: DeviceIntSize) -> Option<DeviceIntSize> {
        ...
        let decoration_size: DeviceIntSize = Size2D::new(
            outer_size.height - inner_size.height,
            outer_size.width - inner_size.width,
        )
        .cast();

The Size2D::new(... is flipped

as it expects

/// A 2d size tagged with a unit.
#[repr(C)]
pub struct Size2D<T, U> {
    /// The extent of the element in the `U` units along the `x` axis (usually horizontal).
    pub width: T,
    /// The extent of the element in the `U` units along the `y` axis (usually vertical).
    pub height: T,
    #[doc(hidden)]
    pub _unit: PhantomData<U>,
}

Testing: I have a python scenario that I did not add, but can do upon request.

Signed-off-by: janeoa <5373400+janeoa@users.noreply.github.com>
@janeoa
janeoa requested a review from atbrakhi as a code owner July 13, 2026 15:45
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jul 13, 2026
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Jul 13, 2026
@sagudev
sagudev added this pull request to the merge queue Jul 13, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 13, 2026
Merged via the queue into servo:main with commit 023f08b Jul 13, 2026
34 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants