styleForElement() should use enums instead of bools so we can all understand what...
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 31 Mar 2012 02:46:08 +0000 (02:46 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 31 Mar 2012 02:46:08 +0000 (02:46 +0000)
commitf7604445a879077bed6f0e1c332ee30847a2f47b
treeea388825d3955c87327fd28c50b3bf4416baf894
parent5c5b52ab6b78df5f789140e3147cb55d5e5fbcc9
styleForElement() should use enums instead of bools so we can all understand what it's doing
https://bugs.webkit.org/show_bug.cgi?id=82807

Reviewed by Adam Barth.

No change in behavior, thus no tests.

Mostly this is just replacing true/false with the correct new enum value
or removing true/false from the callsites when they would have been default anyway.
I think this makes the code *way* more clear.

The old code was extra confusing because the defaults were "true, false". :)
The new defaults are AllowStyleSharing, MatchAllRules.
It's very uncommon for callers to want to override either of these behaviors.
I think most callers which specify DisallowStyleSharing likely don't actually need to
(our style-sharing code should be smart enough to only share when safe anyway).

* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::CSSStyleSelector):
 - Use enums and remove bogus comment (m_rootDefaultStyle is a RefPtr!)
(WebCore::CSSStyleSelector::collectMatchingRulesForList):
* css/CSSStyleSelector.h:
(CSSStyleSelector):
* css/MediaQueryMatcher.cpp:
(WebCore::MediaQueryMatcher::prepareEvaluator):
* css/StyleMedia.cpp:
(WebCore::StyleMedia::matchMedium):
* dom/Element.cpp:
(WebCore::Element::styleForRenderer):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::getUncachedPseudoStyle):
 - Updated to use enums
 - Also fixed this to use toElement and modern early-return styles.
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::computeStyleInRegion):
* svg/SVGElement.cpp:
(WebCore::SVGElement::customStyleForRenderer):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/css/CSSStyleSelector.cpp
Source/WebCore/css/CSSStyleSelector.h
Source/WebCore/css/MediaQueryMatcher.cpp
Source/WebCore/css/StyleMedia.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderRegion.cpp
Source/WebCore/svg/SVGElement.cpp