mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-23 06:55:52 +00:00
Merge remote branch 'refs/remotes/280north/master'
This commit is contained in:
commit
4cdefcc2c7
15 files changed
+535
-50
No files matched your search
+14
-2
@@ -605,7 +605,7 @@ url("data:image/png;base64,BASE64ENCODEDDATA") // if there is a pattern image
|
||||
*/
|
||||
- (CPString)hexString
|
||||
{
|
||||
return rgbToHex([self redComponent], [self greenComponent], [self blueComponent])
|
||||
return rgbToHex([self redComponent], [self greenComponent], [self blueComponent]);
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(CPColor)aColor
|
||||
@@ -616,7 +616,19 @@ url("data:image/png;base64,BASE64ENCODEDDATA") // if there is a pattern image
|
||||
if (aColor === self)
|
||||
return YES;
|
||||
|
||||
return [aColor isKindOfClass:CPColor] && [aColor cssString] === [self cssString];
|
||||
if (![aColor isKindOfClass:CPColor])
|
||||
return NO;
|
||||
|
||||
if (_patternImage || [aColor patternImage])
|
||||
return [_patternImage isEqual:[aColor patternImage]];
|
||||
|
||||
// We don't require the components to be equal beyond 8 bits since otherwise
|
||||
// simple rounding errors will make two colours which are exactly the same on
|
||||
// screen compare unequal.
|
||||
return ROUND([self redComponent] * 255.0) == ROUND([aColor redComponent] * 255.0) &&
|
||||
ROUND([self greenComponent] * 255.0) == ROUND([aColor greenComponent] * 255.0) &&
|
||||
ROUND([self blueComponent] * 255.0) == ROUND([aColor blueComponent] * 255.0) &&
|
||||
[self alphaComponent] == [aColor alphaComponent];
|
||||
}
|
||||
|
||||
- (CPString)description
|
||||
|
||||
@@ -1284,6 +1284,14 @@ var CPViewFlags = { },
|
||||
return view !== nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns YES if the view is not hidden, has no hidden ancestor and doesn't belong to a hidden window.
|
||||
*/
|
||||
- (BOOL)_isVisible
|
||||
{
|
||||
return ![self isHiddenOrHasHiddenAncestor] && [[self window] isVisible];
|
||||
}
|
||||
|
||||
/*!
|
||||
Called when the return value of isHiddenOrHasHiddenAncestor becomes YES,
|
||||
e.g. when this view becomes hidden due to a setHidden:YES message to
|
||||
|
||||
+49
-35
@@ -120,7 +120,6 @@ CPWebViewAppKitScrollMaxPollCount = 3;
|
||||
BOOL _contentIsAccessible;
|
||||
CPTimer _contentSizeCheckTimer;
|
||||
int _contentSizePollCount;
|
||||
CGSize _scrollSize;
|
||||
|
||||
int _loadHTMLStringTimer;
|
||||
|
||||
@@ -228,6 +227,15 @@ CPWebViewAppKitScrollMaxPollCount = 3;
|
||||
[self _resizeWebFrame];
|
||||
}
|
||||
|
||||
- (void)viewDidUnhide
|
||||
{
|
||||
// Sizing cannot properly happen while we're hidden because the iframe is inaccessible.
|
||||
// So now that it is accessible again, make sure to catch up.
|
||||
[_frameView setFrameSize:[_scrollView contentSize]];
|
||||
[self _resizeWebFrame];
|
||||
[self _scheduleContentSizeCheck];
|
||||
}
|
||||
|
||||
- (void)_attachScrollEventIfNecessary
|
||||
{
|
||||
if (_effectiveScrollMode !== CPWebViewScrollAppKit)
|
||||
@@ -255,44 +263,45 @@ CPWebViewAppKitScrollMaxPollCount = 3;
|
||||
|
||||
- (void)_resizeWebFrame
|
||||
{
|
||||
// When a webview is not in the DOM we can't inspect its contents for sizing information.
|
||||
// If we try, we might end up setting the fallback frame size which will then become
|
||||
// somewhat sticky.
|
||||
if (![self _isVisible])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_effectiveScrollMode === CPWebViewScrollAppKit)
|
||||
{
|
||||
if (_scrollSize)
|
||||
var visibleRect = [_frameView visibleRect];
|
||||
[_frameView setFrameSize:CGSizeMake(CGRectGetMaxX(visibleRect), CGRectGetMaxY(visibleRect))];
|
||||
|
||||
// try to get the document size so we can correctly set the frame
|
||||
var win = null;
|
||||
try { win = [self DOMWindow]; } catch (e) {}
|
||||
|
||||
if (win && win.document && win.document.body)
|
||||
{
|
||||
[_frameView setFrameSize:_scrollSize];
|
||||
var width = win.document.body.scrollWidth,
|
||||
height = win.document.body.scrollHeight;
|
||||
|
||||
_iframe.setAttribute("width", width);
|
||||
_iframe.setAttribute("height", height);
|
||||
|
||||
[_frameView setFrameSize:CGSizeMake(width, height)];
|
||||
}
|
||||
else
|
||||
{
|
||||
var visibleRect = [_frameView visibleRect];
|
||||
[_frameView setFrameSize:CGSizeMake(CGRectGetMaxX(visibleRect), CGRectGetMaxY(visibleRect))];
|
||||
|
||||
// try to get the document size so we can correctly set the frame
|
||||
var win = null;
|
||||
try { win = [self DOMWindow]; } catch (e) {}
|
||||
|
||||
if (win && win.document && win.document.body)
|
||||
// If we do have access to the content, it might be that the 'body' element simply hasn't loaded yet.
|
||||
// The size will be updated by the content size timer in this case.
|
||||
if (!win || !win.document)
|
||||
{
|
||||
var width = win.document.body.scrollWidth,
|
||||
height = win.document.body.scrollHeight;
|
||||
|
||||
_iframe.setAttribute("width", width);
|
||||
_iframe.setAttribute("height", height);
|
||||
|
||||
[_frameView setFrameSize:CGSizeMake(width, height)];
|
||||
CPLog.warn("using default size 800*1600");
|
||||
[_frameView setFrameSize:CGSizeMake(800, 1600)];
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we do have access to the content, it might be that the 'body' element simply hasn't loaded yet.
|
||||
// The size will be updated by the content size timer in this case.
|
||||
if (!win || !win.document)
|
||||
{
|
||||
CPLog.warn("using default size 800*1600");
|
||||
[_frameView setFrameSize:CGSizeMake(800, 1600)];
|
||||
}
|
||||
}
|
||||
|
||||
[_frameView scrollRectToVisible:visibleRect];
|
||||
}
|
||||
|
||||
[_frameView scrollRectToVisible:visibleRect];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,6 +517,16 @@ CPWebViewAppKitScrollMaxPollCount = 3;
|
||||
[self _resizeWebFrame];
|
||||
[self _attachScrollEventIfNecessary];
|
||||
|
||||
[self _scheduleContentSizeCheck];
|
||||
|
||||
[[CPNotificationCenter defaultCenter] postNotificationName:CPWebViewProgressFinishedNotification object:self];
|
||||
|
||||
if ([_frameLoadDelegate respondsToSelector:@selector(webView:didFinishLoadForFrame:)])
|
||||
[_frameLoadDelegate webView:self didFinishLoadForFrame:nil]; // FIXME: give this a frame somehow?
|
||||
}
|
||||
|
||||
- (void)_scheduleContentSizeCheck
|
||||
{
|
||||
[_contentSizeCheckTimer invalidate];
|
||||
if (_effectiveScrollMode == CPWebViewScrollAppKit)
|
||||
{
|
||||
@@ -530,11 +549,6 @@ CPWebViewAppKitScrollMaxPollCount = 3;
|
||||
_contentSizePollCount = 0;
|
||||
_contentSizeCheckTimer = [CPTimer scheduledTimerWithTimeInterval:CPWebViewAppKitScrollPollInterval target:self selector:@selector(_maybePollWebFrameSize) userInfo:nil repeats:YES];
|
||||
}
|
||||
|
||||
[[CPNotificationCenter defaultCenter] postNotificationName:CPWebViewProgressFinishedNotification object:self];
|
||||
|
||||
if ([_frameLoadDelegate respondsToSelector:@selector(webView:didFinishLoadForFrame:)])
|
||||
[_frameLoadDelegate webView:self didFinishLoadForFrame:nil]; // FIXME: give this a frame somehow?
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -424,9 +424,7 @@ var CPSetObjectsKey = @"CPSetObjectsKey";
|
||||
{
|
||||
var value = [object valueForKey:aKey];
|
||||
|
||||
// addObject: should be smart enough not to add these, but just in case...
|
||||
if (value !== nil && value !== undefined)
|
||||
[valueSet addObject:value];
|
||||
[valueSet addObject:value];
|
||||
}
|
||||
|
||||
return valueSet;
|
||||
|
||||
@@ -85,7 +85,7 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
- (void)addObject:(id)anObject
|
||||
{
|
||||
if (anObject === nil || anObject === undefined)
|
||||
return;
|
||||
[CPException raise:CPInvalidArgumentException reason:@"attempt to insert nil or undefined"];
|
||||
|
||||
if ([self containsObject:anObject])
|
||||
return;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
- (void)testHexStringConversion
|
||||
{
|
||||
var colors = ['000000', '7E8EAB', 'FFFFFF'];
|
||||
var colors = ['000000', '0099CC', '7E8EAB', 'FFFFFF'];
|
||||
for (var i = 0; i < colors.length; ++i)
|
||||
[self assert: colors[i] equals: [[CPColor colorWithHexString: colors[i]] hexString]];
|
||||
}
|
||||
@@ -21,4 +21,34 @@
|
||||
[self assert:128 equals:Math.round([rgbaColour alphaComponent] * 255) message:"alpha component"];
|
||||
}
|
||||
|
||||
- (void)testIsEqual_
|
||||
{
|
||||
// Based on https://gist.github.com/e06f749362cb1166439f by spakanati.
|
||||
var color1 = [CPColor colorWithCSSString:"rgba(127,127,127,1.0)"],
|
||||
color2 = [CPColor colorWithCSSString:"rgba(127, 127, 127, 1.0)"],
|
||||
color3 = [CPColor colorWithRed:127.0/255.0 green:127.0/255.0 blue:127.0/255.0 alpha:1.0],
|
||||
color4 = [CPColor blackColor];
|
||||
|
||||
[self assertTrue:[color1 isEqual:color2] message:"[color1 isEqual:color2]"];
|
||||
[self assertTrue:[color1 isEqual:color3] message:"[color1 isEqual:color3]"];
|
||||
[self assertTrue:[color2 isEqual:color3] message:"[color2 isEqual:color3]"];
|
||||
|
||||
[self assertTrue:[color1 isEqual:color1] message:"[color1 isEqual:color1]"];
|
||||
[self assertFalse:[color1 isEqual:color4] message:"![color1 isEqual:color4]"];
|
||||
[self assertFalse:[color4 isEqual:color1] message:"![color4 isEqual:color1]"];
|
||||
|
||||
var image1 = [CPImage new],
|
||||
image2 = [CPImage new],
|
||||
color5 = [CPColor colorWithPatternImage:image1],
|
||||
color6 = [CPColor colorWithPatternImage:image2],
|
||||
color7 = [CPColor colorWithPatternImage:image1];
|
||||
|
||||
image2._filename = "othername";
|
||||
|
||||
[self assertTrue:[color5 isEqual:color5] message:"[color5 isEqual:color5]"];
|
||||
[self assertTrue:[color5 isEqual:color7] message:"[color5 isEqual:color7]"];
|
||||
[self assertFalse:[color5 isEqual:color6] message:"![color5 isEqual:color6]"];
|
||||
[self assertFalse:[color4 isEqual:color5] message:"![color4 isEqual:color5]"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -73,4 +73,34 @@
|
||||
[self assertFalse:[view hasThemeAttribute:@"foobar"] message:[view className] + " should not have theme attribute \"" + firstKey + "\""];
|
||||
}
|
||||
|
||||
- (void)testIsVisible
|
||||
{
|
||||
[self assertFalse:[view _isVisible] message:"view must belong to a window to be visible"];
|
||||
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
|
||||
contentView = [theWindow contentView];
|
||||
|
||||
[self assertFalse:[contentView _isVisible] message:"view must belong to a visible window to be visible"];
|
||||
[theWindow orderFront:self];
|
||||
// Fake this because we don't have the DOM in unit tests.
|
||||
[theWindow._isVisible = YES];
|
||||
[self assertTrue:[contentView _isVisible] message:"view is the content view of a visible window, hence visible"];
|
||||
|
||||
[self assertFalse:[view _isVisible] message:"view must belong to a window to be visible"];
|
||||
[contentView addSubview:view];
|
||||
[self assertTrue:[view _isVisible] message:"view is a subview of a visible content view, hence visible"];
|
||||
|
||||
[view setHidden:YES];
|
||||
[self assertFalse:[view _isVisible] message:"view is hidden"];
|
||||
|
||||
[view setHidden:NO];
|
||||
[self assertTrue:[view _isVisible] message:"view is not hidden again"];
|
||||
|
||||
[contentView setHidden:YES];
|
||||
[self assertFalse:[view _isVisible] message:"a superview is hidden"];
|
||||
|
||||
[contentView setHidden:NO];
|
||||
[contentView removeFromSuperview];
|
||||
[self assertFalse:[view _isVisible] message:"a superview does not belong to a visible window"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -73,7 +73,7 @@
|
||||
- (void)testSetWithObject
|
||||
{
|
||||
[self assertSet:[CPSet setWithObject:nil] onlyHasObjects:[]];
|
||||
[self assertSet:[CPSet setWithObject:undefined] onlyHasObjects:[]];
|
||||
[self assertThrows:function() { [CPSet setWithObject:undefined] }];
|
||||
[self assertSet:[CPSet setWithObject:0] onlyHasObjects:[0]];
|
||||
[self assertSet:[CPSet setWithObject:@"a"] onlyHasObjects:[@"a"]];
|
||||
}
|
||||
@@ -87,7 +87,9 @@
|
||||
[self assertSet:[CPSet setWithObjects:[@"a", @"b"] count:2] onlyHasObjects:[@"a", @"b"]];
|
||||
[self assertSet:[CPSet setWithObjects:[@"a", @"b", @"a"] count:3] onlyHasObjects:[@"a", @"b"]];
|
||||
[self assertSet:[CPSet setWithObjects:[@"a", @"b", @"a", 0] count:4] onlyHasObjects:[@"a", @"b", 0]];
|
||||
[self assertSet:[CPSet setWithObjects:[@"a", nil, undefined, 0] count:4] onlyHasObjects:[@"a", 0]];
|
||||
[self assertThrows:function() {
|
||||
[CPSet setWithObjects:[@"a", nil, undefined, 0] count:4];
|
||||
}];
|
||||
|
||||
[self assertSet:[CPSet setWithObjects:[] count:4] onlyHasObjects:[]];
|
||||
[self assertSet:[CPSet setWithObjects:[@"a"] count:2] onlyHasObjects:[@"a"]];
|
||||
@@ -96,10 +98,12 @@
|
||||
[self assertSet:[CPSet setWithObjects:[@"a", @"b"] count:1] onlyHasObjects:[@"a"]];
|
||||
[self assertSet:[CPSet setWithObjects:[@"a", @"b", @"a"] count:2] onlyHasObjects:[@"a", @"b"]];
|
||||
[self assertSet:[CPSet setWithObjects:[@"a", @"b", @"a", 0] count:10] onlyHasObjects:[@"a", @"b", 0]];
|
||||
[self assertSet:[CPSet setWithObjects:[@"a", nil, undefined, 0] count:3] onlyHasObjects:[@"a"]];
|
||||
[self assertThrows:function() {
|
||||
[CPSet setWithObjects:[@"a", nil, undefined, 0] count:3];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testSetWithObjects_count_
|
||||
- (void)testSetWithObjects_
|
||||
{
|
||||
[self assertSet:[CPSet setWithObjects:nil] onlyHasObjects:[]];
|
||||
[self assertSet:[CPSet setWithObjects:@"a"] onlyHasObjects:[@"a"]];
|
||||
@@ -116,7 +120,10 @@
|
||||
[self assertSet:[CPSet setWithObjects:@"a", @"b", @"a", 0, nil] onlyHasObjects:[@"a", @"b", 0]];
|
||||
[self assertSet:[CPSet setWithObjects:@"a", @"b", @"a", nil, 0] onlyHasObjects:[@"a", @"b"]];
|
||||
[self assertSet:[CPSet setWithObjects:@"a", nil, undefined, 0] onlyHasObjects:[@"a"]];
|
||||
[self assertSet:[CPSet setWithObjects:@"a", undefined, 0, nil] onlyHasObjects:[@"a", 0]];
|
||||
|
||||
[self assertThrows:function() {
|
||||
[CPSet setWithObjects:@"a", undefined, 0, nil];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testSetWithSet_
|
||||
@@ -136,7 +143,9 @@
|
||||
[self assertSet:[CPSet setWithSet:[CPSet setWithObjects:@"a", @"b", @"a", 0, nil]] onlyHasObjects:[@"a", @"b", 0]];
|
||||
[self assertSet:[CPSet setWithSet:[CPSet setWithObjects:@"a", @"b", @"a", nil, 0]] onlyHasObjects:[@"a", @"b"]];
|
||||
[self assertSet:[CPSet setWithSet:[CPSet setWithObjects:@"a", nil, undefined, 0]] onlyHasObjects:[@"a"]];
|
||||
[self assertSet:[CPSet setWithSet:[CPSet setWithObjects:@"a", undefined, 0, nil]] onlyHasObjects:[@"a", 0]];
|
||||
[self assertThrows:function() {
|
||||
[CPSet setWithSet:[CPSet setWithObjects:@"a", undefined, 0, nil]];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testAddObject
|
||||
@@ -182,7 +191,18 @@
|
||||
var set = [CPSet new];
|
||||
|
||||
[self assertFalse:[set containsObject:nil]];
|
||||
[set addObject:nil];
|
||||
|
||||
// Should throw an exception. In Cocoa this is NSException.
|
||||
var sawException = NO;
|
||||
try {
|
||||
[set addObject:nil];
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
sawException = YES;
|
||||
[self assert:"attempt to insert nil or undefined" equals:[ex reason]];
|
||||
}
|
||||
[self assertTrue:sawException message:"expected exception for set addObject:nil"];
|
||||
[self assertFalse:[set containsObject:nil]];
|
||||
}
|
||||
|
||||
@@ -190,7 +210,7 @@
|
||||
{
|
||||
var set = [CPSet new];
|
||||
|
||||
[set addObject:nil];
|
||||
[self assertThrows:function() { [set addObject:nil] }];
|
||||
[self assertFalse:[set containsObject:nil]];
|
||||
[set removeObject:nil];
|
||||
[self assertFalse:[set containsObject:nil]];
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
@import <Foundation/CPObject.j>
|
||||
|
||||
/*!
|
||||
This test is based on the code by `tiredashell` for issue #684 and can be used to verify that when a CPWebView is hidden at an initial small size and then later unhidden at a larger, the content reflows properly.
|
||||
|
||||
When you click "Unhide (loadHTMLString)" you should see:
|
||||
|
||||
WITHOUT the fix: the Lorem ipsum text is constrained to a too narrow width and does not reflow.
|
||||
WITH fix c42295f0c7b6ed0a12a8ed472991a3e3ebcc2ecb: the Lorem ipsum text reflows but the scrollbars may not reflect the new content size.
|
||||
WITH fix c42295f0c7b6ed0a12a8ed472991a3e3ebcc2ecb and 2563cb5dc13778074f5b20b8989b1f5ac1e4af2b: the Lorem ipsum text reflows to the available width and the scrollbars update.
|
||||
|
||||
The web view on the right "Unhide (URL)" should work with and without the fixes.
|
||||
*/
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
CPButton unhideHtmlButton;
|
||||
CPButton unhideUrlButton;
|
||||
CPWebView webview;
|
||||
CPWebView webview2;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
{
|
||||
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
|
||||
contentView = [theWindow contentView];
|
||||
|
||||
unhideHtmlButton = [[CPButton alloc] initWithFrame:CGRectMakeZero()];
|
||||
[unhideHtmlButton setTitle:"Unhide (loadHTMLString)"];
|
||||
[unhideHtmlButton sizeToFit];
|
||||
[unhideHtmlButton setTarget:self];
|
||||
[unhideHtmlButton setAction:@selector(unhideHtmlButtonClicked:)];
|
||||
[contentView addSubview:unhideHtmlButton];
|
||||
|
||||
unhideUrlButton = [[CPButton alloc] initWithFrame:CGRectMake([contentView frameSize].width / 2 + 10, 0, 0, 0)];
|
||||
[unhideUrlButton setTitle:"Unhide (URL)"];
|
||||
[unhideUrlButton sizeToFit];
|
||||
[unhideUrlButton setTarget:self];
|
||||
[unhideUrlButton setAction:@selector(unhideUrlButtonClicked:)];
|
||||
[contentView addSubview:unhideUrlButton];
|
||||
|
||||
webview = [[CPWebView alloc] initWithFrame:CGRectMake(0, 40, [contentView frameSize].width / 2 - 10, [contentView frameSize].height - 40)];
|
||||
[webview setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
|
||||
[webview setHidden:YES];
|
||||
[webview loadHTMLString:"<html><body><font size='8'> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</font></body></html>"];
|
||||
[contentView addSubview:webview];
|
||||
|
||||
webview2 = [[CPWebView alloc] initWithFrame:CGRectMake([contentView frameSize].width / 2 + 10, 40, [contentView frameSize].width / 2 - 10, [contentView frameSize].height - 40)];
|
||||
[webview2 setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
|
||||
[webview2 setHidden:YES];
|
||||
[webview2 setMainFrameURL:"http://www.cappuccino.org"];
|
||||
[contentView addSubview:webview2];
|
||||
|
||||
[theWindow orderFront:self];
|
||||
|
||||
// Uncomment the following line to turn on the standard menu bar.
|
||||
//[CPMenu setMenuBarVisible:YES];
|
||||
}
|
||||
|
||||
- (void)unhideHtmlButtonClicked:(id)sender
|
||||
{
|
||||
[webview setHidden:NO];
|
||||
}
|
||||
|
||||
- (void)unhideUrlButtonClicked:(id)sender
|
||||
{
|
||||
[webview2 setHidden:NO];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CPApplicationDelegateClass</key>
|
||||
<string>AppController</string>
|
||||
<key>CPBundleName</key>
|
||||
<string>CPWebViewTest2</string>
|
||||
<key>CPPrincipalClass</key>
|
||||
<string>CPApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Jakefile
|
||||
* CPWebViewTest2
|
||||
*
|
||||
* Created by Alexander Ljungberg on May 9, 2011.
|
||||
* Copyright 2011, WireLoad All rights reserved.
|
||||
*/
|
||||
|
||||
var ENV = require("system").env,
|
||||
FILE = require("file"),
|
||||
JAKE = require("jake"),
|
||||
task = JAKE.task,
|
||||
FileList = JAKE.FileList,
|
||||
app = require("cappuccino/jake").app,
|
||||
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
|
||||
OS = require("os");
|
||||
|
||||
app ("CPWebViewTest2", function(task)
|
||||
{
|
||||
task.setBuildIntermediatesPath(FILE.join("Build", "CPWebViewTest2.build", configuration));
|
||||
task.setBuildPath(FILE.join("Build", configuration));
|
||||
|
||||
task.setProductName("CPWebViewTest2");
|
||||
task.setIdentifier("com.yourcompany.CPWebViewTest2");
|
||||
task.setVersion("1.0");
|
||||
task.setAuthor("WireLoad");
|
||||
task.setEmail("feedback @nospam@ yourcompany.com");
|
||||
task.setSummary("CPWebViewTest2");
|
||||
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
|
||||
task.setResources(new FileList("Resources/**"));
|
||||
task.setIndexFilePath("index.html");
|
||||
task.setInfoPlistPath("Info.plist");
|
||||
|
||||
if (configuration === "Debug")
|
||||
task.setCompilerFlags("-DDEBUG -g");
|
||||
else
|
||||
task.setCompilerFlags("-O");
|
||||
});
|
||||
|
||||
task ("default", ["CPWebViewTest2"], function()
|
||||
{
|
||||
printResults(configuration);
|
||||
});
|
||||
|
||||
task ("build", ["default"]);
|
||||
|
||||
task ("debug", function()
|
||||
{
|
||||
ENV["CONFIGURATION"] = "Debug";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("release", function()
|
||||
{
|
||||
ENV["CONFIGURATION"] = "Release";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("run", ["debug"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Debug", "CPWebViewTest2", "index.html")]);
|
||||
});
|
||||
|
||||
task ("run-release", ["release"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Release", "CPWebViewTest2", "index.html")]);
|
||||
});
|
||||
|
||||
task ("deploy", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Deployment", "CPWebViewTest2"));
|
||||
OS.system(["press", "-f", FILE.join("Build", "Release", "CPWebViewTest2"), FILE.join("Build", "Deployment", "CPWebViewTest2")]);
|
||||
printResults("Deployment")
|
||||
});
|
||||
|
||||
task ("desktop", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Desktop", "CPWebViewTest2"));
|
||||
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CPWebViewTest2"), FILE.join("Build", "Desktop", "CPWebViewTest2", "CPWebViewTest2.app"));
|
||||
printResults("Desktop")
|
||||
});
|
||||
|
||||
task ("run-desktop", ["desktop"], function()
|
||||
{
|
||||
OS.system([FILE.join("Build", "Desktop", "CPWebViewTest2", "CPWebViewTest2.app", "Contents", "MacOS", "NativeHost"), "-i"]);
|
||||
});
|
||||
|
||||
function printResults(configuration)
|
||||
{
|
||||
print("----------------------------");
|
||||
print(configuration+" app built at path: "+FILE.join("Build", configuration, "CPWebViewTest2"));
|
||||
print("----------------------------");
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,103 @@
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<!--
|
||||
index-debug.html
|
||||
CPWebViewTest2
|
||||
|
||||
Created by Alexander Ljungberg on May 9, 2011.
|
||||
Copyright 2011, WireLoad All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||
|
||||
<title>CPWebViewTest2</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</script>
|
||||
|
||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript" charset="UTF-8"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
objj_msgSend_reset();
|
||||
|
||||
// DEBUG OPTIONS:
|
||||
|
||||
// Uncomment to enable printing of backtraces on exceptions:
|
||||
//objj_msgSend_decorate(objj_backtrace_decorator);
|
||||
|
||||
// Uncomment to supress exceptions that take place inside a message
|
||||
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
|
||||
|
||||
// Uncomment to enable runtime type checking:
|
||||
//objj_msgSend_decorate(objj_typecheck_decorator);
|
||||
|
||||
// Uncomment (along with both above) to print backtraces on type check errors:
|
||||
//objj_typecheck_prints_backtrace = true;
|
||||
|
||||
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
|
||||
//CPLogUnregister(CPLogDefault);
|
||||
|
||||
// Uncomment to enable a specific logger:
|
||||
//CPLogRegister(CPLogConsole);
|
||||
//CPLogRegister(CPLogPopup);
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
#container {position: absolute; top:50%; left:50%;}
|
||||
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
|
||||
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
|
||||
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
|
||||
</style>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<STYLE type="text/css">
|
||||
#container { position: relative; top: 50%; }
|
||||
#content { position: relative;}
|
||||
</STYLE>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading CPWebViewTest2...</p></div>");
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<div id="container">
|
||||
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
|
||||
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
|
||||
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
|
||||
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
|
||||
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
|
||||
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
|
||||
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
|
||||
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
|
||||
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
|
||||
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,78 @@
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<!--
|
||||
index.html
|
||||
CPWebViewTest2
|
||||
|
||||
Created by Alexander Ljungberg on May 9, 2011.
|
||||
Copyright 2011, WireLoad All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||
|
||||
<title>CPWebViewTest2</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
#container {position: absolute; top:50%; left:50%;}
|
||||
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
|
||||
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
|
||||
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
|
||||
</style>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<STYLE type="text/css">
|
||||
#container { position: relative; top: 50%; }
|
||||
#content { position: relative;}
|
||||
</STYLE>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading CPWebViewTest2...</p></div>");
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<div id="container">
|
||||
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
|
||||
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
|
||||
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
|
||||
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
|
||||
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
|
||||
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
|
||||
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
|
||||
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
|
||||
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
|
||||
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* CPWebViewTest2
|
||||
*
|
||||
* Created by Alexander Ljungberg on May 9, 2011.
|
||||
* Copyright 2011, WireLoad All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
@import "AppController.j"
|
||||
|
||||
|
||||
function main(args, namedArgs)
|
||||
{
|
||||
CPApplicationMain(args, namedArgs);
|
||||
}
|
||||
Reference in new issue
Block a user