forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for icon_variants and variants in menus and action APIs f…
…or Web Extensions. https://webkit.org/b/279135 rdar://problem/134885372 Reviewed by NOBODY (OOPS!). Add support for the `icons_variants` key in `menus.create()` and `menus.update()`. Also add support for `variants` key in `action.setIcon()`. Proposal: https://github.com/w3c/webextensions/blob/main/proposals/dark_mode_extension_icons.md WECG issue: w3c/webextensions#229 * Source/WebKit/Shared/Extensions/WebExtensionMenuItem.serialization.in: * Source/WebKit/Shared/Extensions/WebExtensionMenuItemParameters.h: * Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIActionCocoa.mm: (WebKit::WebExtensionContext::actionSetIcon): * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionActionCocoa.mm: (WebKit::WebExtensionAction::clearCustomizations): (WebKit::WebExtensionAction::icon): (WebKit::WebExtensionAction::setIcons): (WebKit::WebExtensionAction::setIconVariants): (WebKit::WebExtensionAction::clearIconCache): (WebKit::WebExtensionAction::setIconsDictionary): Deleted. * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionMenuItemCocoa.mm: (WebKit::WebExtensionMenuItem::WebExtensionMenuItem): (WebKit::WebExtensionMenuItem::minimalParameters const): (WebKit::WebExtensionMenuItem::update): (WebKit::WebExtensionMenuItem::icon const): (WebKit::WebExtensionMenuItem::clearIconCache const): * Source/WebKit/UIProcess/Extensions/WebExtensionAction.h: * Source/WebKit/UIProcess/Extensions/WebExtensionContext.h: * Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in: * Source/WebKit/UIProcess/Extensions/WebExtensionMenuItem.h: * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIActionCocoa.mm: (WebKit::WebExtensionAPIAction::isValidDimensionKey): (WebKit::WebExtensionAPIAction::parseIconPath): (WebKit::WebExtensionAPIAction::parseIconPathsDictionary): (WebKit::WebExtensionAPIAction::parseIconImageDataDictionary): (WebKit::WebExtensionAPIAction::parseIconVariants): (WebKit::WebExtensionAPIAction::setIcon): * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIMenusCocoa.mm: (WebKit::WebExtensionAPIMenus::parseCreateAndUpdateProperties): (WebKit::WebExtensionAPIMenus::createMenu): (WebKit::WebExtensionAPIMenus::update): * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIAction.h: * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIMenus.h: * Source/WebKit/WebProcess/Extensions/Bindings/Scripts/CodeGeneratorExtensions.pm: (_generateImplementationFile): * Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPIMenus.idl: * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIAction.mm: (TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconWithDataURL)): Renamed. (TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconWithVariants)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconWithImageDataAndVariants)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconThrowsWithNoValidVariants)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconWithMixedValidAndInvalidVariants)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconWithAnySizeVariantAndSVGDataURL)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconWithSVGDataURL)): Deleted. * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIMenus.mm: (TestWebKitAPI::TEST(WKWebExtensionAPIMenus, Errors)): Fixed expectations. (TestWebKitAPI::TEST(WKWebExtensionAPIMenus, MenuItemWithIconVariants)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIMenus, MenuItemWithImageDataVariants)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIMenus, MenuItemWithWithNoValidVariants)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIMenus, MenuItemWithMixedValidAndInvalidIconVariants)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIMenus, MenuItemWithAnySizeVariantAndSVGDataURL)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIMenus, UpdateMenuItemWithIconVariants)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIMenus, ClearMenuItemIconVariantsWithNull)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIMenus, ClearMenuItemIconVariantsWithEmpty)): Added.
- Loading branch information
Showing
17 changed files
with
1,194 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.