[webkit-changes] [WebKit/WebKit] ab92c8: Move BitmapImage format conversion to a new class ...

Said Abou-Hallawa noreply at github.com
Tue Jan 30 11:15:42 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ab92c87e9f99256f3390219e570a3dc1d0debee6
      https://github.com/WebKit/WebKit/commit/ab92c87e9f99256f3390219e570a3dc1d0debee6
  Author: Said Abou-Hallawa <said at apple.com>
  Date:   2024-01-30 (Tue, 30 Jan 2024)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/PlatformWin.cmake
    M Source/WebCore/Sources.txt
    M Source/WebCore/SourcesCocoa.txt
    M Source/WebCore/SourcesGTK.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/dom/DataTransferMac.mm
    M Source/WebCore/editing/cocoa/HTMLConverter.mm
    M Source/WebCore/loader/cache/CachedImage.cpp
    M Source/WebCore/platform/ScrollView.cpp
    M Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm
    M Source/WebCore/platform/cocoa/DragImageCocoa.mm
    M Source/WebCore/platform/graphics/BitmapImage.cpp
    M Source/WebCore/platform/graphics/BitmapImage.h
    M Source/WebCore/platform/graphics/Image.cpp
    M Source/WebCore/platform/graphics/Image.h
    A Source/WebCore/platform/graphics/ImageAdapter.cpp
    A Source/WebCore/platform/graphics/ImageAdapter.h
    A Source/WebCore/platform/graphics/gtk/ImageAdapterGtk.cpp
    R Source/WebCore/platform/graphics/gtk/ImageGtk.cpp
    A Source/WebCore/platform/graphics/mac/ImageAdapterMac.mm
    R Source/WebCore/platform/graphics/mac/ImageMac.mm
    A Source/WebCore/platform/graphics/win/ImageAdapterWin.cpp
    R Source/WebCore/platform/graphics/win/ImageCairoWin.cpp
    R Source/WebCore/platform/graphics/win/ImageWin.cpp
    M Source/WebCore/platform/gtk/CursorGtk.cpp
    M Source/WebCore/platform/mac/CursorMac.mm
    M Source/WebCore/platform/mac/PasteboardMac.mm
    M Source/WebCore/platform/win/CursorWin.cpp
    M Source/WebCore/platform/win/PasteboardWin.cpp
    M Source/WebCore/rendering/RenderLayerScrollableArea.cpp
    M Source/WebCore/rendering/mac/RenderThemeMac.mm
    M Source/WebKit/UIProcess/API/gtk/DragSourceGtk3.cpp
    M Source/WebKit/UIProcess/API/gtk/DragSourceGtk4.cpp
    M Source/WebKit/UIProcess/gtk/ClipboardGtk3.cpp
    M Source/WebKit/UIProcess/gtk/ClipboardGtk4.cpp
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Source/WebKitLegacy/mac/DOM/DOM.mm
    M Source/WebKitLegacy/mac/Misc/WebElementDictionary.mm
    M Source/WebKitLegacy/mac/WebCoreSupport/WebContextMenuClient.mm
    M Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm
    M Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
    M Tools/TestWebKitAPI/Tests/WebCore/win/BitmapImage.cpp

  Log Message:
  -----------
  Move BitmapImage format conversion to a new class name ImageAdapter
https://bugs.webkit.org/show_bug.cgi?id=267254
rdar://120690546

Reviewed by Cameron McCormack.

The classes Image and BitmapImage are overloaded with many platform functions. The
platform-specific format conversion is not tied to BitmapImage or Image. It relies
mostly on the NativeImage. So move the format conversion to a new class named
ImageAdapter. Move also BitmapImage::nativeImageOfSize() and framesNativeImages()
to this new class since they are only used for image format conversion.

* Source/WebCore/Headers.cmake:
* Source/WebCore/PlatformWin.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/SourcesGTK.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/DataTransferMac.mm:
(WebCore::DataTransfer::createDragImage const):
* Source/WebCore/editing/cocoa/HTMLConverter.mm:
(fileWrapperForElement):
* Source/WebCore/loader/cache/CachedImage.cpp:
(WebCore::CachedImage::brokenImage const):
* Source/WebCore/platform/ScrollView.cpp:
(WebCore::ScrollView::paintPanScrollIcon):
* Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::setNowPlayingInfo):
* Source/WebCore/platform/cocoa/DragImageCocoa.mm:
(WebCore::createDragImageFromImage):
* Source/WebCore/platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::~BitmapImage):
(WebCore::BitmapImage::destroyDecodedData):
(WebCore::BitmapImage::nativeImageAtIndexCacheIfNeeded):
(WebCore::BitmapImage::nativeImage):
(WebCore::BitmapImage::nativeImageForCurrentFrame):
(WebCore::BitmapImage::draw):
(WebCore::BitmapImage::drawPattern):
(WebCore::BitmapImage::decode):
(WebCore::BitmapImage::dump const):
(WebCore::BitmapImage::frameImageAtIndexCacheIfNeeded): Deleted.
(WebCore::BitmapImage::nativeImageOfSize): Deleted.
(WebCore::BitmapImage::framesNativeImages): Deleted.
* Source/WebCore/platform/graphics/BitmapImage.h:
* Source/WebCore/platform/graphics/Image.cpp:
(WebCore::Image::adapter):
(WebCore::Image::invalidateAdapter):
(WebCore::Image::fillWithSolidColor):
(WebCore::Image::drawTiled):
(WebCore::operator<<):
(WebCore::BitmapImage::invalidatePlatformData): Deleted.
(WebCore::Image::loadPlatformResource): Deleted.
* Source/WebCore/platform/graphics/Image.h:
(WebCore::Image::frameCount const):
(WebCore::Image::nativeImageAtIndex):
(WebCore::Image::nativeImageAtIndexCacheIfNeeded):
(WebCore::Image::nativeImageOfSize): Deleted.
(WebCore::Image::nsImage): Deleted.
(WebCore::Image::snapshotNSImage): Deleted.
(WebCore::Image::tiffRepresentation): Deleted.
(WebCore::Image::getHBITMAP): Deleted.
(WebCore::Image::getHBITMAPOfSize): Deleted.
(WebCore::Image::gdkPixbuf): Deleted.
(WebCore::Image::gdkTexture): Deleted.
(WebCore::Image::drawFrameMatchingSourceSize): Deleted.
* Source/WebCore/platform/graphics/ImageAdapter.cpp: Renamed from Source/WebCore/platform/graphics/win/ImageWin.cpp.
(WebCore::ImageAdapter::loadPlatformResource):
(WebCore::ImageAdapter::invalidate):
(WebCore::ImageAdapter::nativeImageOfSize):
(WebCore::ImageAdapter::allNativeImages):
* Source/WebCore/platform/graphics/ImageAdapter.h: Added.
(WebCore::ImageAdapter::ImageAdapter):
(WebCore::ImageAdapter::image const):
* Source/WebCore/platform/graphics/gtk/ImageAdapterGtk.cpp: Renamed from Source/WebCore/platform/graphics/gtk/ImageGtk.cpp.
(WebCore::ImageAdapter::loadPlatformResource):
(WebCore::ImageAdapter::invalidate):
(WebCore::ImageAdapter::gdkPixbuf):
(WebCore::ImageAdapter::gdkTexture):
* Source/WebCore/platform/graphics/mac/ImageAdapterMac.mm: Renamed from Source/WebCore/platform/graphics/mac/ImageMac.mm.
(WebCore::ImageAdapter::loadPlatformResource):
(WebCore::ImageAdapter::tiffRepresentation):
(WebCore::ImageAdapter::invalidate):
(WebCore::ImageAdapter::nsImage):
(WebCore::ImageAdapter::snapshotNSImage):
* Source/WebCore/platform/graphics/win/ImageAdapterWin.cpp: Renamed from Source/WebCore/platform/graphics/win/ImageCairoWin.cpp.
(WebCore::ImageAdapter::loadPlatformResource):
(WebCore::ImageAdapter::nativeImageOfHBITMAP):
(WebCore::ImageAdapter::invalidate):
(WebCore::ImageAdapter::getHBITMAP):
(WebCore::ImageAdapter::getHBITMAPOfSize):
* Source/WebCore/platform/gtk/CursorGtk.cpp:
(WebCore::createCustomCursor):
* Source/WebCore/platform/mac/CursorMac.mm:
(WebCore::createCustomCursor):
* Source/WebCore/platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::write):
* Source/WebCore/platform/win/CursorWin.cpp:
(WebCore::createSharedCursor):
(WebCore::loadCursorByName):
* Source/WebCore/platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::writeImage):
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::drawPlatformResizerImage):
* Source/WebCore/rendering/RenderThemeMac.mm:
(WebCore::createAttachmentPlaceholderImage):
* Source/WebKit/UIProcess/API/gtk/DragSourceGtk3.cpp:
(WebKit::DragSource::DragSource):
* Source/WebKit/UIProcess/API/gtk/DragSourceGtk4.cpp:
(WebKit::DragSource::begin):
* Source/WebKit/UIProcess/gtk/ClipboardGtk3.cpp:
(WebKit::Clipboard::write):
* Source/WebKit/UIProcess/gtk/ClipboardGtk4.cpp:
(WebKit::Clipboard::write):
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::provideDataForPasteboard):
* Source/WebKitLegacy/mac/DOM/DOM.mm:
(-[DOMElement image]):
(-[DOMElement _imageTIFFRepresentation]):
* Source/WebKitLegacy/mac/Misc/WebElementDictionary.mm:
(-[WebElementDictionary _image]):
* Source/WebKitLegacy/mac/WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::imageForCurrentSharingServicePickerItem):
(WebContextMenuClient::contextMenuForEvent):
* Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:
(webGetNSImage):
* Source/WebKitLegacy/mac/WebView/WebHTMLView.mm:
(-[WebHTMLView pasteboard:provideDataForType:]):
* Tools/TestWebKitAPI/Tests/WebCore/win/BitmapImage.cpp:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/273772@main




More information about the webkit-changes mailing list