Title: [161608] trunk
Revision
161608
Author
mmaxfi...@apple.com
Date
2014-01-09 17:29:56 -0800 (Thu, 09 Jan 2014)

Log Message

text-decoration-skip: ink does not work with line wraps
https://bugs.webkit.org/show_bug.cgi?id=126729

Reviewed by Simon Fraser.

Source/WebCore:

InlineTextBox's m_start and m_length fields are offsets into the renderer's string,
not the generated TextRun. Because of this distinction, when multiple InlineTextBoxes
were constructed for the same element, all the subsequent elements would use incorrect
indices and therefore not have skipping decorations.

Test: fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-multiline.html

* platform/graphics/Font.h:
* platform/graphics/mac/FontMac.mm:
(WebCore::Font::dashesForIntersectionsWithRect):
* rendering/InlineTextBox.cpp:
(WebCore::drawSkipInkUnderline):
(WebCore::InlineTextBox::paintDecoration):
* rendering/TextPainter.cpp:
(WebCore::TextPainter::dashesForIntersectionsWithRect):
* rendering/TextPainter.h:

LayoutTests:

This test compares rending of a single element that wraps lines with one element per line.
Both elements have text-decoration-skip:ink turned on.

* fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-multiline-expected.html: Added.
* fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-multiline.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (161607 => 161608)


--- trunk/LayoutTests/ChangeLog	2014-01-10 01:24:53 UTC (rev 161607)
+++ trunk/LayoutTests/ChangeLog	2014-01-10 01:29:56 UTC (rev 161608)
@@ -1,3 +1,16 @@
+2014-01-09  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        text-decoration-skip: ink does not work with line wraps
+        https://bugs.webkit.org/show_bug.cgi?id=126729
+
+        Reviewed by Simon Fraser.
+
+        This test compares rending of a single element that wraps lines with one element per line.
+        Both elements have text-decoration-skip:ink turned on.
+
+        * fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-multiline-expected.html: Added.
+        * fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-multiline.html: Added.
+
 2014-01-09  Zoltan Horvath  <zol...@webkit.org>
 
         [CSS Shapes] First line gets incorrectly adjusted in shape-inside due to rounding

Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-multiline-expected.html (0 => 161608)


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-multiline-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-multiline-expected.html	2014-01-10 01:29:56 UTC (rev 161608)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that text-decoration-skip: ink is applied on elements that wrap lines
+<div style="text-decoration: underline; -webkit-text-decoration-skip: ink; width: 300px;">thisisalongstringofcharactersthatshouldlinewrap</div>
+<div style="text-decoration: underline; -webkit-text-decoration-skip: ink; width: 300px;">thisisalongstringofcharactersthatshouldlinewrap</div>
+<div style="text-decoration: underline; -webkit-text-decoration-skip: ink; width: 300px;">thisisalongstringofcharactersthatshouldlinewrap</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-multiline.html (0 => 161608)


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-multiline.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-multiline.html	2014-01-10 01:29:56 UTC (rev 161608)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that text-decoration-skip: ink is applied on elements that wrap lines
+<div style="text-decoration: underline; -webkit-text-decoration-skip: ink; width: 300px;">thisisalongstringofcharactersthatshouldlinewrap thisisalongstringofcharactersthatshouldlinewrap thisisalongstringofcharactersthatshouldlinewrap</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (161607 => 161608)


--- trunk/Source/WebCore/ChangeLog	2014-01-10 01:24:53 UTC (rev 161607)
+++ trunk/Source/WebCore/ChangeLog	2014-01-10 01:29:56 UTC (rev 161608)
@@ -1,3 +1,27 @@
+2014-01-09  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        text-decoration-skip: ink does not work with line wraps
+        https://bugs.webkit.org/show_bug.cgi?id=126729
+
+        Reviewed by Simon Fraser.
+
+        InlineTextBox's m_start and m_length fields are offsets into the renderer's string,
+        not the generated TextRun. Because of this distinction, when multiple InlineTextBoxes
+        were constructed for the same element, all the subsequent elements would use incorrect
+        indices and therefore not have skipping decorations.
+
+        Test: fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-multiline.html
+
+        * platform/graphics/Font.h:
+        * platform/graphics/mac/FontMac.mm:
+        (WebCore::Font::dashesForIntersectionsWithRect):
+        * rendering/InlineTextBox.cpp:
+        (WebCore::drawSkipInkUnderline):
+        (WebCore::InlineTextBox::paintDecoration):
+        * rendering/TextPainter.cpp:
+        (WebCore::TextPainter::dashesForIntersectionsWithRect):
+        * rendering/TextPainter.h:
+
 2014-01-09  Benjamin Poulain  <bpoul...@apple.com>
 
         Remove remaining blackberry files I could find in WebCore

Modified: trunk/Source/WebCore/platform/graphics/Font.h (161607 => 161608)


--- trunk/Source/WebCore/platform/graphics/Font.h	2014-01-10 01:24:53 UTC (rev 161607)
+++ trunk/Source/WebCore/platform/graphics/Font.h	2014-01-10 01:29:56 UTC (rev 161608)
@@ -106,7 +106,7 @@
     float drawText(GraphicsContext*, const TextRun&, const FloatPoint&, int from = 0, int to = -1, CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const;
     void drawEmphasisMarks(GraphicsContext*, const TextRun&, const AtomicString& mark, const FloatPoint&, int from = 0, int to = -1) const;
 
-    DashArray dashesForIntersectionsWithRect(const TextRun&, const FloatPoint& textOrigin, int from, int to, const FloatRect& lineExtents) const;
+    DashArray dashesForIntersectionsWithRect(const TextRun&, const FloatPoint& textOrigin, const FloatRect& lineExtents) const;
 
     float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
     float width(const TextRun&, int& charsConsumed, String& glyphName) const;

Modified: trunk/Source/WebCore/platform/graphics/mac/FontMac.mm (161607 => 161608)


--- trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2014-01-10 01:24:53 UTC (rev 161607)
+++ trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2014-01-10 01:29:56 UTC (rev 161608)
@@ -436,14 +436,14 @@
     state.currentPoint = point;
 }
 
-DashArray Font::dashesForIntersectionsWithRect(const TextRun& run, const FloatPoint& textOrigin, int textRunStartIndex, int textRunEndIndex, const FloatRect& lineExtents) const
+DashArray Font::dashesForIntersectionsWithRect(const TextRun& run, const FloatPoint& textOrigin, const FloatRect& lineExtents) const
 {
     float deltaX;
     GlyphBuffer glyphBuffer;
     if (codePath(run) != Complex)
-        deltaX = getGlyphsAndAdvancesForSimpleText(run, textRunStartIndex, textRunEndIndex, glyphBuffer);
+        deltaX = getGlyphsAndAdvancesForSimpleText(run, 0, run.length(), glyphBuffer);
     else
-        deltaX = getGlyphsAndAdvancesForComplexText(run, textRunStartIndex, textRunEndIndex, glyphBuffer);
+        deltaX = getGlyphsAndAdvancesForComplexText(run, 0, run.length(), glyphBuffer);
     CGAffineTransform translation = CGAffineTransformMakeTranslation(textOrigin.x() + deltaX, textOrigin.y());
     translation = CGAffineTransformScale(translation, 1, -1);
     DashArray result;

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (161607 => 161608)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2014-01-10 01:24:53 UTC (rev 161607)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2014-01-10 01:29:56 UTC (rev 161608)
@@ -118,12 +118,12 @@
     return result;
 }
 
-static void drawSkipInkUnderline(TextPainter& textPainter, GraphicsContext& context, FloatPoint localOrigin, float underlineOffset, float width, bool isPrinting, int m_start, int m_len)
+static void drawSkipInkUnderline(TextPainter& textPainter, GraphicsContext& context, FloatPoint localOrigin, float underlineOffset, float width, bool isPrinting)
 {
     FloatPoint adjustedLocalOrigin = localOrigin;
     adjustedLocalOrigin.move(0, underlineOffset);
     FloatRect underlineBoundingBox = context.computeLineBoundsForText(adjustedLocalOrigin, width, isPrinting);
-    DashArray intersections = textPainter.dashesForIntersectionsWithRect(underlineBoundingBox, m_start, m_start + m_len);
+    DashArray intersections = textPainter.dashesForIntersectionsWithRect(underlineBoundingBox);
     DashArray a = translateIntersectionPointsToSkipInkBoundaries(intersections, underlineBoundingBox.height(), width);
 
     ASSERT(!(a.size() % 2));
@@ -1185,10 +1185,10 @@
 #if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
                 if (lineStyle.textDecorationSkip() == TextDecorationSkipInk) {
                     if (!context.paintingDisabled()) {
-                        drawSkipInkUnderline(textPainter, context, localOrigin, underlineOffset, width, isPrinting, m_start, m_len);
+                        drawSkipInkUnderline(textPainter, context, localOrigin, underlineOffset, width, isPrinting);
 
                         if (decorationStyle == TextDecorationStyleDouble)
-                            drawSkipInkUnderline(textPainter, context, localOrigin, underlineOffset + doubleOffset, width, isPrinting, m_start, m_len);
+                            drawSkipInkUnderline(textPainter, context, localOrigin, underlineOffset + doubleOffset, width, isPrinting);
                     }
                 } else {
 #endif // CSS3_TEXT_DECORATION_SKIP_INK
@@ -1219,10 +1219,10 @@
 #if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
                 if (lineStyle.textDecorationSkip() == TextDecorationSkipInk) {
                     if (!context.paintingDisabled()) {
-                        drawSkipInkUnderline(textPainter, context, localOrigin, 0, width, isPrinting, m_start, m_len);
+                        drawSkipInkUnderline(textPainter, context, localOrigin, 0, width, isPrinting);
 
                         if (decorationStyle == TextDecorationStyleDouble)
-                            drawSkipInkUnderline(textPainter, context, localOrigin, -doubleOffset, width, isPrinting, m_start, m_len);
+                            drawSkipInkUnderline(textPainter, context, localOrigin, -doubleOffset, width, isPrinting);
                     }
                 } else {
 #endif // CSS3_TEXT_DECORATION_SKIP_INK

Modified: trunk/Source/WebCore/rendering/TextPainter.cpp (161607 => 161608)


--- trunk/Source/WebCore/rendering/TextPainter.cpp	2014-01-10 01:24:53 UTC (rev 161607)
+++ trunk/Source/WebCore/rendering/TextPainter.cpp	2014-01-10 01:29:56 UTC (rev 161608)
@@ -177,9 +177,9 @@
 }
 
 #if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
-DashArray TextPainter::dashesForIntersectionsWithRect(const FloatRect& lineExtents, int textRunStartIndex, int textRunEndIndex)
+DashArray TextPainter::dashesForIntersectionsWithRect(const FloatRect& lineExtents)
 {
-    return m_font.dashesForIntersectionsWithRect(m_textRun, m_textOrigin, textRunStartIndex, textRunEndIndex, lineExtents);
+    return m_font.dashesForIntersectionsWithRect(m_textRun, m_textOrigin, lineExtents);
 }
 #endif
 

Modified: trunk/Source/WebCore/rendering/TextPainter.h (161607 => 161608)


--- trunk/Source/WebCore/rendering/TextPainter.h	2014-01-10 01:24:53 UTC (rev 161607)
+++ trunk/Source/WebCore/rendering/TextPainter.h	2014-01-10 01:29:56 UTC (rev 161608)
@@ -68,7 +68,7 @@
     void paintText();
     void paintTextInContext(GraphicsContext&, float amountToIncreaseStrokeWidthBy);
 
-    DashArray dashesForIntersectionsWithRect(const FloatRect& lineExtents, int textRunStartIndex, int textRunEndIndex);
+    DashArray dashesForIntersectionsWithRect(const FloatRect& lineExtents);
 
 private:
     bool m_paintSelectedTextOnly;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to