Web Inspector: Cleanup Inspector Agents a bit
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Aug 2013 11:24:10 +0000 (11:24 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Aug 2013 11:24:10 +0000 (11:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=120218

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2013-08-24
Reviewed by Andreas Kling.

Merge https://chromium.googlesource.com/chromium/blink/+/8693dcb8ba42a5c225f516c664fb0f453c8ba6f0.

* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::elementForId):
* inspector/InspectorStyleSheet.cpp:
(ParsedStyleSheet::ParsedStyleSheet):
(WebCore::InspectorStyle::setPropertyText):
(WebCore::InspectorStyle::populateAllProperties):
(WebCore::InspectorStyleSheet::inlineStyleSheetText):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154543 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/inspector/InspectorStyleSheet.cpp

index 32457c0caae6bad82f745f2de52d0943adddefa7..298a23722ea835442415fbc4b19503773462f085 100644 (file)
@@ -1,3 +1,20 @@
+2013-08-24  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Cleanup Inspector Agents a bit
+        https://bugs.webkit.org/show_bug.cgi?id=120218
+
+        Reviewed by Andreas Kling.
+
+        Merge https://chromium.googlesource.com/chromium/blink/+/8693dcb8ba42a5c225f516c664fb0f453c8ba6f0.
+
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::elementForId):
+        * inspector/InspectorStyleSheet.cpp:
+        (ParsedStyleSheet::ParsedStyleSheet):
+        (WebCore::InspectorStyle::setPropertyText):
+        (WebCore::InspectorStyle::populateAllProperties):
+        (WebCore::InspectorStyleSheet::inlineStyleSheetText):
+
 2013-08-24  Andreas Kling  <akling@apple.com>
 
         Let Document keep its RenderView during render tree detach.
index da018b9e37a777b0a252be964c84c661994e3bcf..56a72ce64949b910b44308cbf16a80757d4b92fb 100644 (file)
@@ -1146,7 +1146,7 @@ Element* InspectorCSSAgent::elementForId(ErrorString* errorString, int nodeId)
         *errorString = "No node with given id found";
         return 0;
     }
-    if (node->nodeType() != Node::ELEMENT_NODE) {
+    if (!node->isElementNode()) {
         *errorString = "Not an element node";
         return 0;
     }
index 2b08411050d4c571bce83ad5522971d6737ce187..2c9888686bc2f4b68f0dcc2338b4ae7732df398a 100644 (file)
@@ -75,7 +75,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; }
@@ -86,16 +85,13 @@ public:
 
 private:
 
-    // 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)
 {
 }
 
@@ -369,9 +365,6 @@ bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText,
         return false;
     }
 
-    Vector<InspectorStyleProperty> allProperties;
-    populateAllProperties(&allProperties);
-
     if (propertyText.stripWhiteSpace().length()) {
         RefPtr<MutableStylePropertySet> tempMutableStyle = MutableStylePropertySet::create();
         RefPtr<CSSRuleSourceData> sourceData = CSSRuleSourceData::create(CSSRuleSourceData::STYLE_RULE);
@@ -406,6 +399,9 @@ bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText,
         return false;
     }
 
+    Vector<InspectorStyleProperty> allProperties;
+    populateAllProperties(&allProperties);
+
     InspectorStyleTextEditor editor(&allProperties, &m_disabledProperties, text, newLineAndWhitespaceDelimiters());
     if (overwrite) {
         if (index >= allProperties.size()) {
@@ -480,7 +476,6 @@ bool InspectorStyle::getText(String* result) const
 
 bool InspectorStyle::populateAllProperties(Vector<InspectorStyleProperty>* result) const
 {
-    HashSet<String> foundShorthands;
     HashSet<String> sourcePropertyNames;
     unsigned disabledIndex = 0;
     unsigned disabledLength = m_disabledProperties.size();
@@ -1397,7 +1392,7 @@ bool InspectorStyleSheet::inlineStyleSheetText(String* result) const
         return false;
 
     Node* ownerNode = m_pageStyleSheet->ownerNode();
-    if (!ownerNode || ownerNode->nodeType() != Node::ELEMENT_NODE)
+    if (!ownerNode || !ownerNode->isElementNode())
         return false;
     Element* ownerElement = toElement(ownerNode);