Title: [135941] trunk/Source/WebCore
Revision
135941
Author
jer.no...@apple.com
Date
2012-11-27 16:38:37 -0800 (Tue, 27 Nov 2012)

Log Message

Add a new shared class WebCoreFullScreenPlaceholderView, for use in WebKit and WebKit2.
https://bugs.webkit.org/show_bug.cgi?id=102300

Reviewed by Anders Carlsson.

Add a new shared class WebCoreFullScreenPlaceholderView, which presents the contents of the
WebView prior to full screen with a message informing the user how to exit from full screen mode.

* platform/mac/WebCoreFullScreenPlaceholderView.mm:
(-[WebCoreFullScreenPlaceholderView initWithFrame:]): Create the warning view and set up the placeholder layer.
(-[WebCoreFullScreenPlaceholderView setContents:]): Pass along to content view layer.
(-[WebCoreFullScreenPlaceholderView contents]): Ditto.
(-[WebCoreFullScreenPlaceholderView setExitWarningVisible:]): Show or hide the exit warning.
(-[WebCoreFullScreenPlaceholderView mouseDown:]): Call the target with action.

 Add a localized string entry for the "click to exit" text:
 * English.lproj/Localizable.strings:
* platform/LocalizedStrings.cpp:
(WebCore::clickToExitFullScreenText):
* platform/LocalizedStrings.h:
* English.lproj/Localizable.strings:

Add the new files to the project and exports list:
* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135940 => 135941)


--- trunk/Source/WebCore/ChangeLog	2012-11-28 00:37:14 UTC (rev 135940)
+++ trunk/Source/WebCore/ChangeLog	2012-11-28 00:38:37 UTC (rev 135941)
@@ -1,3 +1,31 @@
+2012-11-14  Jer Noble  <jer.no...@apple.com>
+
+        Add a new shared class WebCoreFullScreenPlaceholderView, for use in WebKit and WebKit2.
+        https://bugs.webkit.org/show_bug.cgi?id=102300
+
+        Reviewed by Anders Carlsson.
+
+        Add a new shared class WebCoreFullScreenPlaceholderView, which presents the contents of the 
+        WebView prior to full screen with a message informing the user how to exit from full screen mode.
+
+        * platform/mac/WebCoreFullScreenPlaceholderView.mm:
+        (-[WebCoreFullScreenPlaceholderView initWithFrame:]): Create the warning view and set up the placeholder layer.
+        (-[WebCoreFullScreenPlaceholderView setContents:]): Pass along to content view layer.
+        (-[WebCoreFullScreenPlaceholderView contents]): Ditto.
+        (-[WebCoreFullScreenPlaceholderView setExitWarningVisible:]): Show or hide the exit warning.
+        (-[WebCoreFullScreenPlaceholderView mouseDown:]): Call the target with action.
+
+         Add a localized string entry for the "click to exit" text:
+         * English.lproj/Localizable.strings:
+        * platform/LocalizedStrings.cpp:
+        (WebCore::clickToExitFullScreenText):
+        * platform/LocalizedStrings.h:
+        * English.lproj/Localizable.strings:
+
+        Add the new files to the project and exports list:
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2012-11-27  Andreas Kling  <akl...@apple.com>
 
         Shrink ShadowRoot and TreeScope.

Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (135940 => 135941)


--- trunk/Source/WebCore/English.lproj/Localizable.strings	2012-11-28 00:37:14 UTC (rev 135940)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings	2012-11-28 00:38:37 UTC (rev 135941)
@@ -901,3 +901,6 @@
 /* accessibility role description for video element controller */
 "video element playback controls and status display" = "video element playback controls and status display";
 
+/* Message to display in browser window when in webkit full screen mode. */
+"Click to exit full screen mode" = "Click to exit full screen mode";
+

Modified: trunk/Source/WebCore/WebCore.exp.in (135940 => 135941)


--- trunk/Source/WebCore/WebCore.exp.in	2012-11-28 00:37:14 UTC (rev 135940)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-11-28 00:38:37 UTC (rev 135941)
@@ -1598,6 +1598,7 @@
 .objc_class_name_DOMStyleSheet
 .objc_class_name_DOMStyleSheetList
 .objc_class_name_DOMTreeWalker
+.objc_class_name_WebCoreFullScreenPlaceholderView
 .objc_class_name_WebCoreFullScreenWarningView
 .objc_class_name_WebCoreFullScreenWindow
 .objc_class_name_WebHTMLConverter

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (135940 => 135941)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-11-28 00:37:14 UTC (rev 135940)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-11-28 00:38:37 UTC (rev 135941)
@@ -5927,6 +5927,8 @@
 		CDB859F7160D48A400E5B07F /* MediaKeyEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDB859F4160D489900E5B07F /* MediaKeyEvent.cpp */; };
 		CDB859FA160D494900E5B07F /* JSMediaKeyEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDB859F8160D493E00E5B07F /* JSMediaKeyEvent.cpp */; };
 		CDB859FB160D494F00E5B07F /* JSMediaKeyError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDB859F0160D42DD00E5B07F /* JSMediaKeyError.cpp */; };
+		CDC69DDA16371FD4007C38DF /* WebCoreFullScreenPlaceholderView.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC69DD816371FD3007C38DF /* WebCoreFullScreenPlaceholderView.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		CDC69DDB16371FD4007C38DF /* WebCoreFullScreenPlaceholderView.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC69DD916371FD3007C38DF /* WebCoreFullScreenPlaceholderView.mm */; };
 		CDC69DD61632026C007C38DF /* WebCoreFullScreenWarningView.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC69DD41632026C007C38DF /* WebCoreFullScreenWarningView.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		CDC69DD71632026C007C38DF /* WebCoreFullScreenWarningView.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC69DD51632026C007C38DF /* WebCoreFullScreenWarningView.mm */; };
 		CDD525D7145B6DD0008D204D /* JSHTMLMediaElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDF65CCC145B6AFE00C4C7AA /* JSHTMLMediaElementCustom.cpp */; };
@@ -13352,6 +13354,8 @@
 		CDB859F8160D493E00E5B07F /* JSMediaKeyEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaKeyEvent.cpp; sourceTree = "<group>"; };
 		CDB859F9160D493E00E5B07F /* JSMediaKeyEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaKeyEvent.h; sourceTree = "<group>"; };
 		CDBD93BA1333BD4B002570E3 /* fullscreenQuickTime.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = fullscreenQuickTime.css; sourceTree = "<group>"; };
+		CDC69DD816371FD3007C38DF /* WebCoreFullScreenPlaceholderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenPlaceholderView.h; sourceTree = "<group>"; };
+		CDC69DD916371FD3007C38DF /* WebCoreFullScreenPlaceholderView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFullScreenPlaceholderView.mm; sourceTree = "<group>"; };
 		CDC69DD41632026C007C38DF /* WebCoreFullScreenWarningView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenWarningView.h; sourceTree = "<group>"; };
 		CDC69DD51632026C007C38DF /* WebCoreFullScreenWarningView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFullScreenWarningView.mm; sourceTree = "<group>"; };
 		CDCE5CD014633BC900D47CCA /* EventTargetFactory.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventTargetFactory.in; sourceTree = "<group>"; };
@@ -15855,6 +15859,8 @@
 				BCE659E50EA92FB2007E4533 /* ThemeMac.h */,
 				BCE659E80EA92FFA007E4533 /* ThemeMac.mm */,
 				51DF6D7F0B92A18E00C2DC85 /* ThreadCheck.mm */,
+				CDC69DD816371FD3007C38DF /* WebCoreFullScreenPlaceholderView.h */,
+				CDC69DD916371FD3007C38DF /* WebCoreFullScreenPlaceholderView.mm */,
 				CDC69DD41632026C007C38DF /* WebCoreFullScreenWarningView.h */,
 				CDC69DD51632026C007C38DF /* WebCoreFullScreenWarningView.mm */,
 				CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */,
@@ -25646,6 +25652,7 @@
 				FD581FB51520F93B003A7A75 /* WaveTable.h in Headers */,
 				29A812490FBB9CA900510293 /* WebAccessibilityObjectWrapper.h in Headers */,
 				93F199A808245E59001E9ABC /* WebCoreFrameView.h in Headers */,
+				CDC69DDA16371FD4007C38DF /* WebCoreFullScreenPlaceholderView.h in Headers */,
 				CDC69DD61632026C007C38DF /* WebCoreFullScreenWarningView.h in Headers */,
 				CD127DEE14F3098400E84779 /* WebCoreFullScreenWindow.h in Headers */,
 				BC53D911114310CC000D817E /* WebCoreJSClientData.h in Headers */,
@@ -28764,6 +28771,7 @@
 				FD7F299613D4C0CB00AD9535 /* WaveShaperProcessor.cpp in Sources */,
 				FD581FB41520F93B003A7A75 /* WaveTable.cpp in Sources */,
 				29A8124A0FBB9CA900510293 /* WebAccessibilityObjectWrapper.mm in Sources */,
+				CDC69DDB16371FD4007C38DF /* WebCoreFullScreenPlaceholderView.mm in Sources */,
 				CDC69DD71632026C007C38DF /* WebCoreFullScreenWarningView.mm in Sources */,
 				CD127DED14F3097D00E84779 /* WebCoreFullScreenWindow.mm in Sources */,
 				F3BFC9D315C177EC004244E5 /* WebCoreMemoryInstrumentation.cpp in Sources */,

Modified: trunk/Source/WebCore/platform/LocalizedStrings.cpp (135940 => 135941)


--- trunk/Source/WebCore/platform/LocalizedStrings.cpp	2012-11-28 00:37:14 UTC (rev 135940)
+++ trunk/Source/WebCore/platform/LocalizedStrings.cpp	2012-11-28 00:38:37 UTC (rev 135941)
@@ -998,4 +998,9 @@
     return validationMessageTypeMismatchText();
 }
 
+String clickToExitFullScreenText()
+{
+    return WEB_UI_STRING("Click to exit full screen mode", "Message to display in browser window when in webkit full screen mode.");
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/LocalizedStrings.h (135940 => 135941)


--- trunk/Source/WebCore/platform/LocalizedStrings.h	2012-11-28 00:37:14 UTC (rev 135940)
+++ trunk/Source/WebCore/platform/LocalizedStrings.h	2012-11-28 00:38:37 UTC (rev 135941)
@@ -260,6 +260,8 @@
     String unacceptableTLSCertificate();
 #endif
 
+    String clickToExitFullScreenText();
+
 #if !PLATFORM(CHROMIUM)
 #define WEB_UI_STRING(string, description) WebCore::localizedString(string)
 #define WEB_UI_STRING_KEY(string, key, description) WebCore::localizedString(key)

Added: trunk/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.h (0 => 135941)


--- trunk/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.h	2012-11-28 00:38:37 UTC (rev 135941)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebCoreFullScreenPlaceholderView_h
+#define WebCoreFullScreenPlaceholderView_h
+
+#import <wtf/RetainPtr.h>
+
+@interface WebCoreFullScreenPlaceholderView : NSView {
+    RetainPtr<NSView> _exitWarning;
+    NSObject* _target;
+    SEL _action;
+}
+@property(retain) id contents;
+@property(assign) NSObject* target;
+@property(assign) SEL action;
+- (void)setExitWarningVisible:(BOOL)visible;
+@end
+
+#endif // WebCoreFullScreenPlaceholderView_h

Added: trunk/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.mm (0 => 135941)


--- trunk/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.mm	                        (rev 0)
+++ trunk/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.mm	2012-11-28 00:38:37 UTC (rev 135941)
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebCoreFullScreenPlaceholderView.h"
+
+#include "LocalizedStrings.h"
+#include "WebCoreFullScreenWarningView.h"
+#include <wtf/UnusedParam.h>
+#include <wtf/text/WTFString.h>
+
+@interface CAFilter : NSObject
++ (CAFilter *)filterWithType:(NSString *)type;
+@end
+
+using namespace WebCore;
+
+@implementation WebCoreFullScreenPlaceholderView
+- (id)initWithFrame:(NSRect)frameRect
+{
+    self = [super initWithFrame:frameRect];
+    if (!self)
+        return nil;
+
+    [self setLayer:[CALayer layer]];
+    [self setLayerContentsRedrawPolicy:NSViewLayerContentsRedrawNever];
+    [self setWantsLayer:YES];
+
+    _exitWarning = adoptNS([[WebCoreFullScreenWarningView alloc] initWithTitle:clickToExitFullScreenText()]);
+    NSRect warningFrame = [_exitWarning.get() frame];
+    warningFrame.origin = NSMakePoint((frameRect.size.width - warningFrame.size.width) / 2, (frameRect.size.height - warningFrame.size.height) / 2);
+    [_exitWarning.get() setFrame:warningFrame];
+    [_exitWarning.get() setHidden:YES];
+    [self addSubview:_exitWarning.get()];
+
+    return self;
+}
+
+@synthesize target = _target;
+@synthesize action = ""
+
+@dynamic contents;
+- (void)setContents:(id)contents
+{
+    [[self layer] setContents:contents];
+}
+
+- (id)contents
+{
+    return [[self layer] contents];
+}
+
+- (void)setExitWarningVisible:(BOOL)visible
+{
+    [_exitWarning.get() setHidden:!visible];
+    if (visible) {
+        CAFilter* filter = [CAFilter filterWithType:@"colorMonochrome"];
+        [filter setValue:[NSNumber numberWithFloat:-0.2] forKey:@"inputBias"];
+        [filter setValue:[NSNumber numberWithFloat:1] forKey:@"inputAmount"];
+        [[self layer] setFilters:[NSArray arrayWithObject:filter]];
+    } else
+        [[self layer] setFilters:nil];
+}
+
+- (void)mouseDown:(NSEvent *)theEvent
+{
+    UNUSED_PARAM(theEvent);
+
+    if (!_target || !_action)
+        return;
+    [_target performSelector:_action];
+}
+
+@end
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to