Bug 250800

Summary: Fix moveTo to not use screenAvailableRect as an origin but as a boundary
Product: WebKit Reporter: Ahmad Saleem <ahmad.saleem792>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bfulgham, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=21413

Description Ahmad Saleem 2023-01-18 15:39:59 PST
Hi Team,

While going through Blink's commit, I came across another failing tests (where all browsers are failing few tests but Safari is failing more than others):

Test Case - https://jsfiddle.net/84rogcy7/show

^ Safari 16.2 & STP 161 are failing:

Testing - xxx with 0 arguments & Testing - xxx with with 1 argument where it suppose to throw exception, it is throwing undefined. While Chrome Canary 111 and Firefox Nightly 111 passes these.

All browsers are failing two arguments tests.

Blink Commit - https://chromium.googlesource.com/chromium/blink/+/f7557ab98c0e2bb380f9bfc6355666434c6e481f

WebKit Source - https://searchfox.org/wubkat/source/Source/WebCore/page/DOMWindow.cpp#1813

Just wanted to raise to get input and whether it is good to fix at least 0 and 1 argument cases to match other browsers.

Thanks!
Comment 1 Radar WebKit Bug Importer 2023-01-25 15:40:18 PST
<rdar://problem/104670843>
Comment 2 Ahmad Saleem 2023-11-28 15:04:02 PST
This compiles:

void LocalDOMWindow::moveTo(int x, int y) const
{
    if (!allowedToChangeWindowGeometry())
        return;
    CheckedPtr page = frame()->page();
    auto update = page->chrome().windowRect();
    RefPtr localMainFrame = dynamicDowncast<LocalFrame>(page->mainFrame());
    if (!localMainFrame)
        return;
    update.setLocation(LayoutPoint(x, y));
    page->chrome().setWindowRect(adjustWindowRect(*page, update));
}
Comment 3 Ahmad Saleem 2024-01-11 15:06:43 PST
(In reply to Ahmad Saleem from comment #2)
> This compiles:
> 
> void LocalDOMWindow::moveTo(int x, int y) const
> {
>     if (!allowedToChangeWindowGeometry())
>         return;
>     CheckedPtr page = frame()->page();
>     auto update = page->chrome().windowRect();
>     RefPtr localMainFrame = dynamicDowncast<LocalFrame>(page->mainFrame());
>     if (!localMainFrame)
>         return;
>     update.setLocation(LayoutPoint(x, y));
>     page->chrome().setWindowRect(adjustWindowRect(*page, update));
> }

This is updated:

void LocalDOMWindow::moveTo(int x, int y) const
{
    if (!allowedToChangeWindowGeometry())
        return;

    RefPtr page = frame()->page();
    auto update = page->chrome().windowRect();
    RefPtr localMainFrame = dynamicDowncast<LocalFrame>(page->mainFrame());
    if (!localMainFrame)
        return;

    update.setLocation(LayoutPoint(x, y));
    page->chrome().setWindowRect(adjustWindowRect(*page, update));
}