Changeset 57165 in webkit


Ignore:
Timestamp:
Apr 6, 2010 1:44:42 PM (14 years ago)
Author:
jamesr@google.com
Message:

2010-04-06 James Robinson <jamesr@chromium.org>

Reviewed by Simon Fraser.

Reverts the incorrect fixed position fastpath scrolling logic
https://bugs.webkit.org/show_bug.cgi?id=33150

This code does not properly handle overflow or transforms on fixed
position elements, causing repaint bugs on scroll.

No new tests.

  • page/FrameView.cpp: (WebCore::FrameView::addFixedObject): (WebCore::FrameView::removeFixedObject):
  • page/FrameView.h:
  • platform/ScrollView.cpp: (WebCore::ScrollView::scrollContents):
  • platform/ScrollView.h:
  • rendering/RenderObject.cpp: (WebCore::RenderObject::styleWillChange):
Location:
trunk/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r57164 r57165  
     12010-04-06  James Robinson  <jamesr@chromium.org>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Reverts the incorrect fixed position fastpath scrolling logic
     6        https://bugs.webkit.org/show_bug.cgi?id=33150
     7
     8        This code does not properly handle overflow or transforms on fixed
     9        position elements, causing repaint bugs on scroll.
     10
     11        No new tests.
     12
     13        * page/FrameView.cpp:
     14        (WebCore::FrameView::addFixedObject):
     15        (WebCore::FrameView::removeFixedObject):
     16        * page/FrameView.h:
     17        * platform/ScrollView.cpp:
     18        (WebCore::ScrollView::scrollContents):
     19        * platform/ScrollView.h:
     20        * rendering/RenderObject.cpp:
     21        (WebCore::RenderObject::styleWillChange):
     22
    1232010-04-06  Kevin Ollivier  <kevino@theolliviers.com>
    224
  • trunk/WebCore/page/FrameView.cpp

    r57080 r57165  
    871871void FrameView::addFixedObject()
    872872{
    873     if (!m_fixedObjectCount && platformWidget())
    874         setCanBlitOnScroll(false);
    875873    ++m_fixedObjectCount;
    876874}
     
    880878    ASSERT(m_fixedObjectCount > 0);
    881879    --m_fixedObjectCount;
    882     if (!m_fixedObjectCount)
    883         setCanBlitOnScroll(!useSlowRepaints());
    884 }
    885 
    886 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
    887 {
    888     const size_t fixedObjectThreshold = 5;
    889 
    890     ListHashSet<RenderBox*>* positionedObjects = 0;
    891     if (RenderView* root = m_frame->contentRenderer())
    892         positionedObjects = root->positionedObjects();
    893 
    894     if (!positionedObjects || positionedObjects->isEmpty()) {
    895         hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);
    896         return true;
    897     }
    898 
    899     // Get the rects of the fixed objects visible in the rectToScroll
    900     Vector<IntRect, fixedObjectThreshold> subRectToUpdate;
    901     bool updateInvalidatedSubRect = true;
    902     ListHashSet<RenderBox*>::const_iterator end = positionedObjects->end();
    903     for (ListHashSet<RenderBox*>::const_iterator it = positionedObjects->begin(); it != end; ++it) {
    904         RenderBox* renderBox = *it;
    905         if (renderBox->style()->position() != FixedPosition)
    906             continue;
    907         IntRect topLevelRect;
    908         IntRect updateRect = renderBox->paintingRootRect(topLevelRect);
    909         updateRect.move(-scrollX(), -scrollY());
    910         updateRect.intersect(rectToScroll);
    911         if (!updateRect.isEmpty()) {
    912             if (subRectToUpdate.size() >= fixedObjectThreshold) {
    913                 updateInvalidatedSubRect = false;
    914                 break;
    915             }
    916             subRectToUpdate.append(updateRect);
    917         }
    918     }
    919 
    920     // Scroll the view
    921     if (updateInvalidatedSubRect) {
    922         // 1) scroll
    923         hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);
    924 
    925         // 2) update the area of fixed objects that has been invalidated
    926         size_t fixObjectsCount = subRectToUpdate.size();
    927         for (size_t i = 0; i < fixObjectsCount; ++i) {
    928             IntRect updateRect = subRectToUpdate[i];
    929             IntRect scrolledRect = updateRect;
    930             scrolledRect.move(scrollDelta);
    931             updateRect.unite(scrolledRect);
    932             updateRect.intersect(rectToScroll);
    933             hostWindow()->invalidateContentsAndWindow(updateRect, false);
    934         }
    935         return true;
    936     }
    937 
    938     // the number of fixed objects exceed the threshold, we cannot use the fast path
    939     return false;
    940880}
    941881
  • trunk/WebCore/page/FrameView.h

    r57009 r57165  
    210210    void invalidateScrollCorner();
    211211
    212 protected:
    213     virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
    214 
    215212private:
    216213    FrameView(Frame*);
  • trunk/WebCore/platform/ScrollView.cpp

    r56856 r57165  
    519519    if (canBlitOnScroll()) { // The main frame can just blit the WebView window
    520520        // FIXME: Find a way to scroll subframes with this faster path
    521         if (!scrollContentsFastPath(-scrollDelta, scrollViewRect, clipRect))
    522             hostWindow()->invalidateContentsForSlowScroll(updateRect, false);
     521        hostWindow()->scroll(-scrollDelta, scrollViewRect, clipRect);
    523522    } else {
    524523       // We need to go ahead and repaint the entire backing store.  Do it now before moving the
     
    532531    // Now blit the backingstore into the window which should be very fast.
    533532    hostWindow()->invalidateWindow(IntRect(), true);
    534 }
    535 
    536 bool ScrollView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
    537 {
    538     hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);
    539     return true;
    540533}
    541534
  • trunk/WebCore/platform/ScrollView.h

    r56854 r57165  
    253253    virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);
    254254
    255     // Scroll the content by blitting the pixels
    256     virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
    257    
    258255private:
    259256    RefPtr<Scrollbar> m_horizontalScrollbar;
  • trunk/WebCore/rendering/RenderObject.cpp

    r56890 r57165  
    16531653
    16541654    if (view()->frameView()) {
     1655        // FIXME: A better solution would be to only invalidate the fixed regions when scrolling.  It's overkill to
     1656        // prevent the entire view from blitting on a scroll.
     1657
    16551658        bool shouldBlitOnFixedBackgroundImage = false;
    16561659#if ENABLE(FAST_MOBILE_SCROLLING)
     
    16621665#endif
    16631666
    1664         bool newStyleSlowScroll = newStyle && !shouldBlitOnFixedBackgroundImage && newStyle->hasFixedBackgroundImage();
    1665         bool oldStyleSlowScroll = m_style && !shouldBlitOnFixedBackgroundImage && m_style->hasFixedBackgroundImage();
     1667        bool newStyleSlowScroll = newStyle && (newStyle->position() == FixedPosition
     1668                                                || (!shouldBlitOnFixedBackgroundImage && newStyle->hasFixedBackgroundImage()));
     1669        bool oldStyleSlowScroll = m_style && (m_style->position() == FixedPosition
     1670                                                || (!shouldBlitOnFixedBackgroundImage && m_style->hasFixedBackgroundImage()));
     1671
    16661672        if (oldStyleSlowScroll != newStyleSlowScroll) {
    16671673            if (oldStyleSlowScroll)
Note: See TracChangeset for help on using the changeset viewer.