Title: [181403] trunk/Source/WebCore
Revision
181403
Author
[email protected]
Date
2015-03-11 13:27:42 -0700 (Wed, 11 Mar 2015)

Log 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:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (181402 => 181403)


--- trunk/Source/WebCore/ChangeLog	2015-03-11 20:18:59 UTC (rev 181402)
+++ trunk/Source/WebCore/ChangeLog	2015-03-11 20:27:42 UTC (rev 181403)
@@ -1,3 +1,25 @@
+2015-03-11  Jer Noble  <[email protected]>
+
+        [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:]):
+
 2015-03-11  Timothy Horton  <[email protected]>
 
         Make it possible to zoom on pages that claim to lay out to device size and then fail to do so

Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (181402 => 181403)


--- trunk/Source/WebCore/English.lproj/Localizable.strings	2015-03-11 20:18:59 UTC (rev 181402)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings	2015-03-11 20:27:42 UTC (rev 181403)
@@ -167,7 +167,7 @@
 "Clear Recent Searches" = "Clear Recent Searches";
 
 /* Message to display in browser window when in webkit full screen mode. */
-"Click to exit full screen mode" = "Click to exit full screen mode";
+"Click to Exit Full Screen" = "Click to Exit Full Screen";
 
 /* Subtitle of the label to show on a snapshotted plug-in */
 "Click to restart" = "Click to restart";

Modified: trunk/Source/WebCore/platform/LocalizedStrings.cpp (181402 => 181403)


--- trunk/Source/WebCore/platform/LocalizedStrings.cpp	2015-03-11 20:18:59 UTC (rev 181402)
+++ trunk/Source/WebCore/platform/LocalizedStrings.cpp	2015-03-11 20:27:42 UTC (rev 181403)
@@ -1056,7 +1056,7 @@
 
 String clickToExitFullScreenText()
 {
-    return WEB_UI_STRING("Click to exit full screen mode", "Message to display in browser window when in webkit full screen mode.");
+    return WEB_UI_STRING("Click to Exit Full Screen", "Message to display in browser window when in webkit full screen mode.");
 }
 
 #if ENABLE(VIDEO_TRACK)

Modified: trunk/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.h (181402 => 181403)


--- trunk/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.h	2015-03-11 20:18:59 UTC (rev 181402)
+++ trunk/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.h	2015-03-11 20:27:42 UTC (rev 181403)
@@ -31,7 +31,12 @@
 #import <wtf/RetainPtr.h>
 
 WEBCORE_EXPORT @interface WebCoreFullScreenPlaceholderView : NSView {
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+    RetainPtr<NSVisualEffectView> _effectView;
+    RetainPtr<NSTextField> _exitWarning;
+#else
     RetainPtr<NSView> _exitWarning;
+#endif
     NSObject* _target;
     SEL _action;
 }

Modified: trunk/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.mm (181402 => 181403)


--- trunk/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.mm	2015-03-11 20:18:59 UTC (rev 181402)
+++ trunk/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.mm	2015-03-11 20:27:42 UTC (rev 181403)
@@ -45,6 +45,38 @@
     if (!self)
         return nil;
 
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+    self.wantsLayer = YES;
+    self.autoresizesSubviews = YES;
+    self.layerContentsPlacement = NSViewLayerContentsPlacementTopLeft;
+    self.layerContentsRedrawPolicy = NSViewLayerContentsRedrawNever;
+
+    _effectView = adoptNS([[NSVisualEffectView alloc] initWithFrame:frameRect]);
+    _effectView.get().wantsLayer = YES;
+    _effectView.get().autoresizesSubviews = YES;
+    _effectView.get().autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
+    _effectView.get().blendingMode = NSVisualEffectBlendingModeWithinWindow;
+    _effectView.get().hidden = YES;
+    _effectView.get().material = NSVisualEffectMaterialLight;
+    _effectView.get().state = NSVisualEffectStateActive;
+    [self addSubview:_effectView.get()];
+
+    _exitWarning = adoptNS([[NSTextField alloc] initWithFrame:NSZeroRect]);
+    _exitWarning.get().autoresizingMask = NSViewMinXMargin | NSViewMaxXMargin | NSViewMinYMargin | NSViewMaxYMargin;
+    _exitWarning.get().bordered = NO;
+    _exitWarning.get().drawsBackground = NO;
+    _exitWarning.get().editable = NO;
+    _exitWarning.get().font = [NSFont systemFontOfSize:27];
+    _exitWarning.get().selectable = NO;
+    _exitWarning.get().stringValue = clickToExitFullScreenText();
+    _exitWarning.get().textColor = [NSColor tertiaryLabelColor];
+    [_exitWarning sizeToFit];
+
+    NSRect warningFrame = [_exitWarning.get() frame];
+    warningFrame.origin = NSMakePoint((frameRect.size.width - warningFrame.size.width) / 2, frameRect.size.height / 2);
+    _exitWarning.get().frame = warningFrame;
+    [_effectView addSubview:_exitWarning.get()];
+#else
     [self setLayer:[CALayer layer]];
     [self setLayerContentsRedrawPolicy:NSViewLayerContentsRedrawNever];
     [self setWantsLayer:YES];
@@ -55,6 +87,7 @@
     [_exitWarning.get() setFrame:warningFrame];
     [_exitWarning.get() setHidden:YES];
     [self addSubview:_exitWarning.get()];
+#endif
 
     return self;
 }
@@ -75,6 +108,9 @@
 
 - (void)setExitWarningVisible:(BOOL)visible
 {
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+    [_effectView setHidden:!visible];
+#else
     [_exitWarning.get() setHidden:!visible];
     if (visible) {
         CAFilter* filter = [CAFilter filterWithType:@"colorMonochrome"];
@@ -83,6 +119,7 @@
         [[self layer] setFilters:[NSArray arrayWithObject:filter]];
     } else
         [[self layer] setFilters:nil];
+#endif
 }
 
 - (void)mouseDown:(NSEvent *)theEvent
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to