WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-238500-20220329142348.patch (text/plain), 28.11 KB, created by
Antti Koivisto
on 2022-03-29 04:23:49 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Antti Koivisto
Created:
2022-03-29 04:23:49 PDT
Size:
28.11 KB
patch
obsolete
>Subversion Revision: 292024 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index b06b5fa73f7fb7678f80608059965208b65b74ca..262599eba703bb4d6e76ea0ea393321fcf395e4e 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,50 @@ >+2022-03-29 Antti Koivisto <antti@apple.com> >+ >+ [CSS Container Queries] Support CSSOM >+ https://bugs.webkit.org/show_bug.cgi?id=238500 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add CSSContainerRule interface. >+ >+ https://drafts.csswg.org/css-contain-3/#the-csscontainerrule-interface >+ >+ * DerivedSources-input.xcfilelist: >+ * DerivedSources-output.xcfilelist: >+ * DerivedSources.make: >+ * Sources.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ * bindings/js/JSCSSRuleCustom.cpp: >+ (WebCore::toJSNewlyCreated): >+ * css/CSSContainerRule.cpp: Added. >+ (WebCore::CSSContainerRule::CSSContainerRule): >+ (WebCore::CSSContainerRule::create): >+ (WebCore::CSSContainerRule::styleRuleContainer const): >+ (WebCore::CSSContainerRule::cssText const): >+ (WebCore::CSSContainerRule::conditionText const): >+ >+ Implementation, the only real functionality is serialization. >+ >+ * css/CSSContainerRule.h: Added. >+ * css/CSSContainerRule.idl: Added. >+ >+ Interface. >+ >+ * css/ContainerQuery.cpp: >+ (WebCore::CQ::serialize): >+ (WebCore::serialize): >+ >+ Query syntax serialization support. >+ >+ * css/ContainerQuery.h: >+ * css/ContainerQueryParser.cpp: >+ (WebCore::ContainerQueryParser::consumeContainerQuery): >+ >+ Remember the text of unknown queries. >+ >+ * css/StyleRule.cpp: >+ (WebCore::StyleRuleBase::createCSSOMWrapper const): >+ > 2022-03-28 Alan Bujtas <zalan@apple.com> > > [ macOS & Win ] fast/repaint/list-item-equal-style-change-no-repaint.html is a flaky failure >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index 51d08b998722d41a4d31afc5946a6bf562a2d85b..f1bfb51a77111a13360c5fbf6ea5950edab69a9a 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -762,6 +762,7 @@ set(WebCore_NON_SVG_IDL_FILES > crypto/parameters/RsaOaepParams.idl > crypto/parameters/RsaPssParams.idl > >+ css/CSSContainerRule.idl > css/CSSConditionRule.idl > css/CSSCounterStyleRule.idl > css/CSSFontFaceRule.idl >diff --git a/Source/WebCore/DerivedSources-input.xcfilelist b/Source/WebCore/DerivedSources-input.xcfilelist >index c6eab9d721264bba73c00c24683df8007bdd08f9..ed9d38c63bb1e0dfd1c3e0b7320647903c9b79f8 100644 >--- a/Source/WebCore/DerivedSources-input.xcfilelist >+++ b/Source/WebCore/DerivedSources-input.xcfilelist >@@ -892,6 +892,7 @@ $(PROJECT_DIR)/crypto/parameters/RsaKeyGenParams.idl > $(PROJECT_DIR)/crypto/parameters/RsaOaepParams.idl > $(PROJECT_DIR)/crypto/parameters/RsaPssParams.idl > $(PROJECT_DIR)/css/CSSConditionRule.idl >+$(PROJECT_DIR)/css/CSSContainerRule.idl > $(PROJECT_DIR)/css/CSSCounterStyleRule.idl > $(PROJECT_DIR)/css/CSSFontFaceRule.idl > $(PROJECT_DIR)/css/CSSFontPaletteValuesRule.idl >diff --git a/Source/WebCore/DerivedSources-output.xcfilelist b/Source/WebCore/DerivedSources-output.xcfilelist >index 07e962b67453042b3649daf234cd2ca698f7a24a..2b7fc2bbad2a0bb851fab6c4716ad71f88936e3a 100644 >--- a/Source/WebCore/DerivedSources-output.xcfilelist >+++ b/Source/WebCore/DerivedSources-output.xcfilelist >@@ -299,6 +299,8 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSColorValue.cpp > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSColorValue.h > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSConditionRule.cpp > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSConditionRule.h >+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSContainerRule.cpp >+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSContainerRule.h > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSCounterStyleRule.cpp > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSCounterStyleRule.h > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSFontFaceRule.cpp >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index f960c6f2cdeac4c93ea3f006100cb7af4ae3bac3..d570132a3d583a33fa0599ea66d06517a69acd6c 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -771,6 +771,7 @@ JS_BINDING_IDLS := \ > $(WebCore)/crypto/parameters/RsaOaepParams.idl \ > $(WebCore)/crypto/parameters/RsaPssParams.idl \ > $(WebCore)/css/CSSConditionRule.idl \ >+ $(WebCore)/css/CSSContainerRule.idl \ > $(WebCore)/css/CSSCounterStyleRule.idl \ > $(WebCore)/css/CSSFontFaceRule.idl \ > $(WebCore)/css/CSSFontPaletteValuesRule.idl \ >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index b753740196b57d2d4f023bf93d2cd0675afa79d7..c9420f5d469ada2643d0f6f7fa01874af37e0554 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -715,6 +715,7 @@ css/CSSBorderImageSliceValue.cpp > css/CSSCanvasValue.cpp > css/CSSComputedStyleDeclaration.cpp > css/CSSConditionRule.cpp >+css/CSSContainerRule.cpp > css/CSSContentDistributionValue.cpp > css/CSSCounterStyleRule.cpp > css/CSSCrossfadeValue.cpp >@@ -2947,6 +2948,7 @@ JSByteLengthQueuingStrategy.cpp > JSCDATASection.cpp > JSCSSAnimation.cpp > JSCSSConditionRule.cpp >+JSCSSContainerRule.cpp > JSCSSCounterStyleRule.cpp > JSCSSFontFaceRule.cpp > JSCSSFontPaletteValuesRule.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 5ab9321b52abe2d98ac3022bacca28bc65bee3ef..a3c2684480ba76b6f913824c465bd69186d16478 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -5382,6 +5382,7 @@ > E46B41F91CB24E70008F11DE /* ScriptDisallowedScope.h in Headers */ = {isa = PBXBuildFile; fileRef = E46B41F81CB24E70008F11DE /* ScriptDisallowedScope.h */; settings = {ATTRIBUTES = (Private, ); }; }; > E46C794B1F13E82B00F371E1 /* StyleInvalidationFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A1822F1F13BE5800FEF698 /* StyleInvalidationFunctions.h */; }; > E47127CB163438AE00ED6F5A /* StyleInvalidator.h in Headers */ = {isa = PBXBuildFile; fileRef = E47A97CF163059FC005DCD99 /* StyleInvalidator.h */; }; >+ E476EF4A27E07A410056AC6E /* CSSContainerRule.h in Headers */ = {isa = PBXBuildFile; fileRef = E476EF4827E07A1A0056AC6E /* CSSContainerRule.h */; }; > E4778B80115A581A00B5D372 /* JSCustomEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E4778B7E115A581A00B5D372 /* JSCustomEvent.h */; }; > E47A3AC61C5EAC9D00CCBFA7 /* StyleSharingResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E47A3AC41C5EAC7900CCBFA7 /* StyleSharingResolver.h */; }; > E47B4BE80E71241600038854 /* CachedResourceHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = E47B4BE60E71241600038854 /* CachedResourceHandle.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -17537,6 +17538,9 @@ > E46A2B1B17CA65B9000DBCD8 /* TypedElementDescendantIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypedElementDescendantIterator.h; sourceTree = "<group>"; }; > E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementChildIterator.h; sourceTree = "<group>"; }; > E46B41F81CB24E70008F11DE /* ScriptDisallowedScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDisallowedScope.h; sourceTree = "<group>"; }; >+ E476EF4727E07A020056AC6E /* CSSContainerRule.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSContainerRule.idl; sourceTree = "<group>"; }; >+ E476EF4827E07A1A0056AC6E /* CSSContainerRule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSContainerRule.h; sourceTree = "<group>"; }; >+ E476EF4927E07A280056AC6E /* CSSContainerRule.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSContainerRule.cpp; sourceTree = "<group>"; }; > E4778B7D115A581A00B5D372 /* JSCustomEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomEvent.cpp; sourceTree = "<group>"; }; > E4778B7E115A581A00B5D372 /* JSCustomEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomEvent.h; sourceTree = "<group>"; }; > E47A3AC21C5EABBE00CCBFA7 /* StyleSharingResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleSharingResolver.cpp; sourceTree = "<group>"; }; >@@ -31784,6 +31788,9 @@ > 930AAC96250EB8170013DA9F /* CSSConditionRule.cpp */, > 930AAC98250EB8170013DA9F /* CSSConditionRule.h */, > 930AAC99250EB8180013DA9F /* CSSConditionRule.idl */, >+ E476EF4927E07A280056AC6E /* CSSContainerRule.cpp */, >+ E476EF4827E07A1A0056AC6E /* CSSContainerRule.h */, >+ E476EF4727E07A020056AC6E /* CSSContainerRule.idl */, > 9DAC7C521AF2CAA100437C44 /* CSSContentDistributionValue.cpp */, > 9DAC7C531AF2CAA100437C44 /* CSSContentDistributionValue.h */, > 98F9D66525FDDFE700BD842D /* CSSCounterStyleRule.cpp */, >@@ -34199,6 +34206,7 @@ > BC6049CC0DB560C200204739 /* CSSCanvasValue.h in Headers */, > BCEA4790097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h in Headers */, > 930AAC9A250EB8490013DA9F /* CSSConditionRule.h in Headers */, >+ E476EF4A27E07A410056AC6E /* CSSContainerRule.h in Headers */, > 9DAC7C551AF2CAA200437C44 /* CSSContentDistributionValue.h in Headers */, > 98F9D66925FDE02200BD842D /* CSSCounterStyleRule.h in Headers */, > 2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */, >diff --git a/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp b/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp >index dceb710d64ca461242ab8a301806006c70ec2205..fbf8f40d9930d385f6b43fcb1735c2bf78c856ef 100644 >--- a/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp >+++ b/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp >@@ -26,6 +26,7 @@ > #include "config.h" > #include "JSCSSRule.h" > >+#include "CSSContainerRule.h" > #include "CSSCounterStyleRule.h" > #include "CSSFontFaceRule.h" > #include "CSSFontPaletteValuesRule.h" >@@ -39,6 +40,7 @@ > #include "CSSPageRule.h" > #include "CSSStyleRule.h" > #include "CSSSupportsRule.h" >+#include "JSCSSContainerRule.h" > #include "JSCSSCounterStyleRule.h" > #include "JSCSSFontFaceRule.h" > #include "JSCSSFontPaletteValuesRule.h" >@@ -97,6 +99,7 @@ JSValue toJSNewlyCreated(JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<C > case StyleRuleType::LayerStatement: > return createWrapper<CSSLayerStatementRule>(globalObject, WTFMove(rule)); > case StyleRuleType::Container: >+ return createWrapper<CSSContainerRule>(globalObject, WTFMove(rule)); > case StyleRuleType::Unknown: > case StyleRuleType::Charset: > case StyleRuleType::Margin: >diff --git a/Source/WebCore/css/CSSContainerRule.cpp b/Source/WebCore/css/CSSContainerRule.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..5dfd540760a2d1052efc81371c03b3d24fa3ff9a >--- /dev/null >+++ b/Source/WebCore/css/CSSContainerRule.cpp >@@ -0,0 +1,80 @@ >+/* >+ * Copyright (C) 2022 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "CSSContainerRule.h" >+ >+#include "CSSMarkup.h" >+#include "CSSStyleSheet.h" >+#include "StyleRule.h" >+#include <wtf/text/StringBuilder.h> >+ >+namespace WebCore { >+ >+CSSContainerRule::CSSContainerRule(StyleRuleContainer& rule, CSSStyleSheet* parent) >+ : CSSConditionRule(rule, parent) >+{ >+} >+ >+Ref<CSSContainerRule> CSSContainerRule::create(StyleRuleContainer& rule, CSSStyleSheet* parent) >+{ >+ return adoptRef(*new CSSContainerRule(rule, parent)); >+} >+ >+const StyleRuleContainer& CSSContainerRule::styleRuleContainer() const >+{ >+ return downcast<StyleRuleContainer>(groupRule()); >+} >+ >+String CSSContainerRule::cssText() const >+{ >+ StringBuilder builder; >+ >+ builder.append("@container "); >+ >+ auto name = styleRuleContainer().filteredQuery().nameFilter; >+ if (!name.isEmpty()) { >+ serializeIdentifier(name, builder); >+ builder.append(' '); >+ } >+ >+ serialize(builder, styleRuleContainer().filteredQuery().query); >+ >+ builder.append(" {\n"); >+ appendCSSTextForItems(builder); >+ builder.append('}'); >+ >+ return builder.toString(); >+} >+ >+String CSSContainerRule::conditionText() const >+{ >+ StringBuilder builder; >+ serialize(builder, styleRuleContainer().filteredQuery().query); >+ return builder.toString(); >+} >+ >+} // namespace WebCore >+ >diff --git a/Source/WebCore/css/CSSContainerRule.h b/Source/WebCore/css/CSSContainerRule.h >new file mode 100644 >index 0000000000000000000000000000000000000000..08a1c289f52734d4f86a08da50adc0470682c132 >--- /dev/null >+++ b/Source/WebCore/css/CSSContainerRule.h >@@ -0,0 +1,50 @@ >+/* >+ * Copyright (C) 2022 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "CSSConditionRule.h" >+ >+namespace WebCore { >+ >+class StyleRuleContainer; >+ >+class CSSContainerRule final : public CSSConditionRule { >+public: >+ static Ref<CSSContainerRule> create(StyleRuleContainer&, CSSStyleSheet* parent); >+ >+ String cssText() const final; >+ String conditionText() const final; >+ >+private: >+ const StyleRuleContainer& styleRuleContainer() const; >+ >+ CSSContainerRule(StyleRuleContainer&, CSSStyleSheet*); >+ StyleRuleType styleRuleType() const final { return StyleRuleType::Container; } >+}; >+ >+} // namespace WebCore >+ >+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSContainerRule, StyleRuleType::Container) >diff --git a/Source/WebCore/css/CSSContainerRule.idl b/Source/WebCore/css/CSSContainerRule.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..5ba43a21cccfd6b18dd27d5981d872fd67250b21 >--- /dev/null >+++ b/Source/WebCore/css/CSSContainerRule.idl >@@ -0,0 +1,30 @@ >+/* >+ * Copyright (C) 2022 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ Exposed=Window >+] interface CSSContainerRule : CSSConditionRule { >+}; >+ >diff --git a/Source/WebCore/css/ContainerQuery.cpp b/Source/WebCore/css/ContainerQuery.cpp >index df69fa3270a85dc2129ca7f041dd0db0fa002264..0d9075fa99b8d37769c64cec8e8e0f0557d3ee15 100644 >--- a/Source/WebCore/css/ContainerQuery.cpp >+++ b/Source/WebCore/css/ContainerQuery.cpp >@@ -25,10 +25,12 @@ > #include "config.h" > #include "ContainerQuery.h" > >+#include "CSSMarkup.h" > #include <wtf/NeverDestroyed.h> >+#include <wtf/text/StringBuilder.h> > >-namespace WebCore::CQ { >- >+namespace WebCore { >+namespace CQ { > namespace FeatureNames { > > const AtomString& width() >@@ -84,5 +86,90 @@ OptionSet<Axis> requiredAxesForFeature(const AtomString& featureName) > return { }; > } > >+void serialize(StringBuilder&, const SizeQuery&); >+void serialize(StringBuilder&, const SizeFeature&); >+template<typename ConditionType> void serialize(StringBuilder&, const ConditionType&); >+ >+static void serialize(StringBuilder& builder, const ContainerQuery& containerQuery) >+{ >+ WTF::switchOn(containerQuery, [&](auto& node) { >+ builder.append('('); >+ serialize(builder, node); >+ builder.append(')'); >+ }, [&](const CQ::UnknownQuery& unknownQuery) { >+ builder.append(unknownQuery.name); >+ builder.append('('); >+ builder.append(unknownQuery.text); >+ builder.append(')'); >+ }); >+} >+ >+void serialize(StringBuilder& builder, const SizeQuery& sizeQuery) >+{ >+ WTF::switchOn(sizeQuery, [&](auto& node) { >+ serialize(builder, node); >+ }); >+} >+ >+void serialize(StringBuilder& builder, const SizeFeature& sizeFeature) >+{ >+ auto serializeComparisonOperator = [&](ComparisonOperator op) { >+ builder.append(' '); >+ switch (op) { >+ case ComparisonOperator::LessThan: >+ builder.append('<'); >+ break; >+ case ComparisonOperator::LessThanOrEqual: >+ builder.append("<="); >+ break; >+ case ComparisonOperator::Equal: >+ builder.append('='); >+ break; >+ case ComparisonOperator::GreaterThan: >+ builder.append('>'); >+ break; >+ case ComparisonOperator::GreaterThanOrEqual: >+ builder.append(">="); >+ break; >+ } >+ builder.append(' '); >+ }; >+ >+ if (sizeFeature.leftComparison) { >+ builder.append(sizeFeature.leftComparison->value->cssText()); >+ serializeComparisonOperator(sizeFeature.leftComparison->op); >+ } >+ >+ serializeIdentifier(sizeFeature.name, builder); >+ >+ if (sizeFeature.rightComparison) { >+ serializeComparisonOperator(sizeFeature.rightComparison->op); >+ builder.append(sizeFeature.rightComparison->value->cssText()); >+ } >+} >+ >+template<typename ConditionType> >+void serialize(StringBuilder& builder, const ConditionType& condition) >+{ >+ if (condition.queries.size() == 1 && condition.logicalOperator == LogicalOperator::Not) { >+ builder.append("not "); >+ serialize(builder, condition.queries.first()); >+ return; >+ } >+ >+ for (auto& query : condition.queries) { >+ if (&query != &condition.queries.first()) >+ builder.append(condition.logicalOperator == LogicalOperator::And ? " and " : " or "); >+ serialize(builder, query); >+ } >+} >+ >+} >+ >+void serialize(StringBuilder& builder, const ContainerQuery& query) >+{ >+ CQ::serialize(builder, query); >+} >+ > } > >diff --git a/Source/WebCore/css/ContainerQuery.h b/Source/WebCore/css/ContainerQuery.h >index 32d47fa1d06365d3fa100f76905a59da59cf355f..1fb02a24b09283f3313a2705dae2dcd9fc219f90 100644 >--- a/Source/WebCore/css/ContainerQuery.h >+++ b/Source/WebCore/css/ContainerQuery.h >@@ -39,7 +39,10 @@ struct ContainerCondition; > struct SizeCondition; > struct SizeFeature; > >-struct UnknownQuery { }; >+struct UnknownQuery { >+ String name; >+ String text; >+}; > > using SizeQuery = std::variant<SizeCondition, SizeFeature>; > using ContainerQuery = std::variant<ContainerCondition, SizeQuery, UnknownQuery>; >@@ -97,4 +100,6 @@ struct FilteredContainerQuery { > > using CachedQueryContainers = Vector<Ref<const Element>>; > >+void serialize(StringBuilder&, const ContainerQuery&); >+ > } >diff --git a/Source/WebCore/css/ContainerQueryParser.cpp b/Source/WebCore/css/ContainerQueryParser.cpp >index 051b439f45a33592aee429d2fe25bf5d2f51e078..bbf68359a81158f76ebf6cf6d68d341869322bec 100644 >--- a/Source/WebCore/css/ContainerQueryParser.cpp >+++ b/Source/WebCore/css/ContainerQueryParser.cpp >@@ -61,9 +61,10 @@ std::optional<FilteredContainerQuery> ContainerQueryParser::consumeFilteredConta > std::optional<CQ::ContainerQuery> ContainerQueryParser::consumeContainerQuery(CSSParserTokenRange& range) > { > if (range.peek().type() == FunctionToken) { >- range.consumeBlock(); >+ auto name = range.peek().value(); >+ auto functionRange = range.consumeBlock(); > // This is where we would support style() queries. >- return CQ::UnknownQuery { }; >+ return CQ::UnknownQuery { name.toString(), functionRange.serialize() }; > } > > if (range.peek().type() == LeftParenthesisToken) { >diff --git a/Source/WebCore/css/StyleRule.cpp b/Source/WebCore/css/StyleRule.cpp >index ea3fa1f33b81525647c88ce2850284ea25a1666f..831ea30f0d6535da2963b8080fcce85f76043f12 100644 >--- a/Source/WebCore/css/StyleRule.cpp >+++ b/Source/WebCore/css/StyleRule.cpp >@@ -22,6 +22,7 @@ > #include "config.h" > #include "StyleRule.h" > >+#include "CSSContainerRule.h" > #include "CSSCounterStyleRule.h" > #include "CSSDeferredParser.h" > #include "CSSFontFaceRule.h" >@@ -194,7 +195,7 @@ Ref<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet, CSSRu > rule = CSSLayerStatementRule::create(downcast<StyleRuleLayer>(self), parentSheet); > break; > case StyleRuleType::Container: >- // FIXME: Implement CSSOM. >+ rule = CSSContainerRule::create(downcast<StyleRuleContainer>(self), parentSheet); > break; > case StyleRuleType::Unknown: > case StyleRuleType::Charset: >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 118dda7995caf4c6a95b6f27966b6f91df5ef450..9e9f9fd56d60ad2d4b8196dceb52a065108af800 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,12 @@ >+2022-03-29 Antti Koivisto <antti@apple.com> >+ >+ [CSS Container Queries] Support CSSOM >+ https://bugs.webkit.org/show_bug.cgi?id=238500 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestExpectations: >+ > 2022-03-28 Alan Bujtas <zalan@apple.com> > > [ macOS & Win ] fast/repaint/list-item-equal-style-change-no-repaint.html is a flaky failure >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 98e610d045cf82f8f433b7cc4222d5fb23612b02..42c2518e230d85cd8f12cb63c410797becf300c3 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,13 @@ >+2022-03-29 Antti Koivisto <antti@apple.com> >+ >+ [CSS Container Queries] Support CSSOM >+ https://bugs.webkit.org/show_bug.cgi?id=238500 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * web-platform-tests/css/css-contain/container-queries/at-container-serialization-expected.txt: >+ * web-platform-tests/css/css-contain/container-queries/idlharness-expected.txt: >+ > 2022-03-28 Nikolaos Mouchtaris <nmouchtaris@apple.com> > > Clamp degenerate calc() values for <angle> >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index 622bf15713a9e8901fd40f2de3faf4a99acdc241..fe3eb3a5063efdd9cde8d9bc5867d932cbc5af4a 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -4698,8 +4698,6 @@ imported/w3c/web-platform-tests/css/css-contain/contain-html-overflow-004.html [ > webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/custom-layout-container-001.https.html [ ImageOnlyFailure ] > webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/pseudo-elements-002.html [ ImageOnlyFailure ] > webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/svg-foreignobject-no-size-container.html [ Skip ] >-webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization.html [ Skip ] >-webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/idlharness.html [ Skip ] > > # Flaky css-contain test > imported/w3c/web-platform-tests/css/css-contain/content-visibility/animation-display-lock.html [ Failure Pass ] >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization-expected.txt >index aa657d4ece2f4b13ea9f2bb46f3daf355e2e9cbf..4d37fc9c0d91867c9ff31e101a3ab000e8e61be8 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization-expected.txt >@@ -1,5 +1,5 @@ > >-FAIL Serialization of conditionText null is not an object (evaluating 'rules[0].cssRules') >-FAIL Serialization of inner @container rule null is not an object (evaluating 'rules[0].cssRules') >-FAIL Serialization of nested @container rule null is not an object (evaluating 'rules[0].cssText') >+PASS Serialization of conditionText >+PASS Serialization of inner @container rule >+PASS Serialization of nested @container rule > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/idlharness-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/idlharness-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..62e543c13c8671bd0f3c88f51ba80ba4285f6b81 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/idlharness-expected.txt >@@ -0,0 +1,14 @@ >+ >+PASS idl_test setup >+PASS idl_test validation >+PASS CSSContainerRule interface: existence and properties of interface object >+PASS CSSContainerRule interface object length >+PASS CSSContainerRule interface object name >+PASS CSSContainerRule interface: existence and properties of interface prototype object >+PASS CSSContainerRule interface: existence and properties of interface prototype object's "constructor" property >+PASS CSSContainerRule interface: existence and properties of interface prototype object's @@unscopables property >+PASS CSSContainerRule must be primary interface of sheet.cssRules[0] >+PASS Stringification of sheet.cssRules[0] >+PASS CSSContainerRule must be primary interface of sheet.cssRules[0].cssRules[0] >+PASS Stringification of sheet.cssRules[0].cssRules[0] >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 238500
:
456012
|
456015
|
456016