RESOLVED FIXED 225839
Move CFStringRef and NSString support from StringBuilder into StringConcatenateCF
https://bugs.webkit.org/show_bug.cgi?id=225839
Summary Move CFStringRef and NSString support from StringBuilder into StringConcatena...
Darin Adler
Reported 2021-05-14 20:36:31 PDT
Move CFStringRef and NSString support from StringBuilder into StringConcatenateCF
Attachments
Patch (23.78 KB, patch)
2021-05-14 20:54 PDT, Darin Adler
no flags
Patch (23.83 KB, patch)
2021-05-14 21:00 PDT, Darin Adler
no flags
Patch (23.86 KB, patch)
2021-05-14 21:00 PDT, Darin Adler
no flags
Patch (59.98 KB, patch)
2021-05-14 22:19 PDT, Darin Adler
no flags
Patch (59.97 KB, patch)
2021-05-14 23:59 PDT, Darin Adler
no flags
Patch (123.22 KB, patch)
2021-05-15 16:53 PDT, Darin Adler
ews-feeder: commit-queue-
Patch (126.22 KB, patch)
2021-05-15 17:00 PDT, Darin Adler
ews-feeder: commit-queue-
Patch (135.38 KB, patch)
2021-05-15 18:41 PDT, Darin Adler
sam: review+
Patch (135.13 KB, patch)
2021-05-18 00:37 PDT, Darin Adler
ews-feeder: commit-queue-
Patch (144.35 KB, patch)
2021-05-18 12:31 PDT, Darin Adler
ews-feeder: commit-queue-
Patch (146.27 KB, patch)
2021-05-18 13:03 PDT, Darin Adler
ews-feeder: commit-queue-
Patch (148.39 KB, patch)
2021-05-18 14:07 PDT, Darin Adler
no flags
Darin Adler
Comment 1 2021-05-14 20:54:08 PDT Comment hidden (obsolete)
Darin Adler
Comment 2 2021-05-14 21:00:01 PDT Comment hidden (obsolete)
Darin Adler
Comment 3 2021-05-14 21:00:33 PDT Comment hidden (obsolete)
Darin Adler
Comment 4 2021-05-14 22:19:42 PDT Comment hidden (obsolete)
Darin Adler
Comment 5 2021-05-14 23:59:39 PDT Comment hidden (obsolete)
Darin Adler
Comment 6 2021-05-15 08:57:16 PDT Comment hidden (obsolete)
Darin Adler
Comment 7 2021-05-15 16:53:43 PDT Comment hidden (obsolete)
Darin Adler
Comment 8 2021-05-15 17:00:55 PDT Comment hidden (obsolete)
Darin Adler
Comment 9 2021-05-15 18:41:40 PDT
Sam Weinig
Comment 10 2021-05-16 09:49:49 PDT
Comment on attachment 428759 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=428759&action=review > Source/WTF/wtf/text/StringBuilder.h:124 > + LChar* m_bufferCharacters { nullptr }; What is the intent of removing the union here and replacing its uses with reinterpret_casts<>? An alternative formulation we could consider (though it may have downsides I am not considering) is using a Variant<LChar*, UChar*> and removing the m_is8Bit bool. > Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:327 > Color textColor = captionsTextColor(important); auto?
Darin Adler
Comment 11 2021-05-16 22:55:54 PDT
Comment on attachment 428759 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=428759&action=review >> Source/WTF/wtf/text/StringBuilder.h:124 >> + LChar* m_bufferCharacters { nullptr }; > > What is the intent of removing the union here and replacing its uses with reinterpret_casts<>? An alternative formulation we could consider (though it may have downsides I am not considering) is using a Variant<LChar*, UChar*> and removing the m_is8Bit bool. Your suggestion is excellent. To be honest I do not know why I chose to make the change I did, on reflection now. At one point I had changed it to a void* and was using static_cast. I should probably switch back to the union. I am tempted to switch to the Variant. But one reason not to is the possibility of getting rid of m_is8Bit because m_string and m_buffer both already can answer that question, and there is no need to store the state redundantly. It occurs to me that these bufferCharacters pointers don’t really have much value; they are used to optimize the fast path for append but I am not convinced the benefit is significant over calling m_buffer->characters() and chasing one more pointer; after all, we are already chasing the pointer to check m_buffer->length(). So likely could and should remove both m_bufferCharacters and m_is8Bit. > Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:312 > + Color textColor(adoptCF(MACaptionAppearanceCopyForegroundColor(kMACaptionAppearanceDomainUser, &behavior)).get()); Should use = style here instead of construction syntax I think. >> Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:327 >> Color textColor = captionsTextColor(important); > > auto? Will do. > Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:417 > + auto name = adoptCF(CTFontDescriptorCopyAttribute(font.get(), kCTFontNameAttribute)); Should probably move the cast to CFStringRef up here because this is where we call the function guaranteed to return that type for this key. > Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:428 > auto fontCascadeName = adoptCF(CTFontDescriptorCopyAttribute(fontCascade, kCTFontNameAttribute)); Here too. As is done just above for CFArrayRef.
Darin Adler
Comment 12 2021-05-18 00:37:47 PDT Comment hidden (obsolete)
Darin Adler
Comment 13 2021-05-18 12:31:36 PDT Comment hidden (obsolete)
Darin Adler
Comment 14 2021-05-18 13:03:04 PDT Comment hidden (obsolete)
Darin Adler
Comment 15 2021-05-18 14:07:24 PDT
Darin Adler
Comment 16 2021-05-19 12:37:30 PDT
Radar WebKit Bug Importer
Comment 17 2021-05-19 12:38:19 PDT
Note You need to log in before you can comment on or make changes to this bug.