Log Message
text-decoration: line-through is mispositioned when text has overline/underline too. https://bugs.webkit.org/show_bug.cgi?id=152619
Reviewed by Simon Fraser. Line-through painting was mistakenly calling drawLineForText with overline/underline positioning. Source/WebCore: Test: fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintDecoration): Deleted. * rendering/TextDecorationPainter.cpp: (WebCore::TextDecorationPainter::paintTextDecoration): LayoutTests: * fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html: Added. * fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html: Added.
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/rendering/InlineTextBox.cpp
- trunk/Source/WebCore/rendering/TextDecorationPainter.cpp
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (194464 => 194465)
--- trunk/LayoutTests/ChangeLog 2015-12-31 19:53:21 UTC (rev 194464)
+++ trunk/LayoutTests/ChangeLog 2015-12-31 19:57:25 UTC (rev 194465)
@@ -1,5 +1,17 @@
2015-12-31 Zalan Bujtas <[email protected]>
+ text-decoration: line-through is mispositioned when text has overline/underline too.
+ https://bugs.webkit.org/show_bug.cgi?id=152619
+
+ Reviewed by Simon Fraser.
+
+ Line-through painting was mistakenly calling drawLineForText with overline/underline positioning.
+
+ * fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html: Added.
+ * fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html: Added.
+
+2015-12-31 Zalan Bujtas <[email protected]>
+
Simple line layout: Text with stroke width is not positioned correctly.
https://bugs.webkit.org/show_bug.cgi?id=152614
Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html (0 => 194465)
--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html 2015-12-31 19:57:25 UTC (rev 194465)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that line-through is positioned properly.</title>
+<style>
+ div {
+ border-top: 3px solid green;
+ position: absolute;
+ left: 20px;
+ top: 33px;
+ width: 120px;
+ height: 1px;
+ }
+</style>
+</head>
+<body>
+<div></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html (0 => 194465)
--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html 2015-12-31 19:57:25 UTC (rev 194465)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that line-through is positioned properly.</title>
+<style>
+ body {
+ font-family: Ahem;
+ font-size: 48px;
+ color: white;
+ }
+ #blue-underline {
+ text-decoration: underline;
+ -webkit-text-decoration-color: white;
+ }
+
+ #green-line-through {
+ text-decoration: line-through;
+ -webkit-text-decoration-color: green;
+ }
+
+ div {
+ position: relative;
+ top: 0px;
+ left: 0px;
+ }
+
+</style>
+</head>
+<body>
+<div id="blue-underline">
+ <div id="green-line-through">foo</div>
+</div>
+<div style="position: absolute; left: 0px; top: 20px; width: 20px; height: 20px; background-color: white"></div>
+<div style="position: absolute; left: 140px; top: 20px; width: 20px; height: 20px; background-color: white"></div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (194464 => 194465)
--- trunk/Source/WebCore/ChangeLog 2015-12-31 19:53:21 UTC (rev 194464)
+++ trunk/Source/WebCore/ChangeLog 2015-12-31 19:57:25 UTC (rev 194465)
@@ -1,3 +1,19 @@
+2015-12-31 Zalan Bujtas <[email protected]>
+
+ text-decoration: line-through is mispositioned when text has overline/underline too.
+ https://bugs.webkit.org/show_bug.cgi?id=152619
+
+ Reviewed by Simon Fraser.
+
+ Line-through painting was mistakenly calling drawLineForText with overline/underline positioning.
+
+ Test: fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html
+
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::paintDecoration): Deleted.
+ * rendering/TextDecorationPainter.cpp:
+ (WebCore::TextDecorationPainter::paintTextDecoration):
+
2015-12-31 Simon Fraser <[email protected]>
Clarify that scrollPositionChangedViaPlatformWidget takes offsets
Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (194464 => 194465)
--- trunk/Source/WebCore/rendering/InlineTextBox.cpp 2015-12-31 19:53:21 UTC (rev 194464)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp 2015-12-31 19:57:25 UTC (rev 194465)
@@ -702,11 +702,6 @@
void InlineTextBox::paintDecoration(GraphicsContext& context, const FontCascade& font, const TextRun& textRun, const FloatPoint& textOrigin, const FloatPoint& boxOrigin,
TextDecoration decoration, const ShadowData* shadow)
{
-#if !ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
- UNUSED_PARAM(font);
- UNUSED_PARAM(textRun);
- UNUSED_PARAM(textOrigin);
-#endif
if (m_truncation == cFullTruncation)
return;
Modified: trunk/Source/WebCore/rendering/TextDecorationPainter.cpp (194464 => 194465)
--- trunk/Source/WebCore/rendering/TextDecorationPainter.cpp 2015-12-31 19:53:21 UTC (rev 194464)
+++ trunk/Source/WebCore/rendering/TextDecorationPainter.cpp 2015-12-31 19:57:25 UTC (rev 194465)
@@ -255,19 +255,23 @@
void TextDecorationPainter::paintTextDecoration(const TextRun& textRun, const FloatPoint& textOrigin, const FloatPoint& boxOrigin)
{
+#if !ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
+ UNUSED_PARAM(textRun);
+ UNUSED_PARAM(textOrigin);
+#endif
ASSERT(m_font);
float textDecorationThickness = textDecorationStrokeThickness(m_lineStyle.fontSize());
m_context.setStrokeThickness(textDecorationThickness);
FloatPoint localOrigin = boxOrigin;
- auto paintDecoration = [&](TextDecorationStyle style, Color color, StrokeStyle strokeStyle,
+ auto paintDecoration = [&](TextDecoration decoration, TextDecorationStyle style, Color color, StrokeStyle strokeStyle,
const FloatPoint& start, const FloatPoint& end, int offset) {
m_context.setStrokeColor(color);
m_context.setStrokeStyle(strokeStyle);
if (style == TextDecorationStyleWavy) {
strokeWavyTextDecoration(m_context, start, end, textDecorationThickness);
- } else if (m_decoration & TextDecorationUnderline || m_decoration & TextDecorationOverline) {
+ } else if (decoration == TextDecorationUnderline || decoration == TextDecorationOverline) {
#if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
if ((m_lineStyle.textDecorationSkip() == TextDecorationSkipInk || m_lineStyle.textDecorationSkip() == TextDecorationSkipAuto) && m_isHorizontal) {
if (!m_context.paintingDisabled())
@@ -278,7 +282,7 @@
m_context.drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + offset), m_width, m_isPrinting, style == TextDecorationStyleDouble);
} else {
- ASSERT(m_decoration & TextDecorationLineThrough);
+ ASSERT(decoration == TextDecorationLineThrough);
m_context.drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + 2 * m_baseline / 3), m_width, m_isPrinting, style == TextDecorationStyleDouble);
}
};
@@ -327,17 +331,17 @@
const int offset = computeUnderlineOffset(m_lineStyle.textUnderlinePosition(), m_lineStyle.fontMetrics(), m_inlineTextBox, textDecorationThickness);
FloatPoint start(localOrigin.x(), localOrigin.y() + offset + m_wavyOffset);
FloatPoint end(localOrigin.x() + m_width, localOrigin.y() + offset + m_wavyOffset);
- paintDecoration(m_underlineStyle, m_underlineColor, textDecorationStyleToStrokeStyle(m_underlineStyle), start, end, offset);
+ paintDecoration(TextDecorationUnderline, m_underlineStyle, m_underlineColor, textDecorationStyleToStrokeStyle(m_underlineStyle), start, end, offset);
}
if (m_decoration & TextDecorationOverline) {
FloatPoint start(localOrigin.x(), localOrigin.y() - m_wavyOffset);
FloatPoint end(localOrigin.x() + m_width, localOrigin.y() - m_wavyOffset);
- paintDecoration(m_overlineStyle, m_overlineColor, textDecorationStyleToStrokeStyle(m_overlineStyle), start, end, 0);
+ paintDecoration(TextDecorationOverline, m_overlineStyle, m_overlineColor, textDecorationStyleToStrokeStyle(m_overlineStyle), start, end, 0);
}
if (m_decoration & TextDecorationLineThrough) {
FloatPoint start(localOrigin.x(), localOrigin.y() + 2 * m_baseline / 3);
FloatPoint end(localOrigin.x() + m_width, localOrigin.y() + 2 * m_baseline / 3);
- paintDecoration(m_linethroughStyle, m_linethroughColor, textDecorationStyleToStrokeStyle(m_linethroughStyle), start, end, 0);
+ paintDecoration(TextDecorationLineThrough, m_linethroughStyle, m_linethroughColor, textDecorationStyleToStrokeStyle(m_linethroughStyle), start, end, 0);
}
} while (shadow);
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
