Merge branch 'master' into Aristo2

Conflicts:
	Tests/Manual/CPPopover/Resources/MainMenu.cib
This commit is contained in:
Antoine Mercadal
2013-01-07 13:23:05 -08:00
6 changed files with 71 additions and 15 deletions
+22 -3
View File
@@ -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();
}
+16 -8
View File
@@ -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));
}
/*!
+8
View File
@@ -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.
*/