haikuwebkit/LayoutTests/fast/css/webkit-text-fill-color-inhe...

12 lines
360 B
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html>
<body>
Implement the css-color-4 behavior for inheritance of currentColor https://bugs.webkit.org/show_bug.cgi?id=193171 <rdar://problem/47287516> Reviewed by Simon Fraser. LayoutTests/imported/w3c: * web-platform-tests/css/css-text-decor/parsing/text-decoration-color-computed-expected.txt: * web-platform-tests/css/css-transitions/currentcolor-animation-001-expected.txt: * web-platform-tests/svg/pservers/scripted/stop-color-inheritance-currentcolor-expected.txt: Source/WebCore: In CSS3/4 'currentcolor' inherits as 'currentcolor' instead of as a resolved color value. Value 'currentcolor' is represented in RenderStyle as invalid Color object. This has been true even before the explicit property value for it was added. Fallback to 'color' has always been the default behavior of most color properties. As a result the correct behavior falls pretty easily from WebKit code. It essentially amounts to allowing color properties to inherit normally even when they are invalid/currentcolor. In future we might want to wrap RenderStyle color values into a type that makes 'currentcolor' more explicit. * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * css/CSSGradientValue.cpp: (WebCore::CSSGradientValue::gradientWithStylesResolved): * css/CSSProperties.json: - Remove 'no-default-color' which triggered to old inheritance behavior. - Rename initial value invalidColor to currentColor for clarity. * css/makeprop.pl: Code for 'no-default-color' generation is not needed anymore. (generateInheritValueSetter): * page/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::colorIncludingFallback const): Resolve 'background-color' like the rest so setting it to 'currentcolor' works correctly. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::currentColor): (WebCore::RenderStyle::invalidColor): Deleted. * style/StyleBuilderCustom.h: (WebCore::Style::BuilderCustom::applyTextOrBoxShadowValue): * style/StyleBuilderState.cpp: (WebCore::Style::BuilderState::createFilterOperations): (WebCore::Style::BuilderState::colorFromPrimitiveValue const): Don't resolve 'currentcolor', instead return it as a value. (WebCore::Style::BuilderState::colorFromPrimitiveValueWithResolvedCurrentColor const): Helper for a few cases where we still resolve current color during style building time. It is used for filters and generated images. * style/StyleBuilderState.h: * svg/SVGStopElement.cpp: (WebCore::SVGStopElement::stopColorIncludingOpacity const): Resolve 'currentcolor' during use time for svg color stops. LayoutTests: * TestExpectations: * fast/borders/border-color-inherit-expected.html: Copied from LayoutTests/fast/borders/border-color-inherit.html. * fast/borders/border-color-inherit.html: Fix for the new behavior and make it a reftest. * fast/css/webkit-text-fill-color-inherit.html: * platform/gtk/fast/borders/border-color-inherit-expected.png: Removed. * platform/gtk/fast/borders/border-color-inherit-expected.txt: Removed. * platform/ios/fast/borders/border-color-inherit-expected.txt: Removed. * platform/mac/fast/borders/border-color-inherit-expected.png: Removed. * platform/mac/fast/borders/border-color-inherit-expected.txt: Removed. * platform/win/fast/borders/border-color-inherit-expected.txt: Removed. * platform/wincairo/fast/borders/border-color-inherit-expected.txt: Removed. * platform/wpe/fast/borders/border-color-inherit-expected.txt: Removed. Canonical link: https://commits.webkit.org/222923@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259532 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-04 18:16:25 +00:00
<div style="color: red">
<div id="undefined-parent" style="color: green; -webkit-text-fill-color: inherit">Green</div>
</div>
<div style="color: purple; -webkit-text-fill-color: green">
<div id="defined-parent" style="color: red; -webkit-text-fill-color: inherit">Green</div>
</div>
</body>
<html>