[css-counter-styles] Parse and add feature flag for @counter-style
https://bugs.webkit.org/show_bug.cgi?id=223150
Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-16
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
@counter-style and its descriptors are now exposed behind a feature
flag, so pass some tests and fail others for a different reason
because this patch doesn't actually implement descriptor parsing and
setting yet.
* web-platform-tests/css/css-counter-styles/counter-style-additive-symbols-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-fallback-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-name-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-negative-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-pad-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-range-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-symbols-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-system-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/idlharness-expected.txt:
* web-platform-tests/css/cssom/CSSCounterStyleRule-expected.txt:
Source/WebCore:
Parse @counter-style (without implementing descriptor parsing) behind
a new feature flag, CSSCounterStyleAtRulesEnabled. A separate feature
flag for @counter-style <image> symbol values has also been added, as
image symbols have extra complexities that we won't want to hold the
entire feature back on.
https://www.w3.org/TR/css-counter-styles-3
The CSSCounterStyleRule IDL interface is also added and implemented,
and similarly feature flagged.
https://www.w3.org/TR/css-counter-styles-3/#apis
Test: webexposed/counter-style-is-not-exposed.html and existing WPTs.
* CMakeLists.txt:
Add CSSCounterStyleRule.idl.
* DerivedSources-input.xcfilelist:
Add CSSCounterStyleRule.idl.
* DerivedSources-output.xcfilelist:
Add JSCSSCounterStyleRule.h and JSCSSCounterStyleRule.cpp.
* DerivedSources.make:
Add CSSCounterStyleRule.idl.
* Sources.txt:
Add CSSCounterStyleRule.cpp and JSCSSCounterStyleRule.cpp.
* WebCore.xcodeproj/project.pbxproj:
Add CounterStyle.h, CounterStyle.cpp, and CounterStyle.idl.
* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJSNewlyCreated):
Support CSSCounterStyleRule.
* bindings/js/WebCoreBuiltinNames.h:
Add macro(CSSCounterStyleRule) to generate counter-style built-in
names.
* css/CSSCounterStyleRule.cpp: Added.
(WebCore::StyleRuleCounterStyle::StyleRuleCounterStyle):
(WebCore::StyleRuleCounterStyle::create):
(WebCore::StyleRuleCounterStyle::mutableProperties):
(WebCore::CSSCounterStyleRule::CSSCounterStyleRule):
(WebCore::CSSCounterStyleRule::reattach):
(WebCore::CSSCounterStyleRule::cssText const):
* css/CSSCounterStyleRule.h: Added.
(isType): Add specialized rule.isCounterStyleRule() implementation.
* css/CSSCounterStyleRule.idl: Added.
* css/CSSRule.cpp: Add new StyleRuleType::CounterStyle COMPILE_ASSERT.
* css/CSSRule.h:
Add COUNTER_STYLE_RULE constant. Also add comment `// WebIDL enum` to
disable enum_casing lint, since these values are named to match IDL
attributes.
* css/CSSRule.idl: Add COUNTER_STYLE_RULE constant behind flag.
* css/StyleRule.cpp:
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy const):
(WebCore::StyleRuleBase::createCSSOMWrapper const):
Handle newly added StyleRuleType::CounterStyle.
* css/StyleRule.h:
(WebCore::StyleRuleBase::isCounterStyleRule const): Added.
* css/StyleRuleType.h: Add StyleRuleType::CounterStyle
* css/StyleSheetContents.cpp:
(WebCore::traverseRulesInVector):
(WebCore::StyleSheetContents::traverseSubresources const):
If @counter-style image symbols flag is enabled, do traverse
subresources.
* css/parser/CSSAtRuleID.cpp:
If the @counter-style feature flag is enabled, return newly added
CSSAtRuleCounterStyle ID.
(WebCore::cssAtRuleID):
* css/parser/CSSAtRuleID.h:
Add CSSAtRuleCounterStyle ID.
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
* css/parser/CSSParserContext.h:
(WebCore::CSSParserContextHash::hash):
Add cssCounterStyleAtRulesEnabled and
cssCounterStyleAtRuleImageSymbolsEnabled flags.
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
* css/parser/CSSParserImpl.cpp:
(WebCore::computeNewAllowedRules):
(WebCore::CSSParserImpl::consumeAtRule):
(WebCore::CSSParserImpl::consumeCounterStyleRule): Added.
(WebCore::CSSParserImpl::consumeDeclarationList):
(WebCore::CSSParserImpl::consumeDeclaration):
* css/parser/CSSParserImpl.h:
Handle new @counter-style rule.
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseValue): Handle
StyleRuleType::CounterStyle.
(WebCore::consumeCounterContent):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Add placeholder for future @counter-style descriptor parsing work.
* css/parser/CSSPropertyParser.h:
Add parseCounterStyleDescriptor method
* css/parser/CSSPropertyParserHelpers.h:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
Add new flag that allows consumed custom ident values to be lowercased
on-parse. This is necessary for some <counter-style-name> values.
(WebCore::CSSPropertyParserHelpers::isPredefinedCounterStyle): Added.
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleName):
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleNameInPrelude):
Parse @counter-style names, both in-prelude names and non-prelude
names (e.g. as part of the `extends` descriptor).
Source/WTF:
* Scripts/Preferences/WebPreferencesExperimental.yaml:
Add CSSCounterStyleAtRulesEnabled and CSSCounterStyleAtRuleImageSymbolsEnabled flags.
Tools:
* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Add `false` defaults for CSSCounterStyleAtRulesEnabled and
CSSCounterStyleAtRuleImageSymbolsEnabled flags.
LayoutTests:
Add tests ensuring @counter-style is not exposed when feature flag is
disabled.
* webexposed/counter-style-is-not-exposed-expected.txt: Added.
* webexposed/counter-style-is-not-exposed.html: Added.
Canonical link: https://commits.webkit.org/236643@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276152 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-16 19:19:04 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2021 Tyler Wilcock <twilco.o@protonmail.com>.
|
|
|
|
*
|
|
|
|
* 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. ``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
|
|
|
|
* 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 "CSSRule.h"
|
|
|
|
#include "StyleProperties.h"
|
|
|
|
#include "StyleRule.h"
|
|
|
|
#include <wtf/text/AtomString.h>
|
|
|
|
|
|
|
|
namespace WebCore {
|
|
|
|
|
[css-counter-styles] Parse @counter-style descriptors
https://bugs.webkit.org/show_bug.cgi?id=224718
Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-22
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
Parsing for all @counter-style descriptors is implemented with this
patch, so mark more tests passing.
You'll notice that some @counter-style descriptors implemented in this
patch did not gain any passing tests (e.g. `pad`, `negative`). In all
of these cases, the expected results contain a <string> value, and we
fail only because we incorrectly don't serialize these <string> values
with quotes. I have manually confirmed in all cases that these values
are properly parsed, so it's just the serialization that's incorrect.
These <string> values serialize without quotes because WebKit's representation
of custom identifiers is not a separate type, but instead overloaded onto the
CSS_STRING type. This means that during serialization time, WebKit must guess
whether it is actually serializing a string (and include quotes if so), or if
it's serializing a custom ident (leaving off quotes if so).
Relevant code snippet:
https://github.com/WebKit/WebKit/blob/36caeec07975bd5f47db8ac6b749c2787230a461/Source/WebCore/css/CSSMarkup.cpp#L153#L161
Relevant changelog snippet from David Hyatt, 2016-12-07:
> We also overload CSS_STRING primitive value type and have it act as both a string
> and a custom identifier. This is lame, since the parser should have made two different
> types of objects instead, but since our parser doesn't do that yet, I added a serializeAsStringOrCustomIdent
> that preserves our old behavior of "quote the string only if needed." In this case what
> that really meant was "Try to guess that we were originally a custom ident and leave off
> quotes if so." This function will go away once we properly create CSSStringValues and
> CSSCustomIdentValues instead of turning the latter into strings.
* web-platform-tests/css/css-counter-styles/counter-style-fallback-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-range-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-system-syntax-expected.txt:
Source/WebCore:
Implement parsing and CSSCounterStyleRule IDL interface for @counter-style descriptors.
See spec for full details on all descriptors:
https://drafts.csswg.org/css-counter-styles-3/#the-counter-style-rule
Test: webexposed/counter-style-image-symbols-not-exposed.html and WPTs
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
Return `nullptr` for new @counter-style descriptor properties.
* css/CSSCounterStyleRule.cpp:
(WebCore::toCounterStyleSystemEnum):
(WebCore::symbolsValidForSystem):
(WebCore::StyleRuleCounterStyle::newValueInvalidOrEqual const):
(WebCore::CSSCounterStyleRule::cssText const):
(WebCore::CSSCounterStyleRule::setName):
(WebCore::CSSCounterStyleRule::setterInternal):
(WebCore::CSSCounterStyleRule::setSystem):
(WebCore::CSSCounterStyleRule::setNegative):
(WebCore::CSSCounterStyleRule::setPrefix):
(WebCore::CSSCounterStyleRule::setSuffix):
(WebCore::CSSCounterStyleRule::setRange):
(WebCore::CSSCounterStyleRule::setPad):
(WebCore::CSSCounterStyleRule::setFallback):
(WebCore::CSSCounterStyleRule::setSymbols):
(WebCore::CSSCounterStyleRule::setAdditiveSymbols):
(WebCore::CSSCounterStyleRule::setSpeakAs):
Implement setters and tangential functionality required by setters.
* css/CSSCounterStyleRule.h:
Replace FIXME with actual descriptor getter and setter
implementations.
* css/CSSProperties.json:
Add @counter-style descriptor properties.
* css/CSSValueKeywords.in:
Add new values required for `system` and `speak-as`
@counter-style descriptor properties.
* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):
Ensure new @counter-style descriptors are disabled at runtime based
on CSSParserContext state.
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeCounterStyleSystem):
(WebCore::consumeCounterStyleSymbol):
(WebCore::consumeCounterStyleNegative):
(WebCore::consumeCounterStyleRangeBound):
(WebCore::consumeCounterStyleRange):
(WebCore::consumeCounterStylePad):
(WebCore::consumeCounterStyleSymbols):
(WebCore::consumeCounterStyleAdditiveSymbols):
(WebCore::consumeCounterStyleSpeakAs):
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Parse @counter-style descriptors.
Tools:
* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Fix typo (missing 's'). CSSCounterStyleAtRulesEnabled, not
CSSCounterStyleAtRuleEnabled.
LayoutTests:
Add test ensuring <image> @counter-style symbol values cannot be
parsed when the `counterStyleAtRuleImageSymbolsEnabled` feature flag
is disabled.
---
This test is skipped on Windows because I haven't been able to get the
required feature flags (CSSCounterStyleAtRulesEnabled and
CSSCounterStyleAtRuleImageSymbolsEnabled) to work properly for that
port.
The code hidden behind these flags is all in the CSS parser, which is not
unique to Windows, so I think we can be confident that if the test passes
on all other platforms, that the behavior is correct on Windows too.
One attempt at implementing the necessary Windows-specific flag functionality is here:
https://bugs.webkit.org/attachment.cgi?id=426371&action=edit
Which failed to compile[1] with this error:
> C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp(834,51): error C2039: 'setCSSCounterStyleAtRulesEnabled': is not a member of 'IWebPreferencesPrivate7' [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Tools\DumpRenderTree\DumpRenderTreeLib.vcxproj]
> C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp(835,62): error C2039: 'setCSSCounterStyleAtRuleImageSymbolsEnabled': is not a member of 'IWebPreferencesPrivate7' [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Tools\DumpRenderTree\DumpRenderTreeLib.vcxproj]
Those methods are present in `IWebPreferencesPrivate7.idl`, and implemented similarly to other
flags in other places (e.g. win/WebPreferences.{h, cpp}, win/WebPreferenceKeysPrivate.h).
I can't reproduce this compilation error on my Windows machine.
I then tried removing the lines that caused the above compilation failure.
Those setters are called in DumpRenderTree::enableExperimentalFeatures, so in
lieu of enabling these flags there I could enable the flag I need via test header.
That patch is: https://bugs.webkit.org/attachment.cgi?id=426509&action=edit
This results in successful compilation, but causes lots (all?) of the
layout tests to fail[2] with a stacktrace that looks like:
Canonical link: https://commits.webkit.org/236947@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276488 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-23 05:25:40 +00:00
|
|
|
// The keywords that can be used as values for the counter-style `system` descriptor.
|
|
|
|
// https://www.w3.org/TR/css-counter-styles-3/#counter-style-system
|
|
|
|
enum class CounterStyleSystem : uint8_t {
|
|
|
|
Cyclic,
|
|
|
|
Numeric,
|
|
|
|
Alphabetic,
|
|
|
|
Symbolic,
|
|
|
|
Additive,
|
|
|
|
Fixed,
|
|
|
|
Extends
|
|
|
|
};
|
|
|
|
|
[css-counter-styles] Parse and add feature flag for @counter-style
https://bugs.webkit.org/show_bug.cgi?id=223150
Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-16
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
@counter-style and its descriptors are now exposed behind a feature
flag, so pass some tests and fail others for a different reason
because this patch doesn't actually implement descriptor parsing and
setting yet.
* web-platform-tests/css/css-counter-styles/counter-style-additive-symbols-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-fallback-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-name-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-negative-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-pad-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-range-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-symbols-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-system-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/idlharness-expected.txt:
* web-platform-tests/css/cssom/CSSCounterStyleRule-expected.txt:
Source/WebCore:
Parse @counter-style (without implementing descriptor parsing) behind
a new feature flag, CSSCounterStyleAtRulesEnabled. A separate feature
flag for @counter-style <image> symbol values has also been added, as
image symbols have extra complexities that we won't want to hold the
entire feature back on.
https://www.w3.org/TR/css-counter-styles-3
The CSSCounterStyleRule IDL interface is also added and implemented,
and similarly feature flagged.
https://www.w3.org/TR/css-counter-styles-3/#apis
Test: webexposed/counter-style-is-not-exposed.html and existing WPTs.
* CMakeLists.txt:
Add CSSCounterStyleRule.idl.
* DerivedSources-input.xcfilelist:
Add CSSCounterStyleRule.idl.
* DerivedSources-output.xcfilelist:
Add JSCSSCounterStyleRule.h and JSCSSCounterStyleRule.cpp.
* DerivedSources.make:
Add CSSCounterStyleRule.idl.
* Sources.txt:
Add CSSCounterStyleRule.cpp and JSCSSCounterStyleRule.cpp.
* WebCore.xcodeproj/project.pbxproj:
Add CounterStyle.h, CounterStyle.cpp, and CounterStyle.idl.
* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJSNewlyCreated):
Support CSSCounterStyleRule.
* bindings/js/WebCoreBuiltinNames.h:
Add macro(CSSCounterStyleRule) to generate counter-style built-in
names.
* css/CSSCounterStyleRule.cpp: Added.
(WebCore::StyleRuleCounterStyle::StyleRuleCounterStyle):
(WebCore::StyleRuleCounterStyle::create):
(WebCore::StyleRuleCounterStyle::mutableProperties):
(WebCore::CSSCounterStyleRule::CSSCounterStyleRule):
(WebCore::CSSCounterStyleRule::reattach):
(WebCore::CSSCounterStyleRule::cssText const):
* css/CSSCounterStyleRule.h: Added.
(isType): Add specialized rule.isCounterStyleRule() implementation.
* css/CSSCounterStyleRule.idl: Added.
* css/CSSRule.cpp: Add new StyleRuleType::CounterStyle COMPILE_ASSERT.
* css/CSSRule.h:
Add COUNTER_STYLE_RULE constant. Also add comment `// WebIDL enum` to
disable enum_casing lint, since these values are named to match IDL
attributes.
* css/CSSRule.idl: Add COUNTER_STYLE_RULE constant behind flag.
* css/StyleRule.cpp:
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy const):
(WebCore::StyleRuleBase::createCSSOMWrapper const):
Handle newly added StyleRuleType::CounterStyle.
* css/StyleRule.h:
(WebCore::StyleRuleBase::isCounterStyleRule const): Added.
* css/StyleRuleType.h: Add StyleRuleType::CounterStyle
* css/StyleSheetContents.cpp:
(WebCore::traverseRulesInVector):
(WebCore::StyleSheetContents::traverseSubresources const):
If @counter-style image symbols flag is enabled, do traverse
subresources.
* css/parser/CSSAtRuleID.cpp:
If the @counter-style feature flag is enabled, return newly added
CSSAtRuleCounterStyle ID.
(WebCore::cssAtRuleID):
* css/parser/CSSAtRuleID.h:
Add CSSAtRuleCounterStyle ID.
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
* css/parser/CSSParserContext.h:
(WebCore::CSSParserContextHash::hash):
Add cssCounterStyleAtRulesEnabled and
cssCounterStyleAtRuleImageSymbolsEnabled flags.
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
* css/parser/CSSParserImpl.cpp:
(WebCore::computeNewAllowedRules):
(WebCore::CSSParserImpl::consumeAtRule):
(WebCore::CSSParserImpl::consumeCounterStyleRule): Added.
(WebCore::CSSParserImpl::consumeDeclarationList):
(WebCore::CSSParserImpl::consumeDeclaration):
* css/parser/CSSParserImpl.h:
Handle new @counter-style rule.
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseValue): Handle
StyleRuleType::CounterStyle.
(WebCore::consumeCounterContent):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Add placeholder for future @counter-style descriptor parsing work.
* css/parser/CSSPropertyParser.h:
Add parseCounterStyleDescriptor method
* css/parser/CSSPropertyParserHelpers.h:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
Add new flag that allows consumed custom ident values to be lowercased
on-parse. This is necessary for some <counter-style-name> values.
(WebCore::CSSPropertyParserHelpers::isPredefinedCounterStyle): Added.
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleName):
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleNameInPrelude):
Parse @counter-style names, both in-prelude names and non-prelude
names (e.g. as part of the `extends` descriptor).
Source/WTF:
* Scripts/Preferences/WebPreferencesExperimental.yaml:
Add CSSCounterStyleAtRulesEnabled and CSSCounterStyleAtRuleImageSymbolsEnabled flags.
Tools:
* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Add `false` defaults for CSSCounterStyleAtRulesEnabled and
CSSCounterStyleAtRuleImageSymbolsEnabled flags.
LayoutTests:
Add tests ensuring @counter-style is not exposed when feature flag is
disabled.
* webexposed/counter-style-is-not-exposed-expected.txt: Added.
* webexposed/counter-style-is-not-exposed.html: Added.
Canonical link: https://commits.webkit.org/236643@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276152 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-16 19:19:04 +00:00
|
|
|
class StyleRuleCounterStyle final : public StyleRuleBase {
|
|
|
|
public:
|
|
|
|
static Ref<StyleRuleCounterStyle> create(const AtomString& name, Ref<StyleProperties>&&);
|
|
|
|
~StyleRuleCounterStyle();
|
|
|
|
|
|
|
|
const StyleProperties& properties() const { return m_properties; }
|
|
|
|
MutableStyleProperties& mutableProperties();
|
|
|
|
|
|
|
|
const AtomString& name() const { return m_name; }
|
[css-counter-styles] Parse @counter-style descriptors
https://bugs.webkit.org/show_bug.cgi?id=224718
Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-22
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
Parsing for all @counter-style descriptors is implemented with this
patch, so mark more tests passing.
You'll notice that some @counter-style descriptors implemented in this
patch did not gain any passing tests (e.g. `pad`, `negative`). In all
of these cases, the expected results contain a <string> value, and we
fail only because we incorrectly don't serialize these <string> values
with quotes. I have manually confirmed in all cases that these values
are properly parsed, so it's just the serialization that's incorrect.
These <string> values serialize without quotes because WebKit's representation
of custom identifiers is not a separate type, but instead overloaded onto the
CSS_STRING type. This means that during serialization time, WebKit must guess
whether it is actually serializing a string (and include quotes if so), or if
it's serializing a custom ident (leaving off quotes if so).
Relevant code snippet:
https://github.com/WebKit/WebKit/blob/36caeec07975bd5f47db8ac6b749c2787230a461/Source/WebCore/css/CSSMarkup.cpp#L153#L161
Relevant changelog snippet from David Hyatt, 2016-12-07:
> We also overload CSS_STRING primitive value type and have it act as both a string
> and a custom identifier. This is lame, since the parser should have made two different
> types of objects instead, but since our parser doesn't do that yet, I added a serializeAsStringOrCustomIdent
> that preserves our old behavior of "quote the string only if needed." In this case what
> that really meant was "Try to guess that we were originally a custom ident and leave off
> quotes if so." This function will go away once we properly create CSSStringValues and
> CSSCustomIdentValues instead of turning the latter into strings.
* web-platform-tests/css/css-counter-styles/counter-style-fallback-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-range-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-system-syntax-expected.txt:
Source/WebCore:
Implement parsing and CSSCounterStyleRule IDL interface for @counter-style descriptors.
See spec for full details on all descriptors:
https://drafts.csswg.org/css-counter-styles-3/#the-counter-style-rule
Test: webexposed/counter-style-image-symbols-not-exposed.html and WPTs
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
Return `nullptr` for new @counter-style descriptor properties.
* css/CSSCounterStyleRule.cpp:
(WebCore::toCounterStyleSystemEnum):
(WebCore::symbolsValidForSystem):
(WebCore::StyleRuleCounterStyle::newValueInvalidOrEqual const):
(WebCore::CSSCounterStyleRule::cssText const):
(WebCore::CSSCounterStyleRule::setName):
(WebCore::CSSCounterStyleRule::setterInternal):
(WebCore::CSSCounterStyleRule::setSystem):
(WebCore::CSSCounterStyleRule::setNegative):
(WebCore::CSSCounterStyleRule::setPrefix):
(WebCore::CSSCounterStyleRule::setSuffix):
(WebCore::CSSCounterStyleRule::setRange):
(WebCore::CSSCounterStyleRule::setPad):
(WebCore::CSSCounterStyleRule::setFallback):
(WebCore::CSSCounterStyleRule::setSymbols):
(WebCore::CSSCounterStyleRule::setAdditiveSymbols):
(WebCore::CSSCounterStyleRule::setSpeakAs):
Implement setters and tangential functionality required by setters.
* css/CSSCounterStyleRule.h:
Replace FIXME with actual descriptor getter and setter
implementations.
* css/CSSProperties.json:
Add @counter-style descriptor properties.
* css/CSSValueKeywords.in:
Add new values required for `system` and `speak-as`
@counter-style descriptor properties.
* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):
Ensure new @counter-style descriptors are disabled at runtime based
on CSSParserContext state.
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeCounterStyleSystem):
(WebCore::consumeCounterStyleSymbol):
(WebCore::consumeCounterStyleNegative):
(WebCore::consumeCounterStyleRangeBound):
(WebCore::consumeCounterStyleRange):
(WebCore::consumeCounterStylePad):
(WebCore::consumeCounterStyleSymbols):
(WebCore::consumeCounterStyleAdditiveSymbols):
(WebCore::consumeCounterStyleSpeakAs):
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Parse @counter-style descriptors.
Tools:
* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Fix typo (missing 's'). CSSCounterStyleAtRulesEnabled, not
CSSCounterStyleAtRuleEnabled.
LayoutTests:
Add test ensuring <image> @counter-style symbol values cannot be
parsed when the `counterStyleAtRuleImageSymbolsEnabled` feature flag
is disabled.
---
This test is skipped on Windows because I haven't been able to get the
required feature flags (CSSCounterStyleAtRulesEnabled and
CSSCounterStyleAtRuleImageSymbolsEnabled) to work properly for that
port.
The code hidden behind these flags is all in the CSS parser, which is not
unique to Windows, so I think we can be confident that if the test passes
on all other platforms, that the behavior is correct on Windows too.
One attempt at implementing the necessary Windows-specific flag functionality is here:
https://bugs.webkit.org/attachment.cgi?id=426371&action=edit
Which failed to compile[1] with this error:
> C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp(834,51): error C2039: 'setCSSCounterStyleAtRulesEnabled': is not a member of 'IWebPreferencesPrivate7' [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Tools\DumpRenderTree\DumpRenderTreeLib.vcxproj]
> C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp(835,62): error C2039: 'setCSSCounterStyleAtRuleImageSymbolsEnabled': is not a member of 'IWebPreferencesPrivate7' [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Tools\DumpRenderTree\DumpRenderTreeLib.vcxproj]
Those methods are present in `IWebPreferencesPrivate7.idl`, and implemented similarly to other
flags in other places (e.g. win/WebPreferences.{h, cpp}, win/WebPreferenceKeysPrivate.h).
I can't reproduce this compilation error on my Windows machine.
I then tried removing the lines that caused the above compilation failure.
Those setters are called in DumpRenderTree::enableExperimentalFeatures, so in
lieu of enabling these flags there I could enable the flag I need via test header.
That patch is: https://bugs.webkit.org/attachment.cgi?id=426509&action=edit
This results in successful compilation, but causes lots (all?) of the
layout tests to fail[2] with a stacktrace that looks like:
Canonical link: https://commits.webkit.org/236947@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276488 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-23 05:25:40 +00:00
|
|
|
String system() const { return m_properties->getPropertyValue(CSSPropertySystem); }
|
|
|
|
String negative() const { return m_properties->getPropertyValue(CSSPropertyNegative); }
|
|
|
|
String prefix() const { return m_properties->getPropertyValue(CSSPropertyPrefix); }
|
|
|
|
String suffix() const { return m_properties->getPropertyValue(CSSPropertySuffix); }
|
|
|
|
String range() const { return m_properties->getPropertyValue(CSSPropertyRange); }
|
|
|
|
String pad() const { return m_properties->getPropertyValue(CSSPropertyPad); }
|
|
|
|
String fallback() const { return m_properties->getPropertyValue(CSSPropertyFallback); }
|
|
|
|
String symbols() const { return m_properties->getPropertyValue(CSSPropertySymbols); }
|
|
|
|
String additiveSymbols() const { return m_properties->getPropertyValue(CSSPropertyAdditiveSymbols); }
|
|
|
|
String speakAs() const { return m_properties->getPropertyValue(CSSPropertySpeakAs); }
|
|
|
|
|
|
|
|
bool newValueInvalidOrEqual(CSSPropertyID, const RefPtr<CSSValue> newValue) const;
|
|
|
|
|
|
|
|
void setName(const AtomString& name) { m_name = name; }
|
[css-counter-styles] Parse and add feature flag for @counter-style
https://bugs.webkit.org/show_bug.cgi?id=223150
Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-16
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
@counter-style and its descriptors are now exposed behind a feature
flag, so pass some tests and fail others for a different reason
because this patch doesn't actually implement descriptor parsing and
setting yet.
* web-platform-tests/css/css-counter-styles/counter-style-additive-symbols-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-fallback-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-name-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-negative-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-pad-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-range-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-symbols-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-system-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/idlharness-expected.txt:
* web-platform-tests/css/cssom/CSSCounterStyleRule-expected.txt:
Source/WebCore:
Parse @counter-style (without implementing descriptor parsing) behind
a new feature flag, CSSCounterStyleAtRulesEnabled. A separate feature
flag for @counter-style <image> symbol values has also been added, as
image symbols have extra complexities that we won't want to hold the
entire feature back on.
https://www.w3.org/TR/css-counter-styles-3
The CSSCounterStyleRule IDL interface is also added and implemented,
and similarly feature flagged.
https://www.w3.org/TR/css-counter-styles-3/#apis
Test: webexposed/counter-style-is-not-exposed.html and existing WPTs.
* CMakeLists.txt:
Add CSSCounterStyleRule.idl.
* DerivedSources-input.xcfilelist:
Add CSSCounterStyleRule.idl.
* DerivedSources-output.xcfilelist:
Add JSCSSCounterStyleRule.h and JSCSSCounterStyleRule.cpp.
* DerivedSources.make:
Add CSSCounterStyleRule.idl.
* Sources.txt:
Add CSSCounterStyleRule.cpp and JSCSSCounterStyleRule.cpp.
* WebCore.xcodeproj/project.pbxproj:
Add CounterStyle.h, CounterStyle.cpp, and CounterStyle.idl.
* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJSNewlyCreated):
Support CSSCounterStyleRule.
* bindings/js/WebCoreBuiltinNames.h:
Add macro(CSSCounterStyleRule) to generate counter-style built-in
names.
* css/CSSCounterStyleRule.cpp: Added.
(WebCore::StyleRuleCounterStyle::StyleRuleCounterStyle):
(WebCore::StyleRuleCounterStyle::create):
(WebCore::StyleRuleCounterStyle::mutableProperties):
(WebCore::CSSCounterStyleRule::CSSCounterStyleRule):
(WebCore::CSSCounterStyleRule::reattach):
(WebCore::CSSCounterStyleRule::cssText const):
* css/CSSCounterStyleRule.h: Added.
(isType): Add specialized rule.isCounterStyleRule() implementation.
* css/CSSCounterStyleRule.idl: Added.
* css/CSSRule.cpp: Add new StyleRuleType::CounterStyle COMPILE_ASSERT.
* css/CSSRule.h:
Add COUNTER_STYLE_RULE constant. Also add comment `// WebIDL enum` to
disable enum_casing lint, since these values are named to match IDL
attributes.
* css/CSSRule.idl: Add COUNTER_STYLE_RULE constant behind flag.
* css/StyleRule.cpp:
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy const):
(WebCore::StyleRuleBase::createCSSOMWrapper const):
Handle newly added StyleRuleType::CounterStyle.
* css/StyleRule.h:
(WebCore::StyleRuleBase::isCounterStyleRule const): Added.
* css/StyleRuleType.h: Add StyleRuleType::CounterStyle
* css/StyleSheetContents.cpp:
(WebCore::traverseRulesInVector):
(WebCore::StyleSheetContents::traverseSubresources const):
If @counter-style image symbols flag is enabled, do traverse
subresources.
* css/parser/CSSAtRuleID.cpp:
If the @counter-style feature flag is enabled, return newly added
CSSAtRuleCounterStyle ID.
(WebCore::cssAtRuleID):
* css/parser/CSSAtRuleID.h:
Add CSSAtRuleCounterStyle ID.
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
* css/parser/CSSParserContext.h:
(WebCore::CSSParserContextHash::hash):
Add cssCounterStyleAtRulesEnabled and
cssCounterStyleAtRuleImageSymbolsEnabled flags.
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
* css/parser/CSSParserImpl.cpp:
(WebCore::computeNewAllowedRules):
(WebCore::CSSParserImpl::consumeAtRule):
(WebCore::CSSParserImpl::consumeCounterStyleRule): Added.
(WebCore::CSSParserImpl::consumeDeclarationList):
(WebCore::CSSParserImpl::consumeDeclaration):
* css/parser/CSSParserImpl.h:
Handle new @counter-style rule.
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseValue): Handle
StyleRuleType::CounterStyle.
(WebCore::consumeCounterContent):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Add placeholder for future @counter-style descriptor parsing work.
* css/parser/CSSPropertyParser.h:
Add parseCounterStyleDescriptor method
* css/parser/CSSPropertyParserHelpers.h:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
Add new flag that allows consumed custom ident values to be lowercased
on-parse. This is necessary for some <counter-style-name> values.
(WebCore::CSSPropertyParserHelpers::isPredefinedCounterStyle): Added.
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleName):
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleNameInPrelude):
Parse @counter-style names, both in-prelude names and non-prelude
names (e.g. as part of the `extends` descriptor).
Source/WTF:
* Scripts/Preferences/WebPreferencesExperimental.yaml:
Add CSSCounterStyleAtRulesEnabled and CSSCounterStyleAtRuleImageSymbolsEnabled flags.
Tools:
* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Add `false` defaults for CSSCounterStyleAtRulesEnabled and
CSSCounterStyleAtRuleImageSymbolsEnabled flags.
LayoutTests:
Add tests ensuring @counter-style is not exposed when feature flag is
disabled.
* webexposed/counter-style-is-not-exposed-expected.txt: Added.
* webexposed/counter-style-is-not-exposed.html: Added.
Canonical link: https://commits.webkit.org/236643@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276152 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-16 19:19:04 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
explicit StyleRuleCounterStyle(const AtomString&, Ref<StyleProperties>&&);
|
|
|
|
|
|
|
|
AtomString m_name;
|
|
|
|
Ref<StyleProperties> m_properties;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CSSCounterStyleRule final : public CSSRule {
|
|
|
|
public:
|
|
|
|
static Ref<CSSCounterStyleRule> create(StyleRuleCounterStyle&, CSSStyleSheet*);
|
|
|
|
virtual ~CSSCounterStyleRule();
|
|
|
|
|
|
|
|
String cssText() const final;
|
|
|
|
void reattach(StyleRuleBase&) final;
|
|
|
|
CSSRule::Type type() const final { return COUNTER_STYLE_RULE; }
|
|
|
|
|
|
|
|
String name() const { return m_counterStyleRule->name(); }
|
[css-counter-styles] Parse @counter-style descriptors
https://bugs.webkit.org/show_bug.cgi?id=224718
Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-22
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
Parsing for all @counter-style descriptors is implemented with this
patch, so mark more tests passing.
You'll notice that some @counter-style descriptors implemented in this
patch did not gain any passing tests (e.g. `pad`, `negative`). In all
of these cases, the expected results contain a <string> value, and we
fail only because we incorrectly don't serialize these <string> values
with quotes. I have manually confirmed in all cases that these values
are properly parsed, so it's just the serialization that's incorrect.
These <string> values serialize without quotes because WebKit's representation
of custom identifiers is not a separate type, but instead overloaded onto the
CSS_STRING type. This means that during serialization time, WebKit must guess
whether it is actually serializing a string (and include quotes if so), or if
it's serializing a custom ident (leaving off quotes if so).
Relevant code snippet:
https://github.com/WebKit/WebKit/blob/36caeec07975bd5f47db8ac6b749c2787230a461/Source/WebCore/css/CSSMarkup.cpp#L153#L161
Relevant changelog snippet from David Hyatt, 2016-12-07:
> We also overload CSS_STRING primitive value type and have it act as both a string
> and a custom identifier. This is lame, since the parser should have made two different
> types of objects instead, but since our parser doesn't do that yet, I added a serializeAsStringOrCustomIdent
> that preserves our old behavior of "quote the string only if needed." In this case what
> that really meant was "Try to guess that we were originally a custom ident and leave off
> quotes if so." This function will go away once we properly create CSSStringValues and
> CSSCustomIdentValues instead of turning the latter into strings.
* web-platform-tests/css/css-counter-styles/counter-style-fallback-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-range-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-system-syntax-expected.txt:
Source/WebCore:
Implement parsing and CSSCounterStyleRule IDL interface for @counter-style descriptors.
See spec for full details on all descriptors:
https://drafts.csswg.org/css-counter-styles-3/#the-counter-style-rule
Test: webexposed/counter-style-image-symbols-not-exposed.html and WPTs
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
Return `nullptr` for new @counter-style descriptor properties.
* css/CSSCounterStyleRule.cpp:
(WebCore::toCounterStyleSystemEnum):
(WebCore::symbolsValidForSystem):
(WebCore::StyleRuleCounterStyle::newValueInvalidOrEqual const):
(WebCore::CSSCounterStyleRule::cssText const):
(WebCore::CSSCounterStyleRule::setName):
(WebCore::CSSCounterStyleRule::setterInternal):
(WebCore::CSSCounterStyleRule::setSystem):
(WebCore::CSSCounterStyleRule::setNegative):
(WebCore::CSSCounterStyleRule::setPrefix):
(WebCore::CSSCounterStyleRule::setSuffix):
(WebCore::CSSCounterStyleRule::setRange):
(WebCore::CSSCounterStyleRule::setPad):
(WebCore::CSSCounterStyleRule::setFallback):
(WebCore::CSSCounterStyleRule::setSymbols):
(WebCore::CSSCounterStyleRule::setAdditiveSymbols):
(WebCore::CSSCounterStyleRule::setSpeakAs):
Implement setters and tangential functionality required by setters.
* css/CSSCounterStyleRule.h:
Replace FIXME with actual descriptor getter and setter
implementations.
* css/CSSProperties.json:
Add @counter-style descriptor properties.
* css/CSSValueKeywords.in:
Add new values required for `system` and `speak-as`
@counter-style descriptor properties.
* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):
Ensure new @counter-style descriptors are disabled at runtime based
on CSSParserContext state.
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeCounterStyleSystem):
(WebCore::consumeCounterStyleSymbol):
(WebCore::consumeCounterStyleNegative):
(WebCore::consumeCounterStyleRangeBound):
(WebCore::consumeCounterStyleRange):
(WebCore::consumeCounterStylePad):
(WebCore::consumeCounterStyleSymbols):
(WebCore::consumeCounterStyleAdditiveSymbols):
(WebCore::consumeCounterStyleSpeakAs):
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Parse @counter-style descriptors.
Tools:
* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Fix typo (missing 's'). CSSCounterStyleAtRulesEnabled, not
CSSCounterStyleAtRuleEnabled.
LayoutTests:
Add test ensuring <image> @counter-style symbol values cannot be
parsed when the `counterStyleAtRuleImageSymbolsEnabled` feature flag
is disabled.
---
This test is skipped on Windows because I haven't been able to get the
required feature flags (CSSCounterStyleAtRulesEnabled and
CSSCounterStyleAtRuleImageSymbolsEnabled) to work properly for that
port.
The code hidden behind these flags is all in the CSS parser, which is not
unique to Windows, so I think we can be confident that if the test passes
on all other platforms, that the behavior is correct on Windows too.
One attempt at implementing the necessary Windows-specific flag functionality is here:
https://bugs.webkit.org/attachment.cgi?id=426371&action=edit
Which failed to compile[1] with this error:
> C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp(834,51): error C2039: 'setCSSCounterStyleAtRulesEnabled': is not a member of 'IWebPreferencesPrivate7' [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Tools\DumpRenderTree\DumpRenderTreeLib.vcxproj]
> C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp(835,62): error C2039: 'setCSSCounterStyleAtRuleImageSymbolsEnabled': is not a member of 'IWebPreferencesPrivate7' [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Tools\DumpRenderTree\DumpRenderTreeLib.vcxproj]
Those methods are present in `IWebPreferencesPrivate7.idl`, and implemented similarly to other
flags in other places (e.g. win/WebPreferences.{h, cpp}, win/WebPreferenceKeysPrivate.h).
I can't reproduce this compilation error on my Windows machine.
I then tried removing the lines that caused the above compilation failure.
Those setters are called in DumpRenderTree::enableExperimentalFeatures, so in
lieu of enabling these flags there I could enable the flag I need via test header.
That patch is: https://bugs.webkit.org/attachment.cgi?id=426509&action=edit
This results in successful compilation, but causes lots (all?) of the
layout tests to fail[2] with a stacktrace that looks like:
Canonical link: https://commits.webkit.org/236947@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276488 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-23 05:25:40 +00:00
|
|
|
String system() const { return m_counterStyleRule->system(); }
|
|
|
|
String negative() const { return m_counterStyleRule->negative(); }
|
|
|
|
String prefix() const { return m_counterStyleRule->prefix(); }
|
|
|
|
String suffix() const { return m_counterStyleRule->suffix(); }
|
|
|
|
String range() const { return m_counterStyleRule->range(); }
|
|
|
|
String pad() const { return m_counterStyleRule->pad(); }
|
|
|
|
String fallback() const { return m_counterStyleRule->fallback(); }
|
|
|
|
String symbols() const { return m_counterStyleRule->symbols(); }
|
|
|
|
String additiveSymbols() const { return m_counterStyleRule->additiveSymbols(); }
|
|
|
|
String speakAs() const { return m_counterStyleRule->speakAs(); }
|
|
|
|
|
|
|
|
void setName(const String&);
|
|
|
|
void setSystem(const String&);
|
|
|
|
void setNegative(const String&);
|
|
|
|
void setPrefix(const String&);
|
|
|
|
void setSuffix(const String&);
|
|
|
|
void setRange(const String&);
|
|
|
|
void setPad(const String&);
|
|
|
|
void setFallback(const String&);
|
|
|
|
void setSymbols(const String&);
|
|
|
|
void setAdditiveSymbols(const String&);
|
|
|
|
void setSpeakAs(const String&);
|
[css-counter-styles] Parse and add feature flag for @counter-style
https://bugs.webkit.org/show_bug.cgi?id=223150
Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-16
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
@counter-style and its descriptors are now exposed behind a feature
flag, so pass some tests and fail others for a different reason
because this patch doesn't actually implement descriptor parsing and
setting yet.
* web-platform-tests/css/css-counter-styles/counter-style-additive-symbols-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-fallback-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-name-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-negative-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-pad-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-range-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-symbols-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-system-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/idlharness-expected.txt:
* web-platform-tests/css/cssom/CSSCounterStyleRule-expected.txt:
Source/WebCore:
Parse @counter-style (without implementing descriptor parsing) behind
a new feature flag, CSSCounterStyleAtRulesEnabled. A separate feature
flag for @counter-style <image> symbol values has also been added, as
image symbols have extra complexities that we won't want to hold the
entire feature back on.
https://www.w3.org/TR/css-counter-styles-3
The CSSCounterStyleRule IDL interface is also added and implemented,
and similarly feature flagged.
https://www.w3.org/TR/css-counter-styles-3/#apis
Test: webexposed/counter-style-is-not-exposed.html and existing WPTs.
* CMakeLists.txt:
Add CSSCounterStyleRule.idl.
* DerivedSources-input.xcfilelist:
Add CSSCounterStyleRule.idl.
* DerivedSources-output.xcfilelist:
Add JSCSSCounterStyleRule.h and JSCSSCounterStyleRule.cpp.
* DerivedSources.make:
Add CSSCounterStyleRule.idl.
* Sources.txt:
Add CSSCounterStyleRule.cpp and JSCSSCounterStyleRule.cpp.
* WebCore.xcodeproj/project.pbxproj:
Add CounterStyle.h, CounterStyle.cpp, and CounterStyle.idl.
* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJSNewlyCreated):
Support CSSCounterStyleRule.
* bindings/js/WebCoreBuiltinNames.h:
Add macro(CSSCounterStyleRule) to generate counter-style built-in
names.
* css/CSSCounterStyleRule.cpp: Added.
(WebCore::StyleRuleCounterStyle::StyleRuleCounterStyle):
(WebCore::StyleRuleCounterStyle::create):
(WebCore::StyleRuleCounterStyle::mutableProperties):
(WebCore::CSSCounterStyleRule::CSSCounterStyleRule):
(WebCore::CSSCounterStyleRule::reattach):
(WebCore::CSSCounterStyleRule::cssText const):
* css/CSSCounterStyleRule.h: Added.
(isType): Add specialized rule.isCounterStyleRule() implementation.
* css/CSSCounterStyleRule.idl: Added.
* css/CSSRule.cpp: Add new StyleRuleType::CounterStyle COMPILE_ASSERT.
* css/CSSRule.h:
Add COUNTER_STYLE_RULE constant. Also add comment `// WebIDL enum` to
disable enum_casing lint, since these values are named to match IDL
attributes.
* css/CSSRule.idl: Add COUNTER_STYLE_RULE constant behind flag.
* css/StyleRule.cpp:
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy const):
(WebCore::StyleRuleBase::createCSSOMWrapper const):
Handle newly added StyleRuleType::CounterStyle.
* css/StyleRule.h:
(WebCore::StyleRuleBase::isCounterStyleRule const): Added.
* css/StyleRuleType.h: Add StyleRuleType::CounterStyle
* css/StyleSheetContents.cpp:
(WebCore::traverseRulesInVector):
(WebCore::StyleSheetContents::traverseSubresources const):
If @counter-style image symbols flag is enabled, do traverse
subresources.
* css/parser/CSSAtRuleID.cpp:
If the @counter-style feature flag is enabled, return newly added
CSSAtRuleCounterStyle ID.
(WebCore::cssAtRuleID):
* css/parser/CSSAtRuleID.h:
Add CSSAtRuleCounterStyle ID.
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
* css/parser/CSSParserContext.h:
(WebCore::CSSParserContextHash::hash):
Add cssCounterStyleAtRulesEnabled and
cssCounterStyleAtRuleImageSymbolsEnabled flags.
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
* css/parser/CSSParserImpl.cpp:
(WebCore::computeNewAllowedRules):
(WebCore::CSSParserImpl::consumeAtRule):
(WebCore::CSSParserImpl::consumeCounterStyleRule): Added.
(WebCore::CSSParserImpl::consumeDeclarationList):
(WebCore::CSSParserImpl::consumeDeclaration):
* css/parser/CSSParserImpl.h:
Handle new @counter-style rule.
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseValue): Handle
StyleRuleType::CounterStyle.
(WebCore::consumeCounterContent):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Add placeholder for future @counter-style descriptor parsing work.
* css/parser/CSSPropertyParser.h:
Add parseCounterStyleDescriptor method
* css/parser/CSSPropertyParserHelpers.h:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
Add new flag that allows consumed custom ident values to be lowercased
on-parse. This is necessary for some <counter-style-name> values.
(WebCore::CSSPropertyParserHelpers::isPredefinedCounterStyle): Added.
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleName):
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleNameInPrelude):
Parse @counter-style names, both in-prelude names and non-prelude
names (e.g. as part of the `extends` descriptor).
Source/WTF:
* Scripts/Preferences/WebPreferencesExperimental.yaml:
Add CSSCounterStyleAtRulesEnabled and CSSCounterStyleAtRuleImageSymbolsEnabled flags.
Tools:
* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Add `false` defaults for CSSCounterStyleAtRulesEnabled and
CSSCounterStyleAtRuleImageSymbolsEnabled flags.
LayoutTests:
Add tests ensuring @counter-style is not exposed when feature flag is
disabled.
* webexposed/counter-style-is-not-exposed-expected.txt: Added.
* webexposed/counter-style-is-not-exposed.html: Added.
Canonical link: https://commits.webkit.org/236643@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276152 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-16 19:19:04 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
CSSCounterStyleRule(StyleRuleCounterStyle&, CSSStyleSheet* parent);
|
|
|
|
|
[css-counter-styles] Parse @counter-style descriptors
https://bugs.webkit.org/show_bug.cgi?id=224718
Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-22
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
Parsing for all @counter-style descriptors is implemented with this
patch, so mark more tests passing.
You'll notice that some @counter-style descriptors implemented in this
patch did not gain any passing tests (e.g. `pad`, `negative`). In all
of these cases, the expected results contain a <string> value, and we
fail only because we incorrectly don't serialize these <string> values
with quotes. I have manually confirmed in all cases that these values
are properly parsed, so it's just the serialization that's incorrect.
These <string> values serialize without quotes because WebKit's representation
of custom identifiers is not a separate type, but instead overloaded onto the
CSS_STRING type. This means that during serialization time, WebKit must guess
whether it is actually serializing a string (and include quotes if so), or if
it's serializing a custom ident (leaving off quotes if so).
Relevant code snippet:
https://github.com/WebKit/WebKit/blob/36caeec07975bd5f47db8ac6b749c2787230a461/Source/WebCore/css/CSSMarkup.cpp#L153#L161
Relevant changelog snippet from David Hyatt, 2016-12-07:
> We also overload CSS_STRING primitive value type and have it act as both a string
> and a custom identifier. This is lame, since the parser should have made two different
> types of objects instead, but since our parser doesn't do that yet, I added a serializeAsStringOrCustomIdent
> that preserves our old behavior of "quote the string only if needed." In this case what
> that really meant was "Try to guess that we were originally a custom ident and leave off
> quotes if so." This function will go away once we properly create CSSStringValues and
> CSSCustomIdentValues instead of turning the latter into strings.
* web-platform-tests/css/css-counter-styles/counter-style-fallback-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-range-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-system-syntax-expected.txt:
Source/WebCore:
Implement parsing and CSSCounterStyleRule IDL interface for @counter-style descriptors.
See spec for full details on all descriptors:
https://drafts.csswg.org/css-counter-styles-3/#the-counter-style-rule
Test: webexposed/counter-style-image-symbols-not-exposed.html and WPTs
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
Return `nullptr` for new @counter-style descriptor properties.
* css/CSSCounterStyleRule.cpp:
(WebCore::toCounterStyleSystemEnum):
(WebCore::symbolsValidForSystem):
(WebCore::StyleRuleCounterStyle::newValueInvalidOrEqual const):
(WebCore::CSSCounterStyleRule::cssText const):
(WebCore::CSSCounterStyleRule::setName):
(WebCore::CSSCounterStyleRule::setterInternal):
(WebCore::CSSCounterStyleRule::setSystem):
(WebCore::CSSCounterStyleRule::setNegative):
(WebCore::CSSCounterStyleRule::setPrefix):
(WebCore::CSSCounterStyleRule::setSuffix):
(WebCore::CSSCounterStyleRule::setRange):
(WebCore::CSSCounterStyleRule::setPad):
(WebCore::CSSCounterStyleRule::setFallback):
(WebCore::CSSCounterStyleRule::setSymbols):
(WebCore::CSSCounterStyleRule::setAdditiveSymbols):
(WebCore::CSSCounterStyleRule::setSpeakAs):
Implement setters and tangential functionality required by setters.
* css/CSSCounterStyleRule.h:
Replace FIXME with actual descriptor getter and setter
implementations.
* css/CSSProperties.json:
Add @counter-style descriptor properties.
* css/CSSValueKeywords.in:
Add new values required for `system` and `speak-as`
@counter-style descriptor properties.
* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):
Ensure new @counter-style descriptors are disabled at runtime based
on CSSParserContext state.
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeCounterStyleSystem):
(WebCore::consumeCounterStyleSymbol):
(WebCore::consumeCounterStyleNegative):
(WebCore::consumeCounterStyleRangeBound):
(WebCore::consumeCounterStyleRange):
(WebCore::consumeCounterStylePad):
(WebCore::consumeCounterStyleSymbols):
(WebCore::consumeCounterStyleAdditiveSymbols):
(WebCore::consumeCounterStyleSpeakAs):
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Parse @counter-style descriptors.
Tools:
* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Fix typo (missing 's'). CSSCounterStyleAtRulesEnabled, not
CSSCounterStyleAtRuleEnabled.
LayoutTests:
Add test ensuring <image> @counter-style symbol values cannot be
parsed when the `counterStyleAtRuleImageSymbolsEnabled` feature flag
is disabled.
---
This test is skipped on Windows because I haven't been able to get the
required feature flags (CSSCounterStyleAtRulesEnabled and
CSSCounterStyleAtRuleImageSymbolsEnabled) to work properly for that
port.
The code hidden behind these flags is all in the CSS parser, which is not
unique to Windows, so I think we can be confident that if the test passes
on all other platforms, that the behavior is correct on Windows too.
One attempt at implementing the necessary Windows-specific flag functionality is here:
https://bugs.webkit.org/attachment.cgi?id=426371&action=edit
Which failed to compile[1] with this error:
> C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp(834,51): error C2039: 'setCSSCounterStyleAtRulesEnabled': is not a member of 'IWebPreferencesPrivate7' [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Tools\DumpRenderTree\DumpRenderTreeLib.vcxproj]
> C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp(835,62): error C2039: 'setCSSCounterStyleAtRuleImageSymbolsEnabled': is not a member of 'IWebPreferencesPrivate7' [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Tools\DumpRenderTree\DumpRenderTreeLib.vcxproj]
Those methods are present in `IWebPreferencesPrivate7.idl`, and implemented similarly to other
flags in other places (e.g. win/WebPreferences.{h, cpp}, win/WebPreferenceKeysPrivate.h).
I can't reproduce this compilation error on my Windows machine.
I then tried removing the lines that caused the above compilation failure.
Those setters are called in DumpRenderTree::enableExperimentalFeatures, so in
lieu of enabling these flags there I could enable the flag I need via test header.
That patch is: https://bugs.webkit.org/attachment.cgi?id=426509&action=edit
This results in successful compilation, but causes lots (all?) of the
layout tests to fail[2] with a stacktrace that looks like:
Canonical link: https://commits.webkit.org/236947@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276488 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-23 05:25:40 +00:00
|
|
|
void setterInternal(CSSPropertyID, const String&);
|
|
|
|
|
[css-counter-styles] Parse and add feature flag for @counter-style
https://bugs.webkit.org/show_bug.cgi?id=223150
Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-16
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
@counter-style and its descriptors are now exposed behind a feature
flag, so pass some tests and fail others for a different reason
because this patch doesn't actually implement descriptor parsing and
setting yet.
* web-platform-tests/css/css-counter-styles/counter-style-additive-symbols-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-fallback-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-name-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-negative-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-pad-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-range-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-symbols-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-system-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/idlharness-expected.txt:
* web-platform-tests/css/cssom/CSSCounterStyleRule-expected.txt:
Source/WebCore:
Parse @counter-style (without implementing descriptor parsing) behind
a new feature flag, CSSCounterStyleAtRulesEnabled. A separate feature
flag for @counter-style <image> symbol values has also been added, as
image symbols have extra complexities that we won't want to hold the
entire feature back on.
https://www.w3.org/TR/css-counter-styles-3
The CSSCounterStyleRule IDL interface is also added and implemented,
and similarly feature flagged.
https://www.w3.org/TR/css-counter-styles-3/#apis
Test: webexposed/counter-style-is-not-exposed.html and existing WPTs.
* CMakeLists.txt:
Add CSSCounterStyleRule.idl.
* DerivedSources-input.xcfilelist:
Add CSSCounterStyleRule.idl.
* DerivedSources-output.xcfilelist:
Add JSCSSCounterStyleRule.h and JSCSSCounterStyleRule.cpp.
* DerivedSources.make:
Add CSSCounterStyleRule.idl.
* Sources.txt:
Add CSSCounterStyleRule.cpp and JSCSSCounterStyleRule.cpp.
* WebCore.xcodeproj/project.pbxproj:
Add CounterStyle.h, CounterStyle.cpp, and CounterStyle.idl.
* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJSNewlyCreated):
Support CSSCounterStyleRule.
* bindings/js/WebCoreBuiltinNames.h:
Add macro(CSSCounterStyleRule) to generate counter-style built-in
names.
* css/CSSCounterStyleRule.cpp: Added.
(WebCore::StyleRuleCounterStyle::StyleRuleCounterStyle):
(WebCore::StyleRuleCounterStyle::create):
(WebCore::StyleRuleCounterStyle::mutableProperties):
(WebCore::CSSCounterStyleRule::CSSCounterStyleRule):
(WebCore::CSSCounterStyleRule::reattach):
(WebCore::CSSCounterStyleRule::cssText const):
* css/CSSCounterStyleRule.h: Added.
(isType): Add specialized rule.isCounterStyleRule() implementation.
* css/CSSCounterStyleRule.idl: Added.
* css/CSSRule.cpp: Add new StyleRuleType::CounterStyle COMPILE_ASSERT.
* css/CSSRule.h:
Add COUNTER_STYLE_RULE constant. Also add comment `// WebIDL enum` to
disable enum_casing lint, since these values are named to match IDL
attributes.
* css/CSSRule.idl: Add COUNTER_STYLE_RULE constant behind flag.
* css/StyleRule.cpp:
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy const):
(WebCore::StyleRuleBase::createCSSOMWrapper const):
Handle newly added StyleRuleType::CounterStyle.
* css/StyleRule.h:
(WebCore::StyleRuleBase::isCounterStyleRule const): Added.
* css/StyleRuleType.h: Add StyleRuleType::CounterStyle
* css/StyleSheetContents.cpp:
(WebCore::traverseRulesInVector):
(WebCore::StyleSheetContents::traverseSubresources const):
If @counter-style image symbols flag is enabled, do traverse
subresources.
* css/parser/CSSAtRuleID.cpp:
If the @counter-style feature flag is enabled, return newly added
CSSAtRuleCounterStyle ID.
(WebCore::cssAtRuleID):
* css/parser/CSSAtRuleID.h:
Add CSSAtRuleCounterStyle ID.
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
* css/parser/CSSParserContext.h:
(WebCore::CSSParserContextHash::hash):
Add cssCounterStyleAtRulesEnabled and
cssCounterStyleAtRuleImageSymbolsEnabled flags.
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
* css/parser/CSSParserImpl.cpp:
(WebCore::computeNewAllowedRules):
(WebCore::CSSParserImpl::consumeAtRule):
(WebCore::CSSParserImpl::consumeCounterStyleRule): Added.
(WebCore::CSSParserImpl::consumeDeclarationList):
(WebCore::CSSParserImpl::consumeDeclaration):
* css/parser/CSSParserImpl.h:
Handle new @counter-style rule.
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseValue): Handle
StyleRuleType::CounterStyle.
(WebCore::consumeCounterContent):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Add placeholder for future @counter-style descriptor parsing work.
* css/parser/CSSPropertyParser.h:
Add parseCounterStyleDescriptor method
* css/parser/CSSPropertyParserHelpers.h:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
Add new flag that allows consumed custom ident values to be lowercased
on-parse. This is necessary for some <counter-style-name> values.
(WebCore::CSSPropertyParserHelpers::isPredefinedCounterStyle): Added.
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleName):
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleNameInPrelude):
Parse @counter-style names, both in-prelude names and non-prelude
names (e.g. as part of the `extends` descriptor).
Source/WTF:
* Scripts/Preferences/WebPreferencesExperimental.yaml:
Add CSSCounterStyleAtRulesEnabled and CSSCounterStyleAtRuleImageSymbolsEnabled flags.
Tools:
* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Add `false` defaults for CSSCounterStyleAtRulesEnabled and
CSSCounterStyleAtRuleImageSymbolsEnabled flags.
LayoutTests:
Add tests ensuring @counter-style is not exposed when feature flag is
disabled.
* webexposed/counter-style-is-not-exposed-expected.txt: Added.
* webexposed/counter-style-is-not-exposed.html: Added.
Canonical link: https://commits.webkit.org/236643@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276152 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-16 19:19:04 +00:00
|
|
|
Ref<StyleRuleCounterStyle> m_counterStyleRule;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace WebCore
|
|
|
|
|
|
|
|
SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSCounterStyleRule, CSSRule::COUNTER_STYLE_RULE)
|
|
|
|
|
|
|
|
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::StyleRuleCounterStyle)
|
|
|
|
static bool isType(const WebCore::StyleRuleBase& rule) { return rule.isCounterStyleRule(); }
|
|
|
|
SPECIALIZE_TYPE_TRAITS_END()
|
|
|
|
|