Title: [233945] trunk/Source/WebKit
Revision
233945
Author
[email protected]
Date
2018-07-18 18:19:40 -0700 (Wed, 18 Jul 2018)

Log Message

Let clients override _WKThumbnailView's background color

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

Reviewed by Tim Horton.

* UIProcess/API/Cocoa/_WKThumbnailView.h: Declare a property.
* UIProcess/API/Cocoa/_WKThumbnailView.mm: Define an ivar.
(-[_WKThumbnailView updateLayer]): Consult the background color.
(-[_WKThumbnailView setOverrideBackgroundColor:]): Notably, call -updateLayer.
(-[_WKThumbnailView overrideBackgroundColor]): Added.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (233944 => 233945)


--- trunk/Source/WebKit/ChangeLog	2018-07-19 01:01:25 UTC (rev 233944)
+++ trunk/Source/WebKit/ChangeLog	2018-07-19 01:19:40 UTC (rev 233945)
@@ -1,3 +1,17 @@
+2018-07-18  Ricky Mondello  <[email protected]>
+
+        Let clients override _WKThumbnailView's background color
+
+        https://bugs.webkit.org/show_bug.cgi?id=187788
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/API/Cocoa/_WKThumbnailView.h: Declare a property.
+        * UIProcess/API/Cocoa/_WKThumbnailView.mm: Define an ivar.
+        (-[_WKThumbnailView updateLayer]): Consult the background color.
+        (-[_WKThumbnailView setOverrideBackgroundColor:]): Notably, call -updateLayer.
+        (-[_WKThumbnailView overrideBackgroundColor]): Added.
+
 2018-07-18  Jer Noble  <[email protected]>
 
         CRASH at WebKit: WebKit::WebFullScreenManagerProxy::saveScrollPosition

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.h (233944 => 233945)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.h	2018-07-19 01:01:25 UTC (rev 233944)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.h	2018-07-19 01:19:40 UTC (rev 233945)
@@ -48,6 +48,8 @@
 // Defaults to NO.
 @property (nonatomic) BOOL shouldKeepSnapshotWhenRemovedFromSuperview;
 
+@property (strong, nonatomic) NSColor *overrideBackgroundColor;
+
 // This should be removed when all clients go away; it is always YES now.
 @property (nonatomic) BOOL usesSnapshot;
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.mm (233944 => 233945)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.mm	2018-07-19 01:01:25 UTC (rev 233944)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.mm	2018-07-19 01:19:40 UTC (rev 233945)
@@ -57,6 +57,8 @@
     BOOL _snapshotWasDeferred;
     CGFloat _lastSnapshotScale;
     CGSize _lastSnapshotMaximumSize;
+
+    RetainPtr<NSColor *> _overrideBackgroundColor;
 }
 
 @synthesize snapshotSize=_snapshotSize;
@@ -111,7 +113,8 @@
 {
     [super updateLayer];
 
-    self.layer.backgroundColor = [NSColor quaternaryLabelColor].CGColor;
+    NSColor *backgroundColor = self.overrideBackgroundColor ?: [NSColor quaternaryLabelColor];
+    self.layer.backgroundColor = backgroundColor.CGColor;
 }
 
 - (void)requestSnapshot
@@ -147,6 +150,20 @@
     });
 }
 
+- (void)setOverrideBackgroundColor:(NSColor *)overrideBackgroundColor
+{
+    if ([_overrideBackgroundColor isEqual:overrideBackgroundColor])
+        return;
+
+    _overrideBackgroundColor = overrideBackgroundColor;
+    [self setNeedsDisplay:YES];
+}
+
+- (NSColor *)overrideBackgroundColor
+{
+    return _overrideBackgroundColor.get();
+}
+
 - (void)_viewWasUnparented
 {
     if (!_exclusivelyUsesSnapshot) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to