Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (163961 => 163962)
--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp 2014-02-12 17:57:05 UTC (rev 163961)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp 2014-02-12 18:15:23 UTC (rev 163962)
@@ -227,23 +227,23 @@
RefPtr<InspectorStyleSheet> m_styleSheet;
};
-class InspectorCSSAgent::SetStyleSheetTextAction : public InspectorCSSAgent::StyleSheetAction {
+class InspectorCSSAgent::SetStyleSheetTextAction final : public InspectorCSSAgent::StyleSheetAction {
WTF_MAKE_NONCOPYABLE(SetStyleSheetTextAction);
public:
SetStyleSheetTextAction(InspectorStyleSheet* styleSheet, const String& text)
- : InspectorCSSAgent::StyleSheetAction("SetStyleSheetText", styleSheet)
+ : InspectorCSSAgent::StyleSheetAction(ASCIILiteral("SetStyleSheetText"), styleSheet)
, m_text(text)
{
}
- virtual bool perform(ExceptionCode& ec)
+ virtual bool perform(ExceptionCode& ec) override
{
if (!m_styleSheet->getText(&m_oldText))
return false;
return redo(ec);
}
- virtual bool undo(ExceptionCode& ec)
+ virtual bool undo(ExceptionCode& ec) override
{
if (m_styleSheet->setText(m_oldText, ec)) {
m_styleSheet->reparseStyleSheet(m_oldText);
@@ -252,7 +252,7 @@
return false;
}
- virtual bool redo(ExceptionCode& ec)
+ virtual bool redo(ExceptionCode& ec) override
{
if (m_styleSheet->setText(m_text, ec)) {
m_styleSheet->reparseStyleSheet(m_text);
@@ -261,12 +261,12 @@
return false;
}
- virtual String mergeId()
+ virtual String mergeId() override
{
return String::format("SetStyleSheetText %s", m_styleSheet->id().utf8().data());
}
- virtual void merge(PassOwnPtr<Action> action)
+ virtual void merge(PassOwnPtr<Action> action) override
{
ASSERT(action->mergeId() == mergeId());
@@ -279,7 +279,7 @@
String m_oldText;
};
-class InspectorCSSAgent::SetStyleTextAction : public InspectorCSSAgent::StyleSheetAction {
+class InspectorCSSAgent::SetStyleTextAction final : public InspectorCSSAgent::StyleSheetAction {
WTF_MAKE_NONCOPYABLE(SetStyleTextAction);
public:
SetStyleTextAction(InspectorStyleSheet* styleSheet, const InspectorCSSId& cssId, const String& text)
@@ -289,28 +289,28 @@
{
}
- virtual bool perform(ExceptionCode& ec)
+ virtual bool perform(ExceptionCode& ec) override
{
return redo(ec);
}
- virtual bool undo(ExceptionCode& ec)
+ virtual bool undo(ExceptionCode& ec) override
{
- return m_styleSheet->setStyleText(m_cssId, m_oldText, 0, ec);
+ return m_styleSheet->setStyleText(m_cssId, m_oldText, nullptr, ec);
}
- virtual bool redo(ExceptionCode& ec)
+ virtual bool redo(ExceptionCode& ec) override
{
return m_styleSheet->setStyleText(m_cssId, m_text, &m_oldText, ec);
}
- virtual String mergeId()
+ virtual String mergeId() override
{
ASSERT(m_styleSheet->id() == m_cssId.styleSheetId());
return String::format("SetStyleText %s:%u", m_styleSheet->id().utf8().data(), m_cssId.ordinal());
}
- virtual void merge(PassOwnPtr<Action> action)
+ virtual void merge(PassOwnPtr<Action> action) override
{
ASSERT(action->mergeId() == mergeId());
@@ -324,11 +324,11 @@
String m_oldText;
};
-class InspectorCSSAgent::SetPropertyTextAction : public InspectorCSSAgent::StyleSheetAction {
+class InspectorCSSAgent::SetPropertyTextAction final : public InspectorCSSAgent::StyleSheetAction {
WTF_MAKE_NONCOPYABLE(SetPropertyTextAction);
public:
SetPropertyTextAction(InspectorStyleSheet* styleSheet, const InspectorCSSId& cssId, unsigned propertyIndex, const String& text, bool overwrite)
- : InspectorCSSAgent::StyleSheetAction("SetPropertyText", styleSheet)
+ : InspectorCSSAgent::StyleSheetAction(ASCIILiteral("SetPropertyText"), styleSheet)
, m_cssId(cssId)
, m_propertyIndex(propertyIndex)
, m_text(text)
@@ -336,23 +336,23 @@
{
}
- virtual String toString()
+ virtual String toString() override
{
return mergeId() + ": " + m_oldText + " -> " + m_text;
}
- virtual bool perform(ExceptionCode& ec)
+ virtual bool perform(ExceptionCode& ec) override
{
return redo(ec);
}
- virtual bool undo(ExceptionCode& ec)
+ virtual bool undo(ExceptionCode& ec) override
{
String placeholder;
return m_styleSheet->setPropertyText(m_cssId, m_propertyIndex, m_overwrite ? m_oldText : "", true, &placeholder, ec);
}
- virtual bool redo(ExceptionCode& ec)
+ virtual bool redo(ExceptionCode& ec) override
{
String oldText;
bool result = m_styleSheet->setPropertyText(m_cssId, m_propertyIndex, m_text, m_overwrite, &oldText, ec);
@@ -364,12 +364,12 @@
return result;
}
- virtual String mergeId()
+ virtual String mergeId() override
{
return String::format("SetPropertyText %s:%u:%s", m_styleSheet->id().utf8().data(), m_propertyIndex, m_overwrite ? "true" : "false");
}
- virtual void merge(PassOwnPtr<Action> action)
+ virtual void merge(PassOwnPtr<Action> action) override
{
ASSERT(action->mergeId() == mergeId());
@@ -385,28 +385,28 @@
bool m_overwrite;
};
-class InspectorCSSAgent::TogglePropertyAction : public InspectorCSSAgent::StyleSheetAction {
+class InspectorCSSAgent::TogglePropertyAction final : public InspectorCSSAgent::StyleSheetAction {
WTF_MAKE_NONCOPYABLE(TogglePropertyAction);
public:
TogglePropertyAction(InspectorStyleSheet* styleSheet, const InspectorCSSId& cssId, unsigned propertyIndex, bool disable)
- : InspectorCSSAgent::StyleSheetAction("ToggleProperty", styleSheet)
+ : InspectorCSSAgent::StyleSheetAction(ASCIILiteral("ToggleProperty"), styleSheet)
, m_cssId(cssId)
, m_propertyIndex(propertyIndex)
, m_disable(disable)
{
}
- virtual bool perform(ExceptionCode& ec)
+ virtual bool perform(ExceptionCode& ec) override
{
return redo(ec);
}
- virtual bool undo(ExceptionCode& ec)
+ virtual bool undo(ExceptionCode& ec) override
{
return m_styleSheet->toggleProperty(m_cssId, m_propertyIndex, !m_disable, ec);
}
- virtual bool redo(ExceptionCode& ec)
+ virtual bool redo(ExceptionCode& ec) override
{
return m_styleSheet->toggleProperty(m_cssId, m_propertyIndex, m_disable, ec);
}
@@ -417,17 +417,17 @@
bool m_disable;
};
-class InspectorCSSAgent::SetRuleSelectorAction : public InspectorCSSAgent::StyleSheetAction {
+class InspectorCSSAgent::SetRuleSelectorAction final : public InspectorCSSAgent::StyleSheetAction {
WTF_MAKE_NONCOPYABLE(SetRuleSelectorAction);
public:
SetRuleSelectorAction(InspectorStyleSheet* styleSheet, const InspectorCSSId& cssId, const String& selector)
- : InspectorCSSAgent::StyleSheetAction("SetRuleSelector", styleSheet)
+ : InspectorCSSAgent::StyleSheetAction(ASCIILiteral("SetRuleSelector"), styleSheet)
, m_cssId(cssId)
, m_selector(selector)
{
}
- virtual bool perform(ExceptionCode& ec)
+ virtual bool perform(ExceptionCode& ec) override
{
m_oldSelector = m_styleSheet->ruleSelector(m_cssId, ec);
if (ec)
@@ -435,12 +435,12 @@
return redo(ec);
}
- virtual bool undo(ExceptionCode& ec)
+ virtual bool undo(ExceptionCode& ec) override
{
return m_styleSheet->setRuleSelector(m_cssId, m_oldSelector, ec);
}
- virtual bool redo(ExceptionCode& ec)
+ virtual bool redo(ExceptionCode& ec) override
{
return m_styleSheet->setRuleSelector(m_cssId, m_selector, ec);
}
@@ -451,26 +451,26 @@
String m_oldSelector;
};
-class InspectorCSSAgent::AddRuleAction : public InspectorCSSAgent::StyleSheetAction {
+class InspectorCSSAgent::AddRuleAction final : public InspectorCSSAgent::StyleSheetAction {
WTF_MAKE_NONCOPYABLE(AddRuleAction);
public:
AddRuleAction(InspectorStyleSheet* styleSheet, const String& selector)
- : InspectorCSSAgent::StyleSheetAction("AddRule", styleSheet)
+ : InspectorCSSAgent::StyleSheetAction(ASCIILiteral("AddRule"), styleSheet)
, m_selector(selector)
{
}
- virtual bool perform(ExceptionCode& ec)
+ virtual bool perform(ExceptionCode& ec) override
{
return redo(ec);
}
- virtual bool undo(ExceptionCode& ec)
+ virtual bool undo(ExceptionCode& ec) override
{
return m_styleSheet->deleteRule(m_newId, ec);
}
- virtual bool redo(ExceptionCode& ec)
+ virtual bool redo(ExceptionCode& ec) override
{
CSSStyleRule* cssStyleRule = m_styleSheet->addRule(m_selector, ec);
if (ec)
@@ -491,7 +491,7 @@
CSSStyleRule* InspectorCSSAgent::asCSSStyleRule(CSSRule* rule)
{
if (rule->type() != CSSRule::STYLE_RULE)
- return 0;
+ return nullptr;
return static_cast<CSSStyleRule*>(rule);
}
@@ -525,8 +525,8 @@
void InspectorCSSAgent::discardAgent()
{
- m_domAgent->setDOMListener(0);
- m_domAgent = 0;
+ m_domAgent->setDOMListener(nullptr);
+ m_domAgent = nullptr;
}
void InspectorCSSAgent::reset()
@@ -555,7 +555,7 @@
void InspectorCSSAgent::disable(ErrorString*)
{
- m_instrumentingAgents->setInspectorCSSAgent(0);
+ m_instrumentingAgents->setInspectorCSSAgent(nullptr);
}
void InspectorCSSAgent::mediaQueryResultChanged()
@@ -750,7 +750,7 @@
inlineStyle = styleSheet->buildObjectForStyle(element->style());
RefPtr<Inspector::TypeBuilder::CSS::CSSStyle> attributes = buildObjectForAttributesStyle(element);
- attributesStyle = attributes ? attributes.release() : 0;
+ attributesStyle = attributes ? attributes.release() : nullptr;
}
void InspectorCSSAgent::getComputedStyleForNode(ErrorString* errorString, int nodeId, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::CSS::CSSComputedStyleProperty>>& style)
@@ -760,7 +760,7 @@
return;
RefPtr<CSSComputedStyleDeclaration> computedStyleInfo = CSSComputedStyleDeclaration::create(element, true);
- RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), computedStyleInfo, 0);
+ RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), computedStyleInfo, nullptr);
style = inspectorStyle->buildArrayForComputedStyle();
}
@@ -963,9 +963,9 @@
{
NodeToInspectorStyleSheet::iterator it = m_nodeToInspectorStyleSheet.find(element);
if (it == m_nodeToInspectorStyleSheet.end()) {
- CSSStyleDeclaration* style = element->isStyledElement() ? element->style() : 0;
+ CSSStyleDeclaration* style = element->isStyledElement() ? element->style() : nullptr;
if (!style)
- return 0;
+ return nullptr;
String newStyleSheetId = String::number(m_lastStyleSheetId++);
RefPtr<InspectorStyleSheetForInlineStyle> inspectorStyleSheet = InspectorStyleSheetForInlineStyle::create(m_domAgent->pageAgent(), newStyleSheetId, element, Inspector::TypeBuilder::CSS::StyleSheetOrigin::Regular, this);
@@ -982,11 +982,11 @@
Node* node = m_domAgent->nodeForId(nodeId);
if (!node) {
*errorString = "No node with given id found";
- return 0;
+ return nullptr;
}
if (!node->isElementNode()) {
*errorString = "Not an element node";
- return 0;
+ return nullptr;
}
return toElement(node);
}
@@ -1031,11 +1031,11 @@
{
if (!document) {
ASSERT(!createIfAbsent);
- return 0;
+ return nullptr;
}
if (!document->isHTMLDocument() && !document->isSVGDocument())
- return 0;
+ return nullptr;
RefPtr<InspectorStyleSheet> inspectorStyleSheet = m_documentToInspectorStyleSheet.get(document);
if (inspectorStyleSheet || !createIfAbsent)
@@ -1053,22 +1053,22 @@
else if (document->body())
targetNode = document->body();
else
- return 0;
+ return nullptr;
InlineStyleOverrideScope overrideScope(document);
targetNode->appendChild(styleElement, ec);
}
if (ec)
- return 0;
+ return nullptr;
- CSSStyleSheet* cssStyleSheet = 0;
+ CSSStyleSheet* cssStyleSheet = nullptr;
if (styleElement->isHTMLElement())
cssStyleSheet = toHTMLStyleElement(styleElement.get())->sheet();
else if (styleElement->isSVGElement())
cssStyleSheet = toSVGStyleElement(styleElement.get())->sheet();
if (!cssStyleSheet)
- return 0;
+ return nullptr;
String id = String::number(m_lastStyleSheetId++);
inspectorStyleSheet = InspectorStyleSheet::create(m_domAgent->pageAgent(), id, cssStyleSheet, Inspector::TypeBuilder::CSS::StyleSheetOrigin::Inspector, InspectorDOMAgent::documentURLString(document), this);
@@ -1083,7 +1083,7 @@
IdToInspectorStyleSheet::iterator it = m_idToInspectorStyleSheet.find(styleSheetId);
if (it == m_idToInspectorStyleSheet.end()) {
*errorString = "No style sheet with given id found";
- return 0;
+ return nullptr;
}
return it->value.get();
}
@@ -1106,25 +1106,25 @@
PassRefPtr<Inspector::TypeBuilder::CSS::CSSRule> InspectorCSSAgent::buildObjectForRule(StyleRule* styleRule, StyleResolver& styleResolver)
{
if (!styleRule)
- return 0;
+ return nullptr;
// StyleRules returned by StyleResolver::styleRulesForElement lack parent pointers since that infomation is not cheaply available.
// Since the inspector wants to walk the parent chain, we construct the full wrappers here.
CSSStyleRule* cssomWrapper = styleResolver.inspectorCSSOMWrappers().getWrapperForRuleInSheets(styleRule, styleResolver.document().styleSheetCollection());
if (!cssomWrapper)
- return 0;
+ return nullptr;
InspectorStyleSheet* inspectorStyleSheet = bindStyleSheet(cssomWrapper->parentStyleSheet());
- return inspectorStyleSheet ? inspectorStyleSheet->buildObjectForRule(cssomWrapper) : 0;
+ return inspectorStyleSheet ? inspectorStyleSheet->buildObjectForRule(cssomWrapper) : nullptr;
}
PassRefPtr<Inspector::TypeBuilder::CSS::CSSRule> InspectorCSSAgent::buildObjectForRule(CSSStyleRule* rule)
{
if (!rule)
- return 0;
+ return nullptr;
ASSERT(rule->parentStyleSheet());
InspectorStyleSheet* inspectorStyleSheet = bindStyleSheet(rule->parentStyleSheet());
- return inspectorStyleSheet ? inspectorStyleSheet->buildObjectForRule(rule) : 0;
+ return inspectorStyleSheet ? inspectorStyleSheet->buildObjectForRule(rule) : nullptr;
}
PassRefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::CSS::CSSRule>> InspectorCSSAgent::buildArrayForRuleList(CSSRuleList* ruleList)
@@ -1175,17 +1175,17 @@
PassRefPtr<Inspector::TypeBuilder::CSS::CSSStyle> InspectorCSSAgent::buildObjectForAttributesStyle(Element* element)
{
if (!element->isStyledElement())
- return 0;
+ return nullptr;
// FIXME: Ugliness below.
StyleProperties* attributeStyle = const_cast<StyleProperties*>(toStyledElement(element)->presentationAttributeStyle());
if (!attributeStyle)
- return 0;
+ return nullptr;
ASSERT_WITH_SECURITY_IMPLICATION(attributeStyle->isMutable());
MutableStyleProperties* mutableAttributeStyle = static_cast<MutableStyleProperties*>(attributeStyle);
- RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), mutableAttributeStyle->ensureCSSStyleDeclaration(), 0);
+ RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), mutableAttributeStyle->ensureCSSStyleDeclaration(), nullptr);
return inspectorStyle->buildObjectForStyle();
}