Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: WebCore/inspector/InspectorStyleSheet.cpp

Issue 6205007: Merge 74637 - 2010-12-24 Yury Semikhatsky <yurys@chromium.org>... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/597/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « WebCore/inspector/InspectorStyleSheet.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: WebCore/inspector/InspectorStyleSheet.cpp
===================================================================
--- WebCore/inspector/InspectorStyleSheet.cpp (revision 75605)
+++ WebCore/inspector/InspectorStyleSheet.cpp (working copy)
@@ -131,6 +131,19 @@
return 0;
}
+PassRefPtr<InspectorStyle> InspectorStyle::create(const InspectorCSSId& styleId, PassRefPtr<CSSStyleDeclaration> style, InspectorStyleSheet* parentStyleSheet)
+{
+ return adoptRef(new InspectorStyle(styleId, style, parentStyleSheet));
+}
+
+InspectorStyle::InspectorStyle(const InspectorCSSId& styleId, PassRefPtr<CSSStyleDeclaration> style, InspectorStyleSheet* parentStyleSheet)
+ : m_styleId(styleId)
+ , m_style(style)
+ , m_parentStyleSheet(parentStyleSheet)
+{
+ ASSERT(m_style);
+}
+
PassRefPtr<InspectorObject> InspectorStyle::buildObjectForStyle() const
{
RefPtr<InspectorObject> result = InspectorObject::create();
@@ -141,7 +154,7 @@
propertiesObject->setString("width", m_style->getPropertyValue("width"));
propertiesObject->setString("height", m_style->getPropertyValue("height"));
- RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet ? m_parentStyleSheet->ruleSourceDataFor(m_style) : 0;
+ RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet ? m_parentStyleSheet->ruleSourceDataFor(m_style.get()) : 0;
if (sourceData) {
propertiesObject->setNumber("startOffset", sourceData->styleSourceData->styleBodyRange.start);
propertiesObject->setNumber("endOffset", sourceData->styleSourceData->styleBodyRange.end);
@@ -215,7 +228,7 @@
}
} else {
// Insert at index.
- RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet->ruleSourceDataFor(m_style);
+ RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet->ruleSourceDataFor(m_style.get());
if (!sourceData)
return false;
String text;
@@ -255,7 +268,7 @@
}
text.insert(textToSet, propertyStart);
- m_parentStyleSheet->setStyleText(m_style, text);
+ m_parentStyleSheet->setStyleText(m_style.get(), text);
}
// Recompute subsequent disabled property ranges if acting on a non-disabled property.
@@ -269,7 +282,7 @@
ASSERT(m_parentStyleSheet);
if (!m_parentStyleSheet->ensureParsedDataReady())
return false; // Can toggle only source-based properties.
- RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet->ruleSourceDataFor(m_style);
+ RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet->ruleSourceDataFor(m_style.get());
if (!sourceData)
return false; // No source data for the style.
@@ -310,7 +323,7 @@
bool InspectorStyle::styleText(String* result) const
{
// Precondition: m_parentStyleSheet->ensureParsedDataReady() has been called successfully.
- RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet->ruleSourceDataFor(m_style);
+ RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet->ruleSourceDataFor(m_style.get());
if (!sourceData)
return false;
@@ -379,7 +392,7 @@
if (disabledIndex < disabledLength)
disabledProperty = m_disabledProperties.at(disabledIndex);
- RefPtr<CSSRuleSourceData> sourceData = (m_parentStyleSheet && m_parentStyleSheet->ensureParsedDataReady()) ? m_parentStyleSheet->ruleSourceDataFor(m_style) : 0;
+ RefPtr<CSSRuleSourceData> sourceData = (m_parentStyleSheet && m_parentStyleSheet->ensureParsedDataReady()) ? m_parentStyleSheet->ruleSourceDataFor(m_style.get()) : 0;
Vector<CSSPropertySourceData>* sourcePropertyData = sourceData ? &(sourceData->styleSourceData->propertyData) : 0;
if (sourcePropertyData) {
String styleDeclaration;
@@ -506,7 +519,7 @@
return false;
const SourceRange& range = property.sourceData.range;
text.replace(range.start, range.end - range.start, newText);
- success = m_parentStyleSheet->setStyleText(m_style, text);
+ success = m_parentStyleSheet->setStyleText(m_style.get(), text);
return success;
}
@@ -561,7 +574,12 @@
return properties;
}
-InspectorStyleSheet::InspectorStyleSheet(const String& id, CSSStyleSheet* pageStyleSheet, const String& origin, const String& documentURL)
+PassRefPtr<InspectorStyleSheet> InspectorStyleSheet::create(const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, const String& origin, const String& documentURL)
+{
+ return adoptRef(new InspectorStyleSheet(id, pageStyleSheet, origin, documentURL));
+}
+
+InspectorStyleSheet::InspectorStyleSheet(const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, const String& origin, const String& documentURL)
: m_id(id)
, m_pageStyleSheet(pageStyleSheet)
, m_origin(origin)
@@ -1090,12 +1108,17 @@
}
}
-InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle(const String& id, Element* element, const String& origin)
+PassRefPtr<InspectorStyleSheetForInlineStyle> InspectorStyleSheetForInlineStyle::create(const String& id, PassRefPtr<Element> element, const String& origin)
+{
+ return adoptRef(new InspectorStyleSheetForInlineStyle(id, element, origin));
+}
+
+InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle(const String& id, PassRefPtr<Element> element, const String& origin)
: InspectorStyleSheet(id, 0, origin, "")
, m_element(element)
, m_ruleSourceData(0)
{
- ASSERT(element);
+ ASSERT(m_element);
m_inspectorStyle = InspectorStyle::create(InspectorCSSId(id, 0), inlineStyle(), this);
}
« no previous file with comments | « WebCore/inspector/InspectorStyleSheet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698