WebKit Bugzilla
Attachment 356437 Details for
Bug 192264
: Thick overlines and line-throughs grow in the wrong direction
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for committing
bug-192264-20181203165615.patch (text/plain), 8.52 KB, created by
Myles C. Maxfield
on 2018-12-03 16:56:15 PST
(
hide
)
Description:
Patch for committing
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2018-12-03 16:56:15 PST
Size:
8.52 KB
patch
obsolete
>Subversion Revision: 238825 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 256b67205b62c7913a40af2e508ae6dbbedf3bad..eddd4055efe11943daa3f345e2e99b2475717247 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,19 @@ >+2018-12-03 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ Thick overlines and line-throughs grow in the wrong direction >+ https://bugs.webkit.org/show_bug.cgi?id=192264 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Overlines should grow upward, and line-throughs should stay centered. >+ >+ Test: fast/css3-text/css3-text-decoration/text-decoration-thicknes-overline-grow-direction.html >+ >+ * rendering/TextDecorationPainter.cpp: >+ (WebCore::TextDecorationPainter::paintTextDecoration): >+ * style/InlineTextBoxStyle.cpp: >+ (WebCore::visualOverflowForDecorations): >+ > 2018-12-03 Keith Rollin <krollin@apple.com> > > Add .xcfilelist files >diff --git a/Source/WebCore/rendering/TextDecorationPainter.cpp b/Source/WebCore/rendering/TextDecorationPainter.cpp >index 729cdefce0c215f6662d7efc157d74d104dce33f..7691cd0fe4867f5f21f2cc9922a2261e4b31d0cc 100644 >--- a/Source/WebCore/rendering/TextDecorationPainter.cpp >+++ b/Source/WebCore/rendering/TextDecorationPainter.cpp >@@ -296,12 +296,15 @@ void TextDecorationPainter::paintTextDecoration(const TextRun& textRun, const Fl > if (m_decorations.contains(TextDecoration::Overline)) { > float wavyOffset = m_styles.overlineStyle == TextDecorationStyle::Wavy ? m_wavyOffset : 0; > FloatRect rect(localOrigin, FloatSize(m_width, textDecorationThickness)); >- rect.move(0, -wavyOffset); >+ float autoTextDecorationThickness = TextDecorationThickness::createWithAuto().resolve(m_lineStyle.computedFontSize(), fontMetrics); >+ rect.move(0, autoTextDecorationThickness - textDecorationThickness - wavyOffset); > paintDecoration(TextDecoration::Overline, m_styles.overlineStyle, m_styles.overlineColor, rect); > } > if (m_decorations.contains(TextDecoration::LineThrough)) { > FloatRect rect(localOrigin, FloatSize(m_width, textDecorationThickness)); >- rect.move(0, 2 * fontMetrics.floatAscent() / 3); >+ float autoTextDecorationThickness = TextDecorationThickness::createWithAuto().resolve(m_lineStyle.computedFontSize(), fontMetrics); >+ auto center = 2 * fontMetrics.floatAscent() / 3 + autoTextDecorationThickness / 2; >+ rect.move(0, center - textDecorationThickness / 2); > paintDecoration(TextDecoration::LineThrough, m_styles.linethroughStyle, m_styles.linethroughColor, rect); > } > } while (shadow); >diff --git a/Source/WebCore/style/InlineTextBoxStyle.cpp b/Source/WebCore/style/InlineTextBoxStyle.cpp >index 8b8174ac4e18db08362fa7cd5a9eab032d7a2d8a..bed2843d8e7162acc0ae36c8a881e55af1adfd43 100644 >--- a/Source/WebCore/style/InlineTextBoxStyle.cpp >+++ b/Source/WebCore/style/InlineTextBoxStyle.cpp >@@ -125,6 +125,7 @@ GlyphOverflow visualOverflowForDecorations(const RenderStyle& lineStyle, const I > } > > // These metrics must match where underlines get drawn. >+ // FIXME: Share the code in TextDecorationPainter::paintTextDecoration() so we can just query it for the painted geometry. > if (decoration & TextDecoration::Underline) { > // Compensate for the integral ceiling in GraphicsContext::computeLineBoundsAndAntialiasingModeForText() > int underlineOffset = 1; >@@ -140,23 +141,31 @@ GlyphOverflow visualOverflowForDecorations(const RenderStyle& lineStyle, const I > } > } > if (decoration & TextDecoration::Overline) { >+ FloatRect rect(FloatPoint(), FloatSize(1, strokeThickness)); >+ float autoTextDecorationThickness = TextDecorationThickness::createWithAuto().resolve(lineStyle.computedFontSize(), lineStyle.fontMetrics()); >+ rect.move(0, autoTextDecorationThickness - strokeThickness - wavyOffset); > if (decorationStyle == TextDecorationStyle::Wavy) { >- extendIntToFloat(overflowResult.bottom, -wavyOffset + wavyStrokeParameters.controlPointDistance + strokeThickness - height); >- extendIntToFloat(overflowResult.top, wavyOffset + wavyStrokeParameters.controlPointDistance + strokeThickness); >- } else { >- extendIntToFloat(overflowResult.bottom, strokeThickness - height); >- // top is untouched >+ FloatBoxExtent wavyExpansion; >+ wavyExpansion.setTop(wavyStrokeParameters.controlPointDistance); >+ wavyExpansion.setBottom(wavyStrokeParameters.controlPointDistance); >+ rect.expand(wavyExpansion); > } >+ extendIntToFloat(overflowResult.top, -rect.y()); >+ extendIntToFloat(overflowResult.bottom, rect.maxY() - height); > } > if (decoration & TextDecoration::LineThrough) { >- float baseline = lineStyle.fontMetrics().floatAscent(); >+ FloatRect rect(FloatPoint(), FloatSize(1, strokeThickness)); >+ float autoTextDecorationThickness = TextDecorationThickness::createWithAuto().resolve(lineStyle.computedFontSize(), lineStyle.fontMetrics()); >+ auto center = 2 * lineStyle.fontMetrics().floatAscent() / 3 + autoTextDecorationThickness / 2; >+ rect.move(0, center - strokeThickness / 2); > if (decorationStyle == TextDecorationStyle::Wavy) { >- extendIntToFloat(overflowResult.bottom, 2 * baseline / 3 + wavyStrokeParameters.controlPointDistance + strokeThickness - height); >- extendIntToFloat(overflowResult.top, -(2 * baseline / 3 - wavyStrokeParameters.controlPointDistance - strokeThickness)); >- } else { >- extendIntToFloat(overflowResult.bottom, 2 * baseline / 3 + strokeThickness - height); >- extendIntToFloat(overflowResult.top, -(2 * baseline / 3)); >+ FloatBoxExtent wavyExpansion; >+ wavyExpansion.setTop(wavyStrokeParameters.controlPointDistance); >+ wavyExpansion.setBottom(wavyStrokeParameters.controlPointDistance); >+ rect.expand(wavyExpansion); > } >+ extendIntToFloat(overflowResult.top, -rect.y()); >+ extendIntToFloat(overflowResult.bottom, rect.maxY() - height); > } > return overflowResult; > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index bbc008dc136cef19c57e722e71efeebd303bc995..3e1f675524929b2f6d877c9ffc6221bd3c811d71 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,15 @@ >+2018-12-03 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ Thick overlines and line-throughs grow in the wrong direction >+ https://bugs.webkit.org/show_bug.cgi?id=192264 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ I can't figure out a way to test the line-through, so this just tests the overline. >+ >+ * fast/css3-text/css3-text-decoration/text-decoration-thicknes-overline-grow-direction-expected.html: Added. >+ * fast/css3-text/css3-text-decoration/text-decoration-thicknes-overline-grow-direction.html: Added. >+ > 2018-12-03 Daniel Bates <dabates@apple.com> > > [iOS] Do not handle key events that are key commands >diff --git a/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thicknes-overline-grow-direction-expected.html b/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thicknes-overline-grow-direction-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..5001c718424d53cc40044bebba4e552d6a72991c >--- /dev/null >+++ b/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thicknes-overline-grow-direction-expected.html >@@ -0,0 +1,9 @@ >+<!DOCTYPE html> >+<html> >+<head> >+</head> >+<body> >+This test makes sure that overlines grow upward. The test passes if the overline on the text below has the default thickness. >+<div style="font-size: 48px; text-decoration: overline;">Hello</div> >+</body> >+</html> >diff --git a/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thicknes-overline-grow-direction.html b/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thicknes-overline-grow-direction.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c10f09b06eeede33247e7b3a96c5ca558a9aff0e >--- /dev/null >+++ b/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thicknes-overline-grow-direction.html >@@ -0,0 +1,9 @@ >+<!DOCTYPE html> >+<html> >+<head> >+</head> >+<body> >+This test makes sure that overlines grow upward. The test passes if the overline on the text below has the default thickness. >+<div style="font-size: 48px; text-decoration: overline; overflow: hidden; text-decoration-thickness: 10px;">Hello</div> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192264
:
356256
|
356261
|
356276
|
356281
|
356283
|
356292
|
356299
|
356437
|
356553
|
356568