WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
208038
[CG] Change the UTI of the "WebP" image to be "com.google.webp"
https://bugs.webkit.org/show_bug.cgi?id=208038
Summary
[CG] Change the UTI of the "WebP" image to be "com.google.webp"
Said Abou-Hallawa
Reported
2020-02-20 16:11:14 PST
This is to conform with CGImageSourceGetType().
Attachments
Patch
(3.35 KB, patch)
2020-02-20 16:15 PST
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(1.20 KB, patch)
2020-02-20 17:49 PST
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(3.20 KB, patch)
2020-03-03 12:17 PST
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Said Abou-Hallawa
Comment 1
2020-02-20 16:15:34 PST
Created
attachment 391354
[details]
Patch
Said Abou-Hallawa
Comment 2
2020-02-20 17:49:09 PST
Created
attachment 391364
[details]
Patch
Daniel Bates
Comment 3
2020-02-20 19:48:54 PST
Comment on
attachment 391364
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=391364&action=review
This patch looks good.
> Source/WebCore/platform/graphics/cg/UTIRegistry.cpp:56 > + "com.google.webp"_s,
Is this OK for older mac, iOS versions? If not, then compile time guards are needed.
Said Abou-Hallawa
Comment 4
2020-03-03 12:17:38 PST
Created
attachment 392307
[details]
Patch
Said Abou-Hallawa
Comment 5
2020-03-03 12:20:51 PST
Comment on
attachment 391364
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=391364&action=review
>> Source/WebCore/platform/graphics/cg/UTIRegistry.cpp:56 >> + "com.google.webp"_s, > > Is this OK for older mac, iOS versions? If not, then compile time guards are needed.
You are right. But since WebP will be supported in future macOS/iOS releases I think we do not need to add compile time guards here. I think #if HAVE(WEBP) is enough but I will add both "public.webp" and "com.google.webp" to this list and take whatever CG supports.
Said Abou-Hallawa
Comment 6
2020-03-03 12:22:31 PST
<
rdar://problem/59977846
>
Simon Fraser (smfr)
Comment 7
2020-03-03 14:10:02 PST
Comment on
attachment 392307
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=392307&action=review
> Source/WebCore/platform/graphics/cg/UTIRegistry.cpp:67 > + if (CFArrayContainsValue(systemImageTypes.get(), CFRangeMake(0, count), string.get()))
This is linear search. How big is systemImageTypes?
Said Abou-Hallawa
Comment 8
2020-03-03 14:25:22 PST
Comment on
attachment 392307
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=392307&action=review
>> Source/WebCore/platform/graphics/cg/UTIRegistry.cpp:67 >> + if (CFArrayContainsValue(systemImageTypes.get(), CFRangeMake(0, count), string.get())) > > This is linear search. How big is systemImageTypes?
Between 50 and 60 items. The problem is the items of this array are not sorted. So I can't use CFArrayBSearchValues().
WebKit Commit Bot
Comment 9
2020-03-03 15:02:06 PST
Comment on
attachment 392307
[details]
Patch Clearing flags on attachment: 392307 Committed
r257805
: <
https://trac.webkit.org/changeset/257805
>
WebKit Commit Bot
Comment 10
2020-03-03 15:02:08 PST
All reviewed patches have been landed. Closing bug.
Daniel Bates
Comment 11
2020-03-03 15:20:26 PST
Comment on
attachment 392307
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=392307&action=review
> Source/WebCore/platform/graphics/cg/UTIRegistry.cpp:59 > + const String defaultSupportedImageTypes[] = { > + "com.compuserve.gif"_s, > + "com.microsoft.bmp"_s, > + "com.microsoft.cur"_s, > + "com.microsoft.ico"_s, > + "public.jpeg"_s, > + "public.png"_s, > + "public.tiff"_s, > #if !PLATFORM(WIN) > - "public.jpeg-2000"_s, > - "public.mpo-image"_s, > + "public.jpeg-2000"_s, > + "public.mpo-image"_s, > #endif > #if HAVE(WEBP) > - "public.webp"_s, > + "public.webp"_s, > + "com.google.webp"_s, > #endif > - }; > + };
This is ok as-is. No change needed. A more efficient solution would use std::array<const char*,...> or just make this a const char* array with a nullptr for the last entry because: 1. No need to stack-allocate and initialize String, which does a strlen() <-- well, ASCIILiteral does that 2. Because of (1) there is a reduced memory footprint during the call.
> Source/WebCore/platform/graphics/cg/UTIRegistry.cpp:61 > RetainPtr<CFArrayRef> systemImageTypes = adoptCF(CGImageSourceCopyTypeIdentifiers());
This is ok as-is. No change needed. A more efficient solution would be to copy the array (not a deep copy) then sort it and binary search it below because: 1. Reduces linear search to logarithmic search <-- especially good if the array gets over a 100 or more items in the future.
Daniel Bates
Comment 12
2020-03-03 15:20:33 PST
This patch looks good.
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