mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Merge branch 'master' into Aristo2
Conflicts: Tests/Manual/CPPopover/Resources/MainMenu.cib
This commit is contained in:
@@ -310,11 +310,18 @@ function CPBrowserStyleProperty(aProperty)
|
||||
break;
|
||||
default:
|
||||
var prefixes = ["Webkit", "Moz", "O", "ms"],
|
||||
capProperty = [aProperty capitalizedString];
|
||||
strippedProperty = aProperty.split('-').join(' '),
|
||||
capProperty = [strippedProperty capitalizedString].split(' ').join('');
|
||||
|
||||
for (var i = 0; i < prefixes.length; i++)
|
||||
{
|
||||
if (prefixes[i] + capProperty in testElement.style)
|
||||
// First check if the property is already valid without being formatted, otherwise try the capitalized property
|
||||
if (prefixes[i] + aProperty in testElement.style)
|
||||
{
|
||||
r = prefixes[i] + aProperty;
|
||||
break;
|
||||
}
|
||||
else if (prefixes[i] + capProperty in testElement.style)
|
||||
{
|
||||
r = prefixes[i] + capProperty;
|
||||
break;
|
||||
@@ -352,9 +359,21 @@ function CPBrowserCSSProperty(aProperty)
|
||||
{
|
||||
if (browserProperty.substring(0, prefix.length) == prefix)
|
||||
{
|
||||
return prefixes[prefix] + browserProperty.substring(prefix.length).toLowerCase();
|
||||
var browserPropertyWithoutPrefix = browserProperty.substring(prefix.length),
|
||||
parts = browserPropertyWithoutPrefix.match(/[A-Z][a-z]+/g);
|
||||
|
||||
// If there were any capitalized words in the browserProperty, insert a "-" between each one
|
||||
if (parts && parts.length > 0)
|
||||
browserPropertyWithoutPrefix = parts.join("-");
|
||||
|
||||
return prefixes[prefix] + browserPropertyWithoutPrefix.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
var parts = browserProperty.match(/[A-Z][a-z]+/g);
|
||||
|
||||
if (parts && parts.length > 0)
|
||||
browserProperty = parts.join("-");
|
||||
|
||||
return browserProperty.toLowerCase();
|
||||
}
|
||||
|
||||
@@ -1865,9 +1865,16 @@ CPTexturedBackgroundWindowMask
|
||||
*/
|
||||
- (BOOL)canBecomeKeyWindow
|
||||
{
|
||||
// In Cocoa only resizable or titled windows return YES here by default. But the main browser window in Cappuccino
|
||||
// doesn't have these masks even that it's both titled and resizable, so we return YES when isFullPlatformWindow too.
|
||||
return (_styleMask & CPTitledWindowMask) || (_styleMask & CPResizableWindowMask) || [self isFullPlatformWindow];
|
||||
/*
|
||||
In Cocoa only titled windows return YES here by default. But the main browser
|
||||
window in Cappuccino doesn't have a title bar even that it's both titled and
|
||||
resizable, so we return YES when isFullPlatformWindow too.
|
||||
|
||||
Note that Cocoa will return NO for a non-titled, resizable window. The Cocoa documention
|
||||
says it will return YES if there is a "resize bar", but in practice
|
||||
that is not the same as the resizable mask.
|
||||
*/
|
||||
return (_styleMask & CPTitledWindowMask) || [self isFullPlatformWindow];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -2231,11 +2238,12 @@ CPTexturedBackgroundWindowMask
|
||||
*/
|
||||
- (BOOL)canBecomeMainWindow
|
||||
{
|
||||
// FIXME: Also check if we can resize and titlebar.
|
||||
if ([self isVisible])
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
// Note that the Cocoa documentation says that this method returns YES if
|
||||
// the window is visible and has a title bar or a "resize mechanism". It turns
|
||||
// out a "resize mechanism" is not the same as having the resize mask set.
|
||||
// In practice a window must have a title bar to become main, but we make
|
||||
// an exception for a full platform window.
|
||||
return ([self isVisible] && ((_styleMask & CPTitledWindowMask) || _isFullPlatformWindow));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -389,6 +389,14 @@ var _CPAttachedWindow_attachedWindowShouldClose_ = 1 << 0,
|
||||
return YES;
|
||||
}
|
||||
|
||||
/*!
|
||||
Normally untitled windows cannot become main, but popovers can.
|
||||
*/
|
||||
- (BOOL)canBecomeMainWindow
|
||||
{
|
||||
return [self isVisible];
|
||||
}
|
||||
|
||||
/*!
|
||||
Called when the window is losing focus.
|
||||
*/
|
||||
|
||||
@@ -375,7 +375,14 @@ var CPRunLoopLastNativeRunLoop = 0;
|
||||
|
||||
//initiate a new window.setTimeout if there are any timers
|
||||
if (_nextTimerFireDatesForModes[aMode] !== nil)
|
||||
_nativeTimersForModes[aMode] = window.setNativeTimeout(function() { _effectiveDate = nextFireDate; _nativeTimersForModes[aMode] = nil; ++CPRunLoopLastNativeRunLoop; [self limitDateForMode:aMode]; _effectiveDate = nil; }, MAX(0, [nextFireDate timeIntervalSinceNow] * 1000));
|
||||
_nativeTimersForModes[aMode] = window.setNativeTimeout(function()
|
||||
{
|
||||
_effectiveDate = nextFireDate;
|
||||
_nativeTimersForModes[aMode] = nil;
|
||||
++CPRunLoopLastNativeRunLoop;
|
||||
[self limitDateForMode:aMode];
|
||||
_effectiveDate = nil;
|
||||
}, MAX(0, [nextFireDate timeIntervalSinceNow] * 1000));
|
||||
}
|
||||
|
||||
// Run loop performers
|
||||
|
||||
+16
-2
@@ -245,13 +245,27 @@ var _CPTimerBridgeTimer = function(codeOrFunction, aDelay, shouldRepeat, functio
|
||||
theFunction = nil;
|
||||
|
||||
if (typeof codeOrFunction === "string")
|
||||
theFunction = function() { new Function(codeOrFunction)(); if (!shouldRepeat) CPTimersForTimeoutIDs[timeoutID] = nil; }
|
||||
{
|
||||
theFunction = function()
|
||||
{
|
||||
new Function(codeOrFunction)();
|
||||
|
||||
if (!shouldRepeat)
|
||||
CPTimersForTimeoutIDs[timeoutID] = nil;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!functionArgs)
|
||||
functionArgs = [];
|
||||
|
||||
theFunction = function() { codeOrFunction.apply(window, functionArgs); if (!shouldRepeat) CPTimersForTimeoutIDs[timeoutID] = nil; }
|
||||
theFunction = function()
|
||||
{
|
||||
codeOrFunction.apply(window, functionArgs);
|
||||
|
||||
if (!shouldRepeat)
|
||||
CPTimersForTimeoutIDs[timeoutID] = nil;
|
||||
}
|
||||
}
|
||||
|
||||
// A call such as setTimeout(f) is technically invalid but browsers seem to treat it as setTimeout(f, 0), so so will we.
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user