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

Unified Diff: Source/core/inspector/InspectorStyleSheet.cpp

Issue 20091002: DevTools: Clean up InspectorStyleSheet, InspectorCSSAgent, and InspectorResourceAgent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 years, 5 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 | « Source/core/inspector/InspectorResourceAgent.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorStyleSheet.cpp
diff --git a/Source/core/inspector/InspectorStyleSheet.cpp b/Source/core/inspector/InspectorStyleSheet.cpp
index d82532290b04448f41616618e7020081db410dd8..e556b8494031aecfb2f168929ad982da3117eec9 100644
--- a/Source/core/inspector/InspectorStyleSheet.cpp
+++ b/Source/core/inspector/InspectorStyleSheet.cpp
@@ -67,7 +67,6 @@ class ParsedStyleSheet {
public:
ParsedStyleSheet();
- WebCore::CSSStyleSheet* cssStyleSheet() const { return m_parserOutput; }
const String& text() const { ASSERT(m_hasText); return m_text; }
void setText(const String& text);
bool hasText() const { return m_hasText; }
@@ -78,16 +77,13 @@ public:
private:
void flattenSourceData(RuleSourceDataList*);
- // StyleSheet constructed while parsing m_text.
- WebCore::CSSStyleSheet* m_parserOutput;
String m_text;
bool m_hasText;
OwnPtr<RuleSourceDataList> m_sourceData;
};
ParsedStyleSheet::ParsedStyleSheet()
- : m_parserOutput(0)
- , m_hasText(false)
+ : m_hasText(false)
{
}
@@ -560,9 +556,6 @@ bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText,
return false;
}
- Vector<InspectorStyleProperty> allProperties;
- populateAllProperties(allProperties);
-
if (!propertyText.stripWhiteSpace().isEmpty()) {
RefPtr<MutableStylePropertySet> tempMutableStyle = MutableStylePropertySet::create();
String declarationText = propertyText + " " + bogusPropertyName + ": none";
@@ -598,6 +591,9 @@ bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText,
return false;
}
+ Vector<InspectorStyleProperty> allProperties;
+ populateAllProperties(allProperties);
+
InspectorStyleTextEditor editor(&allProperties, text, newLineAndWhitespaceDelimiters());
if (overwrite) {
if (index >= allProperties.size()) {
@@ -671,11 +667,9 @@ bool InspectorStyle::styleText(String* result) const
void InspectorStyle::populateAllProperties(Vector<InspectorStyleProperty>& result) const
{
- HashSet<String> foundShorthands;
HashSet<String> sourcePropertyNames;
RefPtr<CSSRuleSourceData> sourceData = extractSourceData();
- OwnPtr<CSSParser> cssParser;
if (sourceData) {
String styleDeclaration;
bool isStyleTextKnown = styleText(&styleDeclaration);
@@ -700,9 +694,6 @@ void InspectorStyle::populateAllProperties(Vector<InspectorStyleProperty>& resul
PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyle::styleWithProperties() const
{
- Vector<InspectorStyleProperty> properties;
- populateAllProperties(properties);
-
RefPtr<Array<TypeBuilder::CSS::CSSProperty> > propertiesObject = Array<TypeBuilder::CSS::CSSProperty>::create();
RefPtr<Array<TypeBuilder::CSS::ShorthandEntry> > shorthandEntries = Array<TypeBuilder::CSS::ShorthandEntry>::create();
HashMap<String, RefPtr<TypeBuilder::CSS::CSSProperty> > propertyNameToPreviousActiveProperty;
@@ -713,6 +704,9 @@ PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyle::styleWithProperties() con
RefPtr<CSSRuleSourceData> sourceData = extractSourceData();
unsigned ruleBodyRangeStart = sourceData ? sourceData->ruleBodyRange.start : 0;
+ Vector<InspectorStyleProperty> properties;
+ populateAllProperties(properties);
+
for (Vector<InspectorStyleProperty>::iterator it = properties.begin(), itEnd = properties.end(); it != itEnd; ++it) {
const CSSPropertySourceData& propertyEntry = it->sourceData;
const String& name = propertyEntry.name;
« no previous file with comments | « Source/core/inspector/InspectorResourceAgent.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698