haikuwebkit/LayoutTests/animations/text-underline-offset.html

38 lines
929 B
HTML
Raw Permalink Normal View History

Implement text-underline-offset and text-decoration-thickness https://bugs.webkit.org/show_bug.cgi?id=190774 Reviewed by Dean Jackson. Source/WebCore: Because of our existing infrastructure for text decorations, adding support for these is fairly simple. This patch updates our existing functions to handle thick & placed underlines, as well as updating our repaint code to correcly handle repainting them. It also handles animations. Tests: animations/text-decoration-thickness.html animations/text-underline-offset.html fast/css3-text/css3-text-decoration/text-decoration-offset-2.html fast/css3-text/css3-text-decoration/text-decoration-offset-3.html fast/css3-text/css3-text-decoration/text-decoration-offset-auto-length.html fast/css3-text/css3-text-decoration/text-decoration-offset-baseline.html fast/css3-text/css3-text-decoration/text-decoration-offset-from-font-auto.html fast/css3-text/css3-text-decoration/text-decoration-offset-from-font-length.html fast/css3-text/css3-text-decoration/text-decoration-offset-repaint.html fast/css3-text/css3-text-decoration/text-decoration-offset-under-auto.html fast/css3-text/css3-text-decoration/text-decoration-offset-under-length.html fast/css3-text/css3-text-decoration/text-decoration-offset.html fast/css3-text/css3-text-decoration/text-decoration-thickness-length.html fast/css3-text/css3-text-decoration/text-decoration-thickness-repaint.html * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * platform/graphics/FontMetrics.h: (WebCore::FontMetrics::underlinePosition const): (WebCore::FontMetrics::setUnderlinePosition): (WebCore::FontMetrics::underlineThickness const): (WebCore::FontMetrics::setUnderlineThickness): * platform/graphics/cocoa/FontCocoa.mm: (WebCore::Font::platformInit): * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::addToLine): * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForStyle): * rendering/TextDecorationPainter.cpp: (WebCore::TextDecorationPainter::paintTextDecoration): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::changeAffectsVisualOverflow const): * rendering/style/TextDecorationThickness.h: (WebCore::TextDecorationThickness::resolve const): * style/InlineTextBoxStyle.cpp: (WebCore::computeUnderlineOffset): (WebCore::visualOverflowForDecorations): * style/InlineTextBoxStyle.h: (WebCore::textDecorationStrokeThickness): Deleted. LayoutTests: * animations/text-decoration-thickness-expected.txt: Added. * animations/text-decoration-thickness.html: Added. * animations/text-underline-offset-expected.txt: Added. * animations/text-underline-offset.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-2-expected-mismatch.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-2.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-3-expected-mismatch.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-3.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-auto-length-expected.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-auto-length.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-baseline-expected.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-baseline.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-expected-mismatch.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-from-font-auto-expected.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-from-font-auto.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-from-font-length-expected.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-from-font-length.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-repaint-expected.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-repaint.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-under-auto-expected.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-under-auto.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-under-length-expected.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset-under-length.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-offset.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-thickness-length-expected.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-thickness-length.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-thickness-repaint-expected.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-thickness-repaint.html: Added. Canonical link: https://commits.webkit.org/206142@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237903 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-07 01:22:41 +00:00
<!DOCTYPE html>
<html>
<head>
<script src="resources/animation-test-helpers.js"></script>
<style>
@keyframes TheAnimation {
from {
text-underline-offset: 0px;
}
to {
text-underline-offset: 100px;
}
}
#box {
text-decoration: underline;
animation-duration: 3s;
animation-timing-function: linear;
}
</style>
</head>
<body>
<div id="box">Hello</div>
<div id="result"></div>
<script>
var expectedValues = [
// [animation-name, time, element-id, property, expected-value, tolerance]
["TheAnimation", 0.5, "box", "text-underline-offset", "16.6666", 5],
["TheAnimation", 1.0, "box", "text-underline-offset", "33.3333", 5],
["TheAnimation", 2.0, "box", "text-underline-offset", "66.6666", 5],
];
document.getElementById("box").style.animationName = "TheAnimation";
runAnimationTest(expectedValues, undefined, undefined, undefined, false, undefined);
</script>
</body>
</html>