RESOLVED FIXED 157024
Make FontPlatformData conceptually immutable
https://bugs.webkit.org/show_bug.cgi?id=157024
Summary Make FontPlatformData conceptually immutable
Myles C. Maxfield
Reported 2016-04-25 21:58:07 PDT
Make FontPlatformData immutable
Attachments
Patch (19.25 KB, patch)
2016-04-25 22:00 PDT, Myles C. Maxfield
no flags
Patch (23.36 KB, patch)
2016-04-26 00:04 PDT, Myles C. Maxfield
darin: review+
Myles C. Maxfield
Comment 1 2016-04-25 22:00:26 PDT
Myles C. Maxfield
Comment 2 2016-04-26 00:04:46 PDT
Darin Adler
Comment 3 2016-04-26 08:52:01 PDT
Comment on attachment 277345 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=277345&action=review > Source/WebCore/platform/graphics/Font.cpp:256 > + FontPlatformData verticalRightPlatformData = FontPlatformData::cloneWithOrientation(m_platformData, Horizontal); Can we use auto here instead of naming the type twice? Maybe we don’t need a local variable at all? > Source/WebCore/platform/graphics/Font.cpp:323 > + FontPlatformData nonSyntheticItalicFontPlatformData = FontPlatformData::cloneWithSyntheticOblique(m_platformData, false); Would say the same thing except for the #if that might change things, I guess. > Source/WebCore/platform/graphics/FontPlatformData.cpp:95 > const FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other) Too bad we can’t just let the compiler generate this. Do any of the platformDataAssign functions do something other than what the compiler default would do? Seems like the only issue may be the lack of a smart pointer for m_scaledFont for Cairo! Same thought about the copy constructor and platformDataInit. > Source/WebCore/platform/graphics/FontPlatformData.h:233 > + // vvvv These values are common to all ports vvvv What’s with the "vvvv" thing? Not very attractive. Can we find another way to make this comment clear? > Source/WebCore/platform/graphics/freetype/FontPlatformData.h:73 > + static FontPlatformData cloneWithOrientation(const FontPlatformData&, FontOrientation); > + static FontPlatformData cloneWithSyntheticOblique(const FontPlatformData&, bool); > + static FontPlatformData cloneWithSize(const FontPlatformData&, float); This seems strange. Why an entirely separate header for this one version of FontPlatformData, but not for any of the others?
Myles C. Maxfield
Comment 4 2016-04-26 10:18:15 PDT
Comment on attachment 277345 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=277345&action=review >> Source/WebCore/platform/graphics/FontPlatformData.cpp:95 >> const FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other) > > Too bad we can’t just let the compiler generate this. Do any of the platformDataAssign functions do something other than what the compiler default would do? Seems like the only issue may be the lack of a smart pointer for m_scaledFont for Cairo! > > Same thought about the copy constructor and platformDataInit. I intend to migrate the Cairo pointer to a smart pointer class in the future. That way, we can delete many of these boilerplate functions. >> Source/WebCore/platform/graphics/freetype/FontPlatformData.h:73 >> + static FontPlatformData cloneWithSize(const FontPlatformData&, float); > > This seems strange. Why an entirely separate header for this one version of FontPlatformData, but not for any of the others? I don't know. :(
Myles C. Maxfield
Comment 5 2016-04-26 10:20:04 PDT
Gyuyoung Kim
Comment 6 2016-04-26 21:43:38 PDT
Note You need to log in before you can comment on or make changes to this bug.