haikuwebkit/LayoutTests/fast/encoding
Darin Adler e1adc392ff Handle custom identifiers and strings separately, so we can quote strings correctly consistently
https://bugs.webkit.org/show_bug.cgi?id=226694

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-animations/parsing/animation-name-valid-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-symbols-syntax-expected.txt:
* web-platform-tests/css/css-grid/parsing/grid-area-computed-expected.txt:
* web-platform-tests/css/css-grid/parsing/grid-area-shorthand-expected.txt:
* web-platform-tests/css/css-grid/parsing/grid-area-valid-expected.txt:
* web-platform-tests/css/css-lists/parsing/content-invalid-expected.txt:
* web-platform-tests/css/css-transitions/transition-property-002-expected.txt:
* web-platform-tests/css/cssom/getComputedStyle-pseudo-expected.txt:
* web-platform-tests/css/cssom/serialize-values-expected.txt:
Rebased to reflect progressions. In some cases the entire test passes, in other cases we still
have failures, but the string serialization part of the test has progressed.

Source/WebCore:

Progressions in a number of WPT tests.

* animation/CSSAnimation.cpp:
(WebCore::CSSAnimation::CSSAnimation): Update since Animation::name() now
returns a struct.
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes): Ditto.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::OrderedNamedLinesCollector::appendLines const): Use
createCustomIdent for line names.
(WebCore::valueForGridPosition): Use createCustomIdent for grid line name.
(WebCore::createTransitionPropertyValue): Use createCustomIdent for
animation property names.
(WebCore::counterToCSSValue): Use createCustomIdent for counter names.
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Use
createCustomIdent for list-style-type, locale, animation names if they
were created from a custom-ident, and line-grid.

* css/CSSCustomIdentValue.cpp: Emptied out this file; we can delete it soon.
* css/CSSCustomIdentValue.h: Ditto.

* css/CSSMarkup.cpp:
(WebCore::serializeCharacterAsCodePoint): Optimized to do a single
StringBuilder::append call.
(WebCore::serializeAsStringOrCustomIdent): Deleted.
* css/CSSMarkup.h: Removed serializeAsStringOrCustomIdent.

* css/CSSPrimitiveValue.cpp:
(WebCore::isValidCSSUnitTypeForDoubleConversion): Added a case for
CustomIdent. Changed CSS_IDENT to assert not reached, since it should
never be passed to this function. More cleanup of CSSUnitType is needed,
but for now mostly leaving it alone.
(WebCore::isStringType): Added a case for CustomIdent. Moved CSS_DIMENSION,
which was incorrectly returning true, to return false. Pretty sure there's
no way to create one of these with CSS_DIMENSION, but this is less peculiar.
(WebCore::CSSPrimitiveValue::primitiveType const): Added transformation
from CustomIdent to CSS_IDENT as we do with CSS_PROPERTY_ID and CSS_VALUE_ID.
(WebCore::CSSPrimitiveValue::cleanup): Added a case for CustomIdent.
Moved CSS_DIMENSION to the correct section. Pretty sure there's no way to
create one of these with CSS_DIMENSION, but this is less peculiar.
(WebCore::CSSPrimitiveValue::setFloatValue): Deleted.
(WebCore::CSSPrimitiveValue::setStringValue): Deleted.
(WebCore::CSSPrimitiveValue::getStringValue const): Deleted.
(WebCore::CSSPrimitiveValue::stringValue const): Added a case for CustomIdent.
(WebCore::CSSPrimitiveValue::unitTypeString): Added a case for CustomIdent
and an ASSERT_NOT_REACHED for invalid enumeration values.
(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
Removed inaccurate FIXME comment for CSS_DIMENSION and changed it to do
something less wrong, but still incorrect. Pretty sure there's no way to
create one of these with CSS_DIMENSION, but this is less peculiar. Changed
CSS_STRING case to always serializeAsString. Added a CustomIdent case
that always serializes as an identifier.
(WebCore::CSSPrimitiveValue::equals const): Moved the CSS_DIMENSION to
the correct part of this switch statement. Pretty sure there's no way to
create one of these with CSS_DIMENSION, but this is less peculiar.
Added case for CustomIdent.

* css/CSSPrimitiveValue.h: Made isFontRelativeLength, isResolution,
and isViewportPercentageLength private. Made those plus isLength all
constexpr. Removed WEBCORE_EXPORT from primitiveType and getFloatValue:
those needed to be exported when this was the web-exposed class, but
that is now DeprecatedCSSOMPrimitiveValue. Deleted setFloatValue,
setStringValue, and getStringValue for the same reason: those functions
are now in DeprecatedCSSOMPrimitiveValue and don't need to be here.

* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapAnimationName): Updated to pass a boolean
in to the animation name to keep track of whether it was created with
a string or a custom-ident so we it can properly round-trip in computed
style. This is required to pass some of the WPT tests, although I could
not find clear guidance in the specification that this behavior is required.
The same name with a string and custom-ident are equivalent in other ways.

* css/CSSUnits.cpp:
(WebCore::operator<<): Added a case for CustomIdent.
* css/CSSUnits.h: Added CustomIdent. Added some FIXME about how we can
change this in the future. It's a remnant of the past when these were part
of our web-facing API, and this can be greatly cleaned up.

* css/CSSValue.cpp:
(WebCore::CSSValue::cssText const): Removed CSSCustomIdentValue.h,
CustomIdentClass, CSSCustomIdentValue. We are not going to use a separate
class for custom-ident, just a separate type of primitive value.
(WebCore::CSSValue::destroy): Ditto.
* css/CSSValue.h: Deleted isCustomIdentValue and CustomIdentClass.

* css/CSSValueList.cpp:
(WebCore::CSSValueList::customCSSText const): Tweaked algorithm
to be slightly more efficient.

* css/CSSValuePool.h: Added createCustomIdent. Later should remove
the create function that takes a string value and a type and use
separate named functions for the few different cases, but doing the
new one this way for now.

* css/DeprecatedCSSOMPrimitiveValue.cpp:
(WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType const):
Rewrote this to be a switch that preserves the current behavior
but no longer relies on the numeric values of CSSUnitType values.
Added a FIXME about using CSS_UNKNOWN more: some of the numbers
we are exposing to the web are doing no good.
(WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue): Moved this
function to the header.
(WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue const):
Rewrote this to be a switch as above. Preserves current behavior
but stops relying on CSSUnitType numeric values.
(WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue): Moved this
function to the header.
(WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue const):
Ditto. By putting a switch on primitiveType here, we can enforce
the desired exception behavior here, instead of getting it from
CSSPrimitiveValue, and it's better for this class to deal with
the legacy bindings issues.
(WebCore::DeprecatedCSSOMPrimitiveValue::getCounterValue const): Ditto.
(WebCore::DeprecatedCSSOMPrimitiveValue::getRectValue const): Ditto.
(WebCore::DeprecatedCSSOMPrimitiveValue::getRGBColorValue const): Ditto.

* css/DeprecatedCSSOMPrimitiveValue.h: Removed unneeded cssValueType
function. Made both setFloatValue and setStringValue simpler since
they always raise an exception and we do not intend to change that.
Also stop using protected since we have no classes derived from this.
Could do more cleanup, but this is a start.

* css/DeprecatedCSSOMValue.cpp:
(WebCore::DeprecatedCSSOMValue::cssValueType const): Put the constant
values, CSS_PRIMITIVE_VALUE and CSS_VALUE_LIST, here rather than
calling member functions.

* css/DeprecatedCSSOMValueList.cpp:
(WebCore::DeprecatedCSSOMValueList::cssText const): Tweaked to make
the code more efficient.

* css/DeprecatedCSSOMValueList.h: Removed unneeded cssValueType
function and const overload of item function. Also stop using protected
since we have no classes derived from this.

* css/MediaQueryExpression.cpp:
(WebCore::featureWithValidIdent): Fixed indentation to match WebKit style.
(WebCore::featureWithValidDensity): Ditto.
(WebCore::featureWithValidPositiveLength): Ditto.
(WebCore::featureExpectingPositiveInteger): Ditto.
(WebCore::featureWithPositiveNumber): Ditto.

* css/calc/CSSCalcCategoryMapping.cpp:
(WebCore::hasDoubleValue): Added a case for CustomIdent.

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeWillChange): Removed comment saying we should use
CSSCustomIdentValue since using a property ID for the value is great.
(WebCore::consumeAnimationName): Removed comment saying we should use
CSSCustomIdentValue here because that would be incorrect: we need to
preserve and round-trip the fact that this was string, not custom-ident.
(WebCore::consumeTransitionProperty): Remove special case for
CSSValueAll that wasn't doing anything. Removed comment saying we should
use CSSCustomIdentValue since using a value ID for the value is great.
(WebCore::consumeAttr): Updated comment.
(WebCore::isCustomIdentValue): Updated to work with the new primitive value.

* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
Use the new createCustomIdent and removed an outdated comment. While we
might some day want to implement custom-ident differently, we won't need
to change the code here to make that happen.

* platform/animation/Animation.cpp:
(WebCore::Animation::animationsMatch const): Update since m_name now is a
struct.
(WebCore::Animation::initialName): Update to return Name instead of String.
(WebCore::operator<<): Update since name() now returns a struct.
* platform/animation/Animation.h: Added the Name struct so we can store a
boolean to indicate whether it's a string or custom-ident for round tripping.
Update types and implementations of function and data members accordingly.

* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::createGridPosition): Update code to expect
custom-ident instead of string; they used to both be the same thing.

* style/Styleable.cpp:
(WebCore::shouldConsiderAnimation): Update since Animation::name() now
returns a struct. Also got rid of unsuccessful attempt to optimize comparison
againt the string "none"; later might be good to clean out that special case.
(WebCore::Styleable::updateCSSAnimations const): Ditto.

Tools:

* TestRunnerShared/TestFeatures.cpp:
(WTR::parseTestHeader): Fixed a missing quote that made a log message read strangely.

LayoutTests:

* TestExpectations: Removed expected failures from 13 css-counter-styles tests that are not
currently failing. I had planned to work on making more of these pass, but first found I could
fix them with a corrected custom-ident implementation.

* css3/supports-expected.txt: Rebased.
* css3/supports.html: Updated to expect the value of the content property to be a quoted string,
rather than the old behavior, which was to leave the string unquoted if it happened to be a
string with all characters legal for a custom-ident. New expectation is the correct behavior.

* fast/css/alt-inherit-initial-expected.txt: Rebased.
* fast/css/alt-inherit-initial.html: Updated to expect the value of the language property to be
a custom-ident, and serialize unusual cases with custom-ident rules, not as a quoted string. New
expectation is the correct behavior.
* fast/css/content-language-comma-separated-list-expected.txt: Ditto.
* fast/css/content-language-empty-expected.txt: Ditto.
* fast/css/content-language-only-whitespace-expected.txt: Ditto.
* fast/css/content-language-with-whitespace-expected.txt: Ditto.

* fast/css/getComputedStyle/computed-style-properties-expected.txt: Rebased.
* fast/css/getComputedStyle/computed-style-properties.html: Expect content string (see above).

* fast/css/lang-mapped-to-webkit-locale-expected.txt: Rebased.
* fast/css/lang-mapped-to-webkit-locale.xhtml: Expect language custom-ident (see above).

* fast/css/nested-at-rules-expected.txt: Rebased.
* fast/css/nested-at-rules.html: Expect content string (see above).

* fast/css/parsing-text-emphasis-expected.txt: Rebased.
* fast/css/parsing-text-emphasis.html: Updated to expect strings to remaing quoted strings in
the text-emphasis property, not change into custom-ident if all characters happen to fit.

* fast/encoding/css-charset-default-expected.txt: Expect content string (see above).
* inspector/css/pseudo-element-matches-for-pseudo-element-node-expected.txt: Ditto.

Canonical link: https://commits.webkit.org/238538@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278540 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-07 02:39:33 +00:00
..
GBK
css-charset-evil
dumpAsText
hebrew
resources
ahram-org-eg-expected.txt
ahram-org-eg.html
backslash-encoding-jp-expected.txt TextCodecICU::encode turns the whole string as yen signs if there is any backslash in it 2014-06-29 17:10:27 +00:00
backslash-encoding-jp.html
bandai-co-jp-releases-expected.txt
bandai-co-jp-releases.html
bom-in-content-expected.txt
bom-in-content-utf16-expected.txt
bom-in-content-utf16.html
bom-in-content.html
bracket-in-script-expected.txt
bracket-in-script.html
bracket-in-tag-expected.txt
bracket-in-tag.html
char-after-fast-path-ascii-decoding-expected.txt
char-after-fast-path-ascii-decoding.html
char-decoding-expected.txt Align ISO-8859-{3,6,7,8,8-I} and windows-{874,1253,1255,1257} encodings with Chrome, Firefox, and the specification 2020-09-03 16:33:59 +00:00
char-decoding-mac-expected.txt
char-decoding-mac.html
char-decoding.html Align ISO-8859-{3,6,7,8,8-I} and windows-{874,1253,1255,1257} encodings with Chrome, Firefox, and the specification 2020-09-03 16:33:59 +00:00
char-encoding-expected.txt Align GBK and gb18030 encoder and decoder with specification and other browsers 2020-11-06 02:02:41 +00:00
char-encoding-mac-expected.txt
char-encoding-mac.html
char-encoding.html Align GBK and gb18030 encoder and decoder with specification and other browsers 2020-11-06 02:02:41 +00:00
charset-cp1251-expected.txt
charset-cp1251.html
charset-invalid-expected.txt
charset-invalid.html
charset-koi8-u-expected.txt
charset-koi8-u.html
charset-replacement-expected.txt Allow direct creation of replacement codec 2020-09-02 15:52:14 +00:00
charset-replacement.html Allow direct creation of replacement codec 2020-09-02 15:52:14 +00:00
charset-softbank-sjis-expected.txt Remove support for iOS-only softbank-sjis encoding if possible 2017-11-09 18:37:09 +00:00
charset-softbank-sjis.html
charset-unicode-expected.txt
charset-unicode.html
charset-utf16-expected.txt
charset-utf16.html
charset-xuser-defined-expected.txt
charset-xuser-defined.html
css-cached-bom-expected.txt
css-cached-bom.html
css-charset-default-expected.txt Handle custom identifiers and strings separately, so we can quote strings correctly consistently 2021-06-07 02:39:33 +00:00
css-charset-default.xhtml
css-charset-expected.txt
css-charset-import.css
css-charset-inherit-iso-8859-5.css
css-charset-inherit-koi-8.css
css-charset-missing-semi-colon-and-newline-expected.txt
css-charset-missing-semi-colon-and-newline.html
css-charset.css
css-charset.html
css-link-charset-expected.txt
css-link-charset.css
css-link-charset.html
decoder-allow-null-chars-expected.txt LayoutTests: 2006-02-08 02:39:22 +00:00
decoder-allow-null-chars.html
default-xhtml-encoding-expected.txt LayoutTests: 2007-05-24 01:11:10 +00:00
default-xhtml-encoding.xhtml
denormalised-voiced-japanese-chars-expected.html
denormalised-voiced-japanese-chars.html
duplicate-tec-encodings-expected.txt
duplicate-tec-encodings.html
escaped-bracket-expected.txt
escaped-bracket.html
euckr-name-expected.txt
euckr-name.html
external-script-charset-expected.txt
external-script-charset-koi-8.js
floraexpress-ru-expected.txt
floraexpress-ru.html
frame-default-enc-expected.txt
frame-default-enc.html
hanarei-blog32-fc2-com-expected.txt
hanarei-blog32-fc2-com.html
high-bit-latin1-expected.txt
high-bit-latin1.html
idn-security-expected.txt
idn-security.html Remove non-inclusive language from layout tests 2020-12-21 23:50:35 +00:00
invalid-UTF-8-2-expected.txt
invalid-UTF-8-2.html
invalid-UTF-8.html
invalid-multi-byte-over-consumption-expected.txt
invalid-multi-byte-over-consumption.html
invalid-xml-expected.txt
invalid-xml.html
japanese-encoding-mix-expected.txt
japanese-encoding-mix.html
latin1-winlatin-expected.txt LayoutTests: 2007-05-24 01:11:10 +00:00
latin1-winlatin.html
legacy-ios-encodings-expected.txt
legacy-ios-encodings.html
legacy-tec-encodings-expected.txt Remove TEC support and all TEC-only encodings except EUC-TW (which now uses ICU) 2017-11-19 03:42:49 +00:00
legacy-tec-encodings.html
legacy-utf-32-aliases-expected.txt
legacy-utf-32-aliases.html
mailto-always-utf-8-expected.txt
mailto-always-utf-8.html
meta-charset-expected.txt
meta-charset.html
meta-in-body-expected.txt
meta-in-body.html
meta-in-script-expected.txt
meta-in-script.html
meta-in-title-expected.txt
meta-in-title.html
meta-in-xhtml-expected.txt
meta-in-xhtml.xhtml
meta-overrules-auto-expected.txt
meta-overrules-auto.html
mismatched-end-tag-expected.txt
mismatched-end-tag.html
misplaced-xml-declaration-expected.txt
misplaced-xml-declaration.html
mispositioned-meta-expected.txt
mispositioned-meta.html
namespace-meta-expected.txt
namespace-meta.html
namespace-tolerance-expected.txt Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
namespace-tolerance.html
no-charset-on-dynamic-script-load-expected.txt
no-charset-on-dynamic-script-load.html
noscript-in-head-expected.txt
noscript-in-head.html
not-http-equiv-content-expected.txt
not-http-equiv-content.html
parser-tests-10-expected.txt
parser-tests-10.html
parser-tests-20-expected.txt
parser-tests-20.html
parser-tests-30-expected.txt
parser-tests-30.html
parser-tests-40-expected.txt
parser-tests-40.html
parser-tests-50-expected.txt
parser-tests-50.html
parser-tests-60-expected.txt
parser-tests-60.html
parser-tests-70-expected.txt
parser-tests-70.html
parser-tests-80-expected.txt
parser-tests-80.html
parser-tests-90-expected.txt
parser-tests-90.html
parser-tests-100-expected.txt
parser-tests-100.html
parser-tests-110-expected.txt
parser-tests-110.html
parser-tests-120-expected.txt
parser-tests-120.html
parser-tests-expected.txt
parser-tests.html
percent-escaping-expected.txt
percent-escaping.html
preload-encoding-expected.txt
preload-encoding.html
pseudo-tags-in-attributes-expected.txt
pseudo-tags-in-attributes.html
pseudo-xml-2-expected.txt
pseudo-xml-2.html
pseudo-xml-3-expected.txt
pseudo-xml-3.html
pseudo-xml-4-expected.txt
pseudo-xml-4.html
pseudo-xml-expected.txt
pseudo-xml.html
quotes-in-title-expected.txt
quotes-in-title.html
script-in-head-expected.txt
script-in-head.html
stream-visibility-expected.txt TextEncoderStreamEncoder should not be exposed 2020-11-16 12:17:49 +00:00
stream-visibility.html TextEncoderStreamEncoder should not be exposed 2020-11-16 12:17:49 +00:00
tag-in-title-expected.txt
tag-in-title.html
tag-name-digit-expected.txt
tag-name-digit.html
url-host-name-non-ascii-expected.txt
url-host-name-non-ascii.html
utf-8-non-ascii-expected.txt
utf-8-non-ascii.html
utf-16-big-endian.html Re-added the files 2006-01-09 08:37:44 +00:00
utf-16-little-endian.html
xmacroman-encoding-test.html
xml-charset-utf16-expected.txt
xml-charset-utf16.html Use testRunner instead of layoutTestController in tests still found to be using layoutTestController by grep 2012-08-04 07:22:13 +00:00
xml-utf-8-default-expected.txt
xml-utf-8-default.xml
yahoo-mail-expected.txt
yahoo-mail.html
yentest-expected.txt
yentest.html
yentest2-expected.txt Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
yentest2.html