Changeset 53713 in webkit
- Timestamp:
- Jan 22, 2010, 1:52:40 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r53712 r53713 1 2010-01-22 Dan Bernstein <mitz@apple.com> 2 3 Rubber-stamped by Darin Adler. 4 5 Revert r53693 because it broke scrolling of pages with fixed elements on 6 Mac OS X. 7 8 * page/FrameView.cpp: 9 * page/FrameView.h: 10 * platform/ScrollView.cpp: 11 (WebCore::ScrollView::scrollContents): 12 * platform/ScrollView.h: 13 * rendering/RenderObject.cpp: 14 (WebCore::RenderObject::styleWillChange): 15 (WebCore::RenderObject::destroy): 16 1 17 2010-01-22 Alexey Proskuryakov <ap@apple.com> 2 18 -
trunk/WebCore/page/FrameView.cpp
r53693 r53713 814 814 } 815 815 816 817 void FrameView::registerFixedPositionedObject(RenderObject* object)818 {819 m_fixedPositionedObjects.add(object);820 }821 822 void FrameView::unregisterFixedPositionedObject(RenderObject* object)823 {824 m_fixedPositionedObjects.remove(object);825 }826 827 void FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)828 {829 const size_t fixedObjectNumberThreshold = 5;830 831 if (m_fixedPositionedObjects.isEmpty())832 hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);833 else {834 Vector<RenderObject*> fixedObjectsInViewport;835 fixedObjectsInViewport.reserveCapacity(m_fixedPositionedObjects.size());836 837 bool updateInvalidatedSubRect = true;838 // Get a list of fixed objects that are not in transformations839 HashSet<RenderObject*>::const_iterator end = m_fixedPositionedObjects.end();840 HashSet<RenderObject*>::const_iterator it = m_fixedPositionedObjects.begin();841 for (; it != end; ++it) {842 RenderObject* obj = *it;843 // make sure the parent layer has not been transformed844 if (obj->containingBlock() == obj->view()) {845 fixedObjectsInViewport.append(obj);846 if (fixedObjectsInViewport.size() > fixedObjectNumberThreshold) {847 updateInvalidatedSubRect = false;848 break;849 }850 }851 }852 853 // scroll the content854 if (updateInvalidatedSubRect) {855 // 1) scroll856 hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);857 858 // 2) update the area of fixed objets that has been invalidated859 for (size_t i = 0; i < fixedObjectsInViewport.size(); ++i) {860 IntRect topLevelRect;861 IntRect updateRect = fixedObjectsInViewport[i]->paintingRootRect(topLevelRect);862 updateRect.move(-scrollX(), -scrollY());863 IntRect scrolledRect = updateRect;864 scrolledRect.move(scrollDelta);865 updateRect.unite(scrolledRect);866 updateRect.intersect(rectToScroll);867 hostWindow()->repaint(updateRect, true, false, true);868 }869 } else {870 // the number of fixed objects exceed the threshold, so we repaint everything.871 IntRect updateRect = clipRect;872 updateRect.intersect(rectToScroll);873 hostWindow()->repaint(updateRect, true, false, true);874 }875 }876 }877 878 816 void FrameView::setIsOverlapped(bool isOverlapped) 879 817 { -
trunk/WebCore/page/FrameView.h
r53693 r53713 146 146 void removeSlowRepaintObject(); 147 147 148 // Methods to manage the objects that are fixed149 // in the view when scrolling150 void registerFixedPositionedObject(RenderObject* object);151 void unregisterFixedPositionedObject(RenderObject* object);152 153 148 void beginDeferredRepaints(); 154 149 void endDeferredRepaints(); … … 204 199 bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; } 205 200 void invalidateScrollCorner(); 206 207 protected:208 virtual void scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);209 201 210 202 private: … … 277 269 bool m_contentIsOpaque; 278 270 unsigned m_slowRepaintObjectCount; 279 HashSet<RenderObject*> m_fixedPositionedObjects;280 271 281 272 int m_borderX, m_borderY; -
trunk/WebCore/platform/ScrollView.cpp
r53693 r53713 516 516 if (canBlitOnScroll()) { // The main frame can just blit the WebView window 517 517 // FIXME: Find a way to blit subframes without blitting overlapping content 518 scrollContentsFastPath(-scrollDelta, scrollViewRect, clipRect);518 hostWindow()->scroll(-scrollDelta, scrollViewRect, clipRect); 519 519 } else { 520 520 // We need to go ahead and repaint the entire backing store. Do it now before moving the … … 529 529 // be very fast). 530 530 hostWindow()->paint(); 531 }532 533 void ScrollView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)534 {535 hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);536 531 } 537 532 -
trunk/WebCore/platform/ScrollView.h
r53693 r53713 250 250 virtual void updateScrollCorner(); 251 251 virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect); 252 253 // Scroll the content by blitting the pixels254 virtual void scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);255 252 256 253 private: -
trunk/WebCore/rendering/RenderObject.cpp
r53693 r53713 1648 1648 s_affectsParentBlock = false; 1649 1649 1650 FrameView* frameView = view()->frameView(); 1651 if (frameView) { 1650 if (view()->frameView()) { 1651 // FIXME: A better solution would be to only invalidate the fixed regions when scrolling. It's overkill to 1652 // prevent the entire view from blitting on a scroll. 1653 1652 1654 bool shouldBlitOnFixedBackgroundImage = false; 1653 1655 #if ENABLE(FAST_MOBILE_SCROLLING) … … 1659 1661 #endif 1660 1662 1661 bool newStyleSlowScroll = newStyle && !shouldBlitOnFixedBackgroundImage && newStyle->hasFixedBackgroundImage(); 1662 bool oldStyleSlowScroll = m_style && !shouldBlitOnFixedBackgroundImage && m_style->hasFixedBackgroundImage(); 1663 1663 bool newStyleSlowScroll = newStyle && (newStyle->position() == FixedPosition 1664 || (!shouldBlitOnFixedBackgroundImage && newStyle->hasFixedBackgroundImage())); 1665 bool oldStyleSlowScroll = m_style && (m_style->position() == FixedPosition 1666 || (!shouldBlitOnFixedBackgroundImage && m_style->hasFixedBackgroundImage())); 1664 1667 if (oldStyleSlowScroll != newStyleSlowScroll) { 1665 1668 if (oldStyleSlowScroll) 1666 frameView->removeSlowRepaintObject();1669 view()->frameView()->removeSlowRepaintObject(); 1667 1670 if (newStyleSlowScroll) 1668 frameView->addSlowRepaintObject(); 1669 } 1670 1671 bool newStyleHasTransform = newStyle && (newStyle->hasTransformRelatedProperty()); 1672 if (!newStyleHasTransform) { 1673 bool newStyleHasFixedPosition = newStyle && (newStyle->position() == FixedPosition); 1674 bool oldStyleHasFixedPosition = m_style && (m_style->position() == FixedPosition); 1675 1676 if (oldStyleHasFixedPosition != newStyleHasFixedPosition) { 1677 if (newStyleHasFixedPosition) 1678 frameView->registerFixedPositionedObject(this); 1679 else 1680 frameView->unregisterFixedPositionedObject(this); 1681 } else { 1682 // if previously had a fix position, but had a transform, which has been removed 1683 bool oldStyleHasTransform = m_style && (m_style->hasTransformRelatedProperty()); 1684 if (oldStyleHasTransform && newStyleHasFixedPosition) 1685 frameView->registerFixedPositionedObject(this); 1686 } 1671 view()->frameView()->addSlowRepaintObject(); 1687 1672 } 1688 1673 } … … 1947 1932 void RenderObject::destroy() 1948 1933 { 1949 // unregister from the view if the object had a fixed position1950 if (m_style && m_style->position() == FixedPosition) {1951 FrameView* frameView = document()->view();1952 if (frameView)1953 frameView->unregisterFixedPositionedObject(this);1954 }1955 1956 1934 // Destroy any leftover anonymous children. 1957 1935 RenderObjectChildList* children = virtualChildren();
Note:
See TracChangeset
for help on using the changeset viewer.