Changeset 181403 in webkit


Ignore:
Timestamp:
Mar 11, 2015, 1:27:42 PM (11 years ago)
Author:
jer.noble@apple.com
Message:

[Mac] Update fullscreen placeholder UI to use Vibrancy.
https://bugs.webkit.org/show_bug.cgi?id=142586

Reviewed by Eric Carlson.

Update the fullscreen placeholder with a translucent vibrant appearance
using NSVisualEffectView. Since NSVisuaEffectView is only available for
OS X 10.10 and above, wrap the new implementation in a version check and
retain the old implementation.

Drive-by: Update the strings for the placeholder view with new HI guidance
as well.

  • English.lproj/Localizable.strings:
  • platform/LocalizedStrings.cpp:

(WebCore::clickToExitFullScreenText):

  • platform/mac/WebCoreFullScreenPlaceholderView.h:
  • platform/mac/WebCoreFullScreenPlaceholderView.mm:

(-[WebCoreFullScreenPlaceholderView setExitWarningVisible:]):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r181400 r181403  
     12015-03-11  Jer Noble  <jer.noble@apple.com>
     2
     3        [Mac] Update fullscreen placeholder UI to use Vibrancy.
     4        https://bugs.webkit.org/show_bug.cgi?id=142586
     5
     6        Reviewed by Eric Carlson.
     7
     8        Update the fullscreen placeholder with a translucent vibrant appearance
     9        using NSVisualEffectView. Since NSVisuaEffectView is only available for
     10        OS X 10.10 and above, wrap the new implementation in a version check and
     11        retain the old implementation.
     12
     13        Drive-by: Update the strings for the placeholder view with new HI guidance
     14        as well.
     15
     16        * English.lproj/Localizable.strings:
     17        * platform/LocalizedStrings.cpp:
     18        (WebCore::clickToExitFullScreenText):
     19        * platform/mac/WebCoreFullScreenPlaceholderView.h:
     20        * platform/mac/WebCoreFullScreenPlaceholderView.mm:
     21        (-[WebCoreFullScreenPlaceholderView setExitWarningVisible:]):
     22
    1232015-03-11  Timothy Horton  <timothy_horton@apple.com>
    224
  • trunk/Source/WebCore/English.lproj/Localizable.strings

    r180946 r181403  
    168168
    169169/* Message to display in browser window when in webkit full screen mode. */
    170 "Click to exit full screen mode" = "Click to exit full screen mode";
     170"Click to Exit Full Screen" = "Click to Exit Full Screen";
    171171
    172172/* Subtitle of the label to show on a snapshotted plug-in */
  • trunk/Source/WebCore/platform/LocalizedStrings.cpp

    r174402 r181403  
    10571057String clickToExitFullScreenText()
    10581058{
    1059     return WEB_UI_STRING("Click to exit full screen mode", "Message to display in browser window when in webkit full screen mode.");
     1059    return WEB_UI_STRING("Click to Exit Full Screen", "Message to display in browser window when in webkit full screen mode.");
    10601060}
    10611061
  • trunk/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.h

    r173176 r181403  
    3232
    3333WEBCORE_EXPORT @interface WebCoreFullScreenPlaceholderView : NSView {
     34#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     35    RetainPtr<NSVisualEffectView> _effectView;
     36    RetainPtr<NSTextField> _exitWarning;
     37#else
    3438    RetainPtr<NSView> _exitWarning;
     39#endif
    3540    NSObject* _target;
    3641    SEL _action;
  • trunk/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.mm

    r161589 r181403  
    4646        return nil;
    4747
     48#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     49    self.wantsLayer = YES;
     50    self.autoresizesSubviews = YES;
     51    self.layerContentsPlacement = NSViewLayerContentsPlacementTopLeft;
     52    self.layerContentsRedrawPolicy = NSViewLayerContentsRedrawNever;
     53
     54    _effectView = adoptNS([[NSVisualEffectView alloc] initWithFrame:frameRect]);
     55    _effectView.get().wantsLayer = YES;
     56    _effectView.get().autoresizesSubviews = YES;
     57    _effectView.get().autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
     58    _effectView.get().blendingMode = NSVisualEffectBlendingModeWithinWindow;
     59    _effectView.get().hidden = YES;
     60    _effectView.get().material = NSVisualEffectMaterialLight;
     61    _effectView.get().state = NSVisualEffectStateActive;
     62    [self addSubview:_effectView.get()];
     63
     64    _exitWarning = adoptNS([[NSTextField alloc] initWithFrame:NSZeroRect]);
     65    _exitWarning.get().autoresizingMask = NSViewMinXMargin | NSViewMaxXMargin | NSViewMinYMargin | NSViewMaxYMargin;
     66    _exitWarning.get().bordered = NO;
     67    _exitWarning.get().drawsBackground = NO;
     68    _exitWarning.get().editable = NO;
     69    _exitWarning.get().font = [NSFont systemFontOfSize:27];
     70    _exitWarning.get().selectable = NO;
     71    _exitWarning.get().stringValue = clickToExitFullScreenText();
     72    _exitWarning.get().textColor = [NSColor tertiaryLabelColor];
     73    [_exitWarning sizeToFit];
     74
     75    NSRect warningFrame = [_exitWarning.get() frame];
     76    warningFrame.origin = NSMakePoint((frameRect.size.width - warningFrame.size.width) / 2, frameRect.size.height / 2);
     77    _exitWarning.get().frame = warningFrame;
     78    [_effectView addSubview:_exitWarning.get()];
     79#else
    4880    [self setLayer:[CALayer layer]];
    4981    [self setLayerContentsRedrawPolicy:NSViewLayerContentsRedrawNever];
     
    5688    [_exitWarning.get() setHidden:YES];
    5789    [self addSubview:_exitWarning.get()];
     90#endif
    5891
    5992    return self;
     
    76109- (void)setExitWarningVisible:(BOOL)visible
    77110{
     111#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     112    [_effectView setHidden:!visible];
     113#else
    78114    [_exitWarning.get() setHidden:!visible];
    79115    if (visible) {
     
    84120    } else
    85121        [[self layer] setFilters:nil];
     122#endif
    86123}
    87124
Note: See TracChangeset for help on using the changeset viewer.