RESOLVED FIXED Bug 182053
[CSSOM View] Implement standard behavior for scrollingElement
https://bugs.webkit.org/show_bug.cgi?id=182053
Summary [CSSOM View] Implement standard behavior for scrollingElement
Frédéric Wang (:fredw)
Reported 2018-01-24 09:34:55 PST
Created attachment 332173 [details] Patch (WIP) First patch for bug 5991, which introduces a development flag.
Attachments
Patch (WIP) (13.09 KB, patch)
2018-01-24 09:34 PST, Frédéric Wang (:fredw)
no flags
Patch (28.34 KB, patch)
2018-01-26 02:39 PST, Frédéric Wang (:fredw)
no flags
Archive of layout-test-results from ews101 for mac-sierra (2.30 MB, application/zip)
2018-01-26 03:48 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews107 for mac-sierra-wk2 (2.68 MB, application/zip)
2018-01-26 03:53 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews113 for mac-sierra (2.98 MB, application/zip)
2018-01-26 04:09 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews125 for ios-simulator-wk2 (8.44 MB, application/zip)
2018-01-26 06:21 PST, EWS Watchlist
no flags
Patch (27.76 KB, patch)
2018-01-26 12:25 PST, Frédéric Wang (:fredw)
no flags
Archive of layout-test-results from ews104 for mac-sierra-wk2 (3.04 MB, application/zip)
2018-01-26 13:35 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews123 for ios-simulator-wk2 (8.27 MB, application/zip)
2018-01-26 14:01 PST, EWS Watchlist
no flags
Patch (33.82 KB, patch)
2018-01-27 02:06 PST, Frédéric Wang (:fredw)
no flags
Patch (33.81 KB, patch)
2018-01-27 02:36 PST, Frédéric Wang (:fredw)
no flags
Patch (33.82 KB, patch)
2018-01-27 07:37 PST, Frédéric Wang (:fredw)
no flags
Patch (31.81 KB, patch)
2018-01-28 22:17 PST, Frédéric Wang (:fredw)
no flags
Patch (31.29 KB, patch)
2018-02-07 01:58 PST, Frédéric Wang (:fredw)
no flags
Patch (31.93 KB, patch)
2018-05-10 02:03 PDT, Frédéric Wang (:fredw)
no flags
Patch (31.88 KB, patch)
2018-07-10 07:42 PDT, Frédéric Wang (:fredw)
no flags
Patch (31.80 KB, patch)
2018-08-30 08:09 PDT, Frédéric Wang (:fredw)
no flags
Patch for landing (31.41 KB, patch)
2018-08-31 00:11 PDT, Frédéric Wang (:fredw)
no flags
Daniel Bates
Comment 1 2018-01-24 20:53:33 PST
Comment on attachment 332173 [details] Patch (WIP) View in context: https://bugs.webkit.org/attachment.cgi?id=332173&action=review > Source/WebCore/dom/Document.cpp:1441 > + if (settings().scrollingAPIofCSSOMViewEnabled()) { Can we come up with a better name for this? Maybe cssomViewScrollingAPIEnabled?
Frédéric Wang (:fredw)
Comment 2 2018-01-25 00:05:21 PST
(In reply to Daniel Bates from comment #1) > Can we come up with a better name for this? Maybe > cssomViewScrollingAPIEnabled? Yes, that's what I initially did. My concern was that some functions would be named cssom*, others Cssom* while the real spec name is CSSOM. Anyway, sure I can change it.
Frédéric Wang (:fredw)
Comment 3 2018-01-26 02:39:20 PST
Antonio Gomes
Comment 4 2018-01-26 03:20:53 PST
Comment on attachment 332362 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332362&action=review > Source/WebCore/ChangeLog:10 > + It changes the behavior of document.scrollingElement so that it follow the spec when the nit: follows* > Source/WebCore/dom/Document.cpp:1444 > + // - The element is not the HTML body element, or it is and the root elementâs used value of the nit: strange character after 'element' > Source/WebCore/dom/Document.cpp:1446 > + // - The elementâs used value of the overflow-x or overflow-y properties is not visible. ditto
EWS Watchlist
Comment 5 2018-01-26 03:48:25 PST
Comment on attachment 332362 [details] Patch Attachment 332362 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/6220109 New failing tests: fast/scrolling/arrow-key-scroll-in-rtl-document.html imported/w3c/web-platform-tests/cssom-view/HTMLBody-ScrollArea_quirksmode.html fast/scrolling/scroll-to-focused-element-asynchronously.html fast/overflow/scroll-anchor-in-position-fixed.html fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html fast/events/prevent-default-prevents-interaction-with-scrollbars.html imported/w3c/web-platform-tests/cssom-view/scrolling-quirks-vs-nonquirks.html fast/visual-viewport/zoomed-scroll-into-view-fixed.html fast/scrolling/scroll-to-anchor-zoomed-header.html fast/visual-viewport/zoomed-scroll-to-anchor-in-position-fixed.html
EWS Watchlist
Comment 6 2018-01-26 03:48:26 PST
Created attachment 332363 [details] Archive of layout-test-results from ews101 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 7 2018-01-26 03:53:10 PST
Comment on attachment 332362 [details] Patch Attachment 332362 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/6220117 New failing tests: fast/scrolling/arrow-key-scroll-in-rtl-document.html imported/w3c/web-platform-tests/cssom-view/HTMLBody-ScrollArea_quirksmode.html fast/scrolling/scroll-to-focused-element-asynchronously.html fast/overflow/scroll-anchor-in-position-fixed.html fast/scrolling/rtl-scrollbars-alternate-body-dir-attr-does-not-update-scrollbar-placement.html fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html fast/events/prevent-default-prevents-interaction-with-scrollbars.html imported/w3c/web-platform-tests/cssom-view/scrolling-quirks-vs-nonquirks.html fast/visual-viewport/zoomed-scroll-into-view-fixed.html fast/scrolling/scroll-to-anchor-zoomed-header.html fast/visual-viewport/zoomed-scroll-to-anchor-in-position-fixed.html fast/scrolling/iframe-scrollable-after-back.html
EWS Watchlist
Comment 8 2018-01-26 03:53:11 PST
Created attachment 332364 [details] Archive of layout-test-results from ews107 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 9 2018-01-26 04:09:20 PST
Comment on attachment 332362 [details] Patch Attachment 332362 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/6220128 New failing tests: fast/scrolling/arrow-key-scroll-in-rtl-document.html imported/w3c/web-platform-tests/cssom-view/HTMLBody-ScrollArea_quirksmode.html fast/scrolling/scroll-to-focused-element-asynchronously.html fast/overflow/scroll-anchor-in-position-fixed.html fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html fast/events/prevent-default-prevents-interaction-with-scrollbars.html imported/w3c/web-platform-tests/cssom-view/scrolling-quirks-vs-nonquirks.html fast/visual-viewport/zoomed-scroll-into-view-fixed.html fast/scrolling/scroll-to-anchor-zoomed-header.html fast/visual-viewport/zoomed-scroll-to-anchor-in-position-fixed.html
EWS Watchlist
Comment 10 2018-01-26 04:09:21 PST
Created attachment 332365 [details] Archive of layout-test-results from ews113 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews113 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 11 2018-01-26 06:21:07 PST
Comment on attachment 332362 [details] Patch Attachment 332362 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/6220881 New failing tests: fast/visual-viewport/ios/stable-update-with-keyboard.html imported/w3c/web-platform-tests/cssom-view/HTMLBody-ScrollArea_quirksmode.html fast/scrolling/scroll-to-focused-element-asynchronously.html fast/scrolling/ios/touch-scroll-pointer-events-none.html fast/overflow/scroll-anchor-in-position-fixed.html fast/scrolling/ios/touch-scroll-visibility-hidden.html fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html imported/w3c/web-platform-tests/cssom-view/scrolling-quirks-vs-nonquirks.html
EWS Watchlist
Comment 12 2018-01-26 06:21:09 PST
Created attachment 332371 [details] Archive of layout-test-results from ews125 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews125 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.6
Frédéric Wang (:fredw)
Comment 13 2018-01-26 12:19:36 PST
Comment on attachment 332362 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332362&action=review > Tools/DumpRenderTree/mac/DumpRenderTree.mm:862 > + [preferences setCSSOMViewScrollingAPIEnabled:YES]; Oops, intent was to keep the flag disabled for now. > Tools/DumpRenderTree/win/DumpRenderTree.cpp:787 > + prefsPrivate->setCSSOMViewScrollingAPIEnabled(TRUE); Ditto.
Frédéric Wang (:fredw)
Comment 14 2018-01-26 12:25:29 PST
EWS Watchlist
Comment 15 2018-01-26 13:35:21 PST
Comment on attachment 332402 [details] Patch Attachment 332402 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/6224480 New failing tests: fast/scrolling/arrow-key-scroll-in-rtl-document.html imported/w3c/web-platform-tests/cssom-view/HTMLBody-ScrollArea_quirksmode.html fast/scrolling/scroll-to-focused-element-asynchronously.html fast/overflow/scroll-anchor-in-position-fixed.html fast/scrolling/rtl-scrollbars-alternate-body-dir-attr-does-not-update-scrollbar-placement.html fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html fast/events/prevent-default-prevents-interaction-with-scrollbars.html imported/w3c/web-platform-tests/cssom-view/scrolling-quirks-vs-nonquirks.html fast/visual-viewport/zoomed-scroll-into-view-fixed.html fast/scrolling/scroll-to-anchor-zoomed-header.html fast/visual-viewport/zoomed-scroll-to-anchor-in-position-fixed.html fast/scrolling/iframe-scrollable-after-back.html
EWS Watchlist
Comment 16 2018-01-26 13:35:22 PST
Created attachment 332412 [details] Archive of layout-test-results from ews104 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 17 2018-01-26 14:01:05 PST
Comment on attachment 332402 [details] Patch Attachment 332402 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/6224532 New failing tests: fast/visual-viewport/ios/stable-update-with-keyboard.html imported/w3c/web-platform-tests/cssom-view/HTMLBody-ScrollArea_quirksmode.html fast/scrolling/scroll-to-focused-element-asynchronously.html fast/scrolling/ios/touch-scroll-pointer-events-none.html fast/overflow/scroll-anchor-in-position-fixed.html fast/scrolling/ios/touch-scroll-visibility-hidden.html fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html imported/w3c/web-platform-tests/cssom-view/scrolling-quirks-vs-nonquirks.html
EWS Watchlist
Comment 18 2018-01-26 14:01:06 PST
Created attachment 332413 [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.12.6
Frédéric Wang (:fredw)
Comment 19 2018-01-27 02:06:26 PST
Frédéric Wang (:fredw)
Comment 20 2018-01-27 02:36:59 PST
Frédéric Wang (:fredw)
Comment 21 2018-01-27 07:37:39 PST
Frédéric Wang (:fredw)
Comment 22 2018-01-28 22:17:48 PST
Frédéric Wang (:fredw)
Comment 23 2018-02-01 07:58:23 PST
@cdumez: Can you please review this patch?
Simon Fraser (smfr)
Comment 24 2018-02-01 10:35:06 PST
Comment on attachment 332510 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332510&action=review > Source/WebCore/dom/Document.cpp:1451 > + // FIXME: Use RenderObject::hasOverflowClip() instead of Element::computedStyle()? > + return body.renderer() > + && documentElement()->computedStyle() > + && !documentElement()->computedStyle()->isOverflowVisible() Yeah, we normally don't use computedStyle() for these kinds of things; we just look at the renderer's style() or flags. > Source/WebCore/dom/Document.cpp:1463 > + updateLayout(); Can updateLayout() trigger script which destroyed this Document?
Frédéric Wang (:fredw)
Comment 25 2018-02-05 02:29:13 PST
Comment on attachment 332510 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332510&action=review >> Source/WebCore/dom/Document.cpp:1451 >> + && !documentElement()->computedStyle()->isOverflowVisible() > > Yeah, we normally don't use computedStyle() for these kinds of things; we just look at the renderer's style() or flags. Unfortunately, as I said in the ChangeLog, this does not seem to work because the OverflowClip on the body depends on the one on the html element, see RenderBox::updateFromStyle() and https://bugs.chromium.org/p/chromium/issues/detail?id=665927#c23. Apparently, Chromium people had to rewrite the inheritance of viewport properties in order to make things work properly, which we might need to do too (see also bug 182292). Since this patch is just supposed to introduce the developer preference with basic scrollingElement support, I thought using computedStyle() was enough for now. >> Source/WebCore/dom/Document.cpp:1463 >> + updateLayout(); > > Can updateLayout() trigger script which destroyed this Document? I am not familiar with this, can you elaborate? Using updateLayoutIgnorePendingStylesheets() as do other Element:: functions, seems enough to pass the tests. Do you think it would be safer?
Frédéric Wang (:fredw)
Comment 26 2018-02-07 01:58:07 PST
Frédéric Wang (:fredw)
Comment 27 2018-02-27 03:27:21 PST
Comment on attachment 332510 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332510&action=review >>> Source/WebCore/dom/Document.cpp:1463 >>> + updateLayout(); >> >> Can updateLayout() trigger script which destroyed this Document? > > I am not familiar with this, can you elaborate? Using updateLayoutIgnorePendingStylesheets() as do other Element:: functions, seems enough to pass the tests. Do you think it would be safer? I checked again and without updateLayoutIgnorePendingStylesheets(), the test fails. I see that several other functions from Element:: to implement DOM properties (offsetLeft, clientLeft, setScrollTop...) also calls updateLayoutIgnorePendingStylesheets() on the Element's document, so if we could destroy the Document with scrollingElement then I suspect we can already do that with the existing code. Also, Chromium's code has diverged quick a bit but it forces a style and layout update when calling scrollingElement: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/dom/Document.cpp?l=1501
Frédéric Wang (:fredw)
Comment 28 2018-05-10 02:03:42 PDT
Created attachment 340078 [details] Patch Rebasing...
Frédéric Wang (:fredw)
Comment 29 2018-07-10 07:42:08 PDT
Created attachment 344694 [details] Patch Rebasing...
Frédéric Wang (:fredw)
Comment 30 2018-08-30 08:09:24 PDT
Created attachment 348497 [details] Patch Rebase...
Simon Fraser (smfr)
Comment 31 2018-08-30 10:42:22 PDT
Comment on attachment 348497 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=348497&action=review > Source/WebCore/dom/Document.h:1612 > + bool isPotentiallyScrollable(HTMLBodyElement&); This function name is ambiguous. Are you asking of the passed body element is scrollable, or if the document itself is scrollable? Maybe rename to is isBodyPotentiallyScrollable().
Frédéric Wang (:fredw)
Comment 32 2018-08-31 00:11:50 PDT
Created attachment 348615 [details] Patch for landing
WebKit Commit Bot
Comment 33 2018-08-31 00:49:41 PDT
Comment on attachment 348615 [details] Patch for landing Clearing flags on attachment: 348615 Committed r235539: <https://trac.webkit.org/changeset/235539>
WebKit Commit Bot
Comment 34 2018-08-31 00:49:43 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 35 2018-08-31 00:53:28 PDT
Simon Fraser (smfr)
Comment 36 2019-07-22 11:00:00 PDT
Comment on attachment 348615 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=348615&action=review > Source/WebCore/page/Settings.yaml:558 > +CSSOMViewScrollingAPIEnabled: > + initial: false Frank, do you recall why you left this off by default here, and only enabled it for WebKit2?
Frédéric Wang (:fredw)
Comment 37 2019-07-22 14:06:21 PDT
(In reply to Simon Fraser (smfr) from comment #36) > Comment on attachment 348615 [details] > Patch for landing > > View in context: > https://bugs.webkit.org/attachment.cgi?id=348615&action=review > > > Source/WebCore/page/Settings.yaml:558 > > +CSSOMViewScrollingAPIEnabled: > > + initial: false > > Frank, do you recall why you left this off by default here, and only enabled > it for WebKit2? I'm assuming this question is directed to me? (I can't find any Frank in the cc) IIRC, the biggest backward compatibility concerns were for webviews embedded in apps. So the idea was to keep it disabled by default on (some) Apple ports and Apple would enable it on the Safari side. I'm not really sure about the details, why it is only WK1 and why it had to be disabled by default in trunk instead of doing it on the proprietary side. Maybe there are more explanations in the radar bug.
Simon Fraser (smfr)
Comment 38 2019-07-22 14:10:55 PDT
(In reply to Frédéric Wang (:fredw) from comment #37) > (In reply to Simon Fraser (smfr) from comment #36) > > Comment on attachment 348615 [details] > > Patch for landing > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=348615&action=review > > > > > Source/WebCore/page/Settings.yaml:558 > > > +CSSOMViewScrollingAPIEnabled: > > > + initial: false > > > > Frank, do you recall why you left this off by default here, and only enabled > > it for WebKit2? > > I'm assuming this question is directed to me? (I can't find any Frank in the > cc) > > IIRC, the biggest backward compatibility concerns were for webviews embedded > in apps. So the idea was to keep it disabled by default on (some) Apple > ports and Apple would enable it on the Safari side. I'm not really sure > about the details, why it is only WK1 and why it had to be disabled by > default in trunk instead of doing it on the proprietary side. Maybe there > are more explanations in the radar bug. Sorry Fred, I meant you! We don't normally restrict behavior changes from WebViews in apps unless we have evidence of a compat issue.
Frédéric Wang (:fredw)
Comment 39 2019-07-22 14:35:55 PDT
(In reply to Simon Fraser (smfr) from comment #38) > Sorry Fred, I meant you! No problem, I guessed it was a mix between Fred and Wang... > We don't normally restrict behavior changes from > WebViews in apps unless we have evidence of a compat issue. OK. I guess it is up to Apple to decide. I'm happy if this is enabled everywhere ;-)
Darin Adler
Comment 40 2019-07-22 15:17:18 PDT
As is usual with such things, I think we have a testing challenge for app compatibility. But I think we had that with both Legacy WebKit and Modern WebKit, and we already took the risk with modern WebKit!
Robbert Brak
Comment 41 2019-11-23 05:01:47 PST
*** Bug 193820 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.