Summary: | Change the type of SVGToOTFFontConverter::m_weight to be not a char | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Said Abou-Hallawa <sabouhallawa> | ||||
Component: | SVG | Assignee: | Myles C. Maxfield <mmaxfield> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | achristensen, commit-queue, darin, mmaxfield, webkit-bug-importer, zimmermann | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | WebKit Nightly Build | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Attachments: |
|
Description
Said Abou-Hallawa
2018-03-05 11:17:07 PST
m_result is a Vector<char> because that's what SharedBuffer::create() accepts. Created attachment 335067 [details]
Patch
Comment on attachment 335067 [details] Patch Clearing flags on attachment: 335067 Committed r229328: <https://trac.webkit.org/changeset/229328> All reviewed patches have been landed. Closing bug. (In reply to Myles C. Maxfield from comment #1) > m_result is a Vector<char> because that's what SharedBuffer::create() > accepts. At some point I intend to change Vector<char> to Vector<uint8_t> throughout WebKit for this sort of thing. (In reply to Darin Adler from comment #6) > (In reply to Myles C. Maxfield from comment #1) > > m_result is a Vector<char> because that's what SharedBuffer::create() > > accepts. > > At some point I intend to change Vector<char> to Vector<uint8_t> throughout > WebKit for this sort of thing. Yes! ๐ Comment on attachment 335067 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=335067&action=review > Source/WebCore/svg/SVGToOTFFontConversion.cpp:528 > + if (ok && value >= std::numeric_limits<uint8_t>::min() && value <= std::numeric_limits<uint8_t>::max()) If this pattern is common I think we should add a helper function. > Source/WebCore/svg/SVGToOTFFontConversion.cpp:1464 > + 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())); This is what clampTo is for, and itโs much easier to read: m_weight = clampTo<uint8_t>((value + 50) / 100); |