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)
commit03fa9d924510beda475f91ed269931147e20d012
treea8cf0e44b1ce80c3ea1dc0730a10ec467d39eaf3
parentf4bed9b7555db2b9edeae55773fae0a7f4ff8ffa
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: https://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