Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: b5cf192b43bc91e0a18cf1399fd5f64d152e969c https://github.com/WebKit/WebKit/commit/b5cf192b43bc91e0a18cf1399fd5f64d152e969c Author: Patrick Angle <pan...@apple.com> Date: 2023-01-06 (Fri, 06 Jan 2023)
Changed paths: A LayoutTests/inspector/css/getMatchedStylesForNodeNestingStyleGrouping-expected.txt A LayoutTests/inspector/css/getMatchedStylesForNodeNestingStyleGrouping.html M LayoutTests/inspector/css/setGroupingHeaderText-expected.txt M LayoutTests/inspector/css/setGroupingHeaderText.html M Source/JavaScriptCore/inspector/protocol/CSS.json M Source/WebCore/Headers.cmake M Source/WebCore/WebCore.xcodeproj/project.pbxproj M Source/WebCore/css/CSSStyleRule.cpp M Source/WebCore/css/CSSStyleRule.h M Source/WebCore/css/StyleRule.cpp M Source/WebCore/css/StyleRule.h M Source/WebCore/css/parser/CSSParser.cpp M Source/WebCore/css/parser/CSSParser.h M Source/WebCore/inspector/InspectorStyleSheet.cpp M Source/WebCore/inspector/agents/InspectorCSSAgent.cpp M Source/WebCore/style/InspectorCSSOMWrappers.cpp M Source/WebInspectorUI/UserInterface/Models/CSSGrouping.js M Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js M Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js Log Message: ----------- Web Inspector: Show parent style rules for nested style rules in Styles sidebar https://bugs.webkit.org/show_bug.cgi?id=250088 rdar://100522930 Reviewed by Antti Koivisto. Add basic support for viewing and editing parent style rule selectors for nested style rules. This uses the same mechanism we already use for showing parent `@rule`s, including support for editing. * LayoutTests/inspector/css/getMatchesStylesForNodeNestingStyleGrouping-expected.txt: Added. * LayoutTests/inspector/css/getMatchesStylesForNodeNestingStyleGrouping.html: Added. * LayoutTests/inspector/css/setGroupingHeaderText-expected.txt: * LayoutTests/inspector/css/setGroupingHeaderText.html: - Add test cases for modifying a parent Style rule's selector via a Grouping on a child nested rule. * Source/JavaScriptCore/inspector/protocol/CSS.json: - Add new "StyleRule" grouping type to represent parent style rules. * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/css/CSSStyleRule.cpp: (WebCore::CSSStyleRule::CSSStyleRule): (WebCore::CSSStyleRule::length const): (WebCore::CSSStyleRule::item const): (WebCore::CSSStyleRule::cssRules const): * Source/WebCore/css/CSSStyleRule.h: - Add support for getting the nested rules inside a CSSStyleRule. * Source/WebCore/css/StyleRule.cpp: (WebCore::StyleRuleBase::createCSSOMWrapper const): * Source/WebCore/css/StyleRule.h: - Support creating a wrapper with a CSSStyleRule as a parent. * Source/WebCore/css/parser/CSSParser.cpp: (WebCore::CSSParser::parseSelector): * Source/WebCore/css/parser/CSSParser.h: - Allow callers to enable nesting syntax for parsing a selector, which is done to verify a selector is valid by Web Inspector when editing a nested rule's selector. * Source/WebCore/inspector/InspectorStyleSheet.cpp: (WebCore::flatteningStrategyForStyleRuleType): - Style rules can now contain rules, so get rid of the `Commit` strategy and use the existing `CommitSelfThenChildren` for style rules instead. (WebCore::isValidRuleHeaderText): - Pass through the nesting mode for parsing selectors. (WebCore::protocolGroupingTypeForStyleRuleType): (WebCore::flattenSourceData): - Get rid of `Commit` strategy. (WebCore::StyleSheetHandler::startRuleHeader): - It is no longer invalid to encounter the start of a style rule before encountering the end of the previous style rule. (WebCore::asCSSRuleList): (WebCore::InspectorStyleSheet::buildArrayForGroupings): - Start with the parent of the passed CSSRule, otherwise every style rule will include itself as a grouping. (WebCore::isNestedContext): (WebCore::InspectorStyleSheet::setRuleHeaderText): - Nested rules should allow relevant syntax for selectors. (WebCore::InspectorStyleSheet::collectFlatRules): * Source/WebCore/style/InspectorCSSOMWrappers.cpp: (WebCore::Style::InspectorCSSOMWrappers::collect): - Eagerly create CSSOM wrappers for nested rules. * Source/WebInspectorUI/UserInterface/Models/CSSGrouping.js: (WI.CSSGrouping.prototype.get isStyle): (WI.CSSGrouping.prototype.get prefix): (WI.CSSGrouping): - Nested rules don't have a prefix like `@rule`s do, so provide a null prefix. * Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js: (WI.SpreadsheetCSSStyleDeclarationSection.prototype._renderGroupings): - Support groupings without a prefix by not prepending the prefix. Canonical link: https://commits.webkit.org/258555@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes