[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

apavlov at chromium.org apavlov at chromium.org
Wed Dec 22 16:11:10 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 4794f2e6cf5aa1c7efb0c379192ee402f8d4a04f
Author: apavlov at chromium.org <apavlov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 19 13:33:04 2010 +0000

    2010-11-19  Alexander Pavlov  <apavlov at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: [REGRESSION] Crash on opening WebInspector for a page with CSS containing @media with nested rules
            https://bugs.webkit.org/show_bug.cgi?id=49731
    
            Temporarily disable building of styles for nested rules.
    
            * inspector/InspectorStyleSheet.cpp:
            (WebCore::InspectorStyleSheet::buildObjectForRule):
            (WebCore::InspectorStyleSheet::buildObjectForStyle):
            (WebCore::InspectorStyleSheet::ensureParsedDataReady):
            (WebCore::InspectorStyleSheet::ensureSourceData):
            * inspector/InspectorStyleSheet.h:
            * inspector/front-end/StylesSidebarPane.js:
            (WebInspector.StylesSidebarPane.prototype._rebuildUpdate):
            (WebInspector.StylesSidebarPane.prototype._refreshStyleRules):
            (WebInspector.StylesSidebarPane.prototype._rebuildStyleRules):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72386 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a963326..ce15192 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-11-19  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: [REGRESSION] Crash on opening WebInspector for a page with CSS containing @media with nested rules
+        https://bugs.webkit.org/show_bug.cgi?id=49731
+
+        Temporarily disable building of styles for nested rules.
+
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyleSheet::buildObjectForRule):
+        (WebCore::InspectorStyleSheet::buildObjectForStyle):
+        (WebCore::InspectorStyleSheet::ensureParsedDataReady):
+        (WebCore::InspectorStyleSheet::ensureSourceData):
+        * inspector/InspectorStyleSheet.h:
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylesSidebarPane.prototype._rebuildUpdate):
+        (WebInspector.StylesSidebarPane.prototype._refreshStyleRules):
+        (WebInspector.StylesSidebarPane.prototype._rebuildStyleRules):
+
 2010-11-19  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Not reviewed. Fix Qt build.
diff --git a/WebCore/inspector/InspectorStyleSheet.cpp b/WebCore/inspector/InspectorStyleSheet.cpp
index 2384795..a5b2dfe 100644
--- a/WebCore/inspector/InspectorStyleSheet.cpp
+++ b/WebCore/inspector/InspectorStyleSheet.cpp
@@ -652,8 +652,11 @@ PassRefPtr<InspectorObject> InspectorStyleSheet::buildObjectForRule(CSSStyleRule
     result->setString("origin", m_origin);
 
     result->setObject("style", buildObjectForStyle(rule->style()));
-    if (canBind())
-        result->setString("ruleId", ruleId(rule).asString());
+    if (canBind()) {
+        InspectorCSSId id(ruleId(rule));
+        if (!id.isEmpty())
+            result->setString("ruleId", id.asString());
+    }
 
     RefPtr<CSSRuleSourceData> sourceData;
     if (ensureParsedDataReady())
@@ -674,7 +677,15 @@ PassRefPtr<InspectorObject> InspectorStyleSheet::buildObjectForStyle(CSSStyleDec
     if (ensureParsedDataReady())
         sourceData = ruleSourceDataFor(style);
 
-    RefPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(ruleOrStyleId(style));
+    InspectorCSSId id = ruleOrStyleId(style);
+    if (id.isEmpty()) {
+        RefPtr<InspectorObject> bogusStyle = InspectorObject::create();
+        bogusStyle->setArray("cssProperties", InspectorArray::create());
+        bogusStyle->setObject("shorthandValues", InspectorObject::create());
+        bogusStyle->setObject("properties", InspectorObject::create());
+        return bogusStyle.release();
+    }
+    RefPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id);
     RefPtr<InspectorObject> result = inspectorStyle->buildObjectForStyle();
 
     // Style text cannot be retrieved without stylesheet, so set cssText here.
@@ -828,7 +839,7 @@ unsigned InspectorStyleSheet::ruleIndexByStyle(CSSStyleDeclaration* pageStyle) c
 
 bool InspectorStyleSheet::ensureParsedDataReady()
 {
-    return ensureText() && ensureSourceData(pageStyleSheet()->ownerNode());
+    return ensureText() && ensureSourceData();
 }
 
 bool InspectorStyleSheet::text(String* result) const
@@ -854,7 +865,7 @@ bool InspectorStyleSheet::ensureText() const
     return success;
 }
 
-bool InspectorStyleSheet::ensureSourceData(Node* ownerNode)
+bool InspectorStyleSheet::ensureSourceData()
 {
     if (m_parsedStyleSheet->hasSourceData())
         return true;
@@ -862,7 +873,7 @@ bool InspectorStyleSheet::ensureSourceData(Node* ownerNode)
     if (!m_parsedStyleSheet->hasText())
         return false;
 
-    RefPtr<CSSStyleSheet> newStyleSheet = CSSStyleSheet::create(ownerNode);
+    RefPtr<CSSStyleSheet> newStyleSheet = CSSStyleSheet::create(pageStyleSheet() ? pageStyleSheet()->document() : 0);
     CSSParser p;
     StyleRuleRangeMap ruleRangeMap;
     p.parseSheet(newStyleSheet.get(), m_parsedStyleSheet->text(), 0, &ruleRangeMap);
diff --git a/WebCore/inspector/InspectorStyleSheet.h b/WebCore/inspector/InspectorStyleSheet.h
index e671834..2a14bb9 100644
--- a/WebCore/inspector/InspectorStyleSheet.h
+++ b/WebCore/inspector/InspectorStyleSheet.h
@@ -188,7 +188,7 @@ protected:
 
 private:
     bool ensureText() const;
-    bool ensureSourceData(Node* ownerNode);
+    bool ensureSourceData();
     bool styleSheetTextWithChangedStyle(CSSStyleDeclaration*, const String& newStyleText, String* result);
     CSSStyleRule* findPageRuleWithStyle(CSSStyleDeclaration*);
     InspectorCSSId ruleId(CSSStyleRule* rule) const;
diff --git a/WebCore/inspector/front-end/StylesSidebarPane.js b/WebCore/inspector/front-end/StylesSidebarPane.js
index 1ad0ece..0aec669 100644
--- a/WebCore/inspector/front-end/StylesSidebarPane.js
+++ b/WebCore/inspector/front-end/StylesSidebarPane.js
@@ -197,7 +197,7 @@ WebInspector.StylesSidebarPane.prototype = {
             // Add rules in reverse order to match the cascade order.
             for (var j = pseudoElementCSSRules.rules.length - 1; j >= 0; --j) {
                 var rule = pseudoElementCSSRules.rules[j];
-                styleRules.push({ style: rule.style, selectorText: rule.selectorText, sourceURL: rule.sourceURL, rule: rule });
+                styleRules.push({ style: rule.style, selectorText: rule.selectorText, sourceURL: rule.sourceURL, rule: rule, editable: !!(rule.style && rule.style.id) });
             }
             usedProperties = {};
             disabledComputedProperties = {};
@@ -216,7 +216,7 @@ WebInspector.StylesSidebarPane.prototype = {
                 continue;
             if (section.computedStyle)
                 section.styleRule.style = nodeComputedStyle;
-            var styleRule = { section: section, style: section.styleRule.style, computedStyle: section.computedStyle, rule: section.rule };
+            var styleRule = { section: section, style: section.styleRule.style, computedStyle: section.computedStyle, rule: section.rule, editable: !!(section.styleRule.style && section.styleRule.style.id) };
             styleRules.push(styleRule);
         }
         return styleRules;
@@ -252,7 +252,7 @@ WebInspector.StylesSidebarPane.prototype = {
             styleRules.push({ isStyleSeparator: true, text: WebInspector.UIString("Matched CSS Rules") });
         for (var i = styles.matchedCSSRules.length - 1; i >= 0; --i) {
             var rule = styles.matchedCSSRules[i];
-            styleRules.push({ style: rule.style, selectorText: rule.selectorText, sourceURL: rule.sourceURL, rule: rule });
+            styleRules.push({ style: rule.style, selectorText: rule.selectorText, sourceURL: rule.sourceURL, rule: rule, editable: !!(rule.style && rule.style.id) });
         }
 
         // Walk the node structure and identify styles with inherited properties.
@@ -288,7 +288,7 @@ WebInspector.StylesSidebarPane.prototype = {
                     insertInheritedNodeSeparator(parentNode);
                     separatorInserted = true;
                 }
-                styleRules.push({ style: rule.style, selectorText: rule.selectorText, sourceURL: rule.sourceURL, rule: rule, isInherited: true });
+                styleRules.push({ style: rule.style, selectorText: rule.selectorText, sourceURL: rule.sourceURL, rule: rule, isInherited: true, editable: !!(rule.style && rule.style.id) });
             }
             parentNode = parentNode.parentNode;
         }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list