Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Antoine Mercadal
2012-01-13 13:56:16 +01:00
43 changed files with 166 additions and 157 deletions
+3 -3
View File
@@ -1166,12 +1166,12 @@ CPRunContinuesResponse = -1002;
var _CPModalSessionMake = function(aWindow, aStopCode)
{
return { _window:aWindow, _state:CPRunContinuesResponse , _previous:nil };
}
};
var _CPEventListenerMake = function(anEventMask, aCallback)
{
return { _mask:anEventMask, _callback:aCallback };
}
};
// Make this a global for use in CPPlatformWindow+DOM.j.
_CPRunModalLoop = function(anEvent)
@@ -1183,7 +1183,7 @@ _CPRunModalLoop = function(anEvent)
if (theWindow == modalSession._window || [theWindow worksWhenModal])
[theWindow sendEvent:anEvent];
}
};
/*!
Starts the GUI and Cappuccino frameworks. This function should be
+1 -1
View File
@@ -75,7 +75,7 @@ CPBelowBottom = 6;
var box = [[self alloc] initWithFrame:CGRectMakeZero()],
enclosingView = [aView superview];
[box setAutoresizingMask:[aView autoresizingMask]];
[box setAutoresizingMask:[aView autoresizingMask]];
[box setFrameFromContentFrame:[aView frame]];
[enclosingView replaceSubview:aView with:box];
+2 -2
View File
@@ -922,9 +922,9 @@ var CPDocumentUntitledCount = 0;
var _CPReadSessionMake = function(aType, aDelegate, aDidReadSelector, aContextInfo)
{
return { fileType:aType, delegate:aDelegate, didReadSelector:aDidReadSelector, contextInfo:aContextInfo };
}
};
var _CPSaveSessionMake = function(anAbsoluteURL, aSaveOperation, aChangeCount, aDelegate, aDidSaveSelector, aContextInfo, aConnection)
{
return { absoluteURL:anAbsoluteURL, saveOperation:aSaveOperation, changeCount:aChangeCount, delegate:aDelegate, didSaveSelector:aDidSaveSelector, contextInfo:aContextInfo, connection:aConnection };
}
};
+3 -3
View File
@@ -143,7 +143,7 @@ var _CPFontDetectFontAvailable = function(font)
if (_CPFontDetectCompareFonts(_CPFontDetectReferenceFonts[i], font))
return true;
return false;
}
};
var _CPFontDetectCache = {};
@@ -165,7 +165,7 @@ var _CPFontDetectCompareFonts = function(fontA, fontB)
bHeight = _CPFontDetectSpan.offsetHeight;
return (a.w != bWidth || a.h != bHeight);
}
};
// Test the candidate fonts pairwise until we find two that are different. Otherwise return the first.
var _CPFontDetectPickTwoDifferentFonts = function(candidates)
@@ -175,6 +175,6 @@ var _CPFontDetectPickTwoDifferentFonts = function(candidates)
if (_CPFontDetectCompareFonts(candidates[i], candidates[j]))
return [candidates[i], candidates[j]];
return [candidates[0]];
}
};
[CPFontManager setFontManagerFactory:[CPFontManager class]];
+3 -3
View File
@@ -281,7 +281,7 @@ function CPAppKitImage(aFilename, aSize)
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
[self _derefFromImage];
}
};
_image.onerror = function ()
{
@@ -293,7 +293,7 @@ function CPAppKitImage(aFilename, aSize)
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
[self _derefFromImage];
}
};
_image.onabort = function ()
{
@@ -305,7 +305,7 @@ function CPAppKitImage(aFilename, aSize)
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
[self _derefFromImage];
}
};
_image.src = _filename;
+3 -3
View File
@@ -426,7 +426,7 @@ var resolveMultipleValues = function resolveMultipleValues(/*CPString*/key, /*CP
}
return !operation;
}
};
var invokeAction = function invokeAction(/*CPString*/targetKey, /*CPString*/argumentKey, /*CPDictionary*/bindings)
{
@@ -463,7 +463,7 @@ var invokeAction = function invokeAction(/*CPString*/targetKey, /*CPString*/argu
}
[invocation invoke];
}
};
// Keys in options dictionary
@@ -518,4 +518,4 @@ CPValueTransformerBindingOption = @"CPValueTransformer";
CPIsControllerMarker = function(/*id*/anObject)
{
return anObject === CPMultipleValuesMarker || anObject === CPNoSelectionMarker || anObject === CPNotApplicableMarker || anObject === CPNullMarker;
}
};
+11 -9
View File
@@ -1120,13 +1120,14 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
if (_dragHoverTimer)
[_dragHoverTimer invalidate];
var autoExpandCallBack = function(){
var autoExpandCallBack = function()
{
if (_dropItem)
{
[_dropOperationFeedbackView blink];
[CPTimer scheduledTimerWithTimeInterval:.3 callback:objj_msgSend(self, "expandItem:", _dropItem) repeats:NO];
}
}
};
_dragHoverTimer = [CPTimer scheduledTimerWithTimeInterval:.8 callback:autoExpandCallBack repeats:NO];
}
@@ -1467,7 +1468,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
// Check for the key events manually, as opposed to waiting for CPWindow to sent the actual action message
// in _processKeyboardUIKey:, because we might not want to handle the arrow events.
if (character !== CPRightArrowFunctionKey && character !== CPLeftArrowFunctionKey)
if (character !== CPRightArrowFunctionKey && character !== CPLeftArrowFunctionKey)
return [super keyDown:anEvent];
var rows = [self selectedRowIndexes],
@@ -1481,7 +1482,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
for (; i < c; i++)
items.push([self itemAtRow:indexes[i]]);
if (character === CPRightArrowFunctionKey)
{
@@ -1491,7 +1492,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
else if (character === CPLeftArrowFunctionKey)
{
for (var i = 0; i < c; i++)
[self collapseItem:items[i]];
[self collapseItem:items[i]];
}
[super keyDown:anEvent];
@@ -1535,7 +1536,7 @@ var _reloadItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anItem)
itemInfo.isExpandable = [dataSource outlineView:anOutlineView isItemExpandable:newItem];
itemInfo.isExpanded = itemInfo.isExpandable && itemInfo.isExpanded;
}
}
};
// FIX ME: We're using with() here because Safari fails if we use anOutlineView._itemInfosForItems or whatever...
var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anItem, /*BOOL*/ isIntermediate)
@@ -1640,7 +1641,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
}
}//end of with
return descendants;
}
};
@implementation _CPOutlineViewTableViewDataSource : CPObject
{
@@ -1984,7 +1985,8 @@ var CPOutlineViewIndentationPerLevelKey = @"CPOutlineViewIndentationPerLevelKey"
@end
var colorForDisclosureTriangle = function(isSelected, isHighlighted) {
var colorForDisclosureTriangle = function(isSelected, isHighlighted)
{
return isSelected
? (isHighlighted
? [CPColor colorWithCalibratedWhite:0.9 alpha: 1.0]
@@ -1992,4 +1994,4 @@ var colorForDisclosureTriangle = function(isSelected, isHighlighted) {
: (isHighlighted
? [CPColor colorWithCalibratedWhite:0.4 alpha: 1.0]
: [CPColor colorWithCalibratedWhite:0.5 alpha: 1.0]);
}
};
+1 -1
View File
@@ -63,7 +63,7 @@ var _isSystemUsingOverlayScrollers = function()
#else
return NO;
#endif
}
};
/*!
@ingroup appkit
+10 -8
View File
@@ -683,7 +683,7 @@ NOT YET IMPLEMENTED
*/
- (void)setRowHeight:(unsigned)aRowHeight
{
aRowHeight = +aRowHeight;
aRowHeight = aRowHeight;
if (_rowHeight === aRowHeight)
return;
@@ -954,8 +954,8 @@ NOT YET IMPLEMENTED
*/
- (void)_moveColumn:(unsigned)fromIndex toColumn:(unsigned)toIndex
{
fromIndex = +fromIndex;
toIndex = +toIndex;
fromIndex = fromIndex;
toIndex = toIndex;
if (fromIndex === toIndex)
return;
@@ -1562,7 +1562,7 @@ NOT YET IMPLEMENTED
*/
- (CGRect)rectOfColumn:(CPInteger)aColumnIndex
{
aColumnIndex = +aColumnIndex;
aColumnIndex = aColumnIndex;
if (aColumnIndex < 0 || aColumnIndex >= NUMBER_OF_COLUMNS())
return _CGRectMakeZero();
@@ -4939,15 +4939,17 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
isBlinking = YES;
var showCallback = function() {
var showCallback = function()
{
objj_msgSend(self, "setHidden:", NO)
isBlinking = NO;
}
};
var hideCallback = function() {
var hideCallback = function()
{
objj_msgSend(self, "setHidden:", YES)
isBlinking = YES;
}
};
objj_msgSend(self, "setHidden:", YES);
[CPTimer scheduledTimerWithTimeInterval:0.1 callback:showCallback repeats:NO];
+3 -3
View File
@@ -202,14 +202,14 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
CPTextFieldInputDidBlur = YES;
return true;
}
};
CPTextFieldHandleBlur = function(anEvent)
{
CPTextFieldInputOwner = nil;
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
};
//FIXME make this not onblur
CPTextFieldDOMInputElement.onblur = CPTextFieldBlurFunction;
@@ -1433,7 +1433,7 @@ var secureStringForString = function(aString)
return "";
return Array(aString.length + 1).join(CPSecureTextFieldCharacter);
}
};
var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
+3 -1
View File
@@ -579,6 +579,7 @@ CPThemeStateCircular = CPThemeState("circular");
_cache = {};
_name = [aCoder decodeObjectForKey:@"name"];
_defaultValue = [aCoder decodeObjectForKey:@"defaultValue"];
_values = [CPDictionary dictionary];
if ([aCoder containsValueForKey:@"value"])
@@ -611,6 +612,7 @@ CPThemeStateCircular = CPThemeState("circular");
- (void)encodeWithCoder:(CPCoder)aCoder
{
[aCoder encodeObject:_name forKey:@"name"];
[aCoder encodeObject:_defaultValue forKey:@"defaultValue"];
var keys = [_values allKeys],
count = keys.length;
@@ -666,7 +668,7 @@ var numberOfOnes = function(aNumber)
cachedNumberOfOnes[slot] = count;
return count;
}
};
numberOfOnes.displayName = "numberOfOnes";
+7 -7
View File
@@ -660,7 +660,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
CPTokenFieldInputDidBlur = YES;
return true;
}
};
CPTokenFieldKeyDownFunction = function(aDOMEvent)
{
@@ -814,7 +814,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
}
return true;
}
};
CPTokenFieldKeyPressFunction = function(aDOMEvent)
{
@@ -844,7 +844,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
// Force immediate layout in case word wrapping is now necessary.
[owner setNeedsLayout];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
};
CPTokenFieldKeyUpFunction = function()
{
@@ -857,14 +857,14 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
[self setNeedsLayout];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
};
CPTokenFieldHandleBlur = function(anEvent)
{
CPTokenFieldInputOwner = nil;
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
};
if (document.attachEvent)
{
@@ -1026,7 +1026,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
offset.x += width + spaceBetweenTokens.width;
return r;
}
};
var placeEditor = function(useRemainingWidth)
{
@@ -1053,7 +1053,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
// When editing, always scroll to the cursor.
if (_selectedRange.length == 0)
[[_tokenScrollView documentView] scrollRectToVisible:inputFrame];
}
};
for (var i = 0, count = [tokens count]; i < count; i++)
{
+2 -2
View File
@@ -515,7 +515,7 @@ var TOOLBAR_TOP_MARGIN = 5.0,
var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth)
{
return { index:anIndex, view:aView, label:aLabel, minWidth:aMinWidth };
}
};
/* @ignore */
@implementation _CPToolbarView : CPView
@@ -876,7 +876,7 @@ var _CPToolbarItemVisibilityPriorityCompare = function(lhs, rhs)
return CPOrderedAscending;
return CPOrderedDescending;
}
};
var TOP_MARGIN = 5.0,
LABEL_MARGIN = 2.0;
+2 -2
View File
@@ -2799,7 +2799,7 @@ var _CPViewFullScreenModeStateMake = function(aView)
var superview = aView._superview;
return { autoresizingMask:aView._autoresizingMask, frame:CGRectMakeCopy(aView._frame), index:(superview ? [superview._subviews indexOfObjectIdenticalTo:aView] : 0), superview:superview };
}
};
var _CPViewGetTransform = function(/*CPView*/ fromView, /*CPView */ toView)
{
@@ -2896,4 +2896,4 @@ var _CPViewGetTransform = function(/*CPView*/ fromView, /*CPView */ toView)
}*/
return transform;
}
};
+2 -2
View File
@@ -199,7 +199,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
_ignoreLoadEnd = NO;
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
};
if (_iframe.addEventListener)
_iframe.addEventListener("load", _loadCallback, false);
@@ -830,7 +830,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
- (@action)reload:(id)sender
{
// If we're displaying pure HTML, redisplay it.
if(!_url && (_html !== nil))
if (!_url && (_html !== nil))
[self loadHTMLString:_html];
else
[self _loadMainFrameURL];
+3 -3
View File
@@ -2673,7 +2673,7 @@ var allViews = function(aWindow)
views = views.concat([views[index] subviews]);
return views;
}
};
var keyViewComparator = function(lhs, rhs, context)
{
@@ -2704,7 +2704,7 @@ var keyViewComparator = function(lhs, rhs, context)
return CPOrderedSame;
return CPOrderedDescending;
}
};
@implementation CPWindow (MenuBar)
@@ -2928,7 +2928,7 @@ var keyViewComparator = function(lhs, rhs, context)
var interpolate = function(fromValue, toValue, progress)
{
return fromValue + (toValue - fromValue) * progress;
}
};
/* @ignore */
@implementation _CPWindowFrameAnimation : CPAnimation
+7 -6
View File
@@ -29,7 +29,7 @@
function CABackingStoreGetContext(aBackingStore)
{
return aBackingStore.context;
}
};
if (CPFeatureIsCompatible(CPHTMLCanvasFeature))
{
@@ -42,7 +42,7 @@ CABackingStoreCreate = function()
// FIXME: Consolidate drawImage to support this.
return { context:DOMElement.getContext("2d"), buffer:DOMElement, _image:DOMElement };
}
};
CABackingStoreSetSize = function(aBackingStore, aSize)
{
@@ -52,7 +52,8 @@ CABackingStoreSetSize = function(aBackingStore, aSize)
buffer.height = aSize.height;
buffer.style.width = PIXEL(aSize.width);
buffer.style.height = PIXEL(aSize.height);
}
};
}
else
{
@@ -64,10 +65,10 @@ CABackingStoreCreate = function()
context.buffer = "";
return { context:context };
}
};
CABackingStoreSetSize = function(aBackingStore, aSize)
{
}
};
}
}
+2 -2
View File
@@ -358,7 +358,7 @@ if (CPFeatureIsCompatible(CPJavaScriptCanvasTransformFeature))
CGContextConcatCTM = function(aContext, anAffineTransform)
{
aContext.transform(anAffineTransform.a, anAffineTransform.b, anAffineTransform.c, anAffineTransform.d, anAffineTransform.tx, anAffineTransform.ty);
}
};
}
else
@@ -428,7 +428,7 @@ CGContextConcatCTM = function(aContext, anAffineTransform)
CGContextScaleCTM(aContext, sx, sy);
if (a2 != 0.0)
CGContextRotateCTM(aContext, a2);
}
};
}
+1 -1
View File
@@ -49,7 +49,7 @@ var screenNeedsInitialization = NO,
window.onunload = function()
{
[CPApp terminate:nil];
}
};
}
+ (BOOL)isBrowser
+4 -4
View File
@@ -1568,7 +1568,7 @@ var _CPEventFromNativeMouseEvent = function(aNativeEvent, anEventType, aPoint, m
aNativeEvent._eventNumber = anEventNumber;
aNativeEvent._clickCount = aClickCount;
aNativeEvent._pressure = aPressure;
if((anEventType == CPLeftMouseDragged) || (anEventType == CPRightMouseDragged) || (anEventType == CPMouseMoved))
if ((anEventType == CPLeftMouseDragged) || (anEventType == CPRightMouseDragged) || (anEventType == CPMouseMoved))
{
aNativeEvent._deltaX = aPoint.x - aMouseDragStart.x;
aNativeEvent._deltaY = aPoint.y - aMouseDragStart.y;
@@ -1581,7 +1581,7 @@ var _CPEventFromNativeMouseEvent = function(aNativeEvent, anEventType, aPoint, m
return aNativeEvent;
}
};
var CLICK_SPACE_DELTA = 5.0,
CLICK_TIME_DELTA = (typeof document != "undefined" && document.addEventListener) ? 350.0 : 1000.0;
@@ -1596,7 +1596,7 @@ var CPDOMEventGetClickCount = function(aComparisonEvent, aTimestamp, aLocation)
return (aTimestamp - [aComparisonEvent timestamp] < CLICK_TIME_DELTA &&
ABS(comparisonLocation.x - aLocation.x) < CLICK_SPACE_DELTA &&
ABS(comparisonLocation.y - aLocation.y) < CLICK_SPACE_DELTA) ? [aComparisonEvent clickCount] + 1 : 1;
}
};
var CPDOMEventStop = function(aDOMEvent, aPlatformWindow)
{
@@ -1616,7 +1616,7 @@ var CPDOMEventStop = function(aDOMEvent, aPlatformWindow)
aPlatformWindow._DOMFocusElement.focus();
aPlatformWindow._DOMFocusElement.blur();
}
}
};
function CPWindowObjectList()
{
@@ -229,4 +229,4 @@ CPKeyCodes.isCharacterKey = function(keyCode)
default:
return false;
}
}
};
+8 -8
View File
@@ -26,7 +26,7 @@ BlendTask.prototype.__proto__ = BundleTask.prototype;
BlendTask.prototype.packageType = function()
{
return "BLND";
}
};
BlendTask.prototype.infoPlist = function()
{
@@ -35,28 +35,28 @@ BlendTask.prototype.infoPlist = function()
infoPlist.setValueForKey("CPKeyedThemes", require("narwhal/util").unique(this._keyedThemes));
return infoPlist;
}
};
BlendTask.prototype.themeDescriptors = function()
{
return this._themeDescriptors;
}
};
BlendTask.prototype.setThemeDescriptors = function(/*Array | FileList*/ themeDescriptors)
{
this._themeDescriptors = themeDescriptors;
}
};
BlendTask.prototype.defineTasks = function()
{
this.defineThemeDescriptorTasks();
BundleTask.prototype.defineTasks.apply(this, arguments);
}
};
BlendTask.prototype.defineSourceTasks = function()
{
}
};
BlendTask.prototype.defineThemeDescriptorTasks = function()
{
@@ -106,7 +106,7 @@ BlendTask.prototype.defineThemeDescriptorTasks = function()
});
});
}, this);
}
};
function cibDataFromTopLevelObjects(objects)
{
@@ -232,4 +232,4 @@ exports.blend = function(aName, aFunction)
{
// No .apply necessary because the parameters aren't variable.
return BlendTask.defineTask(aName, aFunction);
}
};
+1 -2
View File
@@ -371,8 +371,7 @@ function pngcrushDirectory(directory) {
var pngs = directoryPath.glob("**/*.png");
system.stderr.print("Running pngcrush on " + pngs.length + " pngs:");
pngs.forEach(function(dst) {
var dstPath = directoryPath.join(dst);
pngs.forEach(function(dstPath) {
var tmpPath = FILE.path(dstPath+".tmp");
var p = OS.popen(["pngcrush", "-rem", "alla", "-reduce", /*"-brute",*/ dstPath, tmpPath]);
+7 -6
View File
@@ -2,19 +2,19 @@
@import <AppKit/AppKit.j>
function findCibClassDependencies(cibPath) {
var cib = [[CPCib alloc] initWithContentsOfURL:cibPath];
var cib = [[CPCib alloc] initWithContentsOfURL:cibPath],
dependencies = {},
CPClassFromStringOriginal = CPClassFromString;
var dependencies = {};
var CPClassFromStringOriginal = CPClassFromString;
CPClassFromString = function(aClassName) {
CPClassFromString = function(aClassName)
{
var result = CPClassFromStringOriginal(aClassName);
// print("CPClassFromString: " + Array.prototype.slice.call(arguments) + " => " + result);
dependencies[aClassName] = true;
return result;
}
};
// make sure CPApp is init'd
[CPApplication sharedApplication];
@@ -29,6 +29,7 @@ function findCibClassDependencies(cibPath) {
return Object.keys(dependencies);
}
// this is copied from CPCib's "instantiateCibWithExternalNameTable:"
@implementation CPCib (Press)
+1 -1
View File
@@ -9,4 +9,4 @@ exports.fontinfo = function(name, size)
return JSON.parse(p.stdout.read());
else
return null;
}
};
+29 -26
View File
@@ -21,15 +21,15 @@ ObjectiveJRuntimeAnalyzer = function(rootPath)
_OBJJ.Executable.prototype.path = function() {
var url = this.URL();
return url ? url.absoluteURL().path() : null;
}
};
_OBJJ.FileDependency.prototype.path = function() {
var url = this.URL();
return url ? url.path() : null;
}
};
this.context.global.CFBundle.prototype.executablePath = function() {
var url = this.executableURL();
return url ? url.absoluteURL().path() : null;
}
};
this.require("cappuccino/objj-flatten-additions");
@@ -42,16 +42,16 @@ ObjectiveJRuntimeAnalyzer = function(rootPath)
var path = new CFURL(aURL, this.rootURL).absoluteURL().path();
requestedURLs[path] = true;
return _lookupCachedRequest.apply(null, arguments);
}
}
};
};
ObjectiveJRuntimeAnalyzer.prototype.setIncludePaths = function(includePaths) {
this.context.global.OBJJ_INCLUDE_PATHS = includePaths;
}
};
ObjectiveJRuntimeAnalyzer.prototype.setEnvironments = function(environments) {
this.context.global.CFBundle.environments = function() { return environments; };
}
};
ObjectiveJRuntimeAnalyzer.prototype.makeAbsoluteURL = function(/*CFURL|String*/ aURL)
{
@@ -59,7 +59,7 @@ ObjectiveJRuntimeAnalyzer.prototype.makeAbsoluteURL = function(/*CFURL|String*/
return aURL;
return new this.context.global.CFURL(aURL, this.mainBundleURL);
}
};
ObjectiveJRuntimeAnalyzer.prototype.initializeGlobalRecorder = function()
{
@@ -103,7 +103,8 @@ ObjectiveJRuntimeAnalyzer.prototype.initializeGlobalRecorder = function()
var _OBJJ = this.require("objective-j");
var _fileExecuterForURL = _OBJJ.Executable.fileExecuterForURL;
_OBJJ.Executable.fileExecuterForURL = function(/*CFURL*/ referenceURL) {
_OBJJ.Executable.fileExecuterForURL = function(/*CFURL*/ referenceURL)
{
referenceURL = self.makeAbsoluteURL(referenceURL);
var referencePath = referenceURL.absoluteURL().path()
var fileExecutor = _fileExecuterForURL.apply(this, arguments);
@@ -130,8 +131,8 @@ ObjectiveJRuntimeAnalyzer.prototype.initializeGlobalRecorder = function()
currentFile = evaluatingPaths.pop();
};
}
}
};
};
ObjectiveJRuntimeAnalyzer.prototype.load = function(path)
{
@@ -142,13 +143,13 @@ ObjectiveJRuntimeAnalyzer.prototype.load = function(path)
});
})+")"
)(path);
}
};
ObjectiveJRuntimeAnalyzer.prototype.finishLoading = function(path)
{
// run the "event loop"
this.require('browser/timeout').serviceTimeouts();
}
};
ObjectiveJRuntimeAnalyzer.prototype.mapGlobalsToFiles = function()
{
@@ -164,7 +165,7 @@ ObjectiveJRuntimeAnalyzer.prototype.mapGlobalsToFiles = function()
(globals[globalName] = globals[globalName] || []).push(fileName);
}
return globals;
}
};
ObjectiveJRuntimeAnalyzer.prototype.mapFilesToGlobals = function()
{
@@ -177,7 +178,7 @@ ObjectiveJRuntimeAnalyzer.prototype.mapFilesToGlobals = function()
files[fileName][globalName] = true;
}
return files;
}
};
// this method resolves library imports and merges their recorded globals with the canonical
// file object for each file
@@ -197,7 +198,7 @@ ObjectiveJRuntimeAnalyzer.prototype.mergeLibraryImports = function()
delete this.files[relativePath];
}
}
}
};
// returns an executable for the import path, or null if none exists
ObjectiveJRuntimeAnalyzer.prototype.executableForImport = function(path, isLocal)
@@ -213,7 +214,7 @@ ObjectiveJRuntimeAnalyzer.prototype.executableForImport = function(path, isLocal
});
return fileExecutable;
}
};
/*
param context includes
@@ -313,7 +314,7 @@ ObjectiveJRuntimeAnalyzer.prototype.traverseDependencies = function(executable,
context.referencedFiles[path] = referencedFiles;
return context;
}
};
ObjectiveJRuntimeAnalyzer.prototype.checkImported = function(context, path, importedFiles) {
for (var importedFile in importedFiles)
@@ -330,7 +331,7 @@ ObjectiveJRuntimeAnalyzer.prototype.checkImported = function(context, path, impo
CPLog.error("Missing imported file: " + importedFile);
}
}
}
};
ObjectiveJRuntimeAnalyzer.prototype.checkReferenced = function(context, path, referencedFiles) {
for (var referencedFile in referencedFiles)
@@ -347,16 +348,17 @@ ObjectiveJRuntimeAnalyzer.prototype.checkReferenced = function(context, path, re
CPLog.error("Missing referenced file: " + referencedFile);
}
}
}
};
ObjectiveJRuntimeAnalyzer.prototype.fileExecutables = function() {
var _OBJJ = this.require("objective-j");
return _OBJJ.FileExecutablesForPaths;
}
};
// returns a unique list of tokens for a piece of code.
// ideally this should return identifiers only
function uniqueTokens(code) {
function uniqueTokens(code)
{
// FIXME: this breaks for indentifiers containing "$" since it's considered a distinct token by the lexer
var lexer = new OBJJ.Lexer(code, null);
@@ -374,7 +376,8 @@ function uniqueTokens(code) {
globalsToFiles (in): map from tokens to files which define those tokens
referencedFiles (out): map of required files (to map of tokens defined in that file)
*/
function markFilesReferencedByTokens(tokens, globalsToFiles, referencedFiles) {
function markFilesReferencedByTokens(tokens, globalsToFiles, referencedFiles)
{
tokens.forEach(function(token) {
if (globalsToFiles.hasOwnProperty(token))
{
@@ -427,14 +430,14 @@ function addMockBrowserEnvironment(scope)
if (!scope.Element)
scope.Element = function() {
this.style = {}
}
};
if (!scope.document)
scope.document = {
createElement : function() {
return new scope.Element();
}
}
};
}
// does a shallow copy of an object. if onlyList is true, it sets each property to "true" instead of the actual value
@@ -457,4 +460,4 @@ function diff(o)
for (var i in o.before)
if (o.deleted && !o.ignore[i] && typeof o.after[i] == "undefined")
o.deleted[i] = true;
}
}
+2 -2
View File
@@ -411,7 +411,7 @@
var selectorCompare = function selectorCompare(object1, object2, selector)
{
return [object1 performSelector:selector withObject:object2];
}
};
// sort using sort descriptors
var compareObjectsUsingDescriptors= function compareObjectsUsingDescriptors(lhs, rhs, descriptors)
@@ -424,4 +424,4 @@ var compareObjectsUsingDescriptors= function compareObjectsUsingDescriptors(lhs,
result = [descriptors[i++] compareObject:lhs withObject:rhs];
return result;
}
};
+5 -5
View File
@@ -145,7 +145,7 @@
return CPOrderedDescending;
else
return CPOrderedAscending;
}
};
return [_rangeEntries indexOfObject:anIndex inSortedRange:nil options:0 usingComparator:sortFunction];
}
@@ -814,17 +814,17 @@ var isEqual = function isEqual(a, b)
return YES;
return NO;
}
};
var makeRangeEntry = function makeRangeEntry(/*CPRange*/aRange, /*CPDictionary*/attributes)
{
return {range:aRange, attributes:[attributes copy]};
}
};
var copyRangeEntry = function copyRangeEntry(/*RangeEntry*/aRangeEntry)
{
return makeRangeEntry(CPCopyRange(aRangeEntry.range), [aRangeEntry.attributes copy]);
}
};
var splitRangeEntry = function splitRangeEntryAtIndex(/*RangeEntry*/aRangeEntry, /*unsigned*/anIndex)
{
@@ -837,4 +837,4 @@ var splitRangeEntry = function splitRangeEntryAtIndex(/*RangeEntry*/aRangeEntry,
newRangeEntry.attributes = [newRangeEntry.attributes copy];
return [aRangeEntry, newRangeEntry];
}
};
+2 -2
View File
@@ -890,7 +890,7 @@ var positionOfIndex = function(ranges, anIndex)
}
return CPNotFound;
}
};
var assumedPositionOfIndex = function(ranges, anIndex)
{
@@ -935,7 +935,7 @@ var assumedPositionOfIndex = function(ranges, anIndex)
}
return CPNotFound;
}
};
/*
new old method
+2 -2
View File
@@ -214,7 +214,7 @@ var _changeKindForSetMutationKind = function(mutationKind)
case CPKeyValueIntersectSetMutation: return CPKeyValueChangeRemoval;
case CPKeyValueSetSetMutation: return CPKeyValueChangeReplacement;
}
}
};
var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld,
DependentKeysKey = "$KVODEPENDENT",
@@ -1139,7 +1139,7 @@ var _CPKVOInfoMake = function _CPKVOInfoMake(anObserver, theOptions, aContext, a
context: aContext,
forwarder: aForwarder
};
}
};
@import "CPArray+KVO.j"
@import "CPSet+KVO.j"
+1 -1
View File
@@ -597,4 +597,4 @@ var _CPKeyedArchiverEncodeObject = function(self, anObject, isConditional)
}
return [CPDictionary dictionaryWithObject:UID forKey:_CPKeyedArchiverUIDKey];
}
};
+1 -1
View File
@@ -541,4 +541,4 @@ var _CPKeyedUnarchiverDecodeObjectAtIndex = function(self, anIndex)
object = [object JSObject];
return object;
}
};
+1 -1
View File
@@ -171,7 +171,7 @@ var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */
{
[self._unnamedRegistry postNotification:aNotification];
[[self._namedRegistries objectForKey:[aNotification name]] postNotification:aNotification];
}
};
/*
Mapping of Notification Name to listening object/selector.
@@ -587,4 +587,4 @@ String.prototype.escapeForRegExp = function()
}
return result;
}
};
+1 -1
View File
@@ -968,7 +968,7 @@ function(newValue)\
var CPRaiseParseError = function CPRaiseParseError(aScanner, target)
{
[CPException raise:CPInvalidArgumentException reason:@"unable to parse " + target + " at index " + [aScanner scanLocation]];
}
};
@import "CPCompoundPredicate.j"
@import "CPComparisonPredicate.j"
+1 -1
View File
@@ -849,6 +849,6 @@ String.prototype.stripDiacritics = function()
}
return output;
}
};
String.prototype.isa = CPString;
+5 -5
View File
@@ -257,7 +257,7 @@ var _CPTimerBridgeTimer = function(codeOrFunction, aDelay, shouldRepeat, functio
CPTimersForTimeoutIDs[timeoutID] = [CPTimer scheduledTimerWithTimeInterval:aDelay / 1000 callback:theFunction repeats:shouldRepeat];
return timeoutID;
}
};
// Avoid "TypeError: Result of expression 'window' [undefined] is not an object" when running unit tests.
// We can't use a regular PLATFORM(DOM) check because that platform constant is not defined in Foundation.
@@ -266,7 +266,7 @@ if (typeof(window) !== 'undefined')
window.setTimeout = function(codeOrFunction, aDelay)
{
return _CPTimerBridgeTimer(codeOrFunction, aDelay, NO, Array.prototype.slice.apply(arguments, [2]));
}
};
window.clearTimeout = function(aTimeoutID)
{
@@ -276,15 +276,15 @@ if (typeof(window) !== 'undefined')
[timer invalidate];
CPTimersForTimeoutIDs[aTimeoutID] = nil;
}
};
window.setInterval = function(codeOrFunction, aDelay, functionArgs)
{
return _CPTimerBridgeTimer(codeOrFunction, aDelay, YES, Array.prototype.slice.apply(arguments, [2]));
}
};
window.clearInterval = function(aTimeoutID)
{
window.clearTimeout(aTimeoutID);
}
};
}
+1 -1
View File
@@ -190,7 +190,7 @@ var CPURLConnectionDelegate = nil;
{
_HTTPRequest.open([_request HTTPMethod], [[_request URL] absoluteString], YES);
_HTTPRequest.onreadystatechange = function() { [self _readyStateDidChange]; }
_HTTPRequest.onreadystatechange = function() { [self _readyStateDidChange]; };
var fields = [_request allHTTPHeaderFields],
key = nil,
+5 -5
View File
@@ -50,7 +50,7 @@ var setURLResourceValuesForKeysFromProperties = function(aURL, keys, properties)
[aURL setResourceValue:displayName forKey:CPURLNameKey];
[aURL setResourceValue:displayName forKey:CPURLLocalizedNameKey];
}
}
};
CPWebDAVManagerCollectionResourceType = 1;
CPWebDAVManagerNonCollectionResourceType = 0;
@@ -99,7 +99,7 @@ CPWebDAVManagerNonCollectionResourceType = 0;
}
return contents;
}
};
if (!aBlock)
return makeContents(aURL, [self PROPFIND:aURL properties:properties depth:1 block:nil]);
@@ -190,7 +190,7 @@ var XMLDocumentFromString = function(anXMLString)
}
return new DOMParser().parseFromString(anXMLString,"text/xml");
}
};
var parsePROPFINDResponse = function(anXMLString)
{
@@ -233,9 +233,9 @@ var parsePROPFINDResponse = function(anXMLString)
}
return propertiesForURLs;
}
};
var mapURLsAndProperties = function(/*CPDictionary*/ properties, /*CPURL*/ ignoredURL)
{
}
};
@@ -16,9 +16,9 @@ CPViewAnimationFadeOutEffect = "CPViewAnimationFadeOutEffect";
@implementation CPViewAnimationTransition : CPAnimation
{
CPArray _viewAnimations;
Function endListener;
BOOL _isAnimating;
CPArray _viewAnimations;
Function endListener;
BOOL _isAnimating;
}
// INSTANCE METHODS
@@ -57,14 +57,14 @@ CPViewAnimationFadeOutEffect = "CPViewAnimationFadeOutEffect";
var count = [_viewAnimations count];
for (var i = 0; i < count; i++)
{
var animation = [_viewAnimations objectAtIndex:i],
var animation = [_viewAnimations objectAtIndex:i],
target = [animation objectForKey:CPViewAnimationTargetKey];
[self _updateAnimationCurve:[self animationCurve] forView:target];
[self _updateAnimationDuration:[self duration] forView:target];
}
endListener = function(event){[self _animationDidEnd:_viewAnimations]};
endListener = function(event){[self _animationDidEnd:_viewAnimations]};
}
- (void)_updateTransitionPropertiesForView:(CPView)target
@@ -136,17 +136,17 @@ CPViewAnimationFadeOutEffect = "CPViewAnimationFadeOutEffect";
if (effect = [animation objectForKey:CPViewAnimationEffectKey])
{
var opacity;
switch (effect)
{
case CPViewAnimationFadeInEffect: opacity = 1;
break;
case CPViewAnimationFadeOutEffect: opacity = 0;
break;
default : opacity = 1;
}
var opacity;
switch (effect)
{
case CPViewAnimationFadeInEffect: opacity = 1;
break;
case CPViewAnimationFadeOutEffect: opacity = 0;
break;
default : opacity = 1;
}
[target setAlphaValue:opacity];
[target setAlphaValue:opacity];
}
[target setFrame:endFrame];
@@ -208,7 +208,7 @@ CPViewAnimationFadeOutEffect = "CPViewAnimationFadeOutEffect";
this.counter = null;
_isAnimating = NO;
while(count--)
while (count--)
{
var target = [viewAnimations[count] objectForKey:CPViewAnimationTargetKey];
target._DOMElement.style.removeProperty("-webkit-transition");
@@ -91,7 +91,6 @@ def writeAccessors(className, ivars, sourceFile, interfaceFile)
return if accessorsMatches.length == 0
accessorsSource = ""
accessorsInterface = ""
# Create a CPSynthesizedAccessor category for the class with synthesized
# accessor methods for each @accessors declaration.
+1 -1
View File
@@ -87,4 +87,4 @@ FILE.listPaths = function(aPath)
paths[count] = FILE.join(aPath, paths[count]);
return paths;
}
};
+1 -1
View File
@@ -583,7 +583,7 @@ function readTheme(name, path)
// By default when we try to load the bundle it will use the CommonJS environment,
// but we want the Browser environment. So we override mostEligibleEnvironment().
themeBundle.mostEligibleEnvironment = function() { return "Browser"; }
themeBundle.mostEligibleEnvironment = function() { return "Browser"; };
themeBundle.load();
var keyedThemes = themeBundle.valueForInfoDictionaryKey("CPKeyedThemes");