haikuwebkit/LayoutTests/fast/css/caret-color-fallback-to-col...

25 lines
363 B
HTML
Raw Permalink Normal View History

[css-ui] Implement caret-color support https://bugs.webkit.org/show_bug.cgi?id=166572 <rdar://problem/33852589> Reviewed by David Hyatt. Source/WebCore: Add support for the CSS property caret-color as per <https://www.w3.org/TR/css-ui-3/#caret-color> (02 March 2017). The property caret-color specifies the color of the text insertion caret in an editable element, say an HTML textarea element. Unlike other CSS color properties caret-color can have value "auto" and this is its initial value. Internally we treat value "auto" as an invalid caret color to simplify the code. Tests: editing/pasteboard/preserve-caret-color.html fast/css/caret-color-auto.html fast/css/caret-color-fallback-to-color.html fast/css/caret-color-inherit.html fast/css/caret-color-span-inside-editable-parent.html fast/css/caret-color.html fast/history/visited-link-caret-color.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSProperties.json: Add property caret-color. We represent the initial "auto" Also, fix up wording in a comment while I am here. * css/StyleResolver.cpp: (WebCore::isValidVisitedLinkProperty): Add caret-color to the list of properties that can be applied to visited hyperlinks. * css/parser/CSSParserFastPaths.cpp: (WebCore::parseCaretColor): Added. (WebCore::CSSParserFastPaths::maybeParseValue): Unlike other CSS color properties caret-color can be defined to be "auto". We explicitly check if the property is caret-color and use parseCaretColor() to parse its value. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeCaretColor): Added. (WebCore::CSSPropertyParser::parseSingleValue): Similar to the change to CSSParserFastPaths::maybeParseValue() use a dedicated code path to parse caret-color. * editing/EditingStyle.cpp: Preserve caret-color during editing operations. * editing/FrameSelection.cpp: (WebCore::CaretBase::paintCaret const): Modified code to query property caret-color instead of color for the color of the text insertion caret. Always honor the caret-color of the editable element if it is valid color. Note that "caret-color: auto" is treated as an invalid color internally. A caret-color can have an invalid color if its inherits from the CSS color property with an invalid color. If caret-color is a valid color then we take it to be the color of the text insertion caret. Otherwise, we do what we do today and use a heuristic to determine the color of the text-insertion caret. (WebCore::disappearsIntoBackground): Deleted; moved logic into CaretBase::paintCaret(). * page/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): Add property wrapper to support animating caret-color. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline const): Modified to consider changes to caret color. (WebCore::RenderStyle::colorIncludingFallback const): Modified to compute the appropriate color for property caret-color with respect to an unvisited or visited link. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::setCaretColor): Added. (WebCore::RenderStyle::setVisitedLinkCaretColor): Added. (WebCore::RenderStyle::caretColor const): Added. (WebCore::RenderStyle::visitedLinkCaretColor const): Added. * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): Modified to consider caret color. (WebCore::StyleRareInheritedData::operator== const): Ditto. * rendering/style/StyleRareInheritedData.h: LayoutTests: Add reference tests to ensure that we do not regress CSS property caret-color. * TestExpectations: Unskip Web Platform Tests that now pass. * editing/deleting/maintain-style-after-delete-expected.txt: Updated expected result. * editing/inserting/insert-paragraph-with-font-and-background-color-expected.txt: Ditto. * editing/pasteboard/do-not-copy-unnecessary-styles-2-expected.txt: Ditto. * editing/pasteboard/onpaste-text-html-expected.txt: Ditto. * editing/pasteboard/preserve-caret-color-expected.txt: Added. * editing/pasteboard/preserve-caret-color.html: Added. * editing/pasteboard/preserve-underline-color-expected.txt: * fast/css/caret-color-auto-expected.html: Added. * fast/css/caret-color-auto.html: Added. * fast/css/caret-color-expected.html: Added. * fast/css/caret-color-fallback-to-color-expected.html: Added. * fast/css/caret-color-fallback-to-color.html: Added. * fast/css/caret-color-inherit-expected.html: Added. * fast/css/caret-color-inherit.html: Added. * fast/css/caret-color-span-inside-editable-parent-expected.html: Added. * fast/css/caret-color-span-inside-editable-parent.html: Added. * fast/css/caret-color.html: Added. * fast/events/before-input-events-prevent-drag-and-drop-expected.txt: Updated expected result. * fast/events/input-events-paste-rich-datatransfer-expected.txt: Ditto. * fast/events/ondrop-text-html-expected.txt: Ditto. * fast/history/visited-link-caret-color-expected.html: Added. * fast/history/visited-link-caret-color.html: Added. * platform/ios/TestExpectations: Skip the tests on iOS as iOS does not enable ENABLE(TEXT_CARET). UIKit renders the text insertion caret on iOS. * platform/mac/editing/style/5065910-expected.txt: Updated expected result. * platform/mac/editing/style/5084241-expected.png: Ditto. * platform/mac/editing/style/5084241-expected.txt: Ditto. * platform/ios-wk2/editing/style/5084241-expected.txt: Ditto. Canonical link: https://commits.webkit.org/192229@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220706 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-14 17:29:34 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
#test-container {
height: 50px;
width: 50px;
overflow: hidden;
}
#mock-caret {
height: inherit;
width: inherit;
background-color: green;
}
</style>
</head>
<body>
<p>This tests that caret-color falls back to color.</p>
<div id="test-container">
<div id="mock-caret"></div>
</div>
</body>
</html>