Changeset 183710 in webkit
- Timestamp:
- May 1, 2015, 7:32:29 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 10 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/compositing/updates (added)
-
LayoutTests/compositing/updates/no-style-change-updates-expected.txt (added)
-
LayoutTests/compositing/updates/no-style-change-updates.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Document.cpp (modified) (1 diff)
-
Source/WebCore/page/FrameView.cpp (modified) (2 diffs)
-
Source/WebCore/page/FrameView.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderLayerCompositor.cpp (modified) (6 diffs)
-
Source/WebCore/rendering/RenderLayerCompositor.h (modified) (4 diffs)
-
Source/WebCore/testing/Internals.cpp (modified) (1 diff)
-
Source/WebCore/testing/Internals.h (modified) (1 diff)
-
Source/WebCore/testing/Internals.idl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r183709 r183710 1 2015-05-01 Simon Fraser <simon.fraser@apple.com> 2 3 Avoid compositing updates after style recalcs which have no compositing implications 4 https://bugs.webkit.org/show_bug.cgi?id=144502 5 6 Reviewed by Darin Adler. 7 8 Use internals.compositingUpdateCount() to see if various document mutations 9 cause a compositing update. Doesn't actually detect any behavior change 10 from this patch, but seems useful in general. 11 12 * compositing/updates/no-style-change-updates-expected.txt: Added. 13 * compositing/updates/no-style-change-updates.html: Added. 14 1 15 2015-05-01 Ryosuke Niwa <rniwa@webkit.org> 2 16 -
trunk/Source/WebCore/ChangeLog
r183706 r183710 1 2015-05-01 Simon Fraser <simon.fraser@apple.com> 2 3 Avoid compositing updates after style recalcs which have no compositing implications 4 https://bugs.webkit.org/show_bug.cgi?id=144502 5 6 Reviewed by Darin Adler. 7 8 After r183461, we have reliable information about whether a style change with zero 9 diff can be reliably ignored. Use that information to track whether a given 10 recalcStyle() does anything which should force a compositing update. 11 12 This eliminates up to 40% of the post-recalcStyle compositing updates on some pages. 13 14 Add Internals API to test. 15 16 Test: compositing/updates/no-style-change-updates.html 17 18 * dom/Document.cpp: 19 (WebCore::Document::recalcStyle): Tell the FrameView we're going to recalc style. 20 * page/FrameView.cpp: 21 (WebCore::FrameView::willRecalcStyle): Pass it on to the compositor. 22 (WebCore::FrameView::updateCompositingLayersAfterStyleChange): Move the code 23 that was here into RenderLayerCompositor::didRecalcStyleWithNoPendingLayout(). 24 * page/FrameView.h: 25 * rendering/RenderLayerCompositor.cpp: 26 (WebCore::RenderLayerCompositor::willRecalcStyle): Reset the m_layerNeedsCompositingUpdate flag. 27 (WebCore::RenderLayerCompositor::didRecalcStyleWithNoPendingLayout): Bail on the update if 28 no layers changed. 29 (WebCore::RenderLayerCompositor::updateCompositingLayers): Logging. Increment m_compositingUpdateCount, 30 which is used for testing. 31 (WebCore::RenderLayerCompositor::layerStyleChanged): Set the m_layerNeedsCompositingUpdate flag. 32 (WebCore::RenderLayerCompositor::startTrackingCompositingUpdates): Reset the counter. 33 (WebCore::RenderLayerCompositor::compositingUpdateCount): 34 * rendering/RenderLayerCompositor.h: 35 * testing/Internals.cpp: 36 (WebCore::Internals::startTrackingCompositingUpdates): 37 (WebCore::Internals::compositingUpdateCount): 38 * testing/Internals.h: 39 * testing/Internals.idl: 40 1 41 2015-05-01 Andreas Kling <akling@apple.com> 2 42 -
trunk/Source/WebCore/dom/Document.cpp
r183682 r183710 1749 1749 m_styleSheetCollection.flushPendingUpdates(); 1750 1750 1751 frameView.willRecalcStyle(); 1752 1751 1753 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(*this); 1752 1754 -
trunk/Source/WebCore/page/FrameView.cpp
r183595 r183710 729 729 } 730 730 731 void FrameView:: updateCompositingLayersAfterStyleChange()731 void FrameView::willRecalcStyle() 732 732 { 733 733 RenderView* renderView = this->renderView(); … … 735 735 return; 736 736 737 renderView->compositor().willRecalcStyle(); 738 } 739 740 void FrameView::updateCompositingLayersAfterStyleChange() 741 { 742 RenderView* renderView = this->renderView(); 743 if (!renderView) 744 return; 745 737 746 // If we expect to update compositing after an incipient layout, don't do so here. 738 747 if (inPreLayoutStyleUpdate() || layoutPending() || renderView->needsLayout()) 739 748 return; 740 749 741 RenderLayerCompositor& compositor = renderView->compositor(); 742 // This call will make sure the cached hasAcceleratedCompositing is updated from the pref 743 compositor.cacheAcceleratedCompositingFlags(); 744 compositor.updateCompositingLayers(CompositingUpdateAfterStyleChange); 750 renderView->compositor().didRecalcStyleWithNoPendingLayout(); 745 751 } 746 752 -
trunk/Source/WebCore/page/FrameView.h
r183597 r183710 148 148 #endif 149 149 150 void willRecalcStyle(); 150 151 void updateCompositingLayersAfterStyleChange(); 151 152 void updateCompositingLayersAfterLayout(); -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r183697 r183710 385 385 } 386 386 387 void RenderLayerCompositor::willRecalcStyle() 388 { 389 m_layerNeedsCompositingUpdate = false; 390 } 391 392 void RenderLayerCompositor::didRecalcStyleWithNoPendingLayout() 393 { 394 if (!m_layerNeedsCompositingUpdate) 395 return; 396 397 cacheAcceleratedCompositingFlags(); 398 updateCompositingLayers(CompositingUpdateAfterStyleChange); 399 } 400 387 401 void RenderLayerCompositor::customPositionForVisibleRectComputation(const GraphicsLayer* graphicsLayer, FloatPoint& position) const 388 402 { … … 657 671 void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType updateType, RenderLayer* updateRoot) 658 672 { 673 LOG(Compositing, "RenderLayerCompositor %p updateCompositingLayers %d %p", this, updateType, updateRoot); 674 659 675 m_updateCompositingLayersTimer.stop(); 660 676 … … 674 690 if (!m_reevaluateCompositingAfterLayout && !m_compositing) 675 691 return; 692 693 ++m_compositingUpdateCount; 676 694 677 695 AnimationUpdateBlock animationUpdateBlock(&m_renderView.frameView().frame().animation()); … … 710 728 if (isFullUpdate && updateType == CompositingUpdateAfterLayout) 711 729 m_reevaluateCompositingAfterLayout = false; 730 731 LOG(Compositing, " checkForHierarchyUpdate %d, needGeometryUpdate %d", checkForHierarchyUpdate, needHierarchyUpdate); 712 732 713 733 #if !LOG_DISABLED … … 920 940 if (diff == StyleDifferenceEqual) 921 941 return; 942 943 m_layerNeedsCompositingUpdate = true; 922 944 923 945 const RenderStyle& newStyle = layer.renderer().style(); … … 4187 4209 } 4188 4210 4211 void RenderLayerCompositor::startTrackingCompositingUpdates() 4212 { 4213 m_compositingUpdateCount = 0; 4214 } 4215 4216 unsigned RenderLayerCompositor::compositingUpdateCount() const 4217 { 4218 return m_compositingUpdateCount; 4219 } 4220 4189 4221 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderLayerCompositor.h
r183454 r183710 120 120 void setCompositingLayersNeedRebuild(bool needRebuild = true); 121 121 bool compositingLayersNeedRebuild() const { return m_compositingLayersNeedRebuild; } 122 123 void willRecalcStyle(); 124 void didRecalcStyleWithNoPendingLayout(); 122 125 123 126 // GraphicsLayers buffer state, which gets pushed to the underlying platform layers … … 311 314 WEBCORE_EXPORT void startTrackingLayerFlushes(); 312 315 WEBCORE_EXPORT unsigned layerFlushCount() const; 316 317 WEBCORE_EXPORT void startTrackingCompositingUpdates(); 318 WEBCORE_EXPORT unsigned compositingUpdateCount() const; 313 319 314 320 private: … … 499 505 unsigned m_layersWithTiledBackingCount { 0 }; 500 506 unsigned m_layerFlushCount { 0 }; 507 unsigned m_compositingUpdateCount { 0 }; 501 508 502 509 RootLayerAttachment m_rootLayerAttachment; … … 535 542 bool m_layerFlushThrottlingTemporarilyDisabledForInteraction; 536 543 bool m_hasPendingLayerFlush; 544 bool m_layerNeedsCompositingUpdate { false }; 537 545 538 546 Timer m_paintRelatedMilestonesTimer; -
trunk/Source/WebCore/testing/Internals.cpp
r183597 r183710 2115 2115 } 2116 2116 2117 void Internals::startTrackingCompositingUpdates(ExceptionCode& ec) 2118 { 2119 Document* document = contextDocument(); 2120 if (!document || !document->renderView()) { 2121 ec = INVALID_ACCESS_ERR; 2122 return; 2123 } 2124 2125 document->renderView()->compositor().startTrackingCompositingUpdates(); 2126 } 2127 2128 unsigned long Internals::compositingUpdateCount(ExceptionCode& ec) 2129 { 2130 Document* document = contextDocument(); 2131 if (!document || !document->renderView()) { 2132 ec = INVALID_ACCESS_ERR; 2133 return 0; 2134 } 2135 2136 return document->renderView()->compositor().compositingUpdateCount(); 2137 } 2138 2117 2139 void Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(ExceptionCode& ec) 2118 2140 { -
trunk/Source/WebCore/testing/Internals.h
r183428 r183710 304 304 unsigned long styleRecalcCount(ExceptionCode&); 305 305 306 void startTrackingCompositingUpdates(ExceptionCode&); 307 unsigned long compositingUpdateCount(ExceptionCode&); 308 306 309 void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(ExceptionCode&); 307 310 void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node*, ExceptionCode&); -
trunk/Source/WebCore/testing/Internals.idl
r183428 r183710 281 281 [RaisesException] unsigned long styleRecalcCount(); 282 282 283 [RaisesException] void startTrackingCompositingUpdates(); 284 [RaisesException] unsigned long compositingUpdateCount(); 285 283 286 // |node| should be Document, HTMLIFrameElement, or unspecified. 284 287 // If |node| is an HTMLIFrameElement, it assumes node.contentDocument is
Note:
See TracChangeset
for help on using the changeset viewer.