<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>183339</bug_id>
          
          <creation_ts>2018-03-05 11:17:07 -0800</creation_ts>
          <short_desc>Change the type of SVGToOTFFontConverter::m_weight to be not a char</short_desc>
          <delta_ts>2018-03-10 17:52:34 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>SVG</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Said Abou-Hallawa">sabouhallawa</reporter>
          <assigned_to name="Myles C. Maxfield">mmaxfield</assigned_to>
          <cc>achristensen</cc>
    
    <cc>commit-queue</cc>
    
    <cc>darin</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1403683</commentid>
    <comment_count>0</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2018-03-05 11:17:07 -0800</bug_when>
    <thetext>This is a follow up for Darin&apos;s comment in https://bugs.webkit.org/show_bug.cgi?id=183165#c2. If m_weight is negative, clampTo&lt;uint16_t&gt; or static_cast&lt;uint16_t&gt; will give the wrong value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1403880</commentid>
    <comment_count>1</comment_count>
    <who name="Myles C. Maxfield">mmaxfield</who>
    <bug_when>2018-03-05 20:03:21 -0800</bug_when>
    <thetext>m_result is a Vector&lt;char&gt; because that&apos;s what SharedBuffer::create() accepts.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1403881</commentid>
    <comment_count>2</comment_count>
      <attachid>335067</attachid>
    <who name="Myles C. Maxfield">mmaxfield</who>
    <bug_when>2018-03-05 20:16:11 -0800</bug_when>
    <thetext>Created attachment 335067
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1404054</commentid>
    <comment_count>3</comment_count>
      <attachid>335067</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2018-03-06 10:35:54 -0800</bug_when>
    <thetext>Comment on attachment 335067
Patch

Clearing flags on attachment: 335067

Committed r229328: &lt;https://trac.webkit.org/changeset/229328&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1404055</commentid>
    <comment_count>4</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2018-03-06 10:36:13 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1404056</commentid>
    <comment_count>5</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2018-03-06 10:37:21 -0800</bug_when>
    <thetext>&lt;rdar://problem/38185027&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1404258</commentid>
    <comment_count>6</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2018-03-06 20:36:46 -0800</bug_when>
    <thetext>(In reply to Myles C. Maxfield from comment #1)
&gt; m_result is a Vector&lt;char&gt; because that&apos;s what SharedBuffer::create()
&gt; accepts.

At some point I intend to change Vector&lt;char&gt; to Vector&lt;uint8_t&gt; throughout WebKit for this sort of thing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1404260</commentid>
    <comment_count>7</comment_count>
    <who name="Myles C. Maxfield">mmaxfield</who>
    <bug_when>2018-03-06 20:46:18 -0800</bug_when>
    <thetext>(In reply to Darin Adler from comment #6)
&gt; (In reply to Myles C. Maxfield from comment #1)
&gt; &gt; m_result is a Vector&lt;char&gt; because that&apos;s what SharedBuffer::create()
&gt; &gt; accepts.
&gt; 
&gt; At some point I intend to change Vector&lt;char&gt; to Vector&lt;uint8_t&gt; throughout
&gt; WebKit for this sort of thing.

Yes! 👍</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1405523</commentid>
    <comment_count>8</comment_count>
      <attachid>335067</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2018-03-10 17:52:34 -0800</bug_when>
    <thetext>Comment on attachment 335067
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=335067&amp;action=review

&gt; Source/WebCore/svg/SVGToOTFFontConversion.cpp:528
&gt; +                if (ok &amp;&amp; value &gt;= std::numeric_limits&lt;uint8_t&gt;::min() &amp;&amp; value &lt;= std::numeric_limits&lt;uint8_t&gt;::max())

If this pattern is common I think we should add a helper function.

&gt; Source/WebCore/svg/SVGToOTFFontConversion.cpp:1464
&gt; +                m_weight = std::max(std::min((value + 50) / 100, static_cast&lt;int&gt;(std::numeric_limits&lt;uint8_t&gt;::max())), static_cast&lt;int&gt;(std::numeric_limits&lt;uint8_t&gt;::min()));

This is what clampTo is for, and it’s much easier to read:

    m_weight = clampTo&lt;uint8_t&gt;((value + 50) / 100);</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>335067</attachid>
            <date>2018-03-05 20:16:11 -0800</date>
            <delta_ts>2018-03-06 10:35:54 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-183339-20180305201610.patch</filename>
            <type>text/plain</type>
            <size>2685</size>
            <attacher name="Myles C. Maxfield">mmaxfield</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjI5MzAzCmRpZm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GVuZDE2KDUpOyAvLyBXaWR0aCBjbGFzcwogICAgIGFw
cGVuZDE2KDApOyAvLyBQcm90ZWN0ZWQgZm9udAogICAgIC8vIFdlYktpdCBoYW5kbGVzIHRoZXNl
IHN1cGVyc2NyaXB0cyBhbmQgc3Vic2NyaXB0cwpAQCAtNTI1LDcgKzUyNSw3IEBAIHZvaWQgU1ZH
VG9PVEZGb250Q29udmVydGVyOjphcHBlbmRPUzJUYWJsZSgpCiAgICAgICAgICAgICBmb3IgKGF1
dG8mIHNlZ21lbnQgOiBzZWdtZW50cykgewogICAgICAgICAgICAgICAgIGJvb2wgb2s7CiAgICAg
ICAgICAgICAgICAgaW50IHZhbHVlID0gc2VnbWVudC50b0ludCgmb2spOwotICAgICAgICAgICAg
ICAgIGlmIChvayAmJiB2YWx1ZSA+PSAwICYmIHZhbHVlIDw9IDB4RkYpCisgICAgICAgICAgICAg
ICAgaWYgKG9rICYmIHZhbHVlID49IHN0ZDo6bnVtZXJpY19saW1pdHM8dWludDhfdD46Om1pbigp
ICYmIHZhbHVlIDw9IHN0ZDo6bnVtZXJpY19saW1pdHM8dWludDhfdD46Om1heCgpKQogICAgICAg
ICAgICAgICAgICAgICBwYW5vc2VCeXRlc1tudW1QYW5vc2VCeXRlcysrXSA9IHZhbHVlOwogICAg
ICAgICAgICAgfQogICAgICAgICB9CkBAIC0xNDYxLDcgKzE0NjEsNyBAQCBTVkdUb09URkZvbnRD
b252ZXJ0ZXI6OlNWR1RvT1RGRm9udENvbnZlcnRlcihjb25zdCBTVkdGb250RWxlbWVudCYgZm9u
dEVsZW1lbnQpCiAgICAgICAgICAgICBib29sIG9rOwogICAgICAgICAgICAgaW50IHZhbHVlID0g
c2VnbWVudC50b0ludChvayk7CiAgICAgICAgICAgICBpZiAob2sgJiYgdmFsdWUgPj0gMCAmJiB2
YWx1ZSA8IDEwMDApIHsKLSAgICAgICAgICAgICAgICBtX3dlaWdodCA9ICh2YWx1ZSArIDUwKSAv
IDEwMDsKKyAgICAgICAgICAgICAgICBtX3dlaWdodCA9IHN0ZDo6bWF4KHN0ZDo6bWluKCh2YWx1
ZSArIDUwKSAvIDEwMCwgc3RhdGljX2Nhc3Q8aW50PihzdGQ6Om51bWVyaWNfbGltaXRzPHVpbnQ4
X3Q+OjptYXgoKSkpLCBzdGF0aWNfY2FzdDxpbnQ+KHN0ZDo6bnVtZXJpY19saW1pdHM8dWludDhf
dD46Om1pbigpKSk7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAgICAg
ICAgIH0K
</data>

          </attachment>
      

    </bug>

</bugzilla>