Diff
Modified: trunk/Source/WebCore/ChangeLog (135936 => 135937)
--- trunk/Source/WebCore/ChangeLog 2012-11-28 00:22:59 UTC (rev 135936)
+++ trunk/Source/WebCore/ChangeLog 2012-11-28 00:23:54 UTC (rev 135937)
@@ -1,3 +1,20 @@
+2012-11-14 Jer Noble <jer.no...@apple.com>
+
+ Add a new shared class WebCoreFullScreenWarningView which presents a styled warning message.
+ https://bugs.webkit.org/show_bug.cgi?id=102299
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add a shared implementation of a warning view for use in WebKit and WebKit2.
+
+ * platform/mac/WebCoreFullScreenWarningView.h: Added.
+ * platform/mac/WebCoreFullScreenWarningView.mm: Added.
+ (-[WebCoreFullScreenWarningView initWithTitle:]): Create the view.
+
+ Add the new files to the project and exports list:
+ * WebCore.exp.in:
+ * WebCore.xcodeproj/project.pbxproj:
+
2012-11-27 Dean Jackson <d...@apple.com>
Make track list control active
Modified: trunk/Source/WebCore/WebCore.exp.in (135936 => 135937)
--- trunk/Source/WebCore/WebCore.exp.in 2012-11-28 00:22:59 UTC (rev 135936)
+++ trunk/Source/WebCore/WebCore.exp.in 2012-11-28 00:23:54 UTC (rev 135937)
@@ -1598,6 +1598,7 @@
.objc_class_name_DOMStyleSheet
.objc_class_name_DOMStyleSheetList
.objc_class_name_DOMTreeWalker
+.objc_class_name_WebCoreFullScreenWarningView
.objc_class_name_WebCoreFullScreenWindow
.objc_class_name_WebHTMLConverter
.objc_class_name_WebWindowFadeAnimation
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (135936 => 135937)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-11-28 00:22:59 UTC (rev 135936)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-11-28 00:23:54 UTC (rev 135937)
@@ -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 */; };
+ 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 */; };
CDEA763014608A53008B31F1 /* PlatformClockCA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEA762E146084DE008B31F1 /* PlatformClockCA.cpp */; };
CDEA76341460B56F008B31F1 /* ClockGeneric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEA76321460AE29008B31F1 /* ClockGeneric.cpp */; };
@@ -13350,6 +13352,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>"; };
+ 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>"; };
CDEA762C14608224008B31F1 /* Clock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Clock.h; sourceTree = "<group>"; };
CDEA762E146084DE008B31F1 /* PlatformClockCA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformClockCA.cpp; sourceTree = "<group>"; };
@@ -15851,6 +15855,8 @@
BCE659E50EA92FB2007E4533 /* ThemeMac.h */,
BCE659E80EA92FFA007E4533 /* ThemeMac.mm */,
51DF6D7F0B92A18E00C2DC85 /* ThreadCheck.mm */,
+ CDC69DD41632026C007C38DF /* WebCoreFullScreenWarningView.h */,
+ CDC69DD51632026C007C38DF /* WebCoreFullScreenWarningView.mm */,
CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */,
CD127DEB14F3097900E84779 /* WebCoreFullScreenWindow.mm */,
371941951566B37200A276D8 /* WebCoreNSCellExtras.h */,
@@ -25640,6 +25646,7 @@
FD581FB51520F93B003A7A75 /* WaveTable.h in Headers */,
29A812490FBB9CA900510293 /* WebAccessibilityObjectWrapper.h in Headers */,
93F199A808245E59001E9ABC /* WebCoreFrameView.h in Headers */,
+ CDC69DD61632026C007C38DF /* WebCoreFullScreenWarningView.h in Headers */,
CD127DEE14F3098400E84779 /* WebCoreFullScreenWindow.h in Headers */,
BC53D911114310CC000D817E /* WebCoreJSClientData.h in Headers */,
93F199BB08245E59001E9ABC /* WebCoreKeyboardUIMode.h in Headers */,
@@ -28757,6 +28764,7 @@
FD7F299613D4C0CB00AD9535 /* WaveShaperProcessor.cpp in Sources */,
FD581FB41520F93B003A7A75 /* WaveTable.cpp in Sources */,
29A8124A0FBB9CA900510293 /* WebAccessibilityObjectWrapper.mm in Sources */,
+ CDC69DD71632026C007C38DF /* WebCoreFullScreenWarningView.mm in Sources */,
CD127DED14F3097D00E84779 /* WebCoreFullScreenWindow.mm in Sources */,
F3BFC9D315C177EC004244E5 /* WebCoreMemoryInstrumentation.cpp in Sources */,
371941961566B37200A276D8 /* WebCoreNSCellExtras.m in Sources */,
Added: trunk/Source/WebCore/platform/mac/WebCoreFullScreenWarningView.h (0 => 135937)
--- trunk/Source/WebCore/platform/mac/WebCoreFullScreenWarningView.h (rev 0)
+++ trunk/Source/WebCore/platform/mac/WebCoreFullScreenWarningView.h 2012-11-28 00:23:54 UTC (rev 135937)
@@ -0,0 +1,41 @@
+/*
+ * 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 WebCoreFullScreenWarningView_h
+#define WebCoreFullScreenWarningView_h
+
+#if ENABLE(FULLSCREEN_API)
+
+#include <wtf/RetainPtr.h>
+
+@interface WebCoreFullScreenWarningView : NSBox {
+ RetainPtr<NSTextField> _textField;
+}
+- (id)initWithTitle:(NSString*)title;
+@end
+
+#endif
+
+#endif // WebCoreFullScreenWarningView_h
Added: trunk/Source/WebCore/platform/mac/WebCoreFullScreenWarningView.mm (0 => 135937)
--- trunk/Source/WebCore/platform/mac/WebCoreFullScreenWarningView.mm (rev 0)
+++ trunk/Source/WebCore/platform/mac/WebCoreFullScreenWarningView.mm 2012-11-28 00:23:54 UTC (rev 135937)
@@ -0,0 +1,108 @@
+/*
+ * 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 "WebCoreFullScreenWarningView.h"
+
+#include "LocalizedStrings.h"
+#include <wtf/text/WTFString.h>
+
+static const CGFloat WarningViewTextWhite = 0.9;
+static const CGFloat WarningViewTextAlpha = 1;
+static const CGFloat WarningViewTextSize = 48;
+static const CGFloat WarningViewPadding = 20;
+static const CGFloat WarningViewCornerRadius = 10;
+static const CGFloat WarningViewBorderWhite = 0.9;
+static const CGFloat WarningViewBorderAlpha = 0.2;
+static const CGFloat WarningViewBackgroundWhite = 0.1;
+static const CGFloat WarningViewBackgroundAlpha = 0.9;
+static const CGFloat WarningViewShadowWhite = 0.1;
+static const CGFloat WarningViewShadowAlpha = 1;
+static const float WarningViewShadowOpacity = 0.25;
+static const CGSize WarningViewShadowOffset = {0, -2};
+static const CGFloat WarningViewShadowRadius = 5;
+static const NSTimeInterval WarningViewHideDelay = 3;
+static const NSTimeInterval WarningViewFadeDuration = 0.5;
+
+@implementation WebCoreFullScreenWarningView
+
+- (id)initWithTitle:(NSString*)title
+{
+ self = [super initWithFrame:NSZeroRect];
+ if (!self)
+ return nil;
+
+ [self setAutoresizingMask:(NSViewMinXMargin | NSViewMaxXMargin | NSViewMinYMargin | NSViewMaxYMargin)];
+ [self setBoxType:NSBoxCustom];
+ [self setTitlePosition:NSNoTitle];
+
+ _textField = adoptNS([[NSTextField alloc] initWithFrame:NSZeroRect]);
+ [_textField.get() setEditable:NO];
+ [_textField.get() setSelectable:NO];
+ [_textField.get() setBordered:NO];
+ [_textField.get() setDrawsBackground:NO];
+
+ NSFont* textFont = [NSFont boldSystemFontOfSize:WarningViewTextSize];
+ NSColor* textColor = [NSColor colorWithCalibratedWhite:WarningViewTextWhite alpha:WarningViewTextAlpha];
+ RetainPtr<NSDictionary> attributes = adoptNS([[NSDictionary alloc] initWithObjectsAndKeys:
+ textFont, NSFontAttributeName,
+ textColor, NSForegroundColorAttributeName,
+ nil]);
+ RetainPtr<NSAttributedString> text = adoptNS([[NSAttributedString alloc] initWithString:title attributes:attributes.get()]);
+ [_textField.get() setAttributedStringValue:text.get()];
+ [_textField.get() sizeToFit];
+ NSRect textFieldFrame = [_textField.get() frame];
+ NSSize frameSize = textFieldFrame.size;
+ frameSize.width += WarningViewPadding * 2;
+ frameSize.height += WarningViewPadding * 2;
+ [self setFrameSize:frameSize];
+
+ textFieldFrame.origin = NSMakePoint(
+ (frameSize.width - textFieldFrame.size.width) / 2,
+ (frameSize.height - textFieldFrame.size.height) / 2);
+
+ // Offset the origin by the font's descender, to center the text field about the baseline:
+ textFieldFrame.origin.y += [[_textField.get() font] descender];
+
+ [_textField.get() setFrame:NSIntegralRect(textFieldFrame)];
+ [self addSubview:_textField.get()];
+
+ NSColor* backgroundColor = [NSColor colorWithCalibratedWhite:WarningViewBackgroundWhite alpha:WarningViewBackgroundAlpha];
+ [self setFillColor:backgroundColor];
+ [self setCornerRadius:WarningViewCornerRadius];
+
+ NSColor* borderColor = [NSColor colorWithCalibratedWhite:WarningViewBorderWhite alpha:WarningViewBorderAlpha];
+ [self setBorderColor:borderColor];
+
+ RetainPtr<NSShadow> shadow = adoptNS([[NSShadow alloc] init]);
+ RetainPtr<NSColor> shadowColor = [NSColor colorWithCalibratedWhite:WarningViewShadowWhite alpha:WarningViewShadowAlpha];
+ [shadow.get() setShadowColor:shadowColor.get()];
+ [shadow.get() setShadowOffset:WarningViewShadowOffset];
+ [shadow.get() setShadowBlurRadius:WarningViewShadowRadius];
+ [self setShadow:shadow.get()];
+
+ return self;
+}
+@end