Summary: | Tighten ImageSource to have BitmapImage pointer instead of Image | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Antti Koivisto <koivisto> | ||||||||
Component: | Images | Assignee: | Nobody <webkit-unassigned> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | cdumez, commit-queue, dbates, dino, ews-watchlist, graouts, japhet, kondapallykalyan, sabouhallawa, webkit-bug-importer | ||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||
Version: | WebKit Nightly Build | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Attachments: |
|
Description
Antti Koivisto
2018-04-06 04:52:05 PDT
Created attachment 337356 [details]
patch
Created attachment 337360 [details]
patch
Comment on attachment 337360 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=337360&action=review > Source/WebCore/loader/ImageLoader.cpp:422 > - if (!image->isBitmapImage()) { > + if (!is<BitmapImage>(image)) { There are places of the code which use isBitmapImage() and others use is<BitmapImage>(). I do not know the rule here and I don't know which way is more preferable. But I think we should be consistent and use one way or the other all over the code. > Source/WebCore/platform/graphics/BitmapImage.h:142 > + void decode(WTF::Function<void()>&&); I think we can remove WTF:: here. > Source/WebCore/platform/graphics/Image.h:-142 > - virtual void decode(WTF::Function<void()>&&) { } > - virtual void imageFrameAvailableAtIndex(size_t) { } > - Shouldn't we do the same thing for the other methods which are related to multi-frame images only? virtual NativeImagePtr nativeImageForCurrentFrame(const GraphicsContext* = nullptr) { return nullptr; } virtual ImageOrientation orientationForCurrentFrame() const { return ImageOrientation(); } virtual Vector<NativeImagePtr> framesNativeImages() { return { }; } > There are places of the code which use isBitmapImage() and others use
> is<BitmapImage>(). I do not know the rule here and I don't know which way is
> more preferable. But I think we should be consistent and use one way or the
> other all over the code.
I think it is good to always use is<> when paired with downcast<>. The safety of the code is then immediately obvious.
> Shouldn't we do the same thing for the other methods which are related to
> multi-frame images only?
>
> virtual NativeImagePtr nativeImageForCurrentFrame(const GraphicsContext*
> = nullptr) { return nullptr; }
> virtual ImageOrientation orientationForCurrentFrame() const { return
> ImageOrientation(); }
> virtual Vector<NativeImagePtr> framesNativeImages() { return { }; }
nativeImageForCurrentFrame has SVGImage implementation too. Did the rest.
Created attachment 337365 [details]
patch
Comment on attachment 337365 [details] patch Clearing flags on attachment: 337365 Committed r230334: <https://trac.webkit.org/changeset/230334> All reviewed patches have been landed. Closing bug. |