Changeset 264008 in webkit
- Timestamp:
- Jul 6, 2020 8:46:01 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r264006 r264008 1 2020-07-06 Simon Fraser <simon.fraser@apple.com> 2 3 High CPU usage on Stash search results pages 4 https://bugs.webkit.org/show_bug.cgi?id=214018 5 <rdar://problem/64832917> 6 7 Reviewed by Tim Horton. 8 9 Stash search results pages can contain a lot of overflow:scroll areas, so scrolling thread CA commits 10 would take a long time because ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters() would 11 open and close a CA commit for each scroller. 12 13 Fix by not explicitly starting a CA commit, and only entering this code if a gesture is active and in 14 the momentum phase. 15 16 Also sprinkle BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS in more places that call into Core 17 Animation. 18 19 * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: 20 (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers): 21 (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers): 22 * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: 23 (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers): 24 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: 25 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: 26 (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): 27 (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters): 28 1 29 2020-07-06 Simon Fraser <simon.fraser@apple.com> 2 30 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm
r263485 r264008 39 39 #import "TileController.h" 40 40 #import "WebCoreCALayerExtras.h" 41 #import <wtf/BlockObjCExceptions.h> 41 42 #import <wtf/Deque.h> 42 43 #import <wtf/text/CString.h> … … 159 160 void ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers() 160 161 { 162 BEGIN_BLOCK_OBJC_EXCEPTIONS 161 163 // We use scroll position here because the root content layer is offset to account for scrollOrigin (see FrameView::positionForRootContentLayer). 162 164 static_cast<CALayer*>(scrolledContentsLayer()).position = -currentScrollPosition(); 165 END_BLOCK_OBJC_EXCEPTIONS 163 166 } 164 167 165 168 void ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers() 166 169 { 170 BEGIN_BLOCK_OBJC_EXCEPTIONS 167 171 auto scrollPosition = currentScrollPosition(); 168 172 auto layoutViewport = this->layoutViewport(); … … 192 196 m_footerLayer.get().position = FloatPoint(horizontalScrollOffsetForBanner, FrameView::yPositionForFooterLayer(scrollPosition, topContentInset, totalContentsSize().height(), footerHeight())); 193 197 } 198 END_BLOCK_OBJC_EXCEPTIONS 194 199 195 200 m_delegate.updateScrollbarPainters(); -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm
r262294 r264008 33 33 #import "ScrollingTree.h" 34 34 #import "WebCoreCALayerExtras.h" 35 #import <wtf/BlockObjCExceptions.h> 35 36 #import <wtf/text/TextStream.h> 36 37 … … 94 95 void ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers() 95 96 { 97 BEGIN_BLOCK_OBJC_EXCEPTIONS 96 98 [static_cast<CALayer*>(scrollContainerLayer()) _web_setLayerBoundsOrigin:currentScrollOffset()]; 99 END_BLOCK_OBJC_EXCEPTIONS 97 100 } 98 101 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h
r262042 r264008 96 96 97 97 ScrollController m_scrollController; 98 99 bool m_inMomentumPhase { false }; 98 100 99 101 RetainPtr<NSScrollerImp> m_verticalScrollerImp; -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm
r263485 r264008 36 36 #import <QuartzCore/QuartzCore.h> 37 37 #import <pal/spi/mac/NSScrollerImpSPI.h> 38 #import <wtf/BlockObjCExceptions.h> 38 39 39 40 namespace WebCore { … … 122 123 bool ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent) 123 124 { 124 if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseBegan) { 125 [m_verticalScrollerImp setUsePresentationValue:YES]; 126 [m_horizontalScrollerImp setUsePresentationValue:YES]; 127 } 128 if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded || wheelEvent.momentumPhase() == PlatformWheelEventPhaseCancelled) { 129 [m_verticalScrollerImp setUsePresentationValue:NO]; 130 [m_horizontalScrollerImp setUsePresentationValue:NO]; 125 bool wasInMomentumPhase = m_inMomentumPhase; 126 127 if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseBegan) 128 m_inMomentumPhase = true; 129 else if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded || wheelEvent.momentumPhase() == PlatformWheelEventPhaseCancelled) 130 m_inMomentumPhase = false; 131 132 if (wasInMomentumPhase != m_inMomentumPhase) { 133 [m_verticalScrollerImp setUsePresentationValue:m_inMomentumPhase]; 134 [m_horizontalScrollerImp setUsePresentationValue:m_inMomentumPhase]; 131 135 } 132 136 … … 389 393 void ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters() 390 394 { 391 if (m_verticalScrollerImp || m_horizontalScrollerImp) { 395 if (m_inMomentumPhase && (m_verticalScrollerImp || m_horizontalScrollerImp)) { 396 BEGIN_BLOCK_OBJC_EXCEPTIONS 392 397 auto scrollOffset = scrollingNode().currentScrollOffset(); 393 398 394 [CATransaction begin];395 399 [CATransaction lock]; 396 400 … … 410 414 411 415 [CATransaction unlock]; 412 [CATransaction commit];416 END_BLOCK_OBJC_EXCEPTIONS 413 417 } 414 418 } -
trunk/Source/WebKit/ChangeLog
r264006 r264008 1 2020-07-06 Simon Fraser <simon.fraser@apple.com> 2 3 High CPU usage on Stash search results pages 4 https://bugs.webkit.org/show_bug.cgi?id=214018 5 <rdar://problem/64832917> 6 7 Reviewed by Tim Horton. 8 9 Stash search results pages can contain a lot of overflow:scroll areas, so scrolling thread CA commits 10 would take a long time because ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters() would 11 open and close a CA commit for each scroller. 12 13 Fix by not explicitly starting a CA commit, and only entering this code if a gesture is active and in 14 the momentum phase. 15 16 Also sprinkle BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS in more places that call into Core 17 Animation. 18 19 * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm: 20 (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::repositionRelatedLayers): 21 1 22 2020-07-06 Simon Fraser <simon.fraser@apple.com> 2 23 -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm
r255037 r264008 33 33 #import <WebCore/ScrollingStateScrollingNode.h> 34 34 #import <WebCore/ScrollingTree.h> 35 #import <wtf/BlockObjCExceptions.h> 35 36 36 37 namespace WebKit { … … 128 129 void ScrollingTreeFrameScrollingNodeRemoteIOS::repositionRelatedLayers() 129 130 { 131 BEGIN_BLOCK_OBJC_EXCEPTIONS 130 132 auto layoutViewport = this->layoutViewport(); 131 133 … … 143 145 [m_footerLayer setPosition:FloatPoint(layoutViewport.x(), totalContentsSize().height() - footerHeight())]; 144 146 } 147 END_BLOCK_OBJC_EXCEPTIONS 145 148 } 146 149
Note: See TracChangeset
for help on using the changeset viewer.