Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: e001647e607b10e6b8fa7de9636fb2b1d8fcf05d https://github.com/WebKit/WebKit/commit/e001647e607b10e6b8fa7de9636fb2b1d8fcf05d Author: Matthieu Dubet <m_du...@apple.com> Date: 2025-08-18 (Mon, 18 Aug 2025)
Changed paths: A LayoutTests/fast/css/nested-media-print-expected.html A LayoutTests/fast/css/nested-media-print.html M Source/WebCore/css/StyleRule.cpp M Source/WebCore/css/StyleRule.h M Source/WebCore/css/StyleSheetContents.cpp M Source/WebCore/style/RuleSetBuilder.cpp M Source/WebCore/style/RuleSetBuilder.h M Source/WebCore/style/StyleScopeRuleSets.cpp Log Message: ----------- [CSS] Fix nesting selector resolution for print https://bugs.webkit.org/show_bug.cgi?id=297232 rdar://158081814 Reviewed by Antti Koivisto. The boolean parameter to resolve nesting selector only-once is stopping print style resolution to work properly because the selectors are considered already resolved. This patch completely changes the mechanism for the necessary only-once nesting selector resolution : instead of using a boolean, it relies on the fact that a style rule selector list should never be empty : if it's empty, it is because it has not been resolved yet. * LayoutTests/fast/css/nested-media-print-expected.html: Added. * LayoutTests/fast/css/nested-media-print.html: Added. * Source/WebCore/css/StyleRule.cpp: (WebCore::StyleRule::debugDescription const): (WebCore::StyleRuleWithNesting::debugDescription const): Improve debug logging (WebCore::StyleRuleWithNesting::StyleRuleWithNesting): (WebCore::m_originalSelectorList): (WebCore::StyleRuleBase::invalidateResolvedSelectorListRecursively): On CSSOM rule mutation, we need to clear all the child selectors because they are incorrect now. They will be resolved again correctly at rule set building. * Source/WebCore/css/StyleRule.h: (WebCore::StyleRule::adoptSelectorList): (WebCore::StyleRule::wrapperAdoptSelectorList): Deleted. (WebCore::StyleRuleWithNesting::wrapperAdoptOriginalSelectorList): Deleted. Create a new inline setter for selector list. Move wrapper* functions which are used by CSSOM to the .cpp file. * Source/WebCore/css/StyleSheetContents.cpp: (WebCore::StyleSheetContents::parserAppendRule): (WebCore::StyleSheetContents::wrapperInsertRule): Fix the detection of the selector list component count to use the original selector list. * Source/WebCore/style/RuleSetBuilder.cpp: (WebCore::Style::RuleSetBuilder::RuleSetBuilder): (WebCore::Style::m_shrinkToFit): (WebCore::Style::RuleSetBuilder::addChildRule): (WebCore::Style::RuleSetBuilder::addRulesFromSheetContents): (WebCore::Style::RuleSetBuilder::resolveSelectorListWithNesting): (WebCore::Style::RuleSetBuilder::addStyleRuleWithSelectorList): (WebCore::Style::RuleSetBuilder::addStyleRule): (WebCore::Style::m_builderShouldResolveNesting): Deleted. * Source/WebCore/style/RuleSetBuilder.h: * Source/WebCore/style/StyleScopeRuleSets.cpp: (WebCore::Style::ScopeRuleSets::appendAuthorStyleSheets): Remove boolean and resolve nesting selector whenever the selector list is empty. Canonical link: https://commits.webkit.org/298843@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes