Changeset 53693 in webkit
- Timestamp:
- Jan 22, 2010 4:01:28 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r53690 r53693 1 2010-01-22 Benjamin Poulain <benjamin.poulain@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 Do not render the full frame when there is some elements with fixed positioning 6 https://bugs.webkit.org/show_bug.cgi?id=33150 7 8 The RenderObjects with fixed position register to the view 9 to be taken into account while scrolling. 10 The scrolling code update specifically those elements after blitting the pixels. 11 12 * page/FrameView.cpp: 13 (WebCore::FrameView::registerFixedPositionedObject): 14 (WebCore::FrameView::unregisterFixedPositionedObject): 15 (WebCore::FrameView::scrollContentsFastPath): 16 * page/FrameView.h: 17 * platform/ScrollView.cpp: 18 (WebCore::ScrollView::scrollContents): 19 (WebCore::ScrollView::scrollContentsFastPath): 20 * platform/ScrollView.h: 21 * rendering/RenderObject.cpp: 22 (WebCore::RenderObject::styleWillChange): 23 (WebCore::RenderObject::destroy): 24 1 25 2010-01-22 Anton Muhin <antonm@chromium.org> 2 26 -
trunk/WebCore/page/FrameView.cpp
r53637 r53693 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 transformations 839 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 transformed 844 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 content 854 if (updateInvalidatedSubRect) { 855 // 1) scroll 856 hostWindow()->scroll(scrollDelta, rectToScroll, clipRect); 857 858 // 2) update the area of fixed objets that has been invalidated 859 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 816 878 void FrameView::setIsOverlapped(bool isOverlapped) 817 879 { -
trunk/WebCore/page/FrameView.h
r52947 r53693 146 146 void removeSlowRepaintObject(); 147 147 148 // Methods to manage the objects that are fixed 149 // in the view when scrolling 150 void registerFixedPositionedObject(RenderObject* object); 151 void unregisterFixedPositionedObject(RenderObject* object); 152 148 153 void beginDeferredRepaints(); 149 154 void endDeferredRepaints(); … … 199 204 bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; } 200 205 void invalidateScrollCorner(); 206 207 protected: 208 virtual void scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); 201 209 202 210 private: … … 269 277 bool m_contentIsOpaque; 270 278 unsigned m_slowRepaintObjectCount; 279 HashSet<RenderObject*> m_fixedPositionedObjects; 271 280 272 281 int m_borderX, m_borderY; -
trunk/WebCore/platform/ScrollView.cpp
r53259 r53693 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 hostWindow()->scroll(-scrollDelta, scrollViewRect, clipRect);518 scrollContentsFastPath(-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); 531 536 } 532 537 -
trunk/WebCore/platform/ScrollView.h
r53259 r53693 250 250 virtual void updateScrollCorner(); 251 251 virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect); 252 253 // Scroll the content by blitting the pixels 254 virtual void scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); 252 255 253 256 private: -
trunk/WebCore/rendering/RenderObject.cpp
r53506 r53693 1648 1648 s_affectsParentBlock = false; 1649 1649 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 1650 FrameView* frameView = view()->frameView(); 1651 if (frameView) { 1654 1652 bool shouldBlitOnFixedBackgroundImage = false; 1655 1653 #if ENABLE(FAST_MOBILE_SCROLLING) … … 1661 1659 #endif 1662 1660 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())); 1661 bool newStyleSlowScroll = newStyle && !shouldBlitOnFixedBackgroundImage && newStyle->hasFixedBackgroundImage(); 1662 bool oldStyleSlowScroll = m_style && !shouldBlitOnFixedBackgroundImage && m_style->hasFixedBackgroundImage(); 1663 1667 1664 if (oldStyleSlowScroll != newStyleSlowScroll) { 1668 1665 if (oldStyleSlowScroll) 1669 view()->frameView()->removeSlowRepaintObject();1666 frameView->removeSlowRepaintObject(); 1670 1667 if (newStyleSlowScroll) 1671 view()->frameView()->addSlowRepaintObject(); 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 } 1672 1687 } 1673 1688 } … … 1932 1947 void RenderObject::destroy() 1933 1948 { 1949 // unregister from the view if the object had a fixed position 1950 if (m_style && m_style->position() == FixedPosition) { 1951 FrameView* frameView = document()->view(); 1952 if (frameView) 1953 frameView->unregisterFixedPositionedObject(this); 1954 } 1955 1934 1956 // Destroy any leftover anonymous children. 1935 1957 RenderObjectChildList* children = virtualChildren();
Note: See TracChangeset
for help on using the changeset viewer.