Title: [183311] trunk/Source/WebInspectorUI
Revision
183311
Author
[email protected]
Date
2015-04-25 09:29:58 -0700 (Sat, 25 Apr 2015)

Log Message

Web Inspector: assertion failure when editing inline styles
https://bugs.webkit.org/show_bug.cgi?id=143939

Patch by Tobias Reiss <[email protected]> on 2015-04-25
Reviewed by Timothy Hatcher.

Prevent "_updateResourceContent" from being called on inline style changes.
Introduce a flag that marks a CSSStyleSheet as a representation of an
"ElementCSSInlineStyle" (DOM Level 2 spec) and return early.

* UserInterface/Controllers/CSSStyleManager.js:
(WebInspector.CSSStyleManager.prototype.styleSheetChanged):
* UserInterface/Models/CSSStyleSheet.js:
(WebInspector.CSSStyleSheet):
(WebInspector.CSSStyleSheet.isInlineStyle):
(WebInspector.CSSStyleSheet.prototype.markAsInlineStyle):
* UserInterface/Models/DOMNodeStyles.js:
(WebInspector.DOMNodeStyles.prototype._parseStyleDeclarationPayload):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (183310 => 183311)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-04-25 15:43:45 UTC (rev 183310)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-04-25 16:29:58 UTC (rev 183311)
@@ -1,3 +1,23 @@
+2015-04-25  Tobias Reiss  <[email protected]>
+
+        Web Inspector: assertion failure when editing inline styles
+        https://bugs.webkit.org/show_bug.cgi?id=143939
+
+        Reviewed by Timothy Hatcher.
+
+        Prevent "_updateResourceContent" from being called on inline style changes.
+        Introduce a flag that marks a CSSStyleSheet as a representation of an
+        "ElementCSSInlineStyle" (DOM Level 2 spec) and return early.
+
+        * UserInterface/Controllers/CSSStyleManager.js:
+        (WebInspector.CSSStyleManager.prototype.styleSheetChanged):
+        * UserInterface/Models/CSSStyleSheet.js:
+        (WebInspector.CSSStyleSheet):
+        (WebInspector.CSSStyleSheet.isInlineStyle):
+        (WebInspector.CSSStyleSheet.prototype.markAsInlineStyle):
+        * UserInterface/Models/DOMNodeStyles.js:
+        (WebInspector.DOMNodeStyles.prototype._parseStyleDeclarationPayload):
+
 2015-04-24  Timothy Hatcher  <[email protected]>
 
         REGRESSION: Web Inspector: Start Timeline Recording in Develop menu broken

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js (183310 => 183311)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js	2015-04-25 15:43:45 UTC (rev 183310)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js	2015-04-25 16:29:58 UTC (rev 183311)
@@ -126,12 +126,14 @@
     styleSheetChanged(styleSheetIdentifier)
     {
         // Called from WebInspector.CSSObserver.
-
         var styleSheet = this.styleSheetForIdentifier(styleSheetIdentifier);
         console.assert(styleSheet);
 
+        // Do not observe inline styles
+        if (styleSheet.isInlineStyle())
+            return;
+
         styleSheet.noteContentDidChange();
-
         this._updateResourceContent(styleSheet);
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js (183310 => 183311)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js	2015-04-25 15:43:45 UTC (rev 183310)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js	2015-04-25 16:29:58 UTC (rev 183311)
@@ -25,15 +25,15 @@
 
 WebInspector.CSSStyleSheet = class CSSStyleSheet extends WebInspector.SourceCode
 {
-    constructor(id, url, parentFrame)
+    constructor(id)
     {
         super();
 
         console.assert(id);
 
         this._id = id || null;
-
-        this.updateInfo(url, parentFrame);
+        this._url = null;
+        this._parentFrame = null;
     }
 
     // Static
@@ -84,6 +84,16 @@
         return WebInspector.UIString("Anonymous StyleSheet %d").format(this._uniqueDisplayNameNumber);
     }
 
+    isInlineStyle()
+    {
+        return !!this._inlineStyle;
+    }
+
+    markAsInlineStyle()
+    {
+        this._inlineStyle = true;
+    }
+
     // Protected
 
     updateInfo(url, parentFrame)

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js (183310 => 183311)


--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js	2015-04-25 15:43:45 UTC (rev 183310)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js	2015-04-25 16:29:58 UTC (rev 183311)
@@ -569,7 +569,7 @@
         var id = payload.styleId;
         var mapKey = id ? id.styleSheetId + ":" + id.ordinal : null;
 
-        if (type == WebInspector.CSSStyleDeclaration.Type.Attribute)
+        if (type === WebInspector.CSSStyleDeclaration.Type.Attribute)
             mapKey = node.id + ":attribute";
 
         var styleDeclaration = rule ? rule.style : null;
@@ -655,8 +655,11 @@
         }
 
         var styleSheet = id ? WebInspector.cssStyleManager.styleSheetForIdentifier(id.styleSheetId) : null;
-        if (styleSheet)
+        if (styleSheet) {
+            if (type === WebInspector.CSSStyleDeclaration.Type.Inline)
+                styleSheet.markAsInlineStyle();
             styleSheet.addEventListener(WebInspector.CSSStyleSheet.Event.ContentDidChange, this._styleSheetContentDidChange, this);
+        }
 
         styleDeclaration = new WebInspector.CSSStyleDeclaration(this, styleSheet, id, type, node, inherited, text, properties, styleSheetTextRange);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to