Bug 187788

Summary: Let clients override _WKThumbnailView's background color
Product: WebKit Reporter: Ricky Mondello <rmondello>
Component: PlatformAssignee: Ricky Mondello <rmondello>
Status: RESOLVED FIXED    
Severity: Normal CC: anshu, commit-queue, rmondello, sam, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Attempt.
thorton: review+
Attempt 2, using setNeedsDisplay
none
Attempt 3, calling -setNeedsDisplay: on the view itself none

Description Ricky Mondello 2018-07-18 15:31:04 PDT
Let clients override _WKThumbnailView's background color
Comment 1 Ricky Mondello 2018-07-18 16:57:11 PDT
Created attachment 345305 [details]
Attempt.
Comment 2 Anshu Chimala 2018-07-18 17:05:57 PDT
Comment on attachment 345305 [details]
Attempt.

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

> Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.mm:159
> +- (void)setOverrideBackgroundColor:(NSColor *)overrideBackgroundColor
> +{
> +    if ([_overrideBackgroundColor isEqual:overrideBackgroundColor])
> +        return;
> +
> +    _overrideBackgroundColor = overrideBackgroundColor;
> +    [self updateLayer];

It seems strange to call -updateLayer directly. Could we instead -setNeedsDisplay on the layer so that -updateLayer gets called during the next display pass?
Comment 3 Tim Horton 2018-07-18 17:07:39 PDT
Comment on attachment 345305 [details]
Attempt.

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

> Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.mm:159
> +    [self updateLayer];

Don't you usually setNeedsDisplay, not updateLayer directly?
Comment 4 Tim Horton 2018-07-18 17:08:07 PDT
lol, yes, that
Comment 5 Ricky Mondello 2018-07-18 17:10:24 PDT
Created attachment 345308 [details]
Attempt 2, using setNeedsDisplay
Comment 6 Tim Horton 2018-07-18 17:14:25 PDT
Comment on attachment 345308 [details]
Attempt 2, using setNeedsDisplay

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

> Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.mm:159
> +    [self.layer setNeedsDisplay];

setNeedsDisplay on the view, no? Isn't that how you get to updateLayer? This might work too, I'm not sure.
Comment 7 Ricky Mondello 2018-07-18 17:24:24 PDT
Created attachment 345310 [details]
Attempt 3, calling -setNeedsDisplay: on the view itself
Comment 8 WebKit Commit Bot 2018-07-18 18:19:47 PDT
Comment on attachment 345310 [details]
Attempt 3, calling -setNeedsDisplay: on the view itself

Clearing flags on attachment: 345310

Committed r233945: <https://trac.webkit.org/changeset/233945>
Comment 9 WebKit Commit Bot 2018-07-18 18:19:48 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Radar WebKit Bug Importer 2018-07-18 18:20:25 PDT
<rdar://problem/42361917>
Comment 11 Sam Weinig 2018-07-19 13:29:53 PDT
Comment on attachment 345310 [details]
Attempt 3, calling -setNeedsDisplay: on the view itself

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

> Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.h:51
> +@property (strong, nonatomic) NSColor *overrideBackgroundColor;

I believe this should probably be nullable.