Title: [229328] trunk/Source/WebCore
Revision
229328
Author
mmaxfi...@apple.com
Date
2018-03-06 10:35:49 -0800 (Tue, 06 Mar 2018)

Log Message

Change the type of SVGToOTFFontConverter::m_weight to be not a char
https://bugs.webkit.org/show_bug.cgi?id=183339

Reviewed by Alex Christensen.

No new tests because there is no behavior change.

* svg/SVGToOTFFontConversion.cpp:
(WebCore::SVGToOTFFontConverter::appendOS2Table):
(WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (229327 => 229328)


--- trunk/Source/WebCore/ChangeLog	2018-03-06 18:34:22 UTC (rev 229327)
+++ trunk/Source/WebCore/ChangeLog	2018-03-06 18:35:49 UTC (rev 229328)
@@ -1,3 +1,16 @@
+2018-03-06  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Change the type of SVGToOTFFontConverter::m_weight to be not a char
+        https://bugs.webkit.org/show_bug.cgi?id=183339
+
+        Reviewed by Alex Christensen.
+
+        No new tests because there is no behavior change.
+
+        * svg/SVGToOTFFontConversion.cpp:
+        (WebCore::SVGToOTFFontConverter::appendOS2Table):
+        (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter):
+
 2018-03-06  Antoine Quint  <grao...@apple.com>
 
         [Web Animations] Add a new CSSAnimation subclass of WebAnimation

Modified: trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp (229327 => 229328)


--- trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp	2018-03-06 18:34:22 UTC (rev 229327)
+++ trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp	2018-03-06 18:35:49 UTC (rev 229328)
@@ -264,7 +264,7 @@
     int m_descent;
     unsigned m_featureCountGSUB;
     unsigned m_tablesAppendedCount;
-    char m_weight;
+    uint8_t m_weight;
     bool m_italic;
     bool m_error { false };
 };
@@ -499,7 +499,7 @@
 
     append16(2); // Version
     append16(clampTo<int16_t>(averageAdvance));
-    append16(clampTo<uint16_t>(m_weight)); // Weight class
+    append16(m_weight); // Weight class
     append16(5); // Width class
     append16(0); // Protected font
     // WebKit handles these superscripts and subscripts
@@ -525,7 +525,7 @@
             for (auto& segment : segments) {
                 bool ok;
                 int value = segment.toInt(&ok);
-                if (ok && value >= 0 && value <= 0xFF)
+                if (ok && value >= std::numeric_limits<uint8_t>::min() && value <= std::numeric_limits<uint8_t>::max())
                     panoseBytes[numPanoseBytes++] = value;
             }
         }
@@ -1461,7 +1461,7 @@
             bool ok;
             int value = segment.toInt(ok);
             if (ok && value >= 0 && value < 1000) {
-                m_weight = (value + 50) / 100;
+                m_weight = std::max(std::min((value + 50) / 100, static_cast<int>(std::numeric_limits<uint8_t>::max())), static_cast<int>(std::numeric_limits<uint8_t>::min()));
                 break;
             }
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to