Fixed: missing var, minor tweaks.

Refs #2073.
This commit is contained in:
Alexander Ljungberg
2014-03-06 14:03:46 +00:00
parent 90b947a7da
commit e6acc3c336
3 changed files with 12 additions and 8 deletions
+10 -7
View File
@@ -327,7 +327,7 @@ function ThemeState(stateNames)
{
if (!stateNames.hasOwnProperty(key))
continue;
if (key != 'normal')
if (key !== 'normal')
{
this._stateNames[key] = true;
stateNameKeys.push(key);
@@ -356,13 +356,15 @@ ThemeState.prototype.toString = function()
ThemeState.prototype.hasThemeState = function(aState)
{
if (aState === undefined || aState === nil || aState._stateNames === undefined)
if (!aState || !aState._stateNames)
return false;
// We can do this in O(n) because both states have their stateNames already sorted.
for (var stateName in aState._stateNames)
{
if (!aState._stateNames.hasOwnProperty(stateName))
continue;
if (!this._stateNames[stateName])
return false;
}
@@ -374,10 +376,11 @@ ThemeState.prototype.isSubsetOf = function(aState)
if (aState._stateNameCount < this._stateNameCount)
return false;
for (key in this._stateNames)
for (var key in this._stateNames)
{
if (!this._stateNames.hasOwnProperty(key))
continue;
if (!aState._stateNames[key])
return false;
}
@@ -386,7 +389,7 @@ ThemeState.prototype.isSubsetOf = function(aState)
ThemeState.prototype.without = function(aState)
{
if (aState === undefined || aState === nil || aState === [CPNull null])
if (!aState || aState === [CPNull null])
return aState;
var newStates = {};
@@ -445,7 +448,7 @@ function CPThemeState()
var stateNames = {};
for (var argIndex = 0; argIndex < arguments.length; argIndex++)
{
if (arguments[argIndex] === [CPNull null] || arguments[argIndex] === nil || arguments[argIndex] === undefined)
if (arguments[argIndex] === [CPNull null] || !arguments[argIndex])
continue;
if (typeof arguments[argIndex] === 'object')
@@ -582,8 +585,8 @@ CPThemeStateKeyWindow = CPThemeState("keyWindow");
- (id)valueForState:(ThemeState)aState
{
var stateName = String(aState);
var value = _cache[stateName];
var stateName = String(aState),
value = _cache[stateName];
// This can be nil.
if (value !== undefined)
+1
View File
@@ -62,4 +62,5 @@
[themeAttribute setValue:9 forState:CPThemeState('aState3')];
[self assertTrue:([themeAttribute valueForState:CPThemeState("aState8+aState3+aState4")] == 10) message:"Return the largest partial subset match for a combined state that isn't a perfect match"];
}
@end
+1 -1
View File
@@ -51,7 +51,7 @@
{
var theme = [Nib2Cib defaultTheme],
height = [theme valueForAttributeWithName:@"default-row-height" forClass:[CPTableView class]],
width = [theme valueForAttributeWithName:@"scroller-width" inState:CPThemeState(CPThemeStateVertical, CPThemeStateScrollViewLegacy) forClass:[CPScroller class]];
width = [theme valueForAttributeWithName:@"scroller-width" inState:CPThemeState(CPThemeStateVertical, CPThemeStateScrollViewLegacy) forClass:[CPScroller class]];
_frame.size.height = height;
_bounds.size.height = height;