WebKit Bugzilla
Attachment 368626 Details for
Bug 197443
: Safe browsing warning should update colors when a user switches between light and dark appearance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197443-20190430163418.patch (text/plain), 9.45 KB, created by
Alex Christensen
on 2019-04-30 16:34:18 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2019-04-30 16:34:18 PDT
Size:
9.45 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 244810) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,24 @@ >+2019-04-30 Alex Christensen <achristensen@webkit.org> >+ >+ Safe browsing warning should update colors when a user switches between light and dark appearance >+ https://bugs.webkit.org/show_bug.cgi?id=197443 >+ <rdar://problem/49883917> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningBoxBackground.colorset: Added. >+ * Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningBoxBackground.colorset/Contents.json: Added. >+ * UIProcess/Cocoa/WKSafeBrowsingWarning.h: >+ * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: >+ (colorForItem): >+ (-[WKSafeBrowsingExclamationPoint viewDidChangeEffectiveAppearance]): >+ (-[WKSafeBrowsingBox setSafeBrowsingBackgroundColor:]): >+ (-[WKSafeBrowsingBox updateLayer]): >+ (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]): >+ (-[WKSafeBrowsingWarning addContent]): >+ (-[WKSafeBrowsingWarning showDetailsClicked]): >+ (setBackground): Deleted. >+ > 2019-04-30 Chris Dumez <cdumez@apple.com> > > Regression(PSON) URL scheme handlers can no longer respond asynchronously >Index: Source/WebKit/Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningBoxBackground.colorset/Contents.json >=================================================================== >--- Source/WebKit/Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningBoxBackground.colorset/Contents.json (nonexistent) >+++ Source/WebKit/Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningBoxBackground.colorset/Contents.json (working copy) >@@ -0,0 +1,38 @@ >+{ >+ "info" : { >+ "version" : 1, >+ "author" : "xcode" >+ }, >+ "colors" : [ >+ { >+ "idiom" : "universal", >+ "color" : { >+ "color-space" : "srgb", >+ "components" : { >+ "red" : "0.925", >+ "alpha" : "1.000", >+ "blue" : "0.925", >+ "green" : "0.925" >+ } >+ } >+ }, >+ { >+ "idiom" : "universal", >+ "appearances" : [ >+ { >+ "appearance" : "luminosity", >+ "value" : "dark" >+ } >+ ], >+ "color" : { >+ "color-space" : "srgb", >+ "components" : { >+ "red" : "0.196", >+ "alpha" : "1.000", >+ "blue" : "0.196", >+ "green" : "0.196" >+ } >+ } >+ } >+ ] >+} >Index: Source/WebKit/Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningBoxBackground.colorset/Contents.json >=================================================================== >--- Source/WebKit/Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningBoxBackground.colorset/Contents.json (nonexistent) >+++ Source/WebKit/Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningBoxBackground.colorset/Contents.json (working copy) >@@ -0,0 +1,38 @@ >+{ >+ "info" : { >+ "version" : 1, >+ "author" : "xcode" >+ }, >+ "colors" : [ >+ { >+ "idiom" : "universal", >+ "color" : { >+ "color-space" : "srgb", >+ "components" : { >+ "red" : "0.925", >+ "alpha" : "1.000", >+ "blue" : "0.925", >+ "green" : "0.925" >+ } >+ } >+ }, >+ { >+ "idiom" : "universal", >+ "appearances" : [ >+ { >+ "appearance" : "luminosity", >+ "value" : "dark" >+ } >+ ], >+ "color" : { >+ "color-space" : "srgb", >+ "components" : { >+ "red" : "0.196", >+ "alpha" : "1.000", >+ "blue" : "0.196", >+ "green" : "0.196" >+ } >+ } >+ } >+ ] >+} >Index: Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.h >=================================================================== >--- Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.h (revision 244759) >+++ Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.h (working copy) >@@ -45,18 +45,33 @@ OBJC_CLASS WKSafeBrowsingTextView; > #if PLATFORM(MAC) > using ViewType = NSView; > using RectType = NSRect; >-@interface WKSafeBrowsingWarning : NSView<NSTextViewDelegate> >+using ColorType = NSColor; > #else > using ViewType = UIView; > using RectType = CGRect; >-@interface WKSafeBrowsingWarning : UIScrollView<UITextViewDelegate> >+using ColorType = UIColor; >+#endif >+ >+@interface WKSafeBrowsingBox : ViewType { >+@package >+#if PLATFORM(MAC) >+ RetainPtr<ColorType> _backgroundColor; >+#endif >+} >+- (void)setSafeBrowsingBackgroundColor:(ColorType *)color; >+@end >+ >+#if PLATFORM(MAC) >+@interface WKSafeBrowsingWarning : WKSafeBrowsingBox<NSTextViewDelegate> >+#else >+@interface WKSafeBrowsingWarning : WKSafeBrowsingBox<UITextViewDelegate> > #endif > { > @package > CompletionHandler<void(Variant<WebKit::ContinueUnsafeLoad, URL>&&)> _completionHandler; > RefPtr<const WebKit::SafeBrowsingWarning> _warning; > WeakObjCPtr<WKSafeBrowsingTextView> _details; >- WeakObjCPtr<ViewType> _box; >+ WeakObjCPtr<WKSafeBrowsingBox> _box; > #if PLATFORM(WATCHOS) > WeakObjCPtr<UIResponder> _previousFirstResponder; > #endif >Index: Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm >=================================================================== >--- Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm (revision 244759) >+++ Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm (working copy) >@@ -50,14 +50,12 @@ constexpr CGFloat maxWidth = 675; > #endif > > #if PLATFORM(MAC) >-using ColorType = NSColor; > using FontType = NSFont; > using TextViewType = NSTextView; > using ButtonType = NSButton; > using AlignmentType = NSLayoutAttribute; > using SizeType = NSSize; > #else >-using ColorType = UIColor; > using FontType = UIFont; > using TextViewType = UITextView; > using ButtonType = UIButton; >@@ -123,7 +121,7 @@ static ColorType *colorForItem(WarningIt > case WarningItem::Background: > return colorNamed(@"WKSafeBrowsingWarningBackground"); > case WarningItem::BoxBackground: >- return [NSColor windowBackgroundColor]; >+ return colorNamed(@"WKSafeBrowsingWarningBoxBackground"); > case WarningItem::TitleText: > case WarningItem::ExclamationPoint: > return colorNamed(@"WKSafeBrowsingWarningTitle"); >@@ -200,6 +198,11 @@ - (void)drawRect:(RectType)rect > [exclamationPoint fill]; > } > >+- (void)viewDidChangeEffectiveAppearance >+{ >+ [self setNeedsDisplay:YES]; >+} >+ > - (NSSize)intrinsicContentSize > { > return { exclamationPointSize, exclamationPointSize }; >@@ -254,16 +257,27 @@ static ViewType *makeLabel(NSAttributedS > #endif > } > >-static void setBackground(ViewType *view, ColorType *color) >+@implementation WKSafeBrowsingBox >+ >+- (void)setSafeBrowsingBackgroundColor:(ColorType *)color > { > #if PLATFORM(MAC) >- view.wantsLayer = YES; >- view.layer.backgroundColor = color.CGColor; >+ _backgroundColor = color; >+ self.wantsLayer = YES; > #else >- view.backgroundColor = color; >+ self.backgroundColor = color; > #endif > } > >+#if PLATFORM(MAC) >+- (void)updateLayer >+{ >+ self.layer.backgroundColor = [_backgroundColor CGColor]; >+} >+#endif >+ >+@end >+ > @interface WKSafeBrowsingTextView : TextViewType { > @package > WeakObjCPtr<WKSafeBrowsingWarning> _warning; >@@ -287,7 +301,7 @@ - (instancetype)initWithFrame:(RectType) > completionHandler(WTFMove(result)); > }; > _warning = makeRef(warning); >- setBackground(self, colorForItem(WarningItem::Background, self)); >+ [self setSafeBrowsingBackgroundColor:colorForItem(WarningItem::Background, self)]; > #if PLATFORM(MAC) > [self addContent]; > #endif >@@ -317,9 +331,9 @@ - (void)addContent > }] autorelease]); > auto showDetails = makeButton(WarningItem::ShowDetailsButton, self, @selector(showDetailsClicked)); > auto goBack = makeButton(WarningItem::GoBackButton, self, @selector(goBackClicked)); >- auto box = [[ViewType new] autorelease]; >+ auto box = [[WKSafeBrowsingBox new] autorelease]; > _box = box; >- setBackground(box, colorForItem(WarningItem::BoxBackground, self)); >+ [box setSafeBrowsingBackgroundColor:colorForItem(WarningItem::BoxBackground, self)]; > box.layer.cornerRadius = boxCornerRadius; > > for (ViewType *view in @[exclamationPoint, title, warning, goBack, showDetails]) { >@@ -392,7 +406,7 @@ - (void)addContent > > - (void)showDetailsClicked > { >- ViewType *box = _box.get().get(); >+ WKSafeBrowsingBox *box = _box.get().get(); > ButtonType *showDetails = box.subviews.lastObject; > [showDetails removeFromSuperview]; > >@@ -400,8 +414,8 @@ - (void)showDetailsClicked > [text addAttributes:@{ NSFontAttributeName:fontOfSize(WarningTextSize::Body) } range:NSMakeRange(0, text.length)]; > WKSafeBrowsingTextView *details = [[[WKSafeBrowsingTextView alloc] initWithAttributedString:text forWarning:self] autorelease]; > _details = details; >- ViewType *bottom = [[ViewType new] autorelease]; >- setBackground(bottom, colorForItem(WarningItem::BoxBackground, self)); >+ WKSafeBrowsingBox *bottom = [[WKSafeBrowsingBox new] autorelease]; >+ [bottom setSafeBrowsingBackgroundColor:colorForItem(WarningItem::BoxBackground, self)]; > bottom.layer.cornerRadius = boxCornerRadius; > > #if HAVE(SAFE_BROWSING) >@@ -416,8 +430,8 @@ - (void)showDetailsClicked > #endif > #endif > >- ViewType *line = [[ViewType new] autorelease]; >- setBackground(line, [ColorType lightGrayColor]); >+ WKSafeBrowsingBox *line = [[WKSafeBrowsingBox new] autorelease]; >+ [line setSafeBrowsingBackgroundColor:[ColorType lightGrayColor]]; > for (ViewType *view in @[details, bottom, line]) > view.translatesAutoresizingMaskIntoConstraints = NO; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197443
:
368626
|
368630
|
368634
|
368731