Title: [222862] trunk/Source/WebCore
Revision
222862
Author
dba...@webkit.org
Date
2017-10-04 11:37:47 -0700 (Wed, 04 Oct 2017)

Log Message

TextDecorationPainter::m_wavyOffset should be a float
https://bugs.webkit.org/show_bug.cgi?id=177883

Reviewed by Simon Fraser.

In r194447 we extracted the text decoration painting code from InlineTextBox into
TextDecorationPainter and changed the data type of the wavy offset from float to int.
We use floating point numbers throughout the painting code and should store the wavy
offset as a float.

* rendering/TextDecorationPainter.cpp:
(WebCore::TextDecorationPainter::TextDecorationPainter): Use C++ uniform initializer
syntax to initialize member fields.
(WebCore::TextDecorationPainter::paintTextDecoration): Change int to float.
* rendering/TextDecorationPainter.h: Remove unnecessary equal initializer for m_wavyOffset
as this class has exactly one constructor and it always initializes it.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (222861 => 222862)


--- trunk/Source/WebCore/ChangeLog	2017-10-04 18:32:28 UTC (rev 222861)
+++ trunk/Source/WebCore/ChangeLog	2017-10-04 18:37:47 UTC (rev 222862)
@@ -1,3 +1,22 @@
+2017-10-04  Daniel Bates  <daba...@apple.com>
+
+        TextDecorationPainter::m_wavyOffset should be a float
+        https://bugs.webkit.org/show_bug.cgi?id=177883
+
+        Reviewed by Simon Fraser.
+
+        In r194447 we extracted the text decoration painting code from InlineTextBox into
+        TextDecorationPainter and changed the data type of the wavy offset from float to int.
+        We use floating point numbers throughout the painting code and should store the wavy
+        offset as a float.
+
+        * rendering/TextDecorationPainter.cpp:
+        (WebCore::TextDecorationPainter::TextDecorationPainter): Use C++ uniform initializer
+        syntax to initialize member fields.
+        (WebCore::TextDecorationPainter::paintTextDecoration): Change int to float.
+        * rendering/TextDecorationPainter.h: Remove unnecessary equal initializer for m_wavyOffset
+        as this class has exactly one constructor and it always initializes it.
+
 2017-10-04  Youenn Fablet  <you...@apple.com>
 
         Remove OpenWebRTC backend

Modified: trunk/Source/WebCore/rendering/TextDecorationPainter.cpp (222861 => 222862)


--- trunk/Source/WebCore/rendering/TextDecorationPainter.cpp	2017-10-04 18:32:28 UTC (rev 222861)
+++ trunk/Source/WebCore/rendering/TextDecorationPainter.cpp	2017-10-04 18:37:47 UTC (rev 222862)
@@ -242,12 +242,12 @@
 }
 
 TextDecorationPainter::TextDecorationPainter(GraphicsContext& context, TextDecoration decoration, const RenderText& renderer, bool isFirstLine)
-    : m_context(context)
-    , m_decoration(decoration)
-    , m_wavyOffset(wavyOffsetFromDecoration())
-    , m_isPrinting(renderer.document().printing())
-    , m_styles(stylesForRenderer(renderer, m_decoration, isFirstLine))
-    , m_lineStyle(isFirstLine ? renderer.firstLineStyle() : renderer.style())
+    : m_context { context }
+    , m_decoration { decoration }
+    , m_wavyOffset { wavyOffsetFromDecoration() }
+    , m_isPrinting { renderer.document().printing() }
+    , m_styles { stylesForRenderer(renderer, m_decoration, isFirstLine) }
+    , m_lineStyle { isFirstLine ? renderer.firstLineStyle() : renderer.style() }
 {
 }
 
@@ -327,13 +327,13 @@
         // These decorations should match the visual overflows computed in visualOverflowForDecorations()
         if (m_decoration & TextDecorationUnderline) {
             const int offset = computeUnderlineOffset(m_lineStyle.textUnderlinePosition(), m_lineStyle.fontMetrics(), m_inlineTextBox, textDecorationThickness);
-            int wavyOffset = m_styles.underlineStyle == TextDecorationStyleWavy ? m_wavyOffset : 0;
+            float wavyOffset = m_styles.underlineStyle == TextDecorationStyleWavy ? m_wavyOffset : 0;
             FloatPoint start = localOrigin + FloatSize(0, offset + wavyOffset);
             FloatPoint end = localOrigin + FloatSize(m_width, offset + wavyOffset);
             paintDecoration(TextDecorationUnderline, m_styles.underlineStyle, m_styles.underlineColor, start, end, offset);
         }
         if (m_decoration & TextDecorationOverline) {
-            int wavyOffset = m_styles.overlineStyle == TextDecorationStyleWavy ? m_wavyOffset : 0;
+            float wavyOffset = m_styles.overlineStyle == TextDecorationStyleWavy ? m_wavyOffset : 0;
             FloatPoint start = localOrigin - FloatSize(0, wavyOffset);
             FloatPoint end = localOrigin + FloatSize(m_width, -wavyOffset);
             paintDecoration(TextDecorationOverline, m_styles.overlineStyle, m_styles.overlineColor, start, end, 0);

Modified: trunk/Source/WebCore/rendering/TextDecorationPainter.h (222861 => 222862)


--- trunk/Source/WebCore/rendering/TextDecorationPainter.h	2017-10-04 18:32:28 UTC (rev 222861)
+++ trunk/Source/WebCore/rendering/TextDecorationPainter.h	2017-10-04 18:37:47 UTC (rev 222862)
@@ -64,7 +64,7 @@
 private:
     GraphicsContext& m_context;
     TextDecoration m_decoration;
-    int m_wavyOffset { 0 };
+    float m_wavyOffset;
     bool m_isPrinting { false };
     float m_width { 0 };
     float m_baseline { 0 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to