Diff
Modified: trunk/Source/WebCore/ChangeLog (173904 => 173905)
--- trunk/Source/WebCore/ChangeLog 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/ChangeLog 2014-09-24 01:45:40 UTC (rev 173905)
@@ -1,3 +1,51 @@
+2014-09-23 Chris Dumez <cdu...@apple.com>
+
+ Have CSS classes' methods return more references
+ https://bugs.webkit.org/show_bug.cgi?id=137036
+
+ Reviewed by Ryosuke Niwa.
+
+ Have CSS classes' methods return more references instead of pointers
+ when possible.
+
+ No new tests, no behavior change.
+
+ * css/CSSFontFaceRule.cpp:
+ (WebCore::CSSFontFaceRule::style):
+ * css/CSSFontFaceRule.h:
+ * css/CSSGroupingRule.cpp:
+ (WebCore::CSSGroupingRule::cssRules):
+ * css/CSSGroupingRule.h:
+ * css/CSSImportRule.cpp:
+ (WebCore::CSSImportRule::media):
+ * css/CSSImportRule.h:
+ * css/CSSPageRule.cpp:
+ (WebCore::CSSPageRule::style):
+ * css/CSSPageRule.h:
+ * css/CSSStyleRule.cpp:
+ (WebCore::CSSStyleRule::style):
+ * css/CSSStyleRule.h:
+ * css/WebKitCSSKeyframeRule.cpp:
+ (WebCore::WebKitCSSKeyframeRule::style):
+ * css/WebKitCSSKeyframeRule.h:
+ * css/WebKitCSSKeyframesRule.cpp:
+ (WebCore::WebKitCSSKeyframesRule::cssRules):
+ * css/WebKitCSSKeyframesRule.h:
+ * css/WebKitCSSViewportRule.cpp:
+ (WebCore::WebKitCSSViewportRule::style):
+ * css/WebKitCSSViewportRule.h:
+ * inspector/InspectorStyleSheet.cpp:
+ (WebCore::asCSSRuleList):
+ (WebCore::fillMediaListChain):
+ (WebCore::InspectorStyleSheet::setRuleSelector):
+ (WebCore::InspectorStyleSheet::deleteRule):
+ (WebCore::InspectorStyleSheet::buildObjectForSelectorList):
+ (WebCore::InspectorStyleSheet::buildObjectForRule):
+ (WebCore::InspectorStyleSheet::styleForId):
+ (WebCore::InspectorStyleSheet::ruleIndexByStyle):
+ (WebCore::InspectorStyleSheet::ruleId):
+ (WebCore::InspectorStyleSheet::revalidateStyle):
+
2014-09-23 Roger Fong <roger_f...@apple.com>
[Windows] Enable CSS Supports Rule on Windows.
Modified: trunk/Source/WebCore/css/CSSFontFaceRule.cpp (173904 => 173905)
--- trunk/Source/WebCore/css/CSSFontFaceRule.cpp 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/CSSFontFaceRule.cpp 2014-09-24 01:45:40 UTC (rev 173905)
@@ -41,11 +41,11 @@
m_propertiesCSSOMWrapper->clearParentRule();
}
-CSSStyleDeclaration* CSSFontFaceRule::style()
+CSSStyleDeclaration& CSSFontFaceRule::style()
{
if (!m_propertiesCSSOMWrapper)
m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_fontFaceRule->mutableProperties(), *this);
- return m_propertiesCSSOMWrapper.get();
+ return *m_propertiesCSSOMWrapper;
}
String CSSFontFaceRule::cssText() const
Modified: trunk/Source/WebCore/css/CSSFontFaceRule.h (173904 => 173905)
--- trunk/Source/WebCore/css/CSSFontFaceRule.h 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/CSSFontFaceRule.h 2014-09-24 01:45:40 UTC (rev 173905)
@@ -40,7 +40,7 @@
virtual String cssText() const override;
virtual void reattach(StyleRuleBase*) override;
- CSSStyleDeclaration* style();
+ CSSStyleDeclaration& style();
private:
CSSFontFaceRule(StyleRuleFontFace*, CSSStyleSheet* parent);
Modified: trunk/Source/WebCore/css/CSSGroupingRule.cpp (173904 => 173905)
--- trunk/Source/WebCore/css/CSSGroupingRule.cpp 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/CSSGroupingRule.cpp 2014-09-24 01:45:40 UTC (rev 173905)
@@ -141,11 +141,11 @@
return rule.get();
}
-CSSRuleList* CSSGroupingRule::cssRules() const
+CSSRuleList& CSSGroupingRule::cssRules() const
{
if (!m_ruleListCSSOMWrapper)
m_ruleListCSSOMWrapper = std::make_unique<LiveCSSRuleList<CSSGroupingRule>>(const_cast<CSSGroupingRule*>(this));
- return m_ruleListCSSOMWrapper.get();
+ return *m_ruleListCSSOMWrapper;
}
void CSSGroupingRule::reattach(StyleRuleBase* rule)
Modified: trunk/Source/WebCore/css/CSSGroupingRule.h (173904 => 173905)
--- trunk/Source/WebCore/css/CSSGroupingRule.h 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/CSSGroupingRule.h 2014-09-24 01:45:40 UTC (rev 173905)
@@ -38,7 +38,7 @@
virtual void reattach(StyleRuleBase*) override;
- CSSRuleList* cssRules() const;
+ CSSRuleList& cssRules() const;
unsigned insertRule(const String& rule, unsigned index, ExceptionCode&);
void deleteRule(unsigned index, ExceptionCode&);
Modified: trunk/Source/WebCore/css/CSSImportRule.cpp (173904 => 173905)
--- trunk/Source/WebCore/css/CSSImportRule.cpp 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/CSSImportRule.cpp 2014-09-24 01:45:40 UTC (rev 173905)
@@ -53,11 +53,11 @@
return m_importRule->href();
}
-MediaList* CSSImportRule::media() const
+MediaList& CSSImportRule::media() const
{
if (!m_mediaCSSOMWrapper)
m_mediaCSSOMWrapper = MediaList::create(m_importRule->mediaQueries(), const_cast<CSSImportRule*>(this));
- return m_mediaCSSOMWrapper.get();
+ return *m_mediaCSSOMWrapper;
}
String CSSImportRule::cssText() const
Modified: trunk/Source/WebCore/css/CSSImportRule.h (173904 => 173905)
--- trunk/Source/WebCore/css/CSSImportRule.h 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/CSSImportRule.h 2014-09-24 01:45:40 UTC (rev 173905)
@@ -42,7 +42,7 @@
virtual void reattach(StyleRuleBase*) override;
String href() const;
- MediaList* media() const;
+ MediaList& media() const;
CSSStyleSheet* styleSheet() const;
private:
Modified: trunk/Source/WebCore/css/CSSPageRule.cpp (173904 => 173905)
--- trunk/Source/WebCore/css/CSSPageRule.cpp 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/CSSPageRule.cpp 2014-09-24 01:45:40 UTC (rev 173905)
@@ -46,11 +46,11 @@
m_propertiesCSSOMWrapper->clearParentRule();
}
-CSSStyleDeclaration* CSSPageRule::style()
+CSSStyleDeclaration& CSSPageRule::style()
{
if (!m_propertiesCSSOMWrapper)
m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_pageRule->mutableProperties(), *this);
- return m_propertiesCSSOMWrapper.get();
+ return *m_propertiesCSSOMWrapper;
}
String CSSPageRule::selectorText() const
Modified: trunk/Source/WebCore/css/CSSPageRule.h (173904 => 173905)
--- trunk/Source/WebCore/css/CSSPageRule.h 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/CSSPageRule.h 2014-09-24 01:45:40 UTC (rev 173905)
@@ -41,7 +41,7 @@
virtual String cssText() const override;
virtual void reattach(StyleRuleBase*) override;
- CSSStyleDeclaration* style();
+ CSSStyleDeclaration& style();
String selectorText() const;
void setSelectorText(const String&);
Modified: trunk/Source/WebCore/css/CSSStyleRule.cpp (173904 => 173905)
--- trunk/Source/WebCore/css/CSSStyleRule.cpp 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/CSSStyleRule.cpp 2014-09-24 01:45:40 UTC (rev 173905)
@@ -59,12 +59,11 @@
}
}
-CSSStyleDeclaration* CSSStyleRule::style()
+CSSStyleDeclaration& CSSStyleRule::style()
{
- if (!m_propertiesCSSOMWrapper) {
+ if (!m_propertiesCSSOMWrapper)
m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_styleRule->mutableProperties(), *this);
- }
- return m_propertiesCSSOMWrapper.get();
+ return *m_propertiesCSSOMWrapper;
}
String CSSStyleRule::generateSelectorText() const
Modified: trunk/Source/WebCore/css/CSSStyleRule.h (173904 => 173905)
--- trunk/Source/WebCore/css/CSSStyleRule.h 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/CSSStyleRule.h 2014-09-24 01:45:40 UTC (rev 173905)
@@ -43,7 +43,7 @@
String selectorText() const;
void setSelectorText(const String&);
- CSSStyleDeclaration* style();
+ CSSStyleDeclaration& style();
// FIXME: Not CSSOM. Remove.
StyleRule* styleRule() const { return m_styleRule.get(); }
Modified: trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp (173904 => 173905)
--- trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp 2014-09-24 01:45:40 UTC (rev 173905)
@@ -105,11 +105,11 @@
m_propertiesCSSOMWrapper->clearParentRule();
}
-CSSStyleDeclaration* WebKitCSSKeyframeRule::style()
+CSSStyleDeclaration& WebKitCSSKeyframeRule::style()
{
if (!m_propertiesCSSOMWrapper)
m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_keyframe->mutableProperties(), *this);
- return m_propertiesCSSOMWrapper.get();
+ return *m_propertiesCSSOMWrapper;
}
void WebKitCSSKeyframeRule::reattach(StyleRuleBase*)
Modified: trunk/Source/WebCore/css/WebKitCSSKeyframeRule.h (173904 => 173905)
--- trunk/Source/WebCore/css/WebKitCSSKeyframeRule.h 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframeRule.h 2014-09-24 01:45:40 UTC (rev 173905)
@@ -76,7 +76,7 @@
String keyText() const { return m_keyframe->keyText(); }
void setKeyText(const String& s) { m_keyframe->setKeyText(s); }
- CSSStyleDeclaration* style();
+ CSSStyleDeclaration& style();
private:
WebKitCSSKeyframeRule(StyleKeyframe*, WebKitCSSKeyframesRule* parent);
Modified: trunk/Source/WebCore/css/WebKitCSSKeyframesRule.cpp (173904 => 173905)
--- trunk/Source/WebCore/css/WebKitCSSKeyframesRule.cpp 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframesRule.cpp 2014-09-24 01:45:40 UTC (rev 173905)
@@ -185,11 +185,11 @@
return rule.get();
}
-CSSRuleList* WebKitCSSKeyframesRule::cssRules()
+CSSRuleList& WebKitCSSKeyframesRule::cssRules()
{
if (!m_ruleListCSSOMWrapper)
m_ruleListCSSOMWrapper = std::make_unique<LiveCSSRuleList<WebKitCSSKeyframesRule>>(this);
- return m_ruleListCSSOMWrapper.get();
+ return *m_ruleListCSSOMWrapper;
}
void WebKitCSSKeyframesRule::reattach(StyleRuleBase* rule)
Modified: trunk/Source/WebCore/css/WebKitCSSKeyframesRule.h (173904 => 173905)
--- trunk/Source/WebCore/css/WebKitCSSKeyframesRule.h 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframesRule.h 2014-09-24 01:45:40 UTC (rev 173905)
@@ -78,7 +78,7 @@
String name() const { return m_keyframesRule->name(); }
void setName(const String&);
- CSSRuleList* cssRules();
+ CSSRuleList& cssRules();
void insertRule(const String& rule);
void deleteRule(const String& key);
Modified: trunk/Source/WebCore/css/WebKitCSSViewportRule.cpp (173904 => 173905)
--- trunk/Source/WebCore/css/WebKitCSSViewportRule.cpp 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/WebKitCSSViewportRule.cpp 2014-09-24 01:45:40 UTC (rev 173905)
@@ -52,12 +52,12 @@
m_propertiesCSSOMWrapper->clearParentRule();
}
-CSSStyleDeclaration* WebKitCSSViewportRule::style()
+CSSStyleDeclaration& WebKitCSSViewportRule::style()
{
if (!m_propertiesCSSOMWrapper)
m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_viewportRule->mutableProperties(), *this);
- return m_propertiesCSSOMWrapper.get();
+ return *m_propertiesCSSOMWrapper;
}
String WebKitCSSViewportRule::cssText() const
Modified: trunk/Source/WebCore/css/WebKitCSSViewportRule.h (173904 => 173905)
--- trunk/Source/WebCore/css/WebKitCSSViewportRule.h 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/css/WebKitCSSViewportRule.h 2014-09-24 01:45:40 UTC (rev 173905)
@@ -53,7 +53,7 @@
virtual String cssText() const override;
virtual void reattach(StyleRuleBase*) override;
- CSSStyleDeclaration* style();
+ CSSStyleDeclaration& style();
private:
WebKitCSSViewportRule(StyleRuleViewport*, CSSStyleSheet*);
Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (173904 => 173905)
--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp 2014-09-24 00:52:37 UTC (rev 173904)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp 2014-09-24 01:45:40 UTC (rev 173905)
@@ -215,14 +215,14 @@
return nullptr;
if (rule->type() == CSSRule::MEDIA_RULE)
- return toCSSMediaRule(rule)->cssRules();
+ return &toCSSMediaRule(rule)->cssRules();
if (rule->type() == CSSRule::WEBKIT_KEYFRAMES_RULE)
- return static_cast<WebKitCSSKeyframesRule*>(rule)->cssRules();
+ return &static_cast<WebKitCSSKeyframesRule*>(rule)->cssRules();
#if ENABLE(CSS3_CONDITIONAL_RULES)
if (rule->type() == CSSRule::SUPPORTS_RULE)
- return toCSSSupportsRule(rule)->cssRules();
+ return &toCSSSupportsRule(rule)->cssRules();
#endif
return nullptr;
@@ -242,7 +242,7 @@
parentStyleSheet = mediaRule->parentStyleSheet();
} else if (parentRule->type() == CSSRule::IMPORT_RULE) {
CSSImportRule* importRule = toCSSImportRule(parentRule);
- mediaList = importRule->media();
+ mediaList = &importRule->media();
parentStyleSheet = importRule->parentStyleSheet();
isMediaRule = false;
} else
@@ -846,7 +846,7 @@
}
rule->setSelectorText(selector);
- RefPtr<CSSRuleSourceData> sourceData = ruleSourceDataFor(rule->style());
+ RefPtr<CSSRuleSourceData> sourceData = ruleSourceDataFor(&rule->style());
if (!sourceData) {
ec = NOT_FOUND_ERR;
return false;
@@ -929,7 +929,7 @@
return false;
}
- RefPtr<CSSRuleSourceData> sourceData = ruleSourceDataFor(rule->style());
+ RefPtr<CSSRuleSourceData> sourceData = ruleSourceDataFor(&rule->style());
if (!sourceData) {
ec = NOT_FOUND_ERR;
return false;
@@ -1018,7 +1018,7 @@
{
RefPtr<CSSRuleSourceData> sourceData;
if (ensureParsedDataReady())
- sourceData = ruleSourceDataFor(rule->style());
+ sourceData = ruleSourceDataFor(&rule->style());
RefPtr<Inspector::Protocol::Array<String>> selectors;
// This intentionally does not rely on the source data to avoid catching the trailing comments (before the declaration starting '{').
@@ -1051,7 +1051,7 @@
.setSelectorList(buildObjectForSelectorList(rule))
.setSourceLine(rule->styleRule()->sourceLine())
.setOrigin(m_origin)
- .setStyle(buildObjectForStyle(rule->style()));
+ .setStyle(buildObjectForStyle(&rule->style()));
// "sourceURL" is present only for regular rules, otherwise "origin" should be used in the frontend.
if (m_origin == Inspector::Protocol::CSS::StyleSheetOrigin::Regular)
@@ -1165,7 +1165,7 @@
if (!rule)
return nullptr;
- return rule->style();
+ return &rule->style();
}
void InspectorStyleSheet::fireStyleSheetChanged()
@@ -1228,7 +1228,7 @@
ensureFlatRules();
unsigned index = 0;
for (unsigned i = 0, size = m_flatRules.size(); i < size; ++i) {
- if (m_flatRules.at(i)->style() == pageStyle)
+ if (&m_flatRules.at(i)->style() == pageStyle)
return index;
++index;
@@ -1334,7 +1334,7 @@
InspectorCSSId InspectorStyleSheet::ruleId(CSSStyleRule* rule) const
{
- return ruleOrStyleId(rule->style());
+ return ruleOrStyleId(&rule->style());
}
void InspectorStyleSheet::revalidateStyle(CSSStyleDeclaration* pageStyle)
@@ -1346,7 +1346,7 @@
ensureFlatRules();
for (unsigned i = 0, size = m_flatRules.size(); i < size; ++i) {
CSSStyleRule* parsedRule = m_flatRules.at(i).get();
- if (parsedRule->style() == pageStyle) {
+ if (&parsedRule->style() == pageStyle) {
if (parsedRule->styleRule()->properties().asText() != pageStyle->cssText()) {
// Clear the disabled properties for the invalid style here.
m_inspectorStyles.remove(pageStyle);