Changeset 292181 in webkit
- Timestamp:
- Mar 31, 2022, 2:50:47 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/inspector/css/getMatchedStylesForNodeContainerGrouping-expected.txt (added)
-
LayoutTests/inspector/css/getMatchedStylesForNodeContainerGrouping.html (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/inspector/protocol/CSS.json (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSContainerRule.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSContainerRule.h (modified) (1 diff)
-
Source/WebCore/inspector/InspectorStyleSheet.cpp (modified) (4 diffs)
-
Source/WebCore/style/InspectorCSSOMWrappers.cpp (modified) (2 diffs)
-
Source/WebInspectorUI/ChangeLog (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Models/CSSGrouping.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r292180 r292181 1 2022-03-31 Patrick Angle <pangle@apple.com> 2 3 Web Inspector: Support Container Queries in the Styles sidebar 4 https://bugs.webkit.org/show_bug.cgi?id=238346 5 6 Reviewed by Devin Rousso. 7 8 * inspector/css/getMatchedStylesForNodeContainerGrouping-expected.txt: Added. 9 * inspector/css/getMatchedStylesForNodeContainerGrouping.html: Added. 10 1 11 2022-03-31 Robert Jenner <Jenner@apple.com> 2 12 -
trunk/Source/JavaScriptCore/ChangeLog
r292118 r292181 1 2022-03-31 Patrick Angle <pangle@apple.com> 2 3 Web Inspector: Support Container Queries in the Styles sidebar 4 https://bugs.webkit.org/show_bug.cgi?id=238346 5 6 Reviewed by Devin Rousso. 7 8 Add new `container-rule` type for `CSS::Grouping::Type`. 9 10 * inspector/protocol/CSS.json: 11 1 12 2022-03-30 Chris Dumez <cdumez@apple.com> 2 13 -
trunk/Source/JavaScriptCore/inspector/protocol/CSS.json
r288492 r292181 229 229 "description": "CSS @media (as well as other users of media queries, like @import, <style>, <link>, etc.), @supports, and @layer descriptor.", 230 230 "properties": [ 231 { "name": "type", "type": "string", "enum": ["media-rule", "media-import-rule", "media-link-node", "media-style-node", "supports-rule", "layer-rule", "layer-import-rule" ], "description": "Source of the media query: \"media-rule\" if specified by a @media rule, \"media-import-rule\" if specified by an @import rule, \"media-link-node\" if specified by a \"media\" attribute in a linked style sheet's LINK tag, \"media-style-node\" if specified by a \"media\" attribute in an inline style sheet's STYLE tag, \"supports-rule\" if specified by an @supports rule, \"layer-rule\" if specified by an @layer rule." },232 { "name": "text", "type": "string", "optional": true, "description": "Query text if specified by a @media or @supportsrule. Layer name (or not present for anonymous layers) for @layer rules." },231 { "name": "type", "type": "string", "enum": ["media-rule", "media-import-rule", "media-link-node", "media-style-node", "supports-rule", "layer-rule", "layer-import-rule", "container-rule"], "description": "Source of the media query: \"media-rule\" if specified by a @media rule, \"media-import-rule\" if specified by an @import rule, \"media-link-node\" if specified by a \"media\" attribute in a linked style sheet's LINK tag, \"media-style-node\" if specified by a \"media\" attribute in an inline style sheet's STYLE tag, \"supports-rule\" if specified by an @supports rule, \"layer-rule\" if specified by an @layer rule, \"container-rule\" if specified by an @container rule." }, 232 { "name": "text", "type": "string", "optional": true, "description": "Query text if specified by a @media, @supports, or @container rule. Layer name (or not present for anonymous layers) for @layer rules." }, 233 233 { "name": "sourceURL", "type": "string", "optional": true, "description": "URL of the document containing the CSS grouping." } 234 234 ] -
trunk/Source/WebCore/ChangeLog
r292160 r292181 1 2022-03-31 Patrick Angle <pangle@apple.com> 2 3 Web Inspector: Support Container Queries in the Styles sidebar 4 https://bugs.webkit.org/show_bug.cgi?id=238346 5 6 Reviewed by Devin Rousso. 7 8 Test: inspector/css/getMatchedStylesForNodeContainerGrouping.html 9 10 Add basic support to Web Inspector for viewing styles in `@container` rules. 11 12 * css/CSSContainerRule.cpp: 13 (WebCore::CSSContainerRule::nameFilterText const): 14 * css/CSSContainerRule.h: 15 - Provide a way to get the name that is used to filter the rule to specific containers. 16 17 * inspector/InspectorStyleSheet.cpp: 18 (flattenSourceData): 19 - In order to prevent future rule types from being added without some consideration for how they are inspected, 20 use an exhaustive switch-case statement here. This will at minimum allow us to make sure we have opened a bug 21 and put a FIXME here for new values in the future. 22 23 (WebCore::asCSSRuleList): 24 (WebCore::buildArrayForGroupings): 25 26 * style/InspectorCSSOMWrappers.cpp: 27 (WebCore::Style::InspectorCSSOMWrappers::collect): 28 1 29 2022-03-31 Diego Pino Garcia <dpino@igalia.com> 2 30 -
trunk/Source/WebCore/css/CSSContainerRule.cpp
r292045 r292181 77 77 } 78 78 79 String CSSContainerRule::nameFilterText() const 80 { 81 StringBuilder builder; 82 83 auto name = styleRuleContainer().filteredQuery().nameFilter; 84 if (!name.isEmpty()) 85 serializeIdentifier(name, builder); 86 87 return builder.toString(); 88 } 89 79 90 } // namespace WebCore 80 91 -
trunk/Source/WebCore/css/CSSContainerRule.h
r292045 r292181 38 38 String cssText() const final; 39 39 String conditionText() const final; 40 String nameFilterText() const; 40 41 41 42 private: -
trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp
r291992 r292181 27 27 #include "InspectorStyleSheet.h" 28 28 29 #include "CSSContainerRule.h" 29 30 #include "CSSImportRule.h" 30 31 #include "CSSKeyframesRule.h" … … 107 108 { 108 109 for (auto& data : dataList) { 109 if (data->type == WebCore::StyleRuleType::Style) 110 switch (data->type) { 111 case WebCore::StyleRuleType::Style: 110 112 target.append(data.copyRef()); 111 else if (data->type == WebCore::StyleRuleType::Media || data->type == WebCore::StyleRuleType::Supports || data->type == WebCore::StyleRuleType::LayerBlock) 113 break; 114 115 case WebCore::StyleRuleType::Media: 116 case WebCore::StyleRuleType::Supports: 117 case WebCore::StyleRuleType::LayerBlock: 118 case WebCore::StyleRuleType::Container: 112 119 flattenSourceData(data->childRules, target); 120 break; 121 122 case WebCore::StyleRuleType::Unknown: 123 case WebCore::StyleRuleType::Charset: 124 case WebCore::StyleRuleType::Import: 125 case WebCore::StyleRuleType::FontFace: 126 case WebCore::StyleRuleType::Page: 127 case WebCore::StyleRuleType::Keyframes: 128 case WebCore::StyleRuleType::Keyframe: 129 case WebCore::StyleRuleType::Margin: 130 case WebCore::StyleRuleType::Namespace: 131 case WebCore::StyleRuleType::CounterStyle: 132 case WebCore::StyleRuleType::LayerStatement: 133 case WebCore::StyleRuleType::FontPaletteValues: 134 // These rule types do not contain child rules, and therefore have nothing to display in the Styles panel in 135 // the details sidebar of the Elements Tab in Web Inspector. 136 break; 137 } 113 138 } 114 139 } … … 431 456 return &downcast<CSSLayerBlockRule>(*rule).cssRules(); 432 457 458 if (auto* containerRule = dynamicDowncast<CSSContainerRule>(rule)) 459 return &containerRule->cssRules(); 460 433 461 return nullptr; 434 462 } … … 483 511 layerRulePayload->setText(layerName); 484 512 ruleGroupingPayloads.append(WTFMove(layerRulePayload)); 513 } else if (auto* containerRule = dynamicDowncast<CSSContainerRule>(parentRule)) { 514 auto containerRulePayload = Protocol::CSS::Grouping::create() 515 .setType(Protocol::CSS::Grouping::Type::ContainerRule) 516 .release(); 517 518 StringBuilder builder; 519 auto nameFilter = containerRule->nameFilterText(); 520 if (!nameFilter.isEmpty()) 521 builder.append(nameFilter, ' '); 522 builder.append(containerRule->conditionText()); 523 containerRulePayload->setText(builder.toString()); 524 525 ruleGroupingPayloads.append(WTFMove(containerRulePayload)); 485 526 } 486 527 -
trunk/Source/WebCore/style/InspectorCSSOMWrappers.cpp
r291824 r292181 30 30 #include "InspectorCSSOMWrappers.h" 31 31 32 #include "CSSContainerRule.h" 32 33 #include "CSSImportRule.h" 33 34 #include "CSSLayerBlockRule.h" … … 64 65 65 66 switch (cssRule->styleRuleType()) { 67 case StyleRuleType::Container: 68 collect(downcast<CSSContainerRule>(cssRule)); 69 break; 66 70 case StyleRuleType::Import: 67 71 collect(downcast<CSSImportRule>(*cssRule).styleSheet()); -
trunk/Source/WebInspectorUI/ChangeLog
r292172 r292181 1 2022-03-31 Patrick Angle <pangle@apple.com> 2 3 Web Inspector: Support Container Queries in the Styles sidebar 4 https://bugs.webkit.org/show_bug.cgi?id=238346 5 6 Reviewed by Devin Rousso. 7 8 * UserInterface/Models/CSSGrouping.js: 9 (WI.CSSGrouping.prototype.get isContainer): 10 (WI.CSSGrouping.prototype.get prefix): 11 (WI.CSSGrouping): 12 1 13 2022-03-31 Devin Rousso <drousso@apple.com> 2 14 -
trunk/Source/WebInspectorUI/UserInterface/Models/CSSGrouping.js
r286558 r292181 62 62 } 63 63 64 get isContainer() 65 { 66 return this._type === WI.CSSGrouping.Type.ContainerRule; 67 } 68 64 69 get prefix() 65 70 { … … 69 74 if (this.isLayer) 70 75 return "@layer"; 76 77 if (this.isContainer) 78 return "@container"; 71 79 72 80 console.assert(this.isMedia); … … 83 91 LayerRule: "layer-rule", 84 92 LayerImportRule: "layer-import-rule", 93 ContainerRule: "container-rule", 85 94 };
Note:
See TracChangeset
for help on using the changeset viewer.