The test was only passing by sheer happenstance (FrameView's pagination is the CSS one, so it was set to Unpaginated, so the totally-broken logic happened to cause the clamping not to happen). So, use both FrameView's and Page's. And fix the logic (we wanted to NOT clamp in the pagination case).
Also, I found ways (with RTL text) that even left-to-right and top-to-bottom pagination can be broken here, so expand to all "pagination enabled" non-0-scrollOrigin states.
Also, the test was broken because DrawingAreaImpl doesn't know what to do with a 40000 px wide view (and just asserts in SharedMemory code and thus makes the test time out). And DidFirstPaintAfterSuppressedIncrementalRendering doesn't fire if the window is offscreen. And EXPECT_JS_EQ is pretty cool.
Basically, rewrite the patch. It deserves it.
Created attachment 206179 [details]