Ignore:
Timestamp:
Mar 31, 2022, 2:50:47 PM (3 years ago)
Author:
Patrick Angle
Message:

Web Inspector: Support Container Queries in the Styles sidebar
https://bugs.webkit.org/show_bug.cgi?id=238346

Reviewed by Devin Rousso.

Source/JavaScriptCore:

Add new container-rule type for CSS::Grouping::Type.

  • inspector/protocol/CSS.json:

Source/WebCore:

Test: inspector/css/getMatchedStylesForNodeContainerGrouping.html

Add basic support to Web Inspector for viewing styles in @container rules.

  • css/CSSContainerRule.cpp:

(WebCore::CSSContainerRule::nameFilterText const):

  • css/CSSContainerRule.h:
  • Provide a way to get the name that is used to filter the rule to specific containers.
  • inspector/InspectorStyleSheet.cpp:

(flattenSourceData):

  • In order to prevent future rule types from being added without some consideration for how they are inspected,

use an exhaustive switch-case statement here. This will at minimum allow us to make sure we have opened a bug
and put a FIXME here for new values in the future.

(WebCore::asCSSRuleList):
(WebCore::buildArrayForGroupings):

  • style/InspectorCSSOMWrappers.cpp:

(WebCore::Style::InspectorCSSOMWrappers::collect):

Source/WebInspectorUI:

  • UserInterface/Models/CSSGrouping.js:

(WI.CSSGrouping.prototype.get isContainer):
(WI.CSSGrouping.prototype.get prefix):
(WI.CSSGrouping):

LayoutTests:

  • inspector/css/getMatchedStylesForNodeContainerGrouping-expected.txt: Added.
  • inspector/css/getMatchedStylesForNodeContainerGrouping.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSContainerRule.cpp

    r292045 r292181  
    7777}
    7878
     79String 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
    7990} // namespace WebCore
    8091
Note: See TracChangeset for help on using the changeset viewer.