Changeset 57165 in webkit
- Timestamp:
- Apr 6, 2010 1:44:42 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r57164 r57165 1 2010-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 1 23 2010-04-06 Kevin Ollivier <kevino@theolliviers.com> 2 24 -
trunk/WebCore/page/FrameView.cpp
r57080 r57165 871 871 void FrameView::addFixedObject() 872 872 { 873 if (!m_fixedObjectCount && platformWidget())874 setCanBlitOnScroll(false);875 873 ++m_fixedObjectCount; 876 874 } … … 880 878 ASSERT(m_fixedObjectCount > 0); 881 879 --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 rectToScroll900 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 view921 if (updateInvalidatedSubRect) {922 // 1) scroll923 hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);924 925 // 2) update the area of fixed objects that has been invalidated926 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 path939 return false;940 880 } 941 881 -
trunk/WebCore/page/FrameView.h
r57009 r57165 210 210 void invalidateScrollCorner(); 211 211 212 protected:213 virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);214 215 212 private: 216 213 FrameView(Frame*); -
trunk/WebCore/platform/ScrollView.cpp
r56856 r57165 519 519 if (canBlitOnScroll()) { // The main frame can just blit the WebView window 520 520 // 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); 523 522 } else { 524 523 // We need to go ahead and repaint the entire backing store. Do it now before moving the … … 532 531 // Now blit the backingstore into the window which should be very fast. 533 532 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;540 533 } 541 534 -
trunk/WebCore/platform/ScrollView.h
r56854 r57165 253 253 virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect); 254 254 255 // Scroll the content by blitting the pixels256 virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);257 258 255 private: 259 256 RefPtr<Scrollbar> m_horizontalScrollbar; -
trunk/WebCore/rendering/RenderObject.cpp
r56890 r57165 1653 1653 1654 1654 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 1655 1658 bool shouldBlitOnFixedBackgroundImage = false; 1656 1659 #if ENABLE(FAST_MOBILE_SCROLLING) … … 1662 1665 #endif 1663 1666 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 1666 1672 if (oldStyleSlowScroll != newStyleSlowScroll) { 1667 1673 if (oldStyleSlowScroll)
Note: See TracChangeset
for help on using the changeset viewer.