Don't create StyleResolvers just to invalidate them.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Apr 2013 19:42:45 +0000 (19:42 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Apr 2013 19:42:45 +0000 (19:42 +0000)
commit1e1fde40171041ab0f2707a6d7d35262748359ba
tree22b6dd0ec0c24aa9a997d5eccecf73192a31b4f1
parentb2924fbcc7004e9c920bf9812dc99cd238f48752
Don't create StyleResolvers just to invalidate them.
<http://webkit.org/b/115436>

Reviewed by Geoffrey Garen.

Source/WebCore:

Renamed Document::styleResolver() to ensureStyleResolver() so it's clear that it never returns null.
Removed a bunch of unnecessary null-checks I spotted while doing this.

Also fixed Element::willModifyAttribute() and FrameView::setFrameRect() to not create a StyleResolver
and immediately invalidate it in some cases.

* css/FontLoader.cpp:
(WebCore::FontLoader::loadFont):
(WebCore::FontLoader::checkFont):
(WebCore::FontLoader::resolveFontStyle):
* css/MediaQueryMatcher.cpp:
(WebCore::MediaQueryMatcher::prepareEvaluator):
* css/StyleMedia.cpp:
(WebCore::StyleMedia::matchMedium):
* dom/Document.cpp:
(WebCore::Document::styleForElementIgnoringPendingStylesheets):
(WebCore::Document::styleForPage):
* dom/Document.h:
(WebCore::Document::ensureStyleResolver):
* dom/DocumentStyleSheetCollection.cpp:
(WebCore::DocumentStyleSheetCollection::combineCSSFeatureFlags):
(WebCore::DocumentStyleSheetCollection::resetCSSFeatureFlags):
(WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):
* dom/Element.cpp:
(WebCore::StyleResolverParentPusher::push):
(WebCore::StyleResolverParentPusher::~StyleResolverParentPusher):
(WebCore::Element::styleForRenderer):
(WebCore::Element::recalcStyle):
(WebCore::Element::willModifyAttribute):
* dom/NodeRenderingContext.cpp:
(WebCore::NodeRenderingContext::createRendererForTextIfNeeded):
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::recalcStyle):
(WebCore::ShadowRoot::attach):
* dom/Text.cpp:
(WebCore::Text::recalcTextStyle):
* editing/EditingStyle.cpp:
(WebCore::styleFromMatchedRulesForElement):
* html/HTMLCanvasElement.cpp:
* html/HTMLCanvasElement.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::customStyleForRenderer):
* html/HTMLOptGroupElement.cpp:
(WebCore::HTMLOptGroupElement::updateNonRenderStyle):
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::updateNonRenderStyle):
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::customStyleForRenderer):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setFont):
* html/shadow/DateTimeEditElement.cpp:
(WebCore::DateTimeEditElement::customStyleForRenderer):
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::getMatchedStylesForNode):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::getMatchedCSSRules):
* page/FrameView.cpp:
(WebCore::FrameView::setFrameRect):
* page/animation/KeyframeAnimation.cpp:
(WebCore::KeyframeAnimation::KeyframeAnimation):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::updateFromElement):
(WebCore::RenderListBox::paintItemForeground):
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::fontSelector):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::getUncachedPseudoStyle):
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::checkRegionStyle):
(WebCore::RenderRegion::computeStyleInRegion):
* rendering/RenderSearchField.cpp:
(WebCore::RenderSearchField::fontSelector):
* rendering/svg/RenderSVGInlineText.cpp:
(WebCore::RenderSVGInlineText::computeNewScaledFontForStyle):
* svg/SVGElement.cpp:
(WebCore::SVGElement::customStyleForRenderer):
* svg/SVGElementRareData.h:
(WebCore::SVGElementRareData::overrideComputedStyle):

Source/WebKit/qt:

* Api/qwebelement.cpp:
(QWebElement::styleProperty):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@149392 268f45cc-cd09-0410-ab3c-d52691b4dbfc
34 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/FontLoader.cpp
Source/WebCore/css/MediaQueryMatcher.cpp
Source/WebCore/css/StyleMedia.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/DocumentStyleSheetCollection.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/NodeRenderingContext.cpp
Source/WebCore/dom/ShadowRoot.cpp
Source/WebCore/dom/Text.cpp
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/html/HTMLCanvasElement.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLOptGroupElement.cpp
Source/WebCore/html/HTMLOptionElement.cpp
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/html/shadow/DateTimeEditElement.cpp
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/animation/KeyframeAnimation.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderRegion.cpp
Source/WebCore/rendering/RenderSearchField.cpp
Source/WebCore/rendering/svg/RenderSVGInlineText.cpp
Source/WebCore/svg/SVGElement.cpp
Source/WebCore/svg/SVGElementRareData.h
Source/WebKit/qt/Api/qwebelement.cpp
Source/WebKit/qt/ChangeLog