2008-10-16 David Hyatt <hyatt@apple.com>
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Oct 2008 00:25:33 +0000 (00:25 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Oct 2008 00:25:33 +0000 (00:25 +0000)
commit3d82c0b1fc52f10fbc45d027206c8b183a5d0ce3
tree94f0dcdc629bc90c6522e3107c69f0cf2da5ba4b
parentc8d032520c997c9170fd87677837d12e47276771
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):
        * dom/Document.cpp:
        (WebCore::Document::recalcStyle):
        * dom/Element.cpp:
        (WebCore::Element::styleForRenderer):
        (WebCore::Element::recalcStyle):
        (WebCore::Element::computedStyle):
        * dom/Element.h:
        * dom/ElementRareData.h:
        (WebCore::ElementRareData::ElementRareData):
        (WebCore::ElementRareData::resetComputedStyle):
        * dom/Node.cpp:
        (WebCore::Node::diff):
        (WebCore::Node::createRendererIfNeeded):
        (WebCore::Node::styleForRenderer):
        (WebCore::Node::setRenderStyle):
        * dom/Node.h:
        * html/CanvasRenderingContext2D.cpp:
        (WebCore::CanvasRenderingContext2D::setFont):
        * html/HTMLOptGroupElement.cpp:
        (WebCore::HTMLOptGroupElement::attach):
        (WebCore::HTMLOptGroupElement::detach):
        (WebCore::HTMLOptGroupElement::setRenderStyle):
        (WebCore::HTMLOptGroupElement::nonRendererRenderStyle):
        * html/HTMLOptGroupElement.h:
        * html/HTMLOptionElement.cpp:
        (WebCore::HTMLOptionElement::attach):
        (WebCore::HTMLOptionElement::detach):
        (WebCore::HTMLOptionElement::setRenderStyle):
        (WebCore::HTMLOptionElement::nonRendererRenderStyle):
        * html/HTMLOptionElement.h:
        * page/animation/AnimationBase.h:
        (WebCore::AnimationBase::animate):
        * page/animation/AnimationController.cpp:
        (WebCore::AnimationController::updateAnimations):
        * page/animation/AnimationController.h:
        * page/animation/CompositeAnimation.cpp:
        (WebCore::CompositeAnimationPrivate::updateTransitions):
        (WebCore::CompositeAnimationPrivate::updateKeyframeAnimations):
        (WebCore::CompositeAnimationPrivate::animate):
        (WebCore::CompositeAnimation::animate):
        * page/animation/CompositeAnimation.h:
        * page/animation/ImplicitAnimation.cpp:
        (WebCore::ImplicitAnimation::ImplicitAnimation):
        (WebCore::ImplicitAnimation::~ImplicitAnimation):
        (WebCore::ImplicitAnimation::animate):
        (WebCore::ImplicitAnimation::reset):
        (WebCore::ImplicitAnimation::isTargetPropertyEqual):
        (WebCore::ImplicitAnimation::blendPropertyValueInStyle):
        * page/animation/ImplicitAnimation.h:
        (WebCore::ImplicitAnimation::create):
        * page/animation/KeyframeAnimation.cpp:
        (WebCore::KeyframeAnimation::KeyframeAnimation):
        (WebCore::KeyframeAnimation::~KeyframeAnimation):
        (WebCore::KeyframeAnimation::animate):
        (WebCore::KeyframeAnimation::validateTransformFunctionList):
        * page/animation/KeyframeAnimation.h:
        (WebCore::KeyframeAnimation::create):
        (WebCore::KeyframeAnimation::unanimatedStyle):
        * rendering/InlineTextBox.cpp:
        (WebCore::InlineTextBox::paint):
        * rendering/MediaControlElements.cpp:
        (WebCore::MediaControlShadowRootElement::MediaControlShadowRootElement):
        (WebCore::MediaControlInputElement::MediaControlInputElement):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::styleDidChange):
        (WebCore::RenderBlock::updateFirstLetter):
        * rendering/RenderContainer.cpp:
        (WebCore::RenderContainer::addChild):
        (WebCore::RenderContainer::updateBeforeAfterContentForContainer):
        * rendering/RenderFileUploadControl.cpp:
        (WebCore::RenderFileUploadControl::updateFromElement):
        (WebCore::RenderFileUploadControl::createButtonStyle):
        * rendering/RenderFileUploadControl.h:
        * rendering/RenderFlow.cpp:
        (WebCore::RenderFlow::createAnonymousFlow):
        * rendering/RenderFlow.h:
        * rendering/RenderInline.cpp:
        (WebCore::RenderInline::addChildToFlow):
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::updateScrollCornerStyle):
        (WebCore::RenderLayer::updateResizerStyle):
        (WebCore::RenderLayer::updateReflectionStyle):
        * rendering/RenderListItem.cpp:
        (WebCore::RenderListItem::styleDidChange):
        * rendering/RenderMedia.cpp:
        (WebCore::RenderMedia::createPanel):
        (WebCore::RenderMedia::createTimeDisplay):
        (WebCore::RenderMedia::changeOpacity):
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::selectionBackgroundColor):
        (WebCore::RenderObject::selectionForegroundColor):
        (WebCore::RenderObject::createAnonymousBlock):
        (WebCore::RenderObject::setAnimatableStyle):
        (WebCore::RenderObject::setStyle):
        (WebCore::RenderObject::setStyleInternal):
        (WebCore::RenderObject::arenaDelete):
        (WebCore::RenderObject::firstLineStyle):
        (WebCore::RenderObject::getPseudoStyle):
        * rendering/RenderObject.h:
        (WebCore::RenderObject::style):
        * rendering/RenderSVGBlock.cpp:
        (WebCore::RenderSVGBlock::setStyle):
        * rendering/RenderSVGBlock.h:
        * rendering/RenderScrollbar.cpp:
        (WebCore::RenderScrollbar::getScrollbarPseudoStyle):
        (WebCore::RenderScrollbar::updateScrollbarPart):
        * rendering/RenderScrollbar.h:
        * rendering/RenderSlider.cpp:
        (WebCore::RenderSlider::styleDidChange):
        (WebCore::RenderSlider::createThumbStyle):
        (WebCore::RenderSlider::updateFromElement):
        * rendering/RenderSlider.h:
        * rendering/RenderTable.cpp:
        (WebCore::RenderTable::addChild):
        * rendering/RenderTableRow.cpp:
        (WebCore::RenderTableRow::addChild):
        * rendering/RenderTableSection.cpp:
        (WebCore::RenderTableSection::addChild):
        * rendering/RenderTextControl.cpp:
        (WebCore::RenderTextControl::styleDidChange):
        (WebCore::RenderTextControl::createInnerBlockStyle):
        (WebCore::RenderTextControl::createInnerTextStyle):
        (WebCore::RenderTextControl::createResultsButtonStyle):
        (WebCore::RenderTextControl::createCancelButtonStyle):
        (WebCore::RenderTextControl::createSubtreeIfNeeded):
        (WebCore::RenderTextControl::updatePlaceholderVisibility):
        * rendering/RenderTextControl.h:
        * rendering/TextControlInnerElements.cpp:
        (WebCore::TextControlInnerElement::attachInnerElement):
        * rendering/TextControlInnerElements.h:
        * rendering/style/KeyframeList.cpp:
        (WebCore::KeyframeList::clear):
        (WebCore::KeyframeList::operator==):
        (WebCore::KeyframeList::insert):
        * rendering/style/KeyframeList.h:
        (WebCore::KeyframeValue::KeyframeValue):
        (WebCore::KeyframeValue::~KeyframeValue):
        (WebCore::KeyframeValue::key):
        (WebCore::KeyframeValue::style):
        * rendering/style/RenderStyle.cpp:
        (WebCore::defaultStyle):
        (WebCore::RenderStyle::create):
        (WebCore::RenderStyle::createDefaultStyle):
        (WebCore::RenderStyle::clone):
        (WebCore::RenderStyle::RenderStyle):
        (WebCore::RenderStyle::getCachedPseudoStyle):
        (WebCore::RenderStyle::addCachedPseudoStyle):
        * rendering/style/RenderStyle.h:
        (WebCore::):
        (WebCore::InheritedFlags::operator!=):
        * svg/SVGClipPathElement.cpp:
        (WebCore::SVGClipPathElement::canvasResource):
        * svg/SVGGradientElement.cpp:
        (WebCore::SVGGradientElement::buildStops):
        * svg/SVGStyledElement.cpp:
        (WebCore::SVGStyledElement::resolveStyle):
        * svg/SVGStyledElement.h:
        * svg/SVGUseElement.cpp:
        (WebCore::SVGUseElement::recalcStyle):
        (WebCore::SVGUseElement::attachShadowTree):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@37637 268f45cc-cd09-0410-ab3c-d52691b4dbfc
62 files changed:
WebCore/ChangeLog
WebCore/css/CSSGradientValue.h
WebCore/css/CSSStyleSelector.cpp
WebCore/css/CSSStyleSelector.h
WebCore/css/CSSVariableDependentValue.cpp
WebCore/css/CSSVariableDependentValue.h
WebCore/dom/Document.cpp
WebCore/dom/Element.cpp
WebCore/dom/Element.h
WebCore/dom/ElementRareData.h
WebCore/dom/Node.cpp
WebCore/dom/Node.h
WebCore/html/CanvasRenderingContext2D.cpp
WebCore/html/HTMLOptGroupElement.cpp
WebCore/html/HTMLOptGroupElement.h
WebCore/html/HTMLOptionElement.cpp
WebCore/html/HTMLOptionElement.h
WebCore/page/animation/AnimationBase.h
WebCore/page/animation/AnimationController.cpp
WebCore/page/animation/AnimationController.h
WebCore/page/animation/CompositeAnimation.cpp
WebCore/page/animation/CompositeAnimation.h
WebCore/page/animation/ImplicitAnimation.cpp
WebCore/page/animation/ImplicitAnimation.h
WebCore/page/animation/KeyframeAnimation.cpp
WebCore/page/animation/KeyframeAnimation.h
WebCore/rendering/InlineTextBox.cpp
WebCore/rendering/MediaControlElements.cpp
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderContainer.cpp
WebCore/rendering/RenderFileUploadControl.cpp
WebCore/rendering/RenderFileUploadControl.h
WebCore/rendering/RenderFlow.cpp
WebCore/rendering/RenderFlow.h
WebCore/rendering/RenderInline.cpp
WebCore/rendering/RenderLayer.cpp
WebCore/rendering/RenderListItem.cpp
WebCore/rendering/RenderMedia.cpp
WebCore/rendering/RenderObject.cpp
WebCore/rendering/RenderObject.h
WebCore/rendering/RenderSVGBlock.cpp
WebCore/rendering/RenderSVGBlock.h
WebCore/rendering/RenderScrollbar.cpp
WebCore/rendering/RenderScrollbar.h
WebCore/rendering/RenderSlider.cpp
WebCore/rendering/RenderSlider.h
WebCore/rendering/RenderTable.cpp
WebCore/rendering/RenderTableRow.cpp
WebCore/rendering/RenderTableSection.cpp
WebCore/rendering/RenderTextControl.cpp
WebCore/rendering/RenderTextControl.h
WebCore/rendering/TextControlInnerElements.cpp
WebCore/rendering/TextControlInnerElements.h
WebCore/rendering/style/KeyframeList.cpp
WebCore/rendering/style/KeyframeList.h
WebCore/rendering/style/RenderStyle.cpp
WebCore/rendering/style/RenderStyle.h
WebCore/svg/SVGClipPathElement.cpp
WebCore/svg/SVGGradientElement.cpp
WebCore/svg/SVGStyledElement.cpp
WebCore/svg/SVGStyledElement.h
WebCore/svg/SVGUseElement.cpp