[Webkit-unassigned] [Bug 107509] [Mac] Update PageVisibilityState when WebView is hidden / visible

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 24 14:20:42 PST 2013


https://bugs.webkit.org/show_bug.cgi?id=107509





--- Comment #7 from Benjamin Poulain <benjamin at webkit.org>  2013-01-24 14:22:36 PST ---
(From update of attachment 184355)
View in context: https://bugs.webkit.org/attachment.cgi?id=184355&action=review

So I guess when you switch tabs, we still have to programmatically change page visibility?

What if someone move the view between windows? Let say I minimize Window 1, and some asshat move the view to Window 2?

> Source/WebKit/mac/WebView/WebView.mm:3691
> +- (void)_windowDidMiniaturize:(NSNotification *)notification
> +{
> +    [self _updateVisibilityState];
> +}
> +
> +- (void)_windowDidDeminiaturize:(NSNotification *)notification
> +{
> +    [self _updateVisibilityState];
> +}
> +
> +- (void)_windowDidOrderOnScreen:(NSNotification *)notification
> +{
> +    [self _updateVisibilityState];
> +}
> +
> +- (void)_windowDidOrderOffScreen:(NSNotification *)notification
> +{
> +    [self _updateVisibilityState];
> +}

Why not just make
- (void)_windowVisibilityChanged:
And register all notifications to that?

> Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:1076
> +				A57A34F016AF677200C2501F /* PageVisibilityStateWithWindowChanges.mm in Sources */,

Build section could be sorted (my new favorite trick to r- patches) :)

> Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm:34
> +static bool didGetPageSignal;

The name is a little generic.

> Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm:68
> +    virtual NSURL *url() const { return [[NSBundle mainBundle] URLForResource:@"PageVisibilityStateWithWindowChanges" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; }
> +    virtual void didLoadURL(WebView *webView) { runTest(webView); teardownView(webView); }
> +    virtual void didLoadURL(WKView *wkView) { runTest(wkView); teardownView(wkView); }

Not a fan of inline implementation here.
Missing OVERRIDE?

> Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm:74
> +    virtual void initializeView(WebView *) OVERRIDE;
> +    virtual void initializeView(WKView *) OVERRIDE;
> +    virtual void teardownView(WebView *);
> +    virtual void teardownView(WKView *);

Style? Missing OVERRIDE?

> Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm:79
> +    webView.UIDelegate = [[PageVisibilityStateDelegate alloc] init];

This looks like a leak.

> Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm:86
> +    id uiDelegate = webView.UIDelegate;
> +    webView.UIDelegate = nil;
> +    [uiDelegate release];

ahahaha, okay.
Maybe a RetainPtr as an attribute would makes things simpler?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list