WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
136766
Introduce FONT_DATA_TYPE_CASTS, and use it
https://bugs.webkit.org/show_bug.cgi?id=136766
Summary
Introduce FONT_DATA_TYPE_CASTS, and use it
Gyuyoung Kim
Reported
2014-09-11 16:45:32 PDT
SSIA
Attachments
Patch
(7.99 KB, patch)
2014-09-11 17:04 PDT
,
Gyuyoung Kim
no flags
Details
Formatted Diff
Diff
Patch
(6.90 KB, patch)
2014-09-11 18:51 PDT
,
Gyuyoung Kim
no flags
Details
Formatted Diff
Diff
Patch for landing
(7.09 KB, patch)
2014-09-14 19:59 PDT
,
Gyuyoung Kim
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Gyuyoung Kim
Comment 1
2014-09-11 17:04:03 PDT
Created
attachment 237998
[details]
Patch
Myles C. Maxfield
Comment 2
2014-09-11 17:20:46 PDT
unofficial r=me
Gyuyoung Kim
Comment 3
2014-09-11 18:51:29 PDT
Created
attachment 238004
[details]
Patch
Darin Adler
Comment 4
2014-09-14 13:02:54 PDT
Comment on
attachment 238004
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=238004&action=review
> Source/WebCore/platform/graphics/FontGlyphs.cpp:74 > + fontCache().releaseFontData(toSimpleFontData(m_realizedFontData[i]));
I don’t understand why the .get() isn’t needed any more.
> Source/WebCore/platform/graphics/FontGlyphs.cpp:82 > - m_pitch = static_cast<const SimpleFontData*>(fontData)->pitch(); > + m_pitch = toSimpleFontData(fontData)->pitch();
Should be toSimpleFontData(*fontData).pitch()
> Source/WebCore/platform/graphics/FontGlyphs.cpp:84 > - const SegmentedFontData* segmentedFontData = static_cast<const SegmentedFontData*>(fontData); > + const SegmentedFontData* segmentedFontData = toSegmentedFontData(fontData);
Should be a reference, not a pointer, since it can’t be null.
Gyuyoung Kim
Comment 5
2014-09-14 19:47:14 PDT
Comment on
attachment 238004
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=238004&action=review
>> Source/WebCore/platform/graphics/FontGlyphs.cpp:74 >> + fontCache().releaseFontData(toSimpleFontData(m_realizedFontData[i])); > > I don’t understand why the .get() isn’t needed any more.
By adding a below line, FONT_DATA_TYPE_CASTS generates "toSimpleFontData(const RefPtr<FontData>& fontData)" as well. Thanks to the function, FONT_DATA_TYPE_CASTS can handle .get(). It seems to me it would be nicer to delegate .get() handling to toFoo(). This idea comes from blink. template<typename T> inline ToValueTypeName* to##ToValueTypeName(const RefPtr<T>& fontData) { return to##ToValueTypeName(fontData.get()); } \
Gyuyoung Kim
Comment 6
2014-09-14 19:59:11 PDT
Created
attachment 238102
[details]
Patch for landing
WebKit Commit Bot
Comment 7
2014-09-14 21:29:33 PDT
Comment on
attachment 238102
[details]
Patch for landing Clearing flags on attachment: 238102 Committed
r173612
: <
http://trac.webkit.org/changeset/173612
>
WebKit Commit Bot
Comment 8
2014-09-14 21:29:36 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 9
2014-09-14 22:06:41 PDT
Comment on
attachment 238004
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=238004&action=review
>>> Source/WebCore/platform/graphics/FontGlyphs.cpp:74 >>> + fontCache().releaseFontData(toSimpleFontData(m_realizedFontData[i])); >> >> I don’t understand why the .get() isn’t needed any more. > > By adding a below line, FONT_DATA_TYPE_CASTS generates "toSimpleFontData(const RefPtr<FontData>& fontData)" as well. Thanks to the function, FONT_DATA_TYPE_CASTS can handle .get(). It seems to me it would be nicer to delegate .get() handling to toFoo(). This idea comes from blink. > > template<typename T> inline ToValueTypeName* to##ToValueTypeName(const RefPtr<T>& fontData) { return to##ToValueTypeName(fontData.get()); } \
I’m not sure this is a good idea. It’s random that some toXXX are overloaded to take RefPtr and others are not, and that this works on RefPtr but not PassRefPtr, and that the result is a raw pointer rather than another RefPtr. In some cases all of those things could be drawbacks. And in this case, the thing can never be nil so it would be nicer to use a reference rather than a pointer.
Gyuyoung Kim
Comment 10
2014-09-14 22:10:22 PDT
(In reply to
comment #9
)
> (From update of
attachment 238004
[details]
)
so it would be nicer to use a reference rather than a pointer. Darin, ok, I see. Let me adjust your suggestion into new patch on
Bug 136809
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug