WebKit Bugzilla
Attachment 343252 Details for
Bug 186862
: [Fullscreen] Use secondary glyph style for fullscreen controls
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-186862-20180621112034.patch (text/plain), 18.33 KB, created by
Jer Noble
on 2018-06-21 11:20:35 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2018-06-21 11:20:35 PDT
Size:
18.33 KB
patch
obsolete
>Subversion Revision: 233032 >diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog >index c9954a4735ff61ae01bd891dc07b9b77834a2168..05ee5030f9340059057a404b5e4d5aa72e43097d 100644 >--- a/Source/WebCore/PAL/ChangeLog >+++ b/Source/WebCore/PAL/ChangeLog >@@ -1,3 +1,13 @@ >+2018-06-20 Jer Noble <jer.noble@apple.com> >+ >+ [Fullscreen] Use secondary glyph style for fullscreen controls >+ https://bugs.webkit.org/show_bug.cgi?id=186862 >+ <rdar://problem/41212210> >+ >+ Reviewed by Tim Horton. >+ >+ * pal/spi/cocoa/AVKitSPI.h: >+ > 2018-06-15 Jonathan Bedard <jbedard@apple.com> > > Complex text handling should opt out of bounded text layout (follow-up fix) >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 1ca42424dd420005199d858040b14af0e3e45f0e..a3518bbcd38198a351f08d4a3d7242f697459e5d 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,35 @@ >+2018-06-20 Jer Noble <jer.noble@apple.com> >+ >+ [Fullscreen] Use secondary glyph style for fullscreen controls >+ https://bugs.webkit.org/show_bug.cgi?id=186862 >+ <rdar://problem/41212210> >+ >+ Reviewed by Tim Horton. >+ >+ Adopt AVBackgroundView, and use its predefined enums to set the material and tint styles for >+ the fullscreen controls. >+ >+ * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: >+ (-[WKFullScreenViewController loadView]): >+ * UIProcess/ios/fullscreen/WKFullscreenStackView.h: >+ * UIProcess/ios/fullscreen/WKFullscreenStackView.mm: >+ (-[WKFullscreenStackView init]): >+ (-[WKFullscreenStackView dealloc]): >+ (-[WKFullscreenStackView addArrangedSubview:applyingMaterialStyle:tintEffectStyle:]): >+ (-[WKFullscreenStackView layoutSubviews]): >+ (+[WKFullscreenStackView baseEffects]): Deleted. >+ (+[WKFullscreenStackView configureView:forTintEffectWithColor:filterType:]): Deleted. >+ (+[WKFullscreenStackView configureView:withBackgroundFillOfColor:opacity:filter:]): Deleted. >+ (+[WKFullscreenStackView secondaryMaterialOverlayView]): Deleted. >+ (+[WKFullscreenStackView applyPrimaryGlyphTintToView:]): Deleted. >+ (+[WKFullscreenStackView applySecondaryGlyphTintToView:]): Deleted. >+ (-[WKFullscreenStackView initWithArrangedSubviews:axis:]): Deleted. >+ (-[WKFullscreenStackView setTargetViewForSecondaryMaterialOverlay:]): Deleted. >+ (-[WKFullscreenStackView contentView]): Deleted. >+ (-[WKFullscreenStackView _setArrangedSubviews:axis:]): Deleted. >+ (-[WKFullscreenStackView setBounds:]): Deleted. >+ (-[WKFullscreenStackView updateConstraints]): Deleted. >+ > 2018-06-20 Jer Noble <jer.noble@apple.com> > > [Fullscreen] Suspend page (and pause video) while phishing warning is presented >diff --git a/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h b/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h >index f1a53b894bf6e5f23d372cebcfb3afd7a0aac657..bb814fd2257bc19ed69e106fe1696d2af005f8e1 100644 >--- a/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h >+++ b/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h >@@ -33,6 +33,7 @@ > > #if USE(APPLE_INTERNAL_SDK) > >+#import <AVKit/AVBackgroundView.h> > #import <AVKit/AVPlayerController.h> > #pragma clang diagnostic push > #pragma clang diagnostic ignored "-Wobjc-property-no-attribute" >@@ -90,6 +91,21 @@ NS_ASSUME_NONNULL_END > > #else > >+NS_ASSUME_NONNULL_BEGIN >+ >+@interface AVBackgroundView : UIView >+@property (nonatomic) BOOL automaticallyDrawsRoundedCorners; >+typedef NS_ENUM(NSInteger, AVBackgroundViewMaterialStyle) { >+ AVBackgroundViewMaterialStylePrimary, >+ AVBackgroundViewMaterialStyleSecondary >+}; >+typedef NS_ENUM(NSInteger, AVBackgroundViewTintEffectStyle) { >+ AVBackgroundViewTintEffectStylePrimary, >+ AVBackgroundViewTintEffectStyleSecondary >+}; >+- (void)addSubview:(UIView *)subview applyingMaterialStyle:(AVBackgroundViewMaterialStyle)materialStyle tintEffectStyle:(AVBackgroundViewTintEffectStyle)tintEffectStyle; >+@end >+ > @interface AVPlayerController : UIResponder > @end > >@@ -108,8 +124,6 @@ typedef NS_ENUM(NSInteger, AVPlayerControllerExternalPlaybackType) { > @property (NS_NONATOMIC_IOSONLY, readonly) AVPlayerControllerStatus status; > @end > >-NS_ASSUME_NONNULL_BEGIN >- > @class AVPlayerLayer; > > @interface AVPictureInPicturePlayerLayerView : UIView >diff --git a/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm b/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm >index 5c0b97ceddf2e50a00d99ce7c75f11ad4f3723fd..a09c2ba16f594e17683ed112c01c04646b58a474 100644 >--- a/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm >+++ b/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm >@@ -36,6 +36,7 @@ > #import "WebFullScreenManagerProxy.h" > #import "WebPageProxy.h" > #import <WebCore/LocalizedStrings.h> >+#import <pal/spi/cocoa/AVKitSPI.h> > #import <wtf/RetainPtr.h> > > using namespace WebCore; >@@ -261,7 +262,6 @@ - (void)loadView > [_cancelButton setTranslatesAutoresizingMaskIntoConstraints:NO]; > [_cancelButton setAdjustsImageWhenHighlighted:NO]; > [_cancelButton setExtrinsicContentSize:CGSizeMake(60.0, 47.0)]; >- [WKFullscreenStackView applyPrimaryGlyphTintToView:_cancelButton.get()]; > NSBundle *bundle = [NSBundle bundleForClass:self.class]; > UIImage *doneImage = [UIImage imageNamed:@"Done" inBundle:bundle compatibleWithTraitCollection:nil]; > [_cancelButton setImage:[doneImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] forState:UIControlStateNormal]; >@@ -273,7 +273,6 @@ - (void)loadView > [_pipButton setTranslatesAutoresizingMaskIntoConstraints:NO]; > [_pipButton setAdjustsImageWhenHighlighted:NO]; > [_pipButton setExtrinsicContentSize:CGSizeMake(60.0, 47.0)]; >- [WKFullscreenStackView applyPrimaryGlyphTintToView:_pipButton.get()]; > UIImage *startPiPImage = [UIImage imageNamed:@"StartPictureInPictureButton" inBundle:bundle compatibleWithTraitCollection:nil]; > UIImage *stopPiPImage = [UIImage imageNamed:@"StopPictureInPictureButton" inBundle:bundle compatibleWithTraitCollection:nil]; > [_pipButton setImage:[startPiPImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] forState:UIControlStateNormal]; >@@ -282,9 +281,10 @@ - (void)loadView > [_pipButton sizeToFit]; > [_pipButton addTarget:self action:@selector(_togglePiPAction:) forControlEvents:UIControlEventTouchUpInside]; > >- _stackView = adoptNS([[WKFullscreenStackView alloc] initWithArrangedSubviews:@[_cancelButton.get(), _pipButton.get()] axis:UILayoutConstraintAxisHorizontal]); >+ _stackView = adoptNS([[WKFullscreenStackView alloc] init]); > [_stackView setTranslatesAutoresizingMaskIntoConstraints:NO]; >- [_stackView setTargetViewForSecondaryMaterialOverlay:_cancelButton.get()]; >+ [_stackView addArrangedSubview:_cancelButton.get() applyingMaterialStyle:AVBackgroundViewMaterialStyleSecondary tintEffectStyle:AVBackgroundViewTintEffectStyleSecondary]; >+ [_stackView addArrangedSubview:_pipButton.get() applyingMaterialStyle:AVBackgroundViewMaterialStylePrimary tintEffectStyle:AVBackgroundViewTintEffectStyleSecondary]; > [[self view] addSubview:_stackView.get()]; > > UILayoutGuide *safeArea = self.view.safeAreaLayoutGuide; >diff --git a/Source/WebKit/UIProcess/ios/fullscreen/WKFullscreenStackView.h b/Source/WebKit/UIProcess/ios/fullscreen/WKFullscreenStackView.h >index f7b82c5b36478ea635eaf1ddad6842f033cd8303..374d4fd4303651320a6bcfc119d2e40a3d7aedc7 100644 >--- a/Source/WebKit/UIProcess/ios/fullscreen/WKFullscreenStackView.h >+++ b/Source/WebKit/UIProcess/ios/fullscreen/WKFullscreenStackView.h >@@ -28,17 +28,12 @@ > #if ENABLE(FULLSCREEN_API) && PLATFORM(IOS) > > #import <UIKit/UIView.h> >+#import <pal/spi/cocoa/AVKitSPI.h> > > NS_ASSUME_NONNULL_BEGIN > >-@interface WKFullscreenStackView : UIView >-+ (void)applyPrimaryGlyphTintToView:(UIView *)view; >-+ (void)applySecondaryGlyphTintToView:(UIView *)view; >- >-- (instancetype)initWithArrangedSubviews:(NSArray<UIView *> *)arrangedSubviews axis:(UILayoutConstraintAxis)axis; >- >-@property (nonatomic, retain, nullable) UIView *targetViewForSecondaryMaterialOverlay; >-@property (nonatomic, readonly) UIView *contentView; >+@interface WKFullscreenStackView : UIStackView >+- (void)addArrangedSubview:(UIView *)subview applyingMaterialStyle:(AVBackgroundViewMaterialStyle)materialStyle tintEffectStyle:(AVBackgroundViewTintEffectStyle)tintEffectStyle; > @end > > NS_ASSUME_NONNULL_END >diff --git a/Source/WebKit/UIProcess/ios/fullscreen/WKFullscreenStackView.mm b/Source/WebKit/UIProcess/ios/fullscreen/WKFullscreenStackView.mm >index d17a7e8849349dd07f349323af5169f5cbc9e57f..7d4ab5d246025661e9e56f2b7a2914b62c2be93e 100644 >--- a/Source/WebKit/UIProcess/ios/fullscreen/WKFullscreenStackView.mm >+++ b/Source/WebKit/UIProcess/ios/fullscreen/WKFullscreenStackView.mm >@@ -31,213 +31,50 @@ > #import "UIKitSPI.h" > #import <QuartzCore/CAFilter.h> > #import <UIKit/UIVisualEffectView.h> >+#import <pal/cf/CoreMediaSoftLink.h> > #import <wtf/NeverDestroyed.h> > #import <wtf/RetainPtr.h> > >-static NSArray<UIVisualEffect *>* reducedTransparencyEffects() >-{ >- static NeverDestroyed<RetainPtr<NSArray<UIVisualEffect *>>> effects; >- static dispatch_once_t onceToken; >- dispatch_once(&onceToken, ^{ >- effects.get() = @[[UIVisualEffect effectCompositingColor:[UIColor colorWithRed:(43.0 / 255.0) green:(46.0 / 255.0) blue:(48.0 / 255.0) alpha:1.0] withMode:UICompositingModeNormal alpha:1.0]]; >- }); >- return effects.get().get(); >-} >+SOFTLINK_AVKIT_FRAMEWORK() >+SOFT_LINK_CLASS_OPTIONAL(AVKit, AVBackgroundView) > >-static NSArray<UIVisualEffect *>* normalTransparencyEffects() >-{ >- static NeverDestroyed<RetainPtr<NSArray<UIVisualEffect *>>> effects; >- static dispatch_once_t onceToken; >- dispatch_once(&onceToken, ^{ >- effects.get() = @[ >- [UIVisualEffect effectCompositingColor:[UIColor blackColor] withMode:UICompositingModeNormal alpha:0.55], >- [UIBlurEffect effectWithBlurRadius:UIRoundToScreenScale(17.5, [UIScreen mainScreen])], >- [UIColorEffect colorEffectSaturate:1.8], >- [UIVisualEffect effectCompositingColor:[UIColor whiteColor] withMode:UICompositingModeNormal alpha:0.14] >- ]; >- }); >- return effects.get().get(); >+@interface WKFullscreenStackView () { >+ RetainPtr<AVBackgroundView> _backgroundView; > } >- >-@interface UIVisualEffectView (WebKitPrivate) >-@property (nonatomic, readwrite, copy) NSArray<UIVisualEffect *> *backgroundEffects; >-@end >- >-@interface WKFullscreenStackView () >-@property (nonatomic, readonly) UIStackView *_stackView; >-@property (nonatomic, readonly) UIVisualEffectView *_visualEffectView; >-@property (nonatomic, assign) UIVisualEffectView *secondaryMaterialOverlayView; >-@property (nonatomic, retain) NSArray<NSLayoutConstraint *> *secondaryMaterialOverlayViewConstraints; > @end > > @implementation WKFullscreenStackView > >-#pragma mark - Class Methods >-+ (NSArray<UIVisualEffect *> *)baseEffects >-{ >- if (UIAccessibilityIsReduceTransparencyEnabled()) >- return reducedTransparencyEffects(); >- return normalTransparencyEffects(); >-} >- >-+ (void)configureView:(UIView *)view forTintEffectWithColor:(UIColor *)tintColor filterType:(NSString *)filterType >-{ >- if ([view isKindOfClass:[UILabel class]]) { >- [(UILabel *)view setTextColor:tintColor]; >- [view setTintColor:tintColor]; >- [[view layer] setCompositingFilter:[CAFilter filterWithType:kCAFilterPlusL]]; >- return; >- } >- >- _UIVisualEffectTintLayerConfig *tintLayerConfig = [_UIVisualEffectTintLayerConfig layerWithTintColor:tintColor filterType:filterType]; >- [[[_UIVisualEffectConfig configWithContentConfig:tintLayerConfig] contentConfig] configureLayerView:view]; >-} >- >-+ (void)configureView:(UIView *)view withBackgroundFillOfColor:(UIColor *)fillColor opacity:(CGFloat)opacity filter:(NSString *)filter >-{ >- _UIVisualEffectLayerConfig *baseLayerConfig = [_UIVisualEffectLayerConfig layerWithFillColor:fillColor opacity:opacity filterType:filter]; >- [[[_UIVisualEffectConfig configWithContentConfig:baseLayerConfig] contentConfig] configureLayerView:view]; >-} >- >-+ (UIVisualEffectView *)secondaryMaterialOverlayView >-{ >- UIVisualEffectView *secondaryMaterialOverlayView = [[UIVisualEffectView alloc] initWithEffect:nil]; >- [secondaryMaterialOverlayView setUserInteractionEnabled:NO]; >- [secondaryMaterialOverlayView setBackgroundEffects:@[[UIVisualEffect effectCompositingColor:[UIColor blackColor] withMode:UICompositingModePlusDarker alpha:0.06]]]; >- return [secondaryMaterialOverlayView autorelease]; >-} >- > #pragma mark - External Interface > >-+ (void)applyPrimaryGlyphTintToView:(UIView *)view >+- (instancetype)init > { >- [self configureView:view forTintEffectWithColor:[UIColor colorWithWhite:1.0 alpha:0.75] filterType:kCAFilterPlusL]; >-} >- >-+ (void)applySecondaryGlyphTintToView:(UIView *)view >-{ >- [self configureView:view forTintEffectWithColor:[UIColor colorWithWhite:1.0 alpha:0.55] filterType:kCAFilterPlusL]; >-} >- >-- (instancetype)initWithArrangedSubviews:(NSArray<UIView *> *)arrangedSubviews axis:(UILayoutConstraintAxis)axis >-{ >- self = [self initWithFrame:CGRectMake(0, 0, 100, 100)]; >+ CGRect frame = CGRectMake(0, 0, 100, 100); >+ self = [self initWithFrame:frame]; > > if (!self) > return nil; > > [self setClipsToBounds:YES]; > >- _visualEffectView = [[UIVisualEffectView alloc] initWithEffect:nil]; >- [self addSubview:_visualEffectView]; >- [_visualEffectView setBackgroundEffects:[[self class] baseEffects]]; >- >- _stackView = [[UIStackView alloc] initWithArrangedSubviews:arrangedSubviews]; >- [_stackView setAxis:axis]; >- [_stackView setLayoutMarginsRelativeArrangement:YES]; >- [_stackView setInsetsLayoutMarginsFromSafeArea:NO]; >- [self insertSubview:_stackView above:_visualEffectView]; >- >- [self _setArrangedSubviews:arrangedSubviews axis:axis]; >+ _backgroundView = adoptNS([allocAVBackgroundViewInstance() initWithFrame:frame]); >+ [self addSubview:_backgroundView.get()]; > > return self; > } > >-- (void)dealloc >-{ >- [_targetViewForSecondaryMaterialOverlay release]; >- [_visualEffectView release]; >- [_stackView release]; >- [_secondaryMaterialOverlayViewConstraints release]; >- [super dealloc]; >-} >- >-- (void)setTargetViewForSecondaryMaterialOverlay:(UIView *)targetViewForSecondaryMaterialOverlay >-{ >- if (_targetViewForSecondaryMaterialOverlay == targetViewForSecondaryMaterialOverlay) >- return; >- >- _targetViewForSecondaryMaterialOverlay = [targetViewForSecondaryMaterialOverlay retain]; >- [self setNeedsUpdateConstraints]; >-} >- >-- (UIView *)contentView >-{ >- return [_visualEffectView contentView]; >-} >- >-#pragma mark - Internal Interface >- >-@synthesize _stackView=_stackView; >-@synthesize _visualEffectView=_visualEffectView; >- >-- (void)_setArrangedSubviews:(NSArray<UIView *> *)arrangedSubviews axis:(UILayoutConstraintAxis)axis >+- (void)addArrangedSubview:(UIView *)subview applyingMaterialStyle:(AVBackgroundViewMaterialStyle)materialStyle tintEffectStyle:(AVBackgroundViewTintEffectStyle)tintEffectStyle > { >- for (UIView *view in [_stackView arrangedSubviews]) >- [view removeFromSuperview]; >- >- for (UIView *view in arrangedSubviews) >- [_stackView addArrangedSubview:view]; >- >- [_stackView setAxis:axis]; >+ [_backgroundView.get() addSubview:subview applyingMaterialStyle:materialStyle tintEffectStyle:tintEffectStyle]; >+ [self addArrangedSubview:subview]; > } > > #pragma mark - UIView Overrides > >-- (void)setBounds:(CGRect)bounds >-{ >- CGSize oldSize = [self bounds].size; >- >- [super setBounds:bounds]; >- >- if (!CGSizeEqualToSize(oldSize, bounds.size)) >- [self _setContinuousCornerRadius:((CGRectGetHeight(bounds) > 40.0) ? 16.0 : 8.0)]; >-} >- >-- (void)updateConstraints >+- (void)layoutSubviews > { >- if ([_stackView translatesAutoresizingMaskIntoConstraints] || [_visualEffectView translatesAutoresizingMaskIntoConstraints]) { >- [_visualEffectView setTranslatesAutoresizingMaskIntoConstraints:NO]; >- [_stackView setTranslatesAutoresizingMaskIntoConstraints:NO]; >- >- NSArray<NSLayoutConstraint *> *constraints = @[ >- [[_visualEffectView leadingAnchor] constraintEqualToAnchor:[self leadingAnchor]], >- [[_visualEffectView topAnchor] constraintEqualToAnchor:[self topAnchor]], >- [[_visualEffectView trailingAnchor] constraintEqualToAnchor:[self trailingAnchor]], >- [[_visualEffectView bottomAnchor] constraintEqualToAnchor:[self bottomAnchor]], >- [[_stackView leadingAnchor] constraintEqualToAnchor:[self leadingAnchor]], >- [[_stackView topAnchor] constraintEqualToAnchor:[self topAnchor]], >- [[_stackView trailingAnchor] constraintEqualToAnchor:[self trailingAnchor]], >- [[_stackView bottomAnchor] constraintEqualToAnchor:[self bottomAnchor]], >- ]; >- >- for (NSLayoutConstraint *constraint in constraints) >- [constraint setPriority:(UILayoutPriorityRequired - 1)]; >- >- [NSLayoutConstraint activateConstraints:constraints]; >- } >- >- if ([[self targetViewForSecondaryMaterialOverlay] isDescendantOfView:self]) { >- if (!_secondaryMaterialOverlayView) { >- [self setSecondaryMaterialOverlayView:[[self class] secondaryMaterialOverlayView]]; >- [self addSubview:[self secondaryMaterialOverlayView]]; >- } >- >- if ([[self secondaryMaterialOverlayView] isDescendantOfView:self] && !_secondaryMaterialOverlayViewConstraints) { >- [[self secondaryMaterialOverlayView] setTranslatesAutoresizingMaskIntoConstraints:NO]; >- NSArray<NSLayoutConstraint *> *constraints = @[ >- [[_secondaryMaterialOverlayView centerXAnchor] constraintEqualToAnchor:[_targetViewForSecondaryMaterialOverlay centerXAnchor]], >- [[_secondaryMaterialOverlayView centerYAnchor] constraintEqualToAnchor:[_targetViewForSecondaryMaterialOverlay centerYAnchor]], >- [[_secondaryMaterialOverlayView widthAnchor] constraintEqualToAnchor:[_targetViewForSecondaryMaterialOverlay widthAnchor]], >- [[_secondaryMaterialOverlayView heightAnchor] constraintEqualToAnchor:[_targetViewForSecondaryMaterialOverlay heightAnchor]] >- ]; >- [self setSecondaryMaterialOverlayViewConstraints:constraints]; >- [NSLayoutConstraint activateConstraints:[self secondaryMaterialOverlayViewConstraints]]; >- } >- } else >- [_secondaryMaterialOverlayView removeFromSuperview]; >- >- [super updateConstraints]; >+ [_backgroundView.get() setFrame:self.bounds]; >+ [super layoutSubviews]; > } > > @end
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 186862
:
343183
|
343189
|
343239
| 343252