mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-29 01:42:03 +00:00
CPPlatformWindow: Paint canvas using the application's effective appearance
The DOM canvas outside application windows was previously unpainted, causing pages without an explicit CSS background to fall back to the browser's default white—leaving non-fullscreen windows framed by a white viewport in dark mode. CPPlatformWindow now paints the canvas using underPageBackgroundColor, resolved against the application's effective appearance, and updates it whenever that appearance changes. Explicit page CSS backgrounds remain unaffected. underPageBackgroundColor serves as an interim choice until a dedicated canvas color is finalized.
This commit is contained in:
1 parent
97a7ef1ae9
commit
310b46dbbc
9 files changed
+437
-22
No files matched your search
@@ -794,6 +794,7 @@ var CPApplicationDelegate_applicationShouldTerminate_ = 1 << 0,
|
||||
/*
|
||||
Applies the application's effective appearance to every window. A window without an
|
||||
appearance of its own passes the change to its views, its child windows and its sheet.
|
||||
Each visible platform window paints its canvas again.
|
||||
*/
|
||||
- (void)_effectiveAppearanceDidChange
|
||||
{
|
||||
@@ -801,6 +802,11 @@ var CPApplicationDelegate_applicationShouldTerminate_ = 1 << 0,
|
||||
|
||||
for (var i = 0, count = windows.length; i < count; i++)
|
||||
[windows[i] _updateEffectiveAppearance];
|
||||
|
||||
var platformWindows = [[CPPlatformWindow visiblePlatformWindows] allObjects];
|
||||
|
||||
for (var i = 0, count = platformWindows.length; i < count; i++)
|
||||
[platformWindows[i] _updateCanvasBackground];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -1328,8 +1328,11 @@ CPTexturedBackgroundWindowMask
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the window's background color.
|
||||
@param aColor the new color for the background
|
||||
Sets the window's background color. For a window that fills its platform window, a
|
||||
\c nil colour gives the default background: the theme's background for the window, else
|
||||
\c +[CPColor windowBackgroundColor], as in AppKit. To let the page behind such a window
|
||||
show, set \c +[CPColor clearColor].
|
||||
@param aColor the new color for the background, or \c nil for the default
|
||||
*/
|
||||
- (void)setBackgroundColor:(CPColor)aColor
|
||||
{
|
||||
@@ -1337,7 +1340,8 @@ CPTexturedBackgroundWindowMask
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the window's background color.
|
||||
Returns the window's background color: the colour in effect, the default background
|
||||
included.
|
||||
*/
|
||||
- (CPColor)backgroundColor
|
||||
{
|
||||
|
||||
@@ -23,9 +23,20 @@
|
||||
@import "_CPWindowView.j"
|
||||
@import "CPCompatibility.j"
|
||||
|
||||
/*
|
||||
The view of a window that fills its platform window. It draws a background by default: the
|
||||
theme's bezel colour in the view's current state, else +[CPColor windowBackgroundColor],
|
||||
as an NSWindow draws its window background. A colour that the application sets stays.
|
||||
|
||||
The view drew no background, so the page behind a full-page window showed through every
|
||||
view without a background of its own. The page is outside the appearance system, so those
|
||||
areas followed neither the system appearance nor the application's, and each application
|
||||
that followed the appearance had to set the window background itself.
|
||||
*/
|
||||
@implementation _CPBorderlessBridgeWindowView : _CPWindowView
|
||||
{
|
||||
CPView _toolbarBackgroundView;
|
||||
BOOL _usesDefaultBackgroundColor;
|
||||
}
|
||||
|
||||
+ (CPString)defaultThemeClass
|
||||
@@ -46,16 +57,52 @@
|
||||
|
||||
if (self)
|
||||
{
|
||||
// Check if the mask contains the HUD flag
|
||||
if (aStyleMask & CPHUDBackgroundWindowMask)
|
||||
{
|
||||
[self setBackgroundColor:[CPColor blackColor]];
|
||||
}
|
||||
/*
|
||||
The black of the HUD style counts as a colour of the window's own until the HUD
|
||||
style takes its background from the theme.
|
||||
*/
|
||||
[self setBackgroundColor:(aStyleMask & CPHUDBackgroundWindowMask) ? [CPColor blackColor] : nil];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
Sets the background colour. A nil colour gives the default background (see
|
||||
-_defaultBackgroundColor), which follows the theme state and the appearance. For a window
|
||||
that shows the page behind it, set +[CPColor clearColor].
|
||||
*/
|
||||
- (void)setBackgroundColor:(CPColor)aColor
|
||||
{
|
||||
if (aColor === [CPNull null])
|
||||
aColor = nil;
|
||||
|
||||
_usesDefaultBackgroundColor = !aColor;
|
||||
|
||||
[super setBackgroundColor:aColor || [self _defaultBackgroundColor]];
|
||||
}
|
||||
|
||||
/*
|
||||
Returns the default background: the theme's bezel colour in the receiver's current state,
|
||||
else the window background colour, AppKit's default.
|
||||
*/
|
||||
- (CPColor)_defaultBackgroundColor
|
||||
{
|
||||
return [self currentValueForThemeAttribute:@"bezel-color"] || [CPColor windowBackgroundColor];
|
||||
}
|
||||
|
||||
/*
|
||||
A change of theme state, theme or appearance lays the view out, so the default background
|
||||
follows it. A colour of the application's own stays.
|
||||
*/
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
||||
if (_usesDefaultBackgroundColor)
|
||||
[super setBackgroundColor:[self _defaultBackgroundColor]];
|
||||
}
|
||||
|
||||
- (void)setShowsResizeIndicator:(BOOL)shouldShowResizeIndicator
|
||||
{
|
||||
// We don't ever want to show the resize indicator.
|
||||
|
||||
@@ -50,6 +50,7 @@ var PrimaryPlatformWindow = NULL;
|
||||
DOMWindow _DOMWindow;
|
||||
|
||||
DOMElement _DOMBodyElement;
|
||||
BOOL _paintsCanvasBackground;
|
||||
DOMElement _DOMFocusElement;
|
||||
DOMElement _DOMEventGuard;
|
||||
DOMElement _DOMScrollingElement;
|
||||
|
||||
@@ -128,16 +128,62 @@
|
||||
@import "CPWindow_Constants.j"
|
||||
|
||||
@class CPApplication
|
||||
@class CPColor
|
||||
@class CPDragServer
|
||||
@class _CPToolTip
|
||||
|
||||
@global _CPRunModalLoop
|
||||
@global _CPAppearanceBeginDrawing
|
||||
@global _CPAppearanceEndDrawing
|
||||
@global _CPAppearanceForApplication
|
||||
|
||||
@global document
|
||||
|
||||
// List of all open native windows
|
||||
var PlatformWindows = [CPSet set];
|
||||
|
||||
/*
|
||||
The canvas is the page area outside every window. Nothing painted it, so a page without a
|
||||
background of its own showed the browser's white in every appearance, and a dark
|
||||
application stood on a white canvas. The platform window now paints the canvas with
|
||||
+[CPColor underPageBackgroundColor], AppKit's colour for the area behind documents, in the
|
||||
application's effective appearance. This is an interim value until the canvas colour is
|
||||
decided. A page that sets a background of its own keeps it.
|
||||
*/
|
||||
|
||||
/*
|
||||
Returns YES when aComputedStyle, the computed style of a page element, gives the element
|
||||
neither a background colour nor a background image. A nil style counts as empty.
|
||||
*/
|
||||
function _CPPlatformWindowStyleHasNoBackground(aComputedStyle)
|
||||
{
|
||||
if (!aComputedStyle)
|
||||
return YES;
|
||||
|
||||
var color = aComputedStyle.backgroundColor,
|
||||
image = aComputedStyle.backgroundImage;
|
||||
|
||||
return (!color || color === "transparent" || color === "rgba(0, 0, 0, 0)") && (!image || image === "none");
|
||||
}
|
||||
|
||||
/*
|
||||
Returns the canvas colour for anAppearance: +[CPColor underPageBackgroundColor] resolved
|
||||
in that appearance.
|
||||
*/
|
||||
function _CPPlatformWindowCanvasColor(anAppearance)
|
||||
{
|
||||
var previousAppearance = _CPAppearanceBeginDrawing(anAppearance);
|
||||
|
||||
try
|
||||
{
|
||||
return [[CPColor underPageBackgroundColor] colorUsingColorSpaceName:nil];
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CPAppearanceEndDrawing(previousAppearance);
|
||||
}
|
||||
}
|
||||
|
||||
// Define up here so compressor knows about them.
|
||||
var CPDOMEventGetClickCount,
|
||||
StopDOMEventPropagation,
|
||||
@@ -412,6 +458,7 @@ var SCROLLWHEEL_LINE_PIXELS = 6.0;
|
||||
_DOMBodyElement.webkitTouchCallout = "none";
|
||||
_DOMBodyElement.style[CPBrowserStyleProperty(@"user-select")] = @"none";
|
||||
|
||||
[self _initializeCanvasBackground];
|
||||
[self createDOMElements];
|
||||
[self _addLayers];
|
||||
|
||||
@@ -589,6 +636,48 @@ var SCROLLWHEEL_LINE_PIXELS = 6.0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Decides whether the receiver paints the canvas: only when neither the body element, the
|
||||
document body nor the root element has a background of its own. A canvas painted
|
||||
before, by an earlier registration of the same document, does not count as the page's.
|
||||
*/
|
||||
- (void)_initializeCanvasBackground
|
||||
{
|
||||
var theDocument = _DOMWindow.document,
|
||||
theView = theDocument.defaultView,
|
||||
elements = [_DOMBodyElement, theDocument.body, theDocument.documentElement];
|
||||
|
||||
if (_paintsCanvasBackground)
|
||||
_DOMBodyElement.style.backgroundColor = "";
|
||||
|
||||
_paintsCanvasBackground = NO;
|
||||
|
||||
if (!theView || !theView.getComputedStyle)
|
||||
return;
|
||||
|
||||
for (var i = 0; i < elements.length; i++)
|
||||
{
|
||||
if (elements[i] && !_CPPlatformWindowStyleHasNoBackground(theView.getComputedStyle(elements[i])))
|
||||
return;
|
||||
}
|
||||
|
||||
_paintsCanvasBackground = YES;
|
||||
|
||||
[self _updateCanvasBackground];
|
||||
}
|
||||
|
||||
/*
|
||||
Paints the canvas in the application's effective appearance, when the receiver paints it.
|
||||
CPApplication calls this when its effective appearance changes.
|
||||
*/
|
||||
- (void)_updateCanvasBackground
|
||||
{
|
||||
if (!_paintsCanvasBackground || !_DOMBodyElement)
|
||||
return;
|
||||
|
||||
_DOMBodyElement.style.backgroundColor = [_CPPlatformWindowCanvasColor(_CPAppearanceForApplication()) cssString];
|
||||
}
|
||||
|
||||
+ (CPSet)visiblePlatformWindows
|
||||
{
|
||||
if ([[CPPlatformWindow primaryPlatformWindow] isVisible])
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* CPBorderlessBridgeWindowViewTest.j
|
||||
* AppKit
|
||||
*
|
||||
* Created by David Richardson on 2026-11-19.
|
||||
* Copyright David Richardson 2026.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
/*
|
||||
A window that fills its platform window draws a default background: the theme's bezel
|
||||
colour, else +[CPColor windowBackgroundColor]. A colour that the application sets stays,
|
||||
and nil returns to the default. Other windows have no default background.
|
||||
|
||||
Only a browser platform window supports full platform windows, so outside the browser a
|
||||
window with CPBorderlessBridgeWindowMask keeps a standard window view. These tests
|
||||
therefore make the bridge window view directly.
|
||||
*/
|
||||
@implementation CPBorderlessBridgeWindowViewTest : OJTestCase
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)tearDown
|
||||
{
|
||||
[CPAppearance setCurrentAppearance:nil];
|
||||
}
|
||||
|
||||
// MARK: Helpers
|
||||
|
||||
/*
|
||||
Returns a bridge window view that takes its values from aTheme. With a nil theme, the view
|
||||
takes a theme that gives no window view a value.
|
||||
*/
|
||||
- (_CPBorderlessBridgeWindowView)bridgeViewWithTheme:(CPTheme)aTheme
|
||||
{
|
||||
var windowView = [[_CPBorderlessBridgeWindowView alloc] initWithFrame:CGRectMake(0.0, 0.0, 300.0, 200.0) styleMask:CPBorderlessBridgeWindowMask];
|
||||
|
||||
[windowView setTheme:aTheme || [[CPTheme alloc] initWithName:@"CPBorderlessBridgeWindowViewTest"]];
|
||||
[self layOut:windowView];
|
||||
|
||||
return windowView;
|
||||
}
|
||||
|
||||
- (void)layOut:(CPView)aView
|
||||
{
|
||||
[aView setNeedsLayout];
|
||||
[aView layoutIfNeeded];
|
||||
}
|
||||
|
||||
/*
|
||||
Returns a theme that gives the bridge window view the bezel colour aColor.
|
||||
*/
|
||||
- (CPTheme)themeWithBridgeBezelColor:(CPColor)aColor
|
||||
{
|
||||
var theme = [[CPTheme alloc] initWithName:@"CPBorderlessBridgeWindowViewTestBezel"],
|
||||
template = [[_CPBorderlessBridgeWindowView alloc] initWithFrame:CGRectMake(0.0, 0.0, 10.0, 10.0) styleMask:CPBorderlessBridgeWindowMask];
|
||||
|
||||
[template setValue:aColor forThemeAttribute:@"bezel-color"];
|
||||
[theme takeThemeFromObject:template];
|
||||
|
||||
return theme;
|
||||
}
|
||||
|
||||
/*
|
||||
Gives aView the dark appearance. The change marks the view for layout.
|
||||
*/
|
||||
- (void)setDarkAppearanceOf:(CPView)aView
|
||||
{
|
||||
[aView setAppearance:[CPAppearance appearanceNamed:CPAppearanceNameDarkAqua]];
|
||||
[aView layoutIfNeeded];
|
||||
}
|
||||
|
||||
// MARK: Default background
|
||||
|
||||
- (void)testABridgeWindowViewDrawsTheWindowBackgroundByDefault
|
||||
{
|
||||
var windowView = [self bridgeViewWithTheme:nil];
|
||||
|
||||
[self assert:[CPColor windowBackgroundColor] same:[windowView backgroundColor]];
|
||||
}
|
||||
|
||||
/*
|
||||
The window background colour is one object whose value depends on the appearance, so the
|
||||
default stays that object when the appearance changes.
|
||||
*/
|
||||
- (void)testTheDefaultBackgroundFollowsAChangeOfAppearance
|
||||
{
|
||||
var windowView = [self bridgeViewWithTheme:nil];
|
||||
|
||||
[self setDarkAppearanceOf:windowView];
|
||||
|
||||
[self assert:[CPColor windowBackgroundColor] same:[windowView backgroundColor]];
|
||||
}
|
||||
|
||||
- (void)testTheThemeBezelColorComesBeforeTheWindowBackground
|
||||
{
|
||||
var bezelColor = [CPColor colorWithRed:0.1 green:0.2 blue:0.3 alpha:1.0],
|
||||
windowView = [self bridgeViewWithTheme:[self themeWithBridgeBezelColor:bezelColor]];
|
||||
|
||||
[self assert:bezelColor same:[windowView backgroundColor]];
|
||||
}
|
||||
|
||||
- (void)testABorderlessWindowHasNoDefaultBackground
|
||||
{
|
||||
var window = [[CPWindow alloc] initWithContentRect:CGRectMake(0.0, 0.0, 300.0, 200.0) styleMask:CPBorderlessWindowMask];
|
||||
|
||||
[self assertNull:[window backgroundColor]];
|
||||
}
|
||||
|
||||
// MARK: Colour of the window's own
|
||||
|
||||
- (void)testAColorOfTheWindowsOwnSurvivesLayoutAndAChangeOfAppearance
|
||||
{
|
||||
var windowView = [self bridgeViewWithTheme:nil],
|
||||
color = [CPColor colorWithRed:0.4 green:0.5 blue:0.6 alpha:1.0];
|
||||
|
||||
[windowView setBackgroundColor:color];
|
||||
[self layOut:windowView];
|
||||
|
||||
[self assert:color same:[windowView backgroundColor] message:@"after layout"];
|
||||
|
||||
[self setDarkAppearanceOf:windowView];
|
||||
|
||||
[self assert:color same:[windowView backgroundColor] message:@"after a change of appearance"];
|
||||
}
|
||||
|
||||
- (void)testNilReturnsToTheDefaultBackground
|
||||
{
|
||||
var windowView = [self bridgeViewWithTheme:nil];
|
||||
|
||||
[windowView setBackgroundColor:[CPColor colorWithRed:0.4 green:0.5 blue:0.6 alpha:1.0]];
|
||||
[windowView setBackgroundColor:nil];
|
||||
|
||||
[self assert:[CPColor windowBackgroundColor] same:[windowView backgroundColor] message:@"after the setter"];
|
||||
|
||||
[self layOut:windowView];
|
||||
|
||||
[self assert:[CPColor windowBackgroundColor] same:[windowView backgroundColor] message:@"after layout"];
|
||||
}
|
||||
|
||||
/*
|
||||
A window that shows the page behind it sets the clear colour.
|
||||
*/
|
||||
- (void)testTheClearColorStaysClear
|
||||
{
|
||||
var windowView = [self bridgeViewWithTheme:nil];
|
||||
|
||||
[windowView setBackgroundColor:[CPColor clearColor]];
|
||||
[self layOut:windowView];
|
||||
[self setDarkAppearanceOf:windowView];
|
||||
|
||||
[self assert:[CPColor clearColor] same:[windowView backgroundColor]];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* CPPlatformWindowCanvasTest.j
|
||||
* AppKit
|
||||
*
|
||||
* Created by David Richardson on 2026-11-19.
|
||||
* Copyright David Richardson 2026.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
/*
|
||||
The platform window paints the canvas, the page area outside every window, with
|
||||
+[CPColor underPageBackgroundColor] in the application's effective appearance, unless the
|
||||
page sets a background of its own. The tests run without a DOM, so they test the colour and
|
||||
the background check that the platform window uses.
|
||||
*/
|
||||
@implementation CPPlatformWindowCanvasTest : OJTestCase
|
||||
{
|
||||
CPTheme _previousTheme;
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
/*
|
||||
The built-in DarkAqua values apply only under a theme that lists DarkAqua among its
|
||||
supported appearances.
|
||||
*/
|
||||
var theme = [[CPTheme alloc] initWithName:@"CPPlatformWindowCanvasTest"],
|
||||
template = [CPColor colorWithWhite:0.0 alpha:1.0];
|
||||
|
||||
[template setValue:[CPAppearanceNameAqua, CPAppearanceNameDarkAqua] forThemeAttribute:@"supported-appearances"];
|
||||
[theme takeThemeFromObject:template];
|
||||
|
||||
_previousTheme = [CPTheme defaultTheme];
|
||||
[CPTheme setDefaultTheme:theme];
|
||||
}
|
||||
|
||||
- (void)tearDown
|
||||
{
|
||||
[CPTheme setDefaultTheme:_previousTheme];
|
||||
[CPAppearance setCurrentAppearance:nil];
|
||||
}
|
||||
|
||||
- (void)assertWhite:(float)aWhite of:(CPColor)aColor message:(CPString)aMessage
|
||||
{
|
||||
var components = [aColor components];
|
||||
|
||||
for (var i = 0; i < 3; i++)
|
||||
[self assert:ROUND(aWhite * 10000) equals:ROUND(components[i] * 10000) message:aMessage + @", component " + i];
|
||||
|
||||
[self assert:1.0 equals:components[3] message:aMessage + @", alpha"];
|
||||
}
|
||||
|
||||
// MARK: Canvas colour
|
||||
|
||||
- (void)testTheCanvasTakesTheUnderPageBackgroundOfEachAppearance
|
||||
{
|
||||
[self assertWhite:0.9647 of:_CPPlatformWindowCanvasColor([CPAppearance appearanceNamed:CPAppearanceNameAqua]) message:@"Aqua"];
|
||||
[self assertWhite:0.1569 of:_CPPlatformWindowCanvasColor([CPAppearance appearanceNamed:CPAppearanceNameDarkAqua]) message:@"DarkAqua"];
|
||||
}
|
||||
|
||||
/*
|
||||
The canvas colour resolves in the appearance it is given, whatever the current drawing
|
||||
appearance is, and leaves the current drawing appearance as it was.
|
||||
*/
|
||||
- (void)testTheCanvasColorKeepsTheCurrentDrawingAppearance
|
||||
{
|
||||
var aqua = [CPAppearance appearanceNamed:CPAppearanceNameAqua];
|
||||
|
||||
[CPAppearance setCurrentAppearance:aqua];
|
||||
|
||||
[self assertWhite:0.1569 of:_CPPlatformWindowCanvasColor([CPAppearance appearanceNamed:CPAppearanceNameDarkAqua]) message:@"DarkAqua under Aqua"];
|
||||
[self assert:aqua same:[CPAppearance currentAppearance]];
|
||||
}
|
||||
|
||||
// MARK: Background of the page
|
||||
|
||||
- (void)testAPageElementWithoutABackgroundLeavesTheCanvasToTheFramework
|
||||
{
|
||||
[self assertTrue:_CPPlatformWindowStyleHasNoBackground(nil) message:@"no style"];
|
||||
[self assertTrue:_CPPlatformWindowStyleHasNoBackground({ backgroundColor: "rgba(0, 0, 0, 0)", backgroundImage: "none" }) message:@"computed default"];
|
||||
[self assertTrue:_CPPlatformWindowStyleHasNoBackground({ backgroundColor: "transparent", backgroundImage: "none" }) message:@"transparent"];
|
||||
}
|
||||
|
||||
- (void)testAPageElementWithABackgroundKeepsIt
|
||||
{
|
||||
[self assertFalse:_CPPlatformWindowStyleHasNoBackground({ backgroundColor: "rgb(255, 255, 255)", backgroundImage: "none" }) message:@"a colour"];
|
||||
[self assertFalse:_CPPlatformWindowStyleHasNoBackground({ backgroundColor: "rgba(0, 0, 0, 0)", backgroundImage: "url(\"canvas.png\")" }) message:@"an image"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -102,13 +102,6 @@ var CSVImportTestFields = [@"Name", @"Email", @"Phone", @"Notes"],
|
||||
|
||||
_window = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask];
|
||||
|
||||
/*
|
||||
A bridge window draws no background of its own, so the page showed through the views
|
||||
without a background. The window takes AppKit's window background, which follows the
|
||||
appearance.
|
||||
*/
|
||||
[_window setBackgroundColor:[CPColor windowBackgroundColor]];
|
||||
|
||||
var contentView = [_window contentView],
|
||||
width = CGRectGetWidth([contentView bounds]),
|
||||
height = CGRectGetHeight([contentView bounds]);
|
||||
|
||||
@@ -62,13 +62,6 @@ var ToolbarSidebarIdentifier = @"SidebarItem",
|
||||
[window setDelegate:self];
|
||||
[window setTitle:@"Smart Folders Demo"];
|
||||
|
||||
/*
|
||||
A bridge window draws no background of its own, so the page showed through views
|
||||
without a background, such as the detail pane. The window takes AppKit's window
|
||||
background, which follows the appearance.
|
||||
*/
|
||||
[window setBackgroundColor:[CPColor windowBackgroundColor]];
|
||||
|
||||
_sourceListController = [[SourceListViewController alloc] initWithLibrary:_library];
|
||||
[_sourceListController setDelegate:self];
|
||||
|
||||
|
||||
Reference in new issue
Block a user