Changeset 151803 in webkit


Ignore:
Timestamp:
Jun 20, 2013, 2:28:15 PM (12 years ago)
Author:
Simon Fraser
Message:

Sticky elements are missing or misplaced sometimes when reloading a page that scrolls to a named anchor
https://bugs.webkit.org/show_bug.cgi?id=117819

Reviewed by Anders Carlsson.

At the end of FrameView::performPostLayoutTasks() we call scrollToAnchor() which attempts
to restore the scroll position to a named anchor, even when the document has been
changed by layout. This ends up in a call to ScrollView::scrollTo(), which in turn
calls repaintFixedElementsAfterScrolling(). However, repaintFixedElementsAfterScrolling()
would bail if m_nestedLayoutCount != 0, so we never updated layer positions which
depend on scroll position (but which would not be updated by layout, since their
renderers are not marked for layout when scrolling happens).

We've solved this problem once before in updateFixedElementsAfterScrolling() which
checks for m_nestedLayoutCount <= 1, so that we do work on the outermost nested layout.
Apply that same fix to repaintFixedElementsAfterScrolling().

Very timing-dependent, so hard to make a test.

  • page/FrameView.cpp:

(WebCore::FrameView::repaintFixedElementsAfterScrolling):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r151800 r151803  
     12013-06-20  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Sticky elements are missing or misplaced sometimes when reloading a page that scrolls to a named anchor
     4        https://bugs.webkit.org/show_bug.cgi?id=117819
     5
     6        Reviewed by Anders Carlsson.
     7       
     8        At the end of FrameView::performPostLayoutTasks() we call scrollToAnchor() which attempts
     9        to restore the scroll position to a named anchor, even when the document has been
     10        changed by layout. This ends up in a call to ScrollView::scrollTo(), which in turn
     11        calls repaintFixedElementsAfterScrolling(). However, repaintFixedElementsAfterScrolling()
     12        would bail if m_nestedLayoutCount != 0, so we never updated layer positions which
     13        depend on scroll position (but which would not be updated by layout, since their
     14        renderers are not marked for layout when scrolling happens).
     15       
     16        We've solved this problem once before in updateFixedElementsAfterScrolling() which
     17        checks for m_nestedLayoutCount <= 1, so that we do work on the outermost nested layout.
     18        Apply that same fix to repaintFixedElementsAfterScrolling().
     19
     20        Very timing-dependent, so hard to make a test.
     21
     22        * page/FrameView.cpp:
     23        (WebCore::FrameView::repaintFixedElementsAfterScrolling):
     24
    1252013-06-20  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
    226
  • trunk/Source/WebCore/page/FrameView.cpp

    r151745 r151803  
    20082008    // For fixed position elements, update widget positions and compositing layers after scrolling,
    20092009    // but only if we're not inside of layout.
    2010     if (!m_nestedLayoutCount && hasViewportConstrainedObjects()) {
     2010    if (m_nestedLayoutCount <= 1 && hasViewportConstrainedObjects()) {
    20112011        if (RenderView* renderView = this->renderView()) {
    20122012            renderView->updateWidgetPositions();
Note: See TracChangeset for help on using the changeset viewer.