10BC0 `ScreenY` and `outerHeight` ignores the title bar height · Issue #37824 · servo/servo · GitHub
[go: up one dir, main page]

Skip to content

ScreenY and outerHeight ignores the title bar height #37824

@yezhizhen

Description

@yezhizhen

Describe the bug:
Right now, this is done in Script like following:

// https://drafts.csswg.org/cssom-view/#dom-window-screeny
fn ScreenY(&self) -> i32 {
let (_, origin) = self.client_window();
origin.y
}

It sends the request to compositor, who ignores the toolbar height etc., giving inaccurate result.
For details, see #37812 (review)

To Reproduce:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
    <button id="logButton">Log Screen Info</button>

    <script>
        document.getElementById('logButton').addEventListener('click', function() {
            console.log('ScreenX:', window.screenX);
            console.log('ScreenY:', window.screenY);
            console.log('OuterWidth:', window.outerWidth);
            console.log('OuterHeight:', window.outerHeight);
        });
    </script>
</body>
</html>

Platform:
All.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0