Title: [103761] trunk
Revision
103761
Author
[email protected]
Date
2011-12-28 04:28:04 -0800 (Wed, 28 Dec 2011)

Log Message

Web Inspector: [protocol] empty enum constant should be replaced with identifier
https://bugs.webkit.org/show_bug.cgi?id=75273

Reviewed by Yury Semikhatsky.

Source/WebCore:

* inspector/Inspector.json:
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::asInspectorStyleSheet):
(WebCore::InspectorCSSAgent::detectOrigin):
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::buildObjectForRule):
* inspector/front-end/CSSStyleModel.js:
(WebInspector.CSSRule.prototype.get isRegular):

LayoutTests:

* inspector/styles/get-set-stylesheet-text-expected.txt:
* inspector/styles/styles-new-API-expected.txt:
* inspector/styles/styles-source-offsets.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (103760 => 103761)


--- trunk/LayoutTests/ChangeLog	2011-12-28 12:04:28 UTC (rev 103760)
+++ trunk/LayoutTests/ChangeLog	2011-12-28 12:28:04 UTC (rev 103761)
@@ -1,3 +1,14 @@
+2011-12-28  Alexander Pavlov  <[email protected]>
+
+        Web Inspector: [protocol] empty enum constant should be replaced with identifier
+        https://bugs.webkit.org/show_bug.cgi?id=75273
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/styles/get-set-stylesheet-text-expected.txt:
+        * inspector/styles/styles-new-API-expected.txt:
+        * inspector/styles/styles-source-offsets.html:
+
 2011-12-27  Ryosuke Niwa  <[email protected]>
 
         Add pass/crash expectation for svg/W3C-SVG-1.1/animate-elem-52-t.svg

Modified: trunk/LayoutTests/inspector/styles/get-set-stylesheet-text-expected.txt (103760 => 103761)


--- trunk/LayoutTests/inspector/styles/get-set-stylesheet-text-expected.txt	2011-12-28 12:04:28 UTC (rev 103760)
+++ trunk/LayoutTests/inspector/styles/get-set-stylesheet-text-expected.txt	2011-12-28 12:28:04 UTC (rev 103761)
@@ -35,6 +35,6 @@
 ['font-weight':'bold'] @[undefined-undefined] style
 
 rule
-h1: []
+h1: [regular]
 ['COLOR':'Red'] @[1-12] active
 

Modified: trunk/LayoutTests/inspector/styles/styles-new-API-expected.txt (103760 => 103761)


--- trunk/LayoutTests/inspector/styles/styles-new-API-expected.txt	2011-12-28 12:04:28 UTC (rev 103760)
+++ trunk/LayoutTests/inspector/styles/styles-new-API-expected.txt	2011-12-28 12:28:04 UTC (rev 103761)
@@ -17,15 +17,15 @@
 ['margin-left':'8px'] @[undefined-undefined] style
 
 rule
-body: []
+body: [regular]
 ['property':'imported-media-screen-stylesheet' non-parsed] @[5-48] active
 
 rule
-body: []
+body: [regular]
 ['property':'imported-media-screen-stylesheet' non-parsed] @[5-48] active
 
 rule
-body: []
+body: [regular]
 ['font-size':'12px'] @[5-21] active
 ['foo':'bar !
 
@@ -37,12 +37,12 @@
 ['color':'"badcolor" ! important /* good property with strange value */' is-important non-parsed] @[209-278] active
 
 rule
-body.main1: []
+body.main1: [regular]
 ['color':'#F00BAA'] @[13-28] active
 ['zoo':'moo /* not an !important unrecognized property */' non-parsed] @[28-81] active
 
 rule
-body.main2: []
+body.main2: [regular]
 ['background':'green /* value !important comment */ !important /* no semicolon, very !important */' is-important] @[0-95] active
 ['background-image':'initial' is-important] @[undefined-undefined] style
 ['background-repeat-x':'initial' is-important] @[undefined-undefined] style
@@ -55,12 +55,12 @@
 ['background-color':'green' is-important] @[undefined-undefined] style
 
 rule
-body.mainpage: []
+body.mainpage: [regular]
 ['text-decoration':'none'] @[5-27] active
 ['badproperty':'1badvalue1' non-parsed] @[108-132] active
 
 rule
-body.mainpage: []
+body.mainpage: [regular]
 ['prop1':'val1' non-parsed] @[5-17] active
 ['prop2':'val2' non-parsed] @[22-34] active
 
@@ -68,7 +68,7 @@
 PseudoId=4
 
 rule
-body::after: []
+body::after: [regular]
 ['content':'"After body"'] @[5-27] active
 
 === Inherited styles for body ===
@@ -79,7 +79,7 @@
 ['display':'block'] @[undefined-undefined] style
 
 rule
-html: []
+html: [regular]
 ['font-weight':'400'] @[5-22] active
 
 === Inline style for body ===
@@ -133,11 +133,11 @@
 '
 
 rule
-html: []
+html: [regular]
 ['font-weight':'400'] @[5-22] active
 
 rule
-body: []
+body: [regular]
 ['font-size':'12px'] @[5-21] active
 ['foo':'bar !
 
@@ -149,12 +149,12 @@
 ['color':'"badcolor" ! important /* good property with strange value */' is-important non-parsed] @[209-278] active
 
 rule
-body.main1: []
+body.main1: [regular]
 ['color':'#F00BAA'] @[13-28] active
 ['zoo':'moo /* not an !important unrecognized property */' non-parsed] @[28-81] active
 
 rule
-body.main2: []
+body.main2: [regular]
 ['background':'green /* value !important comment */ !important /* no semicolon, very !important */' is-important] @[0-95] active
 ['background-image':'initial' is-important] @[undefined-undefined] style
 ['background-repeat-x':'initial' is-important] @[undefined-undefined] style
@@ -167,11 +167,11 @@
 ['background-color':'green' is-important] @[undefined-undefined] style
 
 rule
-body::after: []
+body::after: [regular]
 ['content':'"After body"'] @[5-27] active
 
 rule
-h1: []
+h1: [regular]
 ['height':'100%'] @[5-20] active
 ['border':'1px solid'] @[21-39] active
 ['border-width':'2px'] @[40-58] inactive
@@ -219,10 +219,10 @@
 '
 
 rule
-#absent-id: []
+#absent-id: [regular]
 
 rule
-body: []
+body: [regular]
 ['property':'imported-media-screen-stylesheet' non-parsed] @[5-48] active
 
 StyleSheet: '@import url(styles-new-API-1.css);
@@ -253,10 +253,10 @@
 '
 
 rule
-#absent-id: []
+#absent-id: [regular]
 
 rule
-body: []
+body: [regular]
 ['property':'imported-media-screen-stylesheet' non-parsed] @[5-48] active
 
 StyleSheet: '
@@ -275,12 +275,12 @@
 '
 
 rule
-body.mainpage: []
+body.mainpage: [regular]
 ['text-decoration':'none'] @[5-27] active
 ['badproperty':'1badvalue1' non-parsed] @[108-132] active
 
 rule
-body.mainpage: []
+body.mainpage: [regular]
 ['prop1':'val1' non-parsed] @[5-17] active
 ['prop2':'val2' non-parsed] @[22-34] active
 
@@ -289,12 +289,12 @@
 StyleSheet: 'body.mainpage {    text-decoration: strikethrough;    badproperty: 2badvalue2;}body {    text-align: justify;}'
 
 rule
-body.mainpage: []
+body.mainpage: [regular]
 ['text-decoration':'strikethrough' non-parsed] @[4-35] active
 ['badproperty':'2badvalue2' non-parsed] @[39-63] active
 
 rule
-body: []
+body: [regular]
 ['text-align':'justify'] @[4-24] active
 
 === After selector set ===
@@ -302,12 +302,12 @@
 StyleSheet: 'html *, body[foo="bar"] {    text-decoration: strikethrough;    badproperty: 2badvalue2;}body {    text-align: justify;}'
 
 rule
-html *, body[foo="bar"]: []
+html *, body[foo="bar"]: [regular]
 ['text-decoration':'strikethrough' non-parsed] @[4-35] active
 ['badproperty':'2badvalue2' non-parsed] @[39-63] active
 
 rule
-body: []
+body: [regular]
 ['text-align':'justify'] @[4-24] active
 
 === After style text set ===
@@ -317,7 +317,7 @@
 }body {    text-align: justify;}'
 
 rule
-html *, body[foo="bar"]: []
+html *, body[foo="bar"]: [regular]
 ['color':'white'] @[5-18] active
 ['background':'black'] @[19-37] active
 ['background-image':'initial'] @[undefined-undefined] style
@@ -331,7 +331,7 @@
 ['background-color':'black'] @[undefined-undefined] style
 
 rule
-body: []
+body: [regular]
 ['text-align':'justify'] @[4-24] active
 
 === Matched rules after rule added ===
@@ -345,15 +345,15 @@
 ['margin-left':'8px'] @[undefined-undefined] style
 
 rule
-body: []
+body: [regular]
 ['property':'imported-media-screen-stylesheet' non-parsed] @[5-48] active
 
 rule
-body: []
+body: [regular]
 ['property':'imported-media-screen-stylesheet' non-parsed] @[5-48] active
 
 rule
-body: []
+body: [regular]
 ['font-size':'12px'] @[5-21] active
 ['foo':'bar !
 
@@ -365,7 +365,7 @@
 ['color':'"badcolor" ! important /* good property with strange value */' is-important non-parsed] @[209-278] active
 
 rule
-html *, body[foo="bar"]: []
+html *, body[foo="bar"]: [regular]
 ['color':'white'] @[5-18] active
 ['background':'black'] @[19-37] active
 ['background-image':'initial'] @[undefined-undefined] style
@@ -379,7 +379,7 @@
 ['background-color':'black'] @[undefined-undefined] style
 
 rule
-body: []
+body: [regular]
 ['text-align':'justify'] @[4-24] active
 
 rule
@@ -387,12 +387,12 @@
 ['font-family':'serif'] @[5-24] active
 
 rule
-body.main1: []
+body.main1: [regular]
 ['color':'#F00BAA'] @[13-28] active
 ['zoo':'moo /* not an !important unrecognized property */' non-parsed] @[28-81] active
 
 rule
-body.main2: []
+body.main2: [regular]
 ['background':'green /* value !important comment */ !important /* no semicolon, very !important */' is-important] @[0-95] active
 ['background-image':'initial' is-important] @[undefined-undefined] style
 ['background-repeat-x':'initial' is-important] @[undefined-undefined] style

Modified: trunk/LayoutTests/inspector/styles/styles-source-offsets.html (103760 => 103761)


--- trunk/LayoutTests/inspector/styles/styles-source-offsets.html	2011-12-28 12:04:28 UTC (rev 103760)
+++ trunk/LayoutTests/inspector/styles/styles-source-offsets.html	2011-12-28 12:28:04 UTC (rev 103761)
@@ -15,7 +15,7 @@
         var style;
         var header = "";
         if (isRule) {
-            if (ruleOrStyle.origin !== "")
+            if (ruleOrStyle.origin !== "regular")
                 return;
             style = ruleOrStyle.style;
             header = ruleOrStyle.selectorText + ": [" + (ruleOrStyle.selectorRange ? ruleOrStyle.selectorRange.start + "-" + ruleOrStyle.selectorRange.end : "")  + "]";

Modified: trunk/Source/WebCore/ChangeLog (103760 => 103761)


--- trunk/Source/WebCore/ChangeLog	2011-12-28 12:04:28 UTC (rev 103760)
+++ trunk/Source/WebCore/ChangeLog	2011-12-28 12:28:04 UTC (rev 103761)
@@ -1,3 +1,19 @@
+2011-12-28  Alexander Pavlov  <[email protected]>
+
+        Web Inspector: [protocol] empty enum constant should be replaced with identifier
+        https://bugs.webkit.org/show_bug.cgi?id=75273
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/Inspector.json:
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::asInspectorStyleSheet):
+        (WebCore::InspectorCSSAgent::detectOrigin):
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyleSheet::buildObjectForRule):
+        * inspector/front-end/CSSStyleModel.js:
+        (WebInspector.CSSRule.prototype.get isRegular):
+
 2011-12-27  Pavel Feldman  <[email protected]>
 
         Web Inspector: complete annotating SDK component.

Modified: trunk/Source/WebCore/inspector/Inspector.json (103760 => 103761)


--- trunk/Source/WebCore/inspector/Inspector.json	2011-12-28 12:04:28 UTC (rev 103760)
+++ trunk/Source/WebCore/inspector/Inspector.json	2011-12-28 12:28:04 UTC (rev 103761)
@@ -1555,7 +1555,7 @@
                     { "name": "selectorText", "type": "string", "description": "Rule selector."},
                     { "name": "sourceURL", "type": "string", "optional": true, "description": "Parent stylesheet resource URL (for regular rules)."},
                     { "name": "sourceLine", "type": "integer", "description": "Line ordinal of the rule selector start character in the resource."},
-                    { "name": "origin", "type": "string", "enum": ["user", "user-agent", "inspector", ""], "description": "The parent stylesheet type: \"user\" for user stylesheets, \"user-agent\" for user-agent stylesheets, \"inspector\" for stylesheets created by the inspector (i.e. those holding new rules created with <code>addRule()</code>), \"\" for regular stylesheets."},
+                    { "name": "origin", "type": "string", "enum": ["user", "user-agent", "inspector", "regular"], "description": "The parent stylesheet type: \"user\" for user stylesheets, \"user-agent\" for user-agent stylesheets, \"inspector\" for stylesheets created by the inspector (i.e. those holding new rules created with <code>addRule()</code>), \"regular\" for regular stylesheets."},
                     { "name": "style", "$ref": "CSSStyle", "description": "Associated style declaration." },
                     { "name": "selectorRange", "$ref": "SourceRange", "optional": true, "description": "The rule selector range in the underlying resource (if available)." },
                     { "name": "media", "type": "array", "items": { "$ref": "CSSMedia" }, "optional": true, "description": "Media list array (for rules involving media queries). The array enumerates media queries starting with the innermost one, going outwards." }

Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (103760 => 103761)


--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp	2011-12-28 12:04:28 UTC (rev 103760)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp	2011-12-28 12:28:04 UTC (rev 103761)
@@ -52,84 +52,6 @@
 #include <wtf/Vector.h>
 #include <wtf/text/CString.h>
 
-// Currently implemented model:
-//
-// cssProperty = {
-//    name          : <string>,
-//    value         : <string>,
-//    priority      : <string>, // "" for non-parsedOk properties
-//    implicit      : <boolean>,
-//    parsedOk      : <boolean>, // whether property is understood by WebCore
-//    status        : <string>, // "disabled" | "active" | "inactive" | "style"
-//    shorthandName : <string>,
-//    startOffset   : <number>, // Optional - property text start offset in enclosing style declaration. Absent for computed styles and such.
-//    endOffset     : <number>, // Optional - property text end offset in enclosing style declaration. Absent for computed styles and such.
-// }
-//
-// name + value + priority : present when the property is enabled
-// text                    : present when the property is disabled
-//
-// For disabled properties, startOffset === endOffset === insertion point for the property.
-//
-// status:
-// "disabled" == property disabled by user
-// "active" == property participates in the computed style calculation
-// "inactive" == property does no participate in the computed style calculation (i.e. overridden by a subsequent property with the same name)
-// "style" == property is active and originates from the WebCore CSSStyleDeclaration rather than CSS source code (e.g. implicit longhand properties)
-//
-// cssStyle = {
-//    styleId            : <string>, // Optional
-//    cssProperties      : [
-//                          #cssProperty,
-//                          ...
-//                          #cssProperty
-//                         ],
-//    shorthandEntries   : [
-//                          #shorthandEntry,
-//                          ...
-//                          #shorthandEntry
-//                         ],
-//    cssText            : <string>, // Optional - declaration text
-//    properties         : {
-//                          width,
-//                          height,
-//                          startOffset, // Optional - for source-based styles only
-//                          endOffset, // Optional - for source-based styles only
-//                         }
-// }
-//
-// shorthandEntry = {
-//    name: <string>,
-//    value: <string>
-// }
-//
-// cssRule = {
-//    ruleId       : <string>, // Optional
-//    selectorText : <string>,
-//    sourceURL    : <string>,
-//    sourceLine   : <string>,
-//    origin       : <string>, // "" || "user-agent" || "user" || "inspector"
-//    style        : #cssStyle,
-//    selectorRange: { start: <number>, end: <number> } // Optional - for source-based rules only
-// }
-//
-// cssStyleSheetInfo = {
-//    styleSheetId : <number>
-//    sourceURL    : <string>
-//    title        : <string>
-//    disabled     : <boolean>
-// }
-//
-// cssStyleSheet = {
-//    styleSheetId : <number>
-//    rules        : [
-//                       #cssRule,
-//                       ...
-//                       #cssRule
-//                   ]
-//    text         : <string> // Optional - whenever the text is available for a text-based stylesheet
-// }
-
 namespace CSSAgentState {
 static const char cssAgentEnabled[] = "cssAgentEnabled";
 static const char isSelectorProfiling[] = "isSelectorProfiling";
@@ -632,7 +554,7 @@
             return 0;
 
         String newStyleSheetId = String::number(m_lastStyleSheetId++);
-        RefPtr<InspectorStyleSheetForInlineStyle> inspectorStyleSheet = InspectorStyleSheetForInlineStyle::create(newStyleSheetId, element, "");
+        RefPtr<InspectorStyleSheetForInlineStyle> inspectorStyleSheet = InspectorStyleSheetForInlineStyle::create(newStyleSheetId, element, "regular");
         m_idToInspectorStyleSheet.set(newStyleSheetId, inspectorStyleSheet);
         m_nodeToInspectorStyleSheet.set(element, inspectorStyleSheet);
         return inspectorStyleSheet.get();
@@ -739,7 +661,7 @@
     DEFINE_STATIC_LOCAL(String, user, ("user"));
     DEFINE_STATIC_LOCAL(String, inspector, ("inspector"));
 
-    String origin("");
+    String origin("regular");
     if (pageStyleSheet && !pageStyleSheet->ownerNode() && pageStyleSheet->href().isEmpty())
         origin = userAgent;
     else if (pageStyleSheet && pageStyleSheet->ownerNode() && pageStyleSheet->ownerNode()->nodeName() == "#document")

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (103760 => 103761)


--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2011-12-28 12:04:28 UTC (rev 103760)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2011-12-28 12:28:04 UTC (rev 103761)
@@ -800,7 +800,7 @@
     RefPtr<InspectorObject> result = InspectorObject::create();
     result->setString("selectorText", rule->selectorText());
     // "sourceURL" is present only for regular rules, otherwise "origin" should be used in the frontend.
-    if (!m_origin.length())
+    if (m_origin == "regular")
         result->setString("sourceURL", finalURL());
     result->setNumber("sourceLine", rule->sourceLine());
     result->setString("origin", m_origin);

Modified: trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js (103760 => 103761)


--- trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js	2011-12-28 12:04:28 UTC (rev 103760)
+++ trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js	2011-12-28 12:28:04 UTC (rev 103761)
@@ -538,7 +538,7 @@
 
     get isRegular()
     {
-        return this.origin === "";
+        return this.origin === "regular";
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to