Bug 154798 - Bind _WKUserStyleSheets to WKUserContentWorlds to allow for grouping of user content by associating to a world
Summary: Bind _WKUserStyleSheets to WKUserContentWorlds to allow for grouping of user ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-28 13:08 PST by Sam Weinig
Modified: 2016-02-28 13:56 PST (History)
0 users

See Also:


Attachments
Patch (45.99 KB, patch)
2016-02-28 13:17 PST, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (33.68 KB, patch)
2016-02-28 13:30 PST, Sam Weinig
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>