Implement text-underline-offset and text-decoration-thickness
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2018 01:22:41 +0000 (01:22 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2018 01:22:41 +0000 (01:22 +0000)
commit93c628c69e3f0a02049fb8811cecd091a7878c86
tree2b6c0a883fda4122241bfbd3f941d30adf0a8506
parent1c5089b7866a009a59439ae7c357c2c35dc3537f
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237903 268f45cc-cd09-0410-ab3c-d52691b4dbfc
40 files changed:
LayoutTests/ChangeLog
LayoutTests/animations/text-decoration-thickness-expected.txt [new file with mode: 0644]
LayoutTests/animations/text-decoration-thickness.html [new file with mode: 0644]
LayoutTests/animations/text-underline-offset-expected.txt [new file with mode: 0644]
LayoutTests/animations/text-underline-offset.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-2-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-2.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-3-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-3.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-auto-length-expected.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-auto-length.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-baseline-expected.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-baseline.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-from-font-auto-expected.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-from-font-auto.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-from-font-length-expected.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-from-font-length.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-repaint-expected.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-repaint.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-under-auto-expected.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-under-auto.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-under-length-expected.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset-under-length.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-offset.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness-length-expected.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness-length.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness-repaint-expected.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness-repaint.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/platform/graphics/FontMetrics.h
Source/WebCore/platform/graphics/cocoa/FontCocoa.mm
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/SimpleLineLayout.cpp
Source/WebCore/rendering/TextDecorationPainter.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/TextDecorationThickness.h
Source/WebCore/style/InlineTextBoxStyle.cpp
Source/WebCore/style/InlineTextBoxStyle.h