Allow the UserStyleLevel to be set through _WKUserStyleSheet
<rdar://problem/60506645>
Created attachment 396762 [details] Patch
Comment on attachment 396762 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=396762&action=review > Source/WebKit/UIProcess/API/Cocoa/_WKUserStyleSheet.h:-47 > -- (instancetype)initWithSource:(NSString *)source forWKWebView:(WKWebView *)webView forMainFrameOnly:(BOOL)forMainFrameOnly userContentWorld:(_WKUserContentWorld *)userContentWorld; Huh? Are there no clients of this SPI? (And, how sure are you?) > Source/WebKit/UIProcess/API/Cocoa/_WKUserStyleSheet.mm:98 > + // FIXME: In the API test, we can use generateUniqueURL below before the API::Object constructor has done this... where should this really be? I think there is precedent for this (maybe look at WKWebViewConfiguration, which is most people’s first WK object).
Comment on attachment 396762 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=396762&action=review > Source/WebKit/UIProcess/API/Cocoa/_WKUserStyleSheet.h:52 > +- (instancetype)initWithSource:(NSString *)source forWKWebView:(WKWebView *)webView forMainFrameOnly:(BOOL)forMainFrameOnly level:(_WKUserStyleLevel)level userContentWorld:(_WKUserContentWorld *)userContentWorld; This needs availability > Source/WebKit/UIProcess/API/Cocoa/_WKUserStyleSheet.h:55 > +- (instancetype)initWithSource:(NSString *)source forMainFrameOnly:(BOOL)forMainFrameOnly legacyWhitelist:(NSArray<NSString *> *)legacyWhitelist legacyBlacklist:(NSArray<NSString *> *)legacyBlacklist baseURL:(NSURL *)baseURL level:(_WKUserStyleLevel)level userContentWorld:(_WKUserContentWorld *)userContentWorld; This needs availability > Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm:733 > +// Add two tests, where we set the default explicitly, and where we set to author level. What is this, a fixme? Or just stale?
(In reply to Tim Horton from comment #4) > Comment on attachment 396762 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=396762&action=review > > > Source/WebKit/UIProcess/API/Cocoa/_WKUserStyleSheet.h:52 > > +- (instancetype)initWithSource:(NSString *)source forWKWebView:(WKWebView *)webView forMainFrameOnly:(BOOL)forMainFrameOnly level:(_WKUserStyleLevel)level userContentWorld:(_WKUserContentWorld *)userContentWorld; > > This needs availability > > > Source/WebKit/UIProcess/API/Cocoa/_WKUserStyleSheet.h:55 > > +- (instancetype)initWithSource:(NSString *)source forMainFrameOnly:(BOOL)forMainFrameOnly legacyWhitelist:(NSArray<NSString *> *)legacyWhitelist legacyBlacklist:(NSArray<NSString *> *)legacyBlacklist baseURL:(NSURL *)baseURL level:(_WKUserStyleLevel)level userContentWorld:(_WKUserContentWorld *)userContentWorld; > > This needs availability Will add TBA in both cases. > > Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm:733 > > +// Add two tests, where we set the default explicitly, and where we set to author level. > > What is this, a fixme? Or just stale? Stale, will remove!
(In reply to Tim Horton from comment #3) > Comment on attachment 396762 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=396762&action=review > > > Source/WebKit/UIProcess/API/Cocoa/_WKUserStyleSheet.h:-47 > > -- (instancetype)initWithSource:(NSString *)source forWKWebView:(WKWebView *)webView forMainFrameOnly:(BOOL)forMainFrameOnly userContentWorld:(_WKUserContentWorld *)userContentWorld; > > Huh? Are there no clients of this SPI? (And, how sure are you?) This was added just over a month ago in r257870. I've looked and haven't found any use for this SPI that I'm not also changing in some Internal patch. > > Source/WebKit/UIProcess/API/Cocoa/_WKUserStyleSheet.mm:98 > > + // FIXME: In the API test, we can use generateUniqueURL below before the API::Object constructor has done this... where should this really be? > > I think there is precedent for this (maybe look at WKWebViewConfiguration, > which is most people’s first WK object). I stupidly copy-paster the other _WKUserStyleSheet initializers which had this line. Emphasis on "stupidly".
Committed r260254: <https://trac.webkit.org/changeset/260254>
Build fix in r260269.
Comment on attachment 396762 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=396762&action=review > Source/WebKit/ChangeLog:9 > + Add a new _WKUserStyleLevel enum such that we may provide the specificity level of the backing UserStyleSheet, represented by the UserStyleLevel enum in WebCore. cascade level!