mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-16 07:31:28 +00:00
Fix for failing CPAttributedString test.
Reviewed by me.
This commit is contained in:
+1
-1
@@ -145,7 +145,7 @@ CPButtonStateMixed = CPThemeState("mixed");
|
||||
|
||||
+ (id)themeAttributes
|
||||
{
|
||||
return [CPDictionary dictionaryWithObjects:[_CGInsetMakeZero(), _CGInsetMakeZero(), nil]
|
||||
return [CPDictionary dictionaryWithObjects:[_CGInsetMakeZero(), _CGInsetMakeZero(), [CPNull null]]
|
||||
forKeys:[@"bezel-inset", @"content-inset", @"bezel-color"]];
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
+ (id)themeAttributes
|
||||
{
|
||||
return [CPDictionary dictionaryWithObjects:[nil]
|
||||
return [CPDictionary dictionaryWithObjects:[[CPNull null]]
|
||||
forKeys:[@"bezel-color"]];
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
CPLineBreakByClipping,
|
||||
[CPColor blackColor],
|
||||
[CPFont systemFontOfSize:12.0],
|
||||
nil,
|
||||
[CPNull null],
|
||||
_CGSizeMakeZero(),
|
||||
CPImageLeft,
|
||||
CPScaleToFit,
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
|
||||
+ (id)themeAttributes
|
||||
{
|
||||
return [CPDictionary dictionaryWithObjects:[ nil, nil, nil, nil,
|
||||
return [CPDictionary dictionaryWithObjects:[ [CPNull null], [CPNull null], [CPNull null], [CPNull null],
|
||||
_CGSizeMakeZero(), _CGSizeMakeZero(), _CGInsetMakeZero(), _CGInsetMakeZero(), _CGSizeMakeZero()]
|
||||
forKeys:[ @"knob-slot-color",
|
||||
@"decrement-line-color",
|
||||
|
||||
@@ -56,7 +56,7 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
|
||||
+ (id)themeAttributes
|
||||
{
|
||||
return [CPDictionary dictionaryWithObjects:[CPCenterTextAlignment, CPCenterVerticalTextAlignment, CPImageLeft, CPScaleNone, _CGInsetMakeZero(), _CGInsetMakeZero(), nil, nil, nil, nil, 1.0, 24.0]
|
||||
return [CPDictionary dictionaryWithObjects:[CPCenterTextAlignment, CPCenterVerticalTextAlignment, CPImageLeft, CPScaleNone, _CGInsetMakeZero(), _CGInsetMakeZero(), [CPNull null], [CPNull null], [CPNull null], [CPNull null], 1.0, 24.0]
|
||||
forKeys:[@"alignment", @"vertical-alignment", @"image-position", @"image-scaling", @"bezel-inset", @"content-inset", @"left-segment-bezel-color", @"right-segment-bezel-color", @"center-segment-bezel-color", @"divider-bezel-color", @"divider-thickness", @"default-height"]];
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ CPCircularSlider = 1;
|
||||
|
||||
+ (id)themeAttributes
|
||||
{
|
||||
return [CPDictionary dictionaryWithObjects:[nil, _CGSizeMakeZero(), 0.0, nil]
|
||||
return [CPDictionary dictionaryWithObjects:[[CPNull null], _CGSizeMakeZero(), 0.0, [CPNull null]]
|
||||
forKeys:[@"knob-color", @"knob-size", @"track-width", @"track-color"]];
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
+ (id)themeAttributes
|
||||
{
|
||||
return [CPDictionary dictionaryWithObjects:[_CGInsetMakeZero(), _CGInsetMake(2.0, 2.0, 2.0, 2.0), nil]
|
||||
return [CPDictionary dictionaryWithObjects:[_CGInsetMakeZero(), _CGInsetMake(2.0, 2.0, 2.0, 2.0), [CPNull null]]
|
||||
forKeys:[@"bezel-inset", @"content-inset", @"bezel-color"]];
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -2135,7 +2135,8 @@ setBoundsOrigin:
|
||||
|
||||
var theClass = [self class],
|
||||
CPViewClass = [CPView class],
|
||||
attributes = [];
|
||||
attributes = [],
|
||||
nullValue = [CPNull null];
|
||||
|
||||
for (; theClass && theClass !== CPViewClass; theClass = [theClass superclass])
|
||||
{
|
||||
@@ -2159,9 +2160,10 @@ setBoundsOrigin:
|
||||
|
||||
while (attributeCount--)
|
||||
{
|
||||
var attributeName = attributeKeys[attributeCount];
|
||||
var attributeName = attributeKeys[attributeCount],
|
||||
attributeValue = [attributeDictionary objectForKey:attributeName];
|
||||
|
||||
attributes.push([attributeDictionary objectForKey:attributeName]);
|
||||
attributes.push(attributeValue === nullValue ? nil : attributeValue);
|
||||
attributes.push(attributeName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
+ (CPButton)themedStandardButton
|
||||
{
|
||||
var button = [self button];
|
||||
|
||||
|
||||
[button setTitle:@"Cancel"];
|
||||
|
||||
return button;
|
||||
|
||||
@@ -817,7 +817,7 @@
|
||||
description += '\n';
|
||||
|
||||
var object = [self objectAtIndex:index],
|
||||
objectDescription = object && object.isa ? [object description] : object + "";
|
||||
objectDescription = object && object.isa ? [object description] : String(object);
|
||||
|
||||
description += "\t" + objectDescription.split('\n').join("\n\t");
|
||||
|
||||
|
||||
@@ -638,7 +638,22 @@
|
||||
*/
|
||||
- (void)removeAttribute:(CPString)anAttribute range:(CPRange)aRange
|
||||
{
|
||||
[self addAttribute:anAttribute value:nil range:aRange];
|
||||
[self beginEditing];
|
||||
|
||||
var startingEntryIndex = [self _indexOfRangeEntryForIndex:aRange.location splitOnMaxIndex:YES],
|
||||
endingEntryIndex = [self _indexOfRangeEntryForIndex:CPMaxRange(aRange) splitOnMaxIndex:YES],
|
||||
current = startingEntryIndex;
|
||||
|
||||
if (endingEntryIndex == CPNotFound)
|
||||
endingEntryIndex = _rangeEntries.length;
|
||||
|
||||
while (current < endingEntryIndex)
|
||||
[_rangeEntries[current++].attributes removeObjectForKey:anAttribute];
|
||||
|
||||
//necessary?
|
||||
[self _coalesceRangeEntriesFromIndex:startingEntryIndex toIndex:endingEntryIndex];
|
||||
|
||||
[self endEditing];
|
||||
}
|
||||
|
||||
//Changing Characters and Attributes
|
||||
|
||||
@@ -364,7 +364,7 @@
|
||||
if (lhsObject === rhsObject)
|
||||
continue;
|
||||
|
||||
if (lhsObject.isa && rhsObject.isa && [lhsObject respondsToSelector:@selector(isEqual:)] && [lhsObject isEqual:rhsObject])
|
||||
if (lhsObject && lhsObject.isa && rhsObject && rhsObject.isa && [lhsObject respondsToSelector:@selector(isEqual:)] && [lhsObject isEqual:rhsObject])
|
||||
continue;
|
||||
|
||||
return NO;
|
||||
|
||||
@@ -93,7 +93,7 @@ CFDictionary.prototype.valueForKey = function(/*String*/ aKey)
|
||||
var buckets = this._buckets;
|
||||
|
||||
if (!hasOwnProperty.apply(buckets, [aKey]))
|
||||
return undefined;
|
||||
return nil;
|
||||
|
||||
return buckets[aKey];
|
||||
}
|
||||
@@ -109,7 +109,7 @@ CFDictionary.prototype.toString = function()
|
||||
{
|
||||
var key = keys[index];
|
||||
|
||||
string += "\t" + key + " = \"" + this.valueForKey(key).toString().split('\n').join("\n\t") + "\"\n";
|
||||
string += "\t" + key + " = \"" + String(this.valueForKey(key)).split('\n').join("\n\t") + "\"\n";
|
||||
}
|
||||
|
||||
return string + "}";
|
||||
@@ -143,7 +143,7 @@ CFMutableDictionary.prototype.removeValueForKey = function(/*String*/ aKey)
|
||||
var indexOfKey = -1;
|
||||
|
||||
if (indexOf)
|
||||
indexOfKey = this._keys.indexOf(aKey);
|
||||
indexOfKey = indexOf.call(this._keys, aKey);
|
||||
else
|
||||
{
|
||||
var keys = this._keys,
|
||||
@@ -184,7 +184,10 @@ CFMutableDictionary.prototype.replaceValueForKey = function(/*String*/ aKey, /*O
|
||||
|
||||
CFMutableDictionary.prototype.setValueForKey = function(/*String*/ aKey, /*Object*/ aValue)
|
||||
{
|
||||
if (this.containsKey(aKey))
|
||||
if (aValue === nil || aValue === undefined)
|
||||
this.removeValueForKey(aKey);
|
||||
|
||||
else if (this.containsKey(aKey))
|
||||
this.replaceValueForKey(aKey, aValue);
|
||||
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user