RESOLVED FIXED 210653
Allow the UserStyleLevel to be set through _WKUserStyleSheet
https://bugs.webkit.org/show_bug.cgi?id=210653
Summary Allow the UserStyleLevel to be set through _WKUserStyleSheet
Antoine Quint
Reported 2020-04-17 05:31:53 PDT
Allow the UserStyleLevel to be set through _WKUserStyleSheet
Attachments
Patch (20.00 KB, patch)
2020-04-17 06:27 PDT, Antoine Quint
thorton: review+
Antoine Quint
Comment 1 2020-04-17 05:37:42 PDT
Antoine Quint
Comment 2 2020-04-17 06:27:19 PDT
Tim Horton
Comment 3 2020-04-17 06:34:33 PDT
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).
Tim Horton
Comment 4 2020-04-17 06:38:38 PDT
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?
Antoine Quint
Comment 5 2020-04-17 06:44:39 PDT
(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!
Antoine Quint
Comment 6 2020-04-17 06:46:40 PDT
(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".
Antoine Quint
Comment 7 2020-04-17 08:47:49 PDT
Antoine Quint
Comment 8 2020-04-17 12:00:10 PDT
Build fix in r260269.
Antti Koivisto
Comment 9 2020-04-17 12:04:44 PDT
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!
Note You need to log in before you can comment on or make changes to this bug.