RESOLVED FIXED 157172
[OpenType] OpenTypeVerticalData object should not be created if the font is not OpenType
https://bugs.webkit.org/show_bug.cgi?id=157172
Summary [OpenType] OpenTypeVerticalData object should not be created if the font is n...
Carlos Garcia Campos
Reported 2016-04-29 03:34:10 PDT
It's a bit weird that the object is always created and has an isOpenType() method to check whether it's an OpenType or not. The caller is always deleting the object when it's not an OpenType, so it would be better if the create method returned nullptr instead of creating the object when the font is not OpenType.
Attachments
Patch (7.19 KB, patch)
2016-04-29 03:39 PDT, Carlos Garcia Campos
mcatanzaro: review+
Carlos Garcia Campos
Comment 1 2016-04-29 03:39:49 PDT
Darin Adler
Comment 2 2016-04-29 09:35:16 PDT
Comment on attachment 277690 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=277690&action=review > Source/WebCore/platform/graphics/FontCache.cpp:322 > auto addResult = fontVerticalDataCache().add(platformData, nullptr); > - if (addResult.isNewEntry) { > - RefPtr<OpenTypeVerticalData> data = OpenTypeVerticalData::create(platformData); > - addResult.iterator->value = data->isOpenType() ? WTFMove(data) : nullptr; > - } > + if (addResult.isNewEntry) > + addResult.iterator->value = OpenTypeVerticalData::create(platformData); This is now a perfect candidate for using the new "ensure" function instead of add.
Carlos Garcia Campos
Comment 3 2016-05-03 01:17:46 PDT
Note You need to log in before you can comment on or make changes to this bug.