Merge branch 'master' of git://github.com/280north/cappuccino

This commit is contained in:
Klaas Pieter Annema committed 2010-05-05 12:03:51 +02:00
commit 65362e727a
6 files changed
+65 -9

No files matched your search

+1
View File
@@ -41,6 +41,7 @@ var PrimaryPlatformWindow = NULL;
DOMElement _DOMBodyElement;
DOMElement _DOMFocusElement;
DOMElement _DOMEventGuard;
CPArray _windowLevels;
CPDictionary _windowLayers;
+8 -4
View File
@@ -130,8 +130,6 @@ var CPDOMEventGetClickCount,
StopDOMEventPropagation,
StopContextMenuDOMEventPropagation;
var _DOMEventGuard;
//right now we hard code q, w, r and t as keys to propogate
//these aren't normal keycodes, they are with modifier key codes
//might be mac only, we should investigate futher later.
@@ -280,7 +278,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
_DOMBodyElement = theDocument.getElementById("cappuccino-body") || theDocument.body;
// FIXME: Always do this?
if ([CPPlatform supportsDragAndDrop])
if (supportsNativeDragAndDrop)
_DOMBodyElement.style["-khtml-user-select"] = "none";
_DOMBodyElement.webkitTouchCallout = "none";
@@ -469,7 +467,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
[PlatformWindows addObject:self];
// FIXME: cpSetFrame?
_DOMWindow.document.write("<html><head></head><body style = 'background-color:transparent;'></body></html>");
_DOMWindow.document.write("<!DOCTYPE html><html lang='en'><head></head><body style='background-color:transparent;'></body></html>");
_DOMWindow.document.close();
if (![CPPlatform isBrowser])
@@ -516,6 +514,11 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
DOMDragElement.style.left = -_CGRectGetWidth(draggedWindowFrame) + "px";
DOMDragElement.style.top = -_CGRectGetHeight(draggedWindowFrame) + "px";
var parentNode = DOMDragElement.parentNode;
if (parentNode)
parentNode.removeChild(DOMDragElement);
_DOMBodyElement.appendChild(DOMDragElement);
var draggingOffset = [dragServer draggingOffset];
@@ -1189,6 +1192,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
[_windowLevels insertObject:aLevel atIndex:insertionIndex];
layer._DOMElement.style.zIndex = aLevel;
_DOMBodyElement.appendChild(layer._DOMElement);
}
@@ -1,6 +1,7 @@
var URLCache = { };
var CFHTTPRequest_open = CFHTTPRequest.prototype.open;
CFHTTPRequest.prototype.open = function(/*String*/ method, /*String*/ url, /*Boolean*/ async, /*String*/ user, /*String*/ password)
{
var cachedRequest = CFHTTPRequest._lookupCachedRequest(url);
@@ -13,7 +14,7 @@ CFHTTPRequest.prototype.open = function(/*String*/ method, /*String*/ url, /*Boo
ObjectiveJ.determineAndDispatchHTTPRequestEvents(self);
};
}
return this._nativeRequest.open(method, url, async, user, password);
return CFHTTPRequest_open.apply(this, arguments);
}
CFHTTPRequest._cacheRequest = function(/*CFURL|String*/ aURL, /*Number*/ status, /*Object*/ headers, /*String*/ body)
+4
View File
@@ -269,11 +269,13 @@ var CPRunLoopLastNativeRunLoop = 0;
aTimer._lastNativeRunLoopsForModes[aMode] = CPRunLoopLastNativeRunLoop;
#if PLATFORM(DOM)
if (!_runLoopInsuranceTimer)
_runLoopInsuranceTimer = window.setNativeTimeout(function()
{
[self limitDateForMode:CPDefaultRunLoopMode];
}, 0);
#endif
}
/*!
@@ -287,11 +289,13 @@ var CPRunLoopLastNativeRunLoop = 0;
_runLoopLock = YES;
#if PLATFORM(DOM)
if (_runLoopInsuranceTimer)
{
window.clearNativeTimeout(_runLoopInsuranceTimer);
_runLoopInsuranceTimer = nil;
}
#endif
var now = _effectiveDate ? [_effectiveDate laterDate:[CPDate date]] : [CPDate date],
nextFireDate = nil,
+11 -4
View File
@@ -92,6 +92,7 @@ if (!NativeRequest)
GLOBAL(CFHTTPRequest) = function()
{
this._isOpen = false;
this._requestHeaders = {};
this._mimeType = null;
@@ -207,6 +208,7 @@ CFHTTPRequest.prototype.overrideMimeType = function(/*String*/ aMimeType)
CFHTTPRequest.prototype.open = function(/*String*/ aMethod, /*String*/ aURL, /*Boolean*/ isAsynchronous, /*String*/ aUser, /*String*/ aPassword)
{
this._isOpen = true;
this._URL = aURL;
this._async = isAsynchronous;
this._method = aMethod;
@@ -217,19 +219,23 @@ CFHTTPRequest.prototype.open = function(/*String*/ aMethod, /*String*/ aURL, /*B
CFHTTPRequest.prototype.send = function(/*Object*/ aBody)
{
delete this._nativeRequest.onreadystatechange;
for (var i in this._requestHeaders)
{
if (this._requestHeaders.hasOwnProperty(i))
this._nativeRequest.setRequestHeader(i, this._requestHeaders[i]);
}
if (!this._isOpen)
{
delete this._nativeRequest.onreadystatechange;
this._nativeRequest.open(this._method, this._URL, this._async, this._user, this._password);
this._nativeRequest.onreadystatechange = this._stateChangeHandler;
}
if (this._mimeType && "overrideMimeType" in this._nativeRequest)
this._nativeRequest.overrideMimeType(this._mimeType);
this._nativeRequest.open(this._method, this._URL, this._async, this._user, this._password);
this._nativeRequest.onreadystatechange = this._stateChangeHandler;
this._isOpen = false;
try
{
@@ -244,6 +250,7 @@ CFHTTPRequest.prototype.send = function(/*Object*/ aBody)
CFHTTPRequest.prototype.abort = function()
{
this._isOpen = false;
return this._nativeRequest.abort();
}
+39
View File
@@ -0,0 +1,39 @@
var OS = require("os");
var FILE = require("file");
function cleanup() {
["ToolsTestApp", "PressTestApp", "FlattenTestApp"].forEach(function(dir) {
if (FILE.isDirectory(dir))
FILE.rmtree(dir);
});
}
@implementation ToolsTest : OJTestCase
{
}
- (void)setUp
{
cleanup();
}
- (void)testTools
{
var status;
status = OS.system(["capp", "gen", "ToolsTestApp"]);
[self assert:status equals:0 message:"capp gen failed"];
status = OS.system(["press", "-f", "ToolsTestApp", "PressTestApp"]);
[self assert:status equals:0 message:"press failed"];
status = OS.system(["flatten", "-f", "ToolsTestApp", "FlattenTestApp"]);
[self assert:status equals:0 message:"flatten failed"];
}
- (void)tearDown
{
cleanup();
}
@end