[webkit-changes] [WebKit/WebKit] a4ea62: Add categories and shortcuts to _WKApplicationMani...
Commit Queue
noreply at github.com
Fri Oct 6 16:51:04 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a4ea62848c891ee3c0aaff18417e2cacfc3d064c
https://github.com/WebKit/WebKit/commit/a4ea62848c891ee3c0aaff18417e2cacfc3d064c
Author: Luming Yin <luming_yin at apple.com>
Date: 2023-10-06 (Fri, 06 Oct 2023)
Changed paths:
M Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h
M Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp
M Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.h
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h
M Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm
M Tools/TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp
Log Message:
-----------
Add categories and shortcuts to _WKApplicationManifest
https://bugs.webkit.org/show_bug.cgi?id=262654
rdar://116486952
Reviewed by Wenson Hsieh, Sihui Liu and Chris Dumez.
Add two new properties, categories and shortcuts, to _WKApplicationManifest.
See rdar://116486952 for more detail.
* Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h:
Add a new Shortcut struct that represents an individual shortcut, as well
as categories and shortcuts members on the manifest.
* Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp:
(WebCore::ApplicationManifestParser::parseManifest):
Parse the categories and shortcuts members of the manifest.
(WebCore::ApplicationManifestParser::parseCategories):
Parse categories by mapping its values into a vector of strings.
(WebCore::ApplicationManifestParser::parseShortcuts):
Parse shortcuts by mapping its values into a vector of shortcut items. For each
icon member inside each shortcut, use the existing parseIcons method to parse
them since they are in the same format as the top-level icons member.
* Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.h:
Header declaration for new methods that parse categories and shortcuts.
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
Serialize the parsed categories and shortcuts for XPC.
* Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm:
(makeVectorElement):
Method to convert an individual array element of _WKApplicationManifestShortcut
back into WebCore::ApplicationManifest::Shortcut. This is used when initializing
with coder. Remove the isKindOfClass check since dynamic_objc_cast already returns
nil if the class check fails.
(-[_WKApplicationManifestIcon initWithCoder:]):
(-[_WKApplicationManifestIcon initWithCoreIcon:]):
(-[_WKApplicationManifestIcon encodeWithCoder:]):
(-[_WKApplicationManifestIcon src]):
(-[_WKApplicationManifestIcon sizes]):
(-[_WKApplicationManifestIcon type]):
(-[_WKApplicationManifestIcon purposes]):
(-[_WKApplicationManifestIcon dealloc]):
Switch to using RetainPtr.
(+[_WKApplicationManifestShortcut supportsSecureCoding]):
Allow secure encoding of _WKApplicationManifestShortcut.
(-[_WKApplicationManifestShortcut initWithCoder:]):
Decode an encoded _WKApplicationManifestShortcut.
(-[_WKApplicationManifestShortcut name]):
(-[_WKApplicationManifestShortcut url]):
(-[_WKApplicationManifestShortcut icons]):
Getter for RetainPtr backed ivars.
(-[_WKApplicationManifestShortcut initWithCoreShortcut:]):
Initialize Obj-C wrapper object based on the WebCore shortcut object.
(-[_WKApplicationManifestShortcut encodeWithCoder:]):
Encode _WKApplicationManifestShortcut for on-disk persistence.
(-[_WKApplicationManifestShortcut dealloc]):
Deallocate _WKApplicationManifestShortcut.
(-[_WKApplicationManifest initWithCoder:]):
Decode categories and shortcuts.
(-[_WKApplicationManifest encodeWithCoder:]):
Encode categories and shortcuts.
(-[_WKApplicationManifest categories]):
Return categories as an array of NSString from the underlying manifest.
(-[_WKApplicationManifest shortcuts]):
Return shortcuts as an array of _WKApplicationManifestShortcut from the
underlying manifest.
* Tools/TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp:
(ApplicationManifestParserTest::parseShortcutFirstTopLevelProperty):
(ApplicationManifestParserTest::parseShortcutFirstTopLevelPropertyForURL):
Test whether shortcut property can be parsed correctly.
(ApplicationManifestParserTest::parseShortcutIconFirstTopLevelProperty):
(ApplicationManifestParserTest::parseShortcutIconFirstTopLevelPropertyForSrc):
Test whether an icon nested within a shortcut can be parsed correctly.
(ApplicationManifestParserTest::testCategories):
Test whether a set of categories can be parsed correctly.
(ApplicationManifestParserTest::testIconsSrc):
(ApplicationManifestParserTest::testIconsType):
(ApplicationManifestParserTest::testIconsSizes):
(ApplicationManifestParserTest::testIconsPurposes):
Update icon test methods to also test icons nested within shortcuts members.
(ApplicationManifestParserTest::testShortcutsURL):
(ApplicationManifestParserTest::testShortcutsName):
Test shortcuts url and name.
(TEST_F):
Run categories and shortcuts tests. Also make a drive-by test fix for Scope tests where
the expected isDefaultValue is incorrectly specified in the test file (the actual parsing
logic in ApplicationManifestParser for isDefaultValue is already correct).
Canonical link: https://commits.webkit.org/269021@main
More information about the webkit-changes
mailing list