Bug 183040 - Separate paint and scroll offsets for RenderLayerBacking::m_scrollingContentsLayer
Summary: Separate paint and scroll offsets for RenderLayerBacking::m_scrollingContents...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Frédéric Wang (:fredw)
URL:
Keywords: InRadar
Depends on:
Blocks: 182868
  Show dependency treegraph
 
Reported: 2018-02-22 08:49 PST by Frédéric Wang (:fredw)
Modified: 2018-11-29 22:36 PST (History)
7 users (show)

See Also:


Attachments
Patch (13.62 KB, patch)
2018-02-22 08:54 PST, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Patch (13.56 KB, patch)
2018-05-09 23:33 PDT, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Patch (13.61 KB, patch)
2018-09-05 07:02 PDT, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Patch (13.61 KB, patch)
2018-11-15 07:06 PST, Frédéric Wang (:fredw)
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews123 for ios-simulator-wk2 (2.79 MB, application/zip)
2018-11-15 09:13 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews126 for ios-simulator-wk2 (2.92 MB, application/zip)
2018-11-15 11:00 PST, EWS Watchlist
no flags Details
Patch (15.52 KB, patch)
2018-11-20 05:39 PST, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Patch (18.68 KB, patch)
2018-11-22 06:45 PST, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Patch for landing (19.07 KB, patch)
2018-11-29 21:45 PST, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Wang (:fredw) 2018-02-22 08:49:20 PST
Source/WebCore/rendering/RenderLayerBacking.cpp
// FIXME: The paint offset and the scroll offset should really be separate concepts.
Comment 1 Frédéric Wang (:fredw) 2018-02-22 08:54:25 PST
Created attachment 334454 [details]
Patch
Comment 2 Frédéric Wang (:fredw) 2018-02-22 12:49:42 PST
Comment on attachment 334454 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=334454&action=review

@Simon, Daniel: This patch just extracts the scrollOffset from offsetFromRender, but I'm not sure it is what was meant in the FIXME nor whether it's really an improvement... WDYT?

> Source/WebCore/rendering/RenderLayerBacking.cpp:2471
>          // but the repaint rect is computed without taking the scroll position into account (see shouldApplyClipAndScrollPositionForRepaint()).

I'm a bit confused by this comment. The first line (from Daniel, bug 125239) seems to say it is done because scrollOffset is included in the offsetFromRenderer in RenderLayerBacking::updateGeometry(), which actually happens on non-iOS platforms too and what I'm trying to remove here. The second line (from Simon, bug 159186) seems to say it is done because scrollPosition in applyCachedClipAndScrollPositionForRepaint (rather than shouldApplyClipAndScrollPositionForRepaint). So it does not seem we can get rid of this...
Comment 3 Frédéric Wang (:fredw) 2018-05-09 23:33:34 PDT
Created attachment 340071 [details]
Patch

Rebasing
Comment 4 Frédéric Wang (:fredw) 2018-09-05 07:02:53 PDT
Created attachment 348912 [details]
Patch
Comment 5 Frédéric Wang (:fredw) 2018-11-15 07:06:11 PST
Created attachment 354929 [details]
Patch

Rebasing...
Comment 6 EWS Watchlist 2018-11-15 09:13:41 PST
Comment on attachment 354929 [details]
Patch

Attachment 354929 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/10004230

New failing tests:
compositing/overflow/scrolling-without-painting.html
compositing/overflow/textarea-scroll-touch.html
Comment 7 EWS Watchlist 2018-11-15 09:13:43 PST
Created attachment 354943 [details]
Archive of layout-test-results from ews123 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 8 EWS Watchlist 2018-11-15 11:00:22 PST
Comment on attachment 354929 [details]
Patch

Attachment 354929 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/10005225

New failing tests:
compositing/overflow/textarea-scroll-touch.html
compositing/overflow/scrolling-without-painting.html
Comment 9 EWS Watchlist 2018-11-15 11:00:23 PST
Created attachment 354956 [details]
Archive of layout-test-results from ews126 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews126  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 10 Frédéric Wang (:fredw) 2018-11-20 05:39:53 PST
Created attachment 355336 [details]
Patch
Comment 11 Frédéric Wang (:fredw) 2018-11-22 06:45:06 PST
Created attachment 355474 [details]
Patch
Comment 12 Frédéric Wang (:fredw) 2018-11-22 06:46:37 PST
@smfr: review ping?
Comment 13 Simon Fraser (smfr) 2018-11-29 10:39:48 PST
Comment on attachment 355474 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=355474&action=review

> Source/WebCore/ChangeLog:8
> +        Reviewed by NOBODY (OOPS!).
> +
> +        No new tests, already covered by existing tests.

Can you explain here why the scroll offset needs to be store separately from the paint offset?
Comment 14 Frédéric Wang (:fredw) 2018-11-29 13:06:35 PST
Comment on attachment 355474 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=355474&action=review

>> Source/WebCore/ChangeLog:8
>> +        No new tests, already covered by existing tests.
> 
> Can you explain here why the scroll offset needs to be store separately from the paint offset?

I'm not exactly sure why it needs to be that way (seem comment 2) but I see it makes the API cleaner and maybe help to optimize re-display. Can you please explain the rationale of this FIXME?
Comment 15 Frédéric Wang (:fredw) 2018-11-29 13:06:43 PST
View in context: https://bugs.webkit.org/attachment.cgi?id=355474&action=review

>> Source/WebCore/ChangeLog:8
>> +        No new tests, already covered by existing tests.
> 
> Can you explain here why the scroll offset needs to be store separately from the paint offset?

I'm not exactly sure why it needs to be that way (seem comment 2) but I see it makes the API cleaner and maybe help to optimize re-display. Can you please explain the rationale of this FIXME?
Comment 16 Simon Fraser (smfr) 2018-11-29 13:13:41 PST
Comment on attachment 355474 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=355474&action=review

>>> Source/WebCore/ChangeLog:8
>>> +        No new tests, already covered by existing tests.
>> 
>> Can you explain here why the scroll offset needs to be store separately from the paint offset?
> 
> I'm not exactly sure why it needs to be that way (seem comment 2) but I see it makes the API cleaner and maybe help to optimize re-display. Can you please explain the rationale of this FIXME?

Oh ha, that was my fixme. I mean, it makes sense, but do we need to do it to avoid repaints on composited scroll, for example?
Comment 17 Frédéric Wang (:fredw) 2018-11-29 13:47:35 PST
Comment on attachment 355474 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=355474&action=review

>>>> Source/WebCore/ChangeLog:8
>>>> +        No new tests, already covered by existing tests.
>>> 
>>> Can you explain here why the scroll offset needs to be store separately from the paint offset?
>> 
>> I'm not exactly sure why it needs to be that way (seem comment 2) but I see it makes the API cleaner and maybe help to optimize re-display. Can you please explain the rationale of this FIXME?
> 
> Oh ha, that was my fixme. I mean, it makes sense, but do we need to do it to avoid repaints on composited scroll, for example?

That was what I mean by optimizing redisplay but I'm not sure at all to be honest... 

As a reminder, this originates from the discussion about iOS frame scrolling on 12/02/2018: 

23:21:32 - fredw: I also tried to copy the stuff with offsetFromRenderer, but again, I'm not sure about that
23:21:34 - smfr: right, that's to match how UIScrollVIew works
23:21:41 - smfr: don't use offsetFromRenderer! it's special
23:21:55 - smfr: it's to size layers to take account of borders, shadows etc
23:22:18 - fredw: mmh, but I think it was used for more...
23:23:00 - smfr: maybe you could draw some ASCII art in a bug to show how the web process layer tree maps into UIScrollVIews for a subframe, across the frame boundary
23:23:11 - smfr: it's critical to get that part right
23:24:44 - fredw: This is only taking padding for m_scrollingLayer: https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/rendering/RenderLayerBacking.cpp#L1140
23:25:13 - fredw: but this is taking offset into account for the content layer: https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/rendering/RenderLayerBacking.cpp#L1163
23:25:42 - smfr: "FIXME: The paint offset and the scroll offset should really be separate concepts." yes
23:26:44 - fredw: So for now I just tried to copy the logic of overflow node, but maybe that was not a good idea...
23:27:04 - smfr: i think it will be different in some ways
23:27:54 - fredw: I think I just ignored the padding stuff in this code, since it is taken into account somewhere else
23:28:20 - smfr: be sure to test content with iframes which have padding, thick borders and box shadows
23:28:40 - fredw: Yes, I already did did that in my patch. Not box shadows, though
23:30:08 - fredw: So do you think I should keep "setBoundsOrigin" like for overflow node or try to use "setPosition" instead?
23:30:29 - smfr: you'll have to use bounds origin since that's what UIScrollView uses
23:30:44 - smfr: maybe we should try to get that distinction out of the WebCore codeethough
23:30:53 - smfr: would be nice to hide that difference in the scrolling tree for WK2
23:31:01 - smfr: harder with iOS WK1
23:31:46 - fredw: and what about these offsetFromRenderer's?
23:32:49 - fredw: IIUC, I need it unless i do the FIXME you mentioned
23:32:52 - smfr: we should address the FIXME :)
23:33:09 - smfr: i'd have to study more to see what that involves
23:33:37 - fredw: OK, maybe I could do that for overflow node first too. Although, I don't really understand it :-)
23:34:10 - fredw: it seems it's  not specific to iOS, though, there is another one in the #ekse
23:34:18 - smfr: so, for normal layers, offsetFromRenderer is the offset between the top left of the GraphicsLayer (the backing store) to the top left of the renderer's border box
23:34:36 - smfr: basically if you add box-shadow or something, offsetFromRenderer accounts for the extra space you need
Comment 18 Frédéric Wang (:fredw) 2018-11-29 21:45:13 PST
Created attachment 356130 [details]
Patch for landing
Comment 19 WebKit Commit Bot 2018-11-29 22:34:51 PST
The commit-queue encountered the following flaky tests while processing attachment 356130 [details]:

workers/bomb.html bug 171985 (author: fpizlo@apple.com)
webgl/2.0.0/conformance/more/functions/vertexAttribPointerBadArgs.html bug 192218 (author: justin_fan@apple.com)
The commit-queue is continuing to process your patch.
Comment 20 WebKit Commit Bot 2018-11-29 22:35:46 PST
Comment on attachment 356130 [details]
Patch for landing

Clearing flags on attachment: 356130

Committed r238727: <https://trac.webkit.org/changeset/238727>
Comment 21 WebKit Commit Bot 2018-11-29 22:35:48 PST
All reviewed patches have been landed.  Closing bug.
Comment 22 Radar WebKit Bug Importer 2018-11-29 22:36:47 PST
<rdar://problem/46365397>