2008-10-16 David Hyatt <hyatt@apple.com>
https://bugs.webkit.org/attachment.cgi?bugid=21647
Make RenderStyle inherit from RefCounted so that it works with RefPtr. RenderStyle was being malloced
out of the RenderArena. Years and years ago (before TCMalloc), the plan was to make RenderStyles and
all their associated sub-structs use the arena. However only the RenderStyle itself was ever changed
to use the arena.
At a later point style sharing was implemented, which made using the arena for styles pretty pointless,
as the bulk of the styles on a given page are actually shared. Not ever making the sub-structs use the
arena also limited the usefulness.
Now that we have RefPtr/PassRefPtr to eliminate manual ref/deref and now that we use TCMalloc for fast
mallocs, there is no reason to keep RenderStyles in the arena. The benefits of being able to eliminate
manual ref/deref far outweigh keeping them in the arena.
Reviewed by Adam Roben
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::CSSStyleSelector):
(WebCore::CSSStyleSelector::~CSSStyleSelector):
(WebCore::CSSStyleSelector::styleForElement):
(WebCore::CSSStyleSelector::keyframeStylesForAnimation):
(WebCore::CSSStyleSelector::pseudoStyleForElement):
These methods now return a PassRefPtr. They will null out the m_style variable as they hand it back
so that it isn't left pointing to the previous style resolve RenderStyle (which is what the old code did).
(WebCore::CSSStyleSelector::updateFont):
(WebCore::CSSStyleSelector::checkSelector):
(WebCore::CSSStyleSelector::applyProperty):
(WebCore::CSSStyleSelector::mapFillSize):
(WebCore::CSSStyleSelector::mapFillXPosition):
(WebCore::CSSStyleSelector::mapFillYPosition):
* css/CSSStyleSelector.h:
(WebCore::CSSStyleSelector::style):