Web Inspector: rename CSS.StyleSheetOrigin.Regular to CSS.StyleSheetOrigin.Author...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 May 2020 02:34:39 +0000 (02:34 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 May 2020 02:34:39 +0000 (02:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=211827

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* inspector/protocol/CSS.json:

Source/WebCore:

Tests: inspector/css/add-rule.html
       inspector/css/getMatchedStylesForNode.html

* inspector/agents/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::asInspectorStyleSheet):
(WebCore::InspectorCSSAgent::detectOrigin):
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::buildObjectForRule):

Source/WebInspectorUI:

* UserInterface/Controllers/CSSManager.js:
(WI.CSSManager.protocolStyleSheetOriginToEnum):

LayoutTests:

* inspector/css/add-rule.html:
* inspector/css/add-rule-expected.txt:
* inspector/css/getMatchedStylesForNode-expected.txt:

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

LayoutTests/ChangeLog
LayoutTests/inspector/css/add-rule-expected.txt
LayoutTests/inspector/css/add-rule.html
LayoutTests/inspector/css/getMatchedStylesForNode-expected.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/CSS.json
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorStyleSheet.cpp
Source/WebCore/inspector/agents/InspectorCSSAgent.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js

index dba88b6..9750aeb 100644 (file)
@@ -1,3 +1,14 @@
+2020-05-13  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: rename CSS.StyleSheetOrigin.Regular to CSS.StyleSheetOrigin.Author to match the spec
+        https://bugs.webkit.org/show_bug.cgi?id=211827
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/css/add-rule.html:
+        * inspector/css/add-rule-expected.txt:
+        * inspector/css/getMatchedStylesForNode-expected.txt:
+
 2020-05-13  Jack Lee  <shihchieh_lee@apple.com>
 
         Nullptr crash in InsertParagraphSeparatorCommand::doApply when the canonical position is uneditable
index 46d5ea8..3d69a82 100644 (file)
@@ -16,7 +16,7 @@ PASS: Rule origin should be "inspector"
 -- Running test case: CSS.addRule.ExternalStyleSheet
 PASS: Rule selector should be "div"
 PASS: Rule range should be [2:0,2:3]
-PASS: Rule origin should be "regular"
+PASS: Rule origin should be "author"
 
 -- Running test case: CSS.addRule.BadStyleSheetId
 PASS: Missing style sheet for given styleSheetId
index 75f9c9c..814678c 100644 (file)
@@ -95,7 +95,7 @@ function test() {
 
                 InspectorTest.expectEqual(rulePayload.selectorList.text, "div", `Rule selector should be "div"`);
                 InspectorTest.expectEqual(stringify(rulePayload.selectorList.range), "2:0,2:3", `Rule range should be [2:0,2:3]`);
-                InspectorTest.expectEqual(rulePayload.origin, "regular", `Rule origin should be "regular"`);
+                InspectorTest.expectEqual(rulePayload.origin, "author", `Rule origin should be "author"`);
 
                 resolve();
             }
index 2c4d524..9a45c7f 100644 (file)
@@ -24,7 +24,7 @@ Matched:
         "range": "<filtered>"
       },
       "sourceLine": "<filtered>",
-      "origin": "regular",
+      "origin": "author",
       "style": {
         "cssProperties": [
           {
@@ -67,7 +67,7 @@ Matched:
         "range": "<filtered>"
       },
       "sourceLine": "<filtered>",
-      "origin": "regular",
+      "origin": "author",
       "style": {
         "cssProperties": [
           {
@@ -110,7 +110,7 @@ Matched:
         "range": "<filtered>"
       },
       "sourceLine": "<filtered>",
-      "origin": "regular",
+      "origin": "author",
       "style": {
         "cssProperties": [
           {
@@ -160,7 +160,7 @@ Pseudo:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -208,7 +208,7 @@ Pseudo:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -256,7 +256,7 @@ Pseudo:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -304,7 +304,7 @@ Pseudo:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -352,7 +352,7 @@ Pseudo:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -400,7 +400,7 @@ Pseudo:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -448,7 +448,7 @@ Pseudo:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -496,7 +496,7 @@ Pseudo:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -544,7 +544,7 @@ Pseudo:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -592,7 +592,7 @@ Pseudo:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -640,7 +640,7 @@ Pseudo:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -688,7 +688,7 @@ Pseudo:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -736,7 +736,7 @@ Pseudo:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -787,7 +787,7 @@ Inherited:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -837,7 +837,7 @@ Inherited:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -880,7 +880,7 @@ Inherited:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -930,7 +930,7 @@ Inherited:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -985,7 +985,7 @@ Inherited:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
@@ -1035,7 +1035,7 @@ Inherited:
             "range": "<filtered>"
           },
           "sourceLine": "<filtered>",
-          "origin": "regular",
+          "origin": "author",
           "style": {
             "cssProperties": [
               {
index 73ba3b7..0d12d17 100644 (file)
@@ -1,3 +1,12 @@
+2020-05-13  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: rename CSS.StyleSheetOrigin.Regular to CSS.StyleSheetOrigin.Author to match the spec
+        https://bugs.webkit.org/show_bug.cgi?id=211827
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/protocol/CSS.json:
+
 2020-05-13  Yusuke Suzuki  <ysuzuki@apple.com>
 
         JSDOMWindowBase m_windowCloseWatchpoints must be Ref<>
index f847021..f9f5578 100644 (file)
@@ -20,7 +20,7 @@
         {
             "id": "StyleSheetOrigin",
             "type": "string",
-            "enum": ["user", "user-agent", "inspector", "regular"],
+            "enum": ["user", "user-agent", "author", "inspector"],
             "description": "Stylesheet type: \"user\" for user stylesheets, \"user-agent\" for user-agent stylesheets, \"inspector\" for stylesheets created by the inspector (i.e. those holding the \"via inspector\" rules), \"regular\" for regular stylesheets."
         },
         {
index 9b0ed23..7eee8d7 100644 (file)
@@ -1,3 +1,19 @@
+2020-05-13  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: rename CSS.StyleSheetOrigin.Regular to CSS.StyleSheetOrigin.Author to match the spec
+        https://bugs.webkit.org/show_bug.cgi?id=211827
+
+        Reviewed by Timothy Hatcher.
+
+        Tests: inspector/css/add-rule.html
+               inspector/css/getMatchedStylesForNode.html
+
+        * inspector/agents/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::asInspectorStyleSheet):
+        (WebCore::InspectorCSSAgent::detectOrigin):
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyleSheet::buildObjectForRule):
+
 2020-05-13  Yusuke Suzuki  <ysuzuki@apple.com>
 
         JSDOMWindowBase m_windowCloseWatchpoints must be Ref<>
index eaab064..ae0fef5 100644 (file)
@@ -1135,7 +1135,7 @@ RefPtr<Inspector::Protocol::CSS::CSSRule> InspectorStyleSheet::buildObjectForRul
         .setStyle(buildObjectForStyle(&rule->style()))
         .release();
 
-    if (m_origin == Inspector::Protocol::CSS::StyleSheetOrigin::Regular || m_origin == Inspector::Protocol::CSS::StyleSheetOrigin::User)
+    if (m_origin == Inspector::Protocol::CSS::StyleSheetOrigin::Author || m_origin == Inspector::Protocol::CSS::StyleSheetOrigin::User)
         result->setSourceURL(finalURL());
 
     if (canBind()) {
index 56bc0a0..7b688aa 100644 (file)
@@ -870,7 +870,7 @@ InspectorStyleSheetForInlineStyle& InspectorCSSAgent::asInspectorStyleSheet(Styl
 {
     return m_nodeToInspectorStyleSheet.ensure(&element, [this, &element] {
         String newStyleSheetId = String::number(m_lastStyleSheetId++);
-        auto inspectorStyleSheet = InspectorStyleSheetForInlineStyle::create(m_instrumentingAgents.inspectorPageAgent(), newStyleSheetId, element, Inspector::Protocol::CSS::StyleSheetOrigin::Regular, this);
+        auto inspectorStyleSheet = InspectorStyleSheetForInlineStyle::create(m_instrumentingAgents.inspectorPageAgent(), newStyleSheetId, element, Inspector::Protocol::CSS::StyleSheetOrigin::Author, this);
         m_idToInspectorStyleSheet.set(newStyleSheetId, inspectorStyleSheet.copyRef());
         return inspectorStyleSheet;
     }).iterator->value;
@@ -942,7 +942,7 @@ Inspector::Protocol::CSS::StyleSheetOrigin InspectorCSSAgent::detectOrigin(CSSSt
         }
     }
 
-    return Inspector::Protocol::CSS::StyleSheetOrigin::Regular;
+    return Inspector::Protocol::CSS::StyleSheetOrigin::Author;
 }
 
 RefPtr<Inspector::Protocol::CSS::CSSRule> InspectorCSSAgent::buildObjectForRule(const StyleRule* styleRule, Style::Resolver& styleResolver, Element& element)
index 38c7c30..1028990 100644 (file)
@@ -1,3 +1,13 @@
+2020-05-13  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: rename CSS.StyleSheetOrigin.Regular to CSS.StyleSheetOrigin.Author to match the spec
+        https://bugs.webkit.org/show_bug.cgi?id=211827
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Controllers/CSSManager.js:
+        (WI.CSSManager.protocolStyleSheetOriginToEnum):
+
 2020-05-11  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Network: Timing: gaps around the "Resource does not have timing data" message
index 77cf4d1..f9bdb09 100644 (file)
@@ -63,18 +63,20 @@ WI.CSSManager = class CSSManager extends WI.Object
     static protocolStyleSheetOriginToEnum(origin)
     {
         switch (origin) {
-        case InspectorBackend.Enum.CSS.StyleSheetOrigin.Regular:
-            return WI.CSSStyleSheet.Type.Author;
         case InspectorBackend.Enum.CSS.StyleSheetOrigin.User:
             return WI.CSSStyleSheet.Type.User;
+
         case InspectorBackend.Enum.CSS.StyleSheetOrigin.UserAgent:
             return WI.CSSStyleSheet.Type.UserAgent;
+
         case InspectorBackend.Enum.CSS.StyleSheetOrigin.Inspector:
             return WI.CSSStyleSheet.Type.Inspector;
-        default:
-            console.assert(false, "Unknown CSS.StyleSheetOrigin", origin);
-            return InspectorBackend.Enum.CSS.StyleSheetOrigin.Regular;
         }
+
+        // COMPATIBILITY (iOS 14): CSS.StyleSheetOrigin.Regular was replaced with CSS.StyleSheetOrigin.Author.
+        console.assert(!InspectorBackend.Enum.CSS.StyleSheetOrigin.Author || origin === InspectorBackend.Enum.CSS.StyleSheetOrigin.Author);
+        console.assert(!InspectorBackend.Enum.CSS.StyleSheetOrigin.Regular || origin === InspectorBackend.Enum.CSS.StyleSheetOrigin.Regular);
+        return WI.CSSStyleSheet.Type.Author;
     }
 
     static protocolGroupingTypeToEnum(type)