haikuwebkit/LayoutTests/fast/css/getComputedStyle
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
..
resources
computed-style-apple-pay-button-expected.txt
computed-style-apple-pay-button.html
computed-style-border-image-expected.txt initial value for border-image-outset should be 0 2021-03-04 11:26:43 +00:00
computed-style-border-image.html initial value for border-image-outset should be 0 2021-03-04 11:26:43 +00:00
computed-style-cross-fade-expected.txt
computed-style-cross-fade.html
computed-style-display-none-expected.txt
computed-style-display-none.html
computed-style-expected.txt
computed-style-font-expected.txt
computed-style-font-family-expected.txt
computed-style-font-family-monospace-expected.txt
computed-style-font-family-monospace.html
computed-style-font-family.html
computed-style-font.html
computed-style-negative-top-expected.txt
computed-style-negative-top.html
computed-style-page-break-inside-expected.txt 2010-01-28 Hayato Ito <hayato@chromium.org> 2010-01-29 07:01:43 +00:00
computed-style-page-break-inside.html
computed-style-properties-expected.txt Handle custom identifiers and strings separately, so we can quote strings correctly consistently 2021-06-07 02:39:33 +00:00
computed-style-properties.html Handle custom identifiers and strings separately, so we can quote strings correctly consistently 2021-06-07 02:39:33 +00:00
computed-style-select-overflow-expected.txt
computed-style-select-overflow.html
computed-style-with-zoom-expected.txt initial value for border-image-outset should be 0 2021-03-04 11:26:43 +00:00
computed-style-with-zoom.html
computed-style-without-renderer-expected.txt
computed-style-without-renderer.html
computed-style.html
counterIncrement-without-counter-expected.txt
counterIncrement-without-counter.html
empty-update-without-renderer-expected.txt
empty-update-without-renderer.html
first-child-update-without-renderer-expected.txt
first-child-update-without-renderer.html
font-family-fallback-reset-expected.txt
font-family-fallback-reset.html
getComputedStyle-background-position-expected.txt
getComputedStyle-background-position.html
getComputedStyle-background-shorthand-expected.txt
getComputedStyle-background-shorthand.html
getComputedStyle-background-size-expected.txt
getComputedStyle-background-size.html
getComputedStyle-border-box-expected.txt
getComputedStyle-border-box.html
getComputedStyle-border-color-shorthand-expected.txt
getComputedStyle-border-color-shorthand.html
getComputedStyle-border-image-expected.txt initial value for border-image-outset should be 0 2021-03-04 11:26:43 +00:00
getComputedStyle-border-image-slice-expected.txt
getComputedStyle-border-image-slice.html
getComputedStyle-border-image.html
getComputedStyle-border-radius-shorthand-expected.txt
getComputedStyle-border-radius-shorthand.html
getComputedStyle-border-shorthand-expected.txt
getComputedStyle-border-shorthand.html
getComputedStyle-border-spacing-expected.txt
getComputedStyle-border-spacing.html
getComputedStyle-border-style-shorthand-expected.txt
getComputedStyle-border-style-shorthand.html
getComputedStyle-border-width-expected.txt
getComputedStyle-border-width.html
getComputedStyle-borderRadius-2-expected.txt
getComputedStyle-borderRadius-2.html
getComputedStyle-borderRadius-expected.txt
getComputedStyle-borderRadius.html
getComputedStyle-column-rule-expected.txt
getComputedStyle-column-rule.html
getComputedStyle-height-expected.txt
getComputedStyle-height.html
getComputedStyle-length-unit-expected.txt
getComputedStyle-length-unit.html
getComputedStyle-list-style-shorthand-expected.txt
getComputedStyle-list-style-shorthand.html
getComputedStyle-margin-auto-expected.txt
getComputedStyle-margin-auto.html
getComputedStyle-margin-length-expected.txt
getComputedStyle-margin-length.html
getComputedStyle-margin-percentage-expected.txt
getComputedStyle-margin-percentage.html
getComputedStyle-margin-shorthand-expected.txt
getComputedStyle-margin-shorthand.html
getComputedStyle-offsets-expected.txt
getComputedStyle-offsets.html
getComputedStyle-outline-offset-expected.txt
getComputedStyle-outline-offset.html
getComputedStyle-outline-shorthand-expected.txt
getComputedStyle-outline-shorthand.html
getComputedStyle-overflow-expected.txt
getComputedStyle-overflow.html
getComputedStyle-padding-margin-subpixel-length-expected.txt
getComputedStyle-padding-margin-subpixel-length.html
getComputedStyle-padding-shorthand-expected.txt
getComputedStyle-padding-shorthand.html
getComputedStyle-relayout-expected.txt
getComputedStyle-relayout.html
getComputedStyle-resolved-values-expected.txt
getComputedStyle-resolved-values.html
getComputedStyle-style-resolution-expected.txt
getComputedStyle-style-resolution.html
getComputedStyle-text-decoration-expected.txt
getComputedStyle-text-decoration.html
getComputedStyle-text-overflow-expected.txt
getComputedStyle-text-overflow.html
getComputedStyle-transform-expected.txt
getComputedStyle-transform.html
getComputedStyle-webkit-columns-shorthand-expected.txt
getComputedStyle-webkit-columns-shorthand.html
getComputedStyle-with-pseudo-element-expected.txt
getComputedStyle-with-pseudo-element.html
getComputedStyle-zIndex-auto-expected.txt
getComputedStyle-zIndex-auto.html
getComputedStyle-zoom-and-background-size-expected.txt
getComputedStyle-zoom-and-background-size.html
last-child-update-without-renderer-expected.txt
last-child-update-without-renderer.html
pending-stylesheet-expected.txt
pending-stylesheet.html
sticky-scroll-container-crash-expected.txt
sticky-scroll-container-crash.html
zoom-on-display-none-expected.txt
zoom-on-display-none.html