Cache isSelfPaintingLayer() for better performance
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jun 2012 04:20:47 +0000 (04:20 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jun 2012 04:20:47 +0000 (04:20 +0000)
commitae354307990a124cd61f1426fc612a671f340766
treea8cf0e44b1ce80c3ea1dc0730a10ec467d39eaf3
parentbcf2f3c11329d06207d6871a3320ee163c61ffd8
Cache isSelfPaintingLayer() for better performance
https://bugs.webkit.org/show_bug.cgi?id=88464

Reviewed by Simon Fraser.

Covered by existing tests (repaint tests among them).

isSelfPaintingLayer() has shown up several times on some scrolling benchmarks due
to the function being called several time per paint phase. This change caches the
boolean at style change time.

On http://dglazkov.github.com/performance-tests/biggrid.html, this nearly speed-up
painting by 2 (lowering the time taken to paint the newly exposed area when scrolling
on a 10,000 * 100 table from 95ms to 50ms).

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
Initialized m_isSelfPaintingLayer here.

(WebCore::RenderLayer::paintLayer):
Changed the order of the checks to get the more likely check first.

(WebCore::RenderLayer::shouldBeSelfPaintingLayer):
Renamed from isSelfPaintingLayer to make m_isNormalFlowOnly.

(WebCore::RenderLayer::styleChanged):
Added code to update our cached m_isSelfPaintingLayer.

* rendering/RenderLayer.h:
(WebCore::RenderLayer::isSelfPaintingLayer):
Changed to return m_isSelfPaintingLayer.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@119676 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h