Bug 172911 - Elements with position: fixed; repaint when window scroll position is set via JavaScript
Summary: Elements with position: fixed; repaint when window scroll position is set via...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Mac macOS 10.12
: P2 Normal
Assignee: Nobody
URL: https://codepen.io/peterhry/full/PmMyeB/
Keywords: InRadar, Performance, PerfRegression, Regression
Depends on:
Blocks:
 
Reported: 2017-06-04 21:47 PDT by Peter Hrynkow
Modified: 2017-06-20 16:56 PDT (History)
5 users (show)

See Also:


Attachments
Testcase (598 bytes, text/html)
2017-06-20 16:24 PDT, Simon Fraser (smfr)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Hrynkow 2017-06-04 21:47:37 PDT
Bug demo: https://codepen.io/peterhry/full/PmMyeB/

Enable "paint flashing" and notice how the element with `position: fixed` repaints continuously as the scroll position is set by JavaScript. This does not happen in Safari 10, Chrome, or Firefox.
Comment 1 Radar WebKit Bug Importer 2017-06-06 17:34:28 PDT
<rdar://problem/32602876>
Comment 2 Alexey Proskuryakov 2017-06-09 22:40:49 PDT
Could you please confirm which Safari version you are observing this with? Is it currently shipping Safari, Safari Tech Preview, nightly or something else?
Comment 3 Peter Hrynkow 2017-06-10 08:37:30 PDT
Occurs in Safari 10.1 and WebKit Nightly
Comment 4 Simon Fraser (smfr) 2017-06-12 11:26:07 PDT
This reproduces in STP 32.
Comment 5 Simon Fraser (smfr) 2017-06-20 16:24:50 PDT
Created attachment 313451 [details]
Testcase
Comment 6 Simon Fraser (smfr) 2017-06-20 16:56:43 PDT
We mark the fixed elements as needing layout under:

  * frame #0: 0x0000000107c71df7 WebCore`WebCore::FrameView::setViewportConstrainedObjectsNeedLayout(this=0x0000000119cd5680) at FrameView.cpp:2522
    frame #1: 0x0000000107c71d12 WebCore`WebCore::FrameView::setBaseLayoutViewportOrigin(this=0x0000000119cd5680, origin={ x = 0px (0), y = 80px (5120) }, layoutTriggering=Yes) at FrameView.cpp:1898
    frame #2: 0x0000000107c72a22 WebCore`WebCore::FrameView::updateLayoutViewport(this=0x0000000119cd5680) at FrameView.cpp:1950
    frame #3: 0x0000000107c75fc6 WebCore`WebCore::FrameView::scrollPositionChanged(this=0x0000000119cd5680, oldPosition=0x00007fff5ef5b638, newPosition=0x00007fff5ef5b628) at FrameView.cpp:2561
    frame #4: 0x0000000107c7a84f WebCore`WebCore::FrameView::scrollTo(this=0x0000000119cd5680, newPosition=0x00007fff5ef5b690) at FrameView.cpp:3905
    frame #5: 0x00000001097d0f73 WebCore`WebCore::ScrollView::setScrollOffset(this=0x0000000119cd5680, offset=0x00007fff5ef5b7b0) at ScrollView.cpp:413
    frame #6: 0x000000010977ec0f WebCore`WebCore::ScrollableArea::scrollPositionChanged(this=0x0000000119cd5680, position=0x00007fff5ef5b9c8) at ScrollableArea.cpp:169
    frame #7: 0x000000010977eb5f WebCore`WebCore::ScrollableArea::notifyScrollPositionChanged(this=0x0000000119cd5680, position=0x00007fff5ef5b9c8) at ScrollableArea.cpp:161
    frame #8: 0x000000010723cc1a WebCore`WebCore::AsyncScrollingCoordinator::reconcileScrollingState(this=0x0000000117a6d000, frameView=0x0000000119cd5680, scrollPosition=0x00007fff5ef5bbc8, layoutViewportOriginOrOverrideRect=0x00007fff5ef5bb50, programmaticScroll=true, inStableState=true, scrollingLayerPositionAction=Set) at AsyncScrollingCoordinator.cpp:400
    frame #9: 0x000000010723bea7 WebCore`WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(this=0x0000000117a6d000, scrollingNodeID=30, scrollPosition=0x00007fff5ef5bbc8, layoutViewportOrigin=optional<WebCore::FloatPoint> @ 0x00007fff5ef5bbb8, programmaticScroll=true, scrollingLayerPositionAction=Set) at AsyncScrollingCoordinator.cpp:344
    frame #10: 0x000000010723bb6c WebCore`WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate(this=0x0000000117a6d000, frameView=0x0000000119cd5680, scrollPosition=0x00007fff5ef5bd20) at AsyncScrollingCoordinator.cpp:250
    frame #11: 0x0000000107c76900 WebCore`WebCore::FrameView::requestScrollPositionUpdate(this=0x0000000119cd5680, position=0x00007fff5ef5bd20) at FrameView.cpp:2706

This doesn't happen for async scrolls because we've already sync'd a new layout viewport from the scrolling thread.