Bug 265115 - Align 'moveTo' and 'moveBy' with Web-Specification (CSSOM View Extension to 'Window' Interface'
Summary: Align 'moveTo' and 'moveBy' with Web-Specification (CSSOM View Extension to '...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BrowserCompat, InRadar, WPTImpact
Depends on:
Blocks:
 
Reported: 2023-11-19 15:44 PST by Ahmad Saleem
Modified: 2023-11-20 19:16 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Saleem 2023-11-19 15:44:51 PST
Hi Team,

While looking into 'browser specific failures' on WPT, I noticed that we fail few test cases 'cssom-view\idlharness.html' around 'moveTo' and 'moveBy' (there are few more but it is better to tackle one by one - easier to revert in case of any issue):

WPT Test Case: https://wpt.fyi/results/css/cssom-view/idlharness.html?label=master&label=experimental&aligned&q=safari:fail

Web-Specification: https://www.w3.org/TR/cssom-view-1/#extensions-to-the-window-interface

By doing changes in 'LocalDOMWindow' and 'Source/WebCore/page/LocalDOMWindow+CSSOMView.idl', I was able to progress few of them but I am not sure whether it is intentional to hold-off so I just wanted to raise bug.

>> Source/WebCore/page/LocalDOMWindow+CSSOMView.idl:

From:

undefined moveTo(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: Parameters should be mandatory and of type long.
    undefined moveBy(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: Parameters should be mandatory and of type long.

To:

  undefined moveTo(long x, long y);
    undefined moveBy(long x, long y);

>> Source/WebCore/page/LocalDOMWindow.cpp (To):

void LocalDOMWindow::moveBy(int x, int y) const
{
    if (!allowedToChangeWindowGeometry())
        return;
    CheckedPtr page = frame()->page();
    auto fr = page->chrome().windowRect();
    auto update = fr;
    update.move(x, y);
    page->chrome().setWindowRect(adjustWindowRect(*page, update));
}
void LocalDOMWindow::moveTo(int x, int y) const
{
    if (!allowedToChangeWindowGeometry())
        return;
    CheckedPtr page = frame()->page();
    auto fr = page->chrome().windowRect();
    RefPtr localMainFrame = dynamicDowncast<LocalFrame>(page->mainFrame());
    if (!localMainFrame)
        return;
    auto sr = screenAvailableRect(localMainFrame->view());
    fr.setLocation(sr.location());
    auto update = fr;
    update.move(x, y);
    page->chrome().setWindowRect(adjustWindowRect(*page, update));
}

>> Source/WebCore/page/LocalDOMWindow.h (To):

void moveBy(int x, int y) const;
    void moveTo(int x, int y) const;

___

Just wanted to raise so I can get insight / plan. Adding 'BrowserCompat' tag since only WebKit / Safari is failing them and 'WPTImpact' because it has impact on WPT.

Thanks!
Comment 1 Ahmad Saleem 2023-11-20 18:23:24 PST
PR - https://github.com/WebKit/WebKit/pull/20750

All EWS green - just added 'merge-queue'.
Comment 2 EWS 2023-11-20 19:15:47 PST
Committed 270997@main (ec1d30359a7e): <https://commits.webkit.org/270997@main>

Reviewed commits have been landed. Closing PR #20750 and removing active labels.
Comment 3 Radar WebKit Bug Importer 2023-11-20 19:16:13 PST
<rdar://problem/118668830>