Bug 154798

Summary: Bind _WKUserStyleSheets to WKUserContentWorlds to allow for grouping of user content by associating to a world
Product: WebKit Reporter: Sam Weinig <sam>
Component: New BugsAssignee: Sam Weinig <sam>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch mitz: review+

Description Sam Weinig 2016-02-28 13:08:09 PST
Bind _WKUserStyleSheets to WKUserContentWorlds to allow for grouping of user content by associating to a world
Comment 1 Sam Weinig 2016-02-28 13:17:39 PST
Created attachment 272463 [details]
Patch
Comment 2 Sam Weinig 2016-02-28 13:30:32 PST
Created attachment 272464 [details]
Patch
Comment 3 mitz 2016-02-28 13:43:22 PST
Comment on attachment 272464 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=272464&action=review

> Source/WebKit2/Shared/API/APIArray.h:95
> +        return m_elements.removeAllMatching(
> +            [&] (const RefPtr<Object>& object) -> bool {

I think these should be one line.

> Source/WebKit2/Shared/API/APIArray.h:99
> +                if (object->type() != T::APIType)
> +                    return false;
> +                return matchFunction(static_pointer_cast<T>(object));
> +            });

And then this should be less indented.

> Source/WebKit2/UIProcess/API/Cocoa/_WKUserStyleSheet.h:45
> +- (instancetype)initWithSource:(NSString *)source forMainFrameOnly:(BOOL)forMainFrameOnly legacyWhitelist:(WK_ARRAY(NSString *) *)legacyWhitelist legacyBlacklist:(WK_ARRAY(NSString *) *)legacyBlacklist userContentWorld:(_WKUserContentWorld *)userContentWorld;

Missing availability.

> Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp:194
> +    unsigned userScriptsRemoved = m_userScripts->removeAllOfTypeMatching<API::UserScript>(
> +        [&] (const RefPtr<API::UserScript>& userScript) -> bool {
> +            return &userScript->userContentWorld() == &world;
> +        });

Weird indentation, as evident from that last line! I’d write it like this:

unsigned userScriptsRemoved = m_userScripts->removeAllOfTypeMatching<API::UserScript>([&] (const RefPtr<API::UserScript>& userScript) -> bool {
    return &userScript->userContentWorld() == &world;
 });
Comment 4 Sam Weinig 2016-02-28 13:56:35 PST
Committed r197302: <http://trac.webkit.org/changeset/197302>