Merge branch '0.7b' of git@github.com:280north/cappuccino into 0.7b

This commit is contained in:
Ross Boucher committed 2009-05-13 11:33:34 -07:00
commit 8e7ce7c814
7 files changed
+100 -30

No files matched your search

+5
View File
@@ -8,6 +8,11 @@
{
}
+ (CPString)themeClass
{
return @"button-bar";
}
+ (id)themeAttributes
{
return [CPDictionary dictionaryWithObjects:[nil]
+10 -4
View File
@@ -2199,7 +2199,6 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
_autoresizesSubviews = [aCoder decodeBoolForKey:CPViewAutoresizesSubviewsKey];
_hitTests = [aCoder decodeObjectForKey:CPViewHitTestsKey];
_isHidden = [aCoder decodeObjectForKey:CPViewIsHiddenKey];
_opacity = [aCoder decodeIntForKey:CPViewOpacityKey];
// DOM SETUP
@@ -2240,8 +2239,13 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
}
[self setNeedsDisplay:YES];
}
_isHidden = NO;
if ([aCoder containsValueForKey:CPViewIsHiddenKey])
[self setHidden:[aCoder decodeBoolForKey:CPViewIsHiddenKey]];
}
return self;
}
@@ -2269,9 +2273,11 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
[aCoder encodeObject:_backgroundColor forKey:CPViewBackgroundColorKey];
[aCoder encodeBool:_hitTests forKey:CPViewHitTestsKey];
[aCoder encodeBool:_isHidden forKey:CPViewIsHiddenKey];
[aCoder encodeFloat:_opacity forKey:CPViewOpacityKey];
if (_isHidden)
[aCoder encodeBool:_isHidden forKey:CPViewIsHiddenKey];
[aCoder encodeConditionalObject:[self nextKeyView] forKey:CPViewNextKeyViewKey];
[aCoder encodeConditionalObject:[self previousKeyView] forKey:CPViewPreviousKeyViewKey];
+5 -5
View File
@@ -180,7 +180,7 @@ CPWebViewScrollNative = 2;
// try to get the document size so we can correctly set the frame
var win = null;
try { win = [self window]; } catch (e) {}
try { win = [self DOMWindow]; } catch (e) {}
if (win && win.document)
{
@@ -290,7 +290,7 @@ CPWebViewScrollNative = 2;
// need to give the browser a chance to reset iframe, otherwise we'll be document.write()-ing the previous document
window.setTimeout(function() {
var win = [self window];
var win = [self DOMWindow];
win.document.write(_html);
@@ -385,14 +385,14 @@ CPWebViewScrollNative = 2;
_iframe.parentNode.removeChild(_iframe);
}
- (Window)window
- (DOMWindow)DOMWindow
{
return (_iframe.contentDocument && _iframe.contentDocument.defaultView) || _iframe.contentWindow;
}
- (CPWebScriptObject)windowScriptObject
{
var win = [self window];
var win = [self DOMWindow];
if (!_wso || win != [_wso window])
{
if (win)
@@ -470,7 +470,7 @@ CPWebViewScrollNative = 2;
{
try
{
[self window].print();
[self DOMWindow].print();
}
catch (e)
{
+60 -1
View File
@@ -229,7 +229,10 @@ function CGContextDrawPath(aContext, aMode)
vml.push("\">");
if (fill)
if (gState.gradient)
vml.push(gState.gradient)
else if (fill)
vml.push("<cg_vml_:fill color=\"", gState.fillStyle, "\" opacity=\"", opacity, "\" />");
if (stroke)
@@ -260,3 +263,59 @@ function CGContextDrawPath(aContext, aMode)
aContext.DOMElement.insertAdjacentHTML("BeforeEnd", vml.join(""));
}
function to_string(aColor)
{
return "rgb(" + ROUND(aColor.components[0] * 255) + ", " + ROUND(aColor.components[1] * 255) + ", " + ROUND(255 * aColor.components[2]) + ")";
}
function CGContextDrawLinearGradient(aContext, aGradient, aStartPoint, anEndPoint, options)
{
if (!aContext || !aGradient)
return;
var vml = nil;
if (aGradient.vml_gradient)
{
var stops = [[aGradient.vml_gradient stops] sortedArrayUsingSelector:@selector(comparePosition:)],
count = [stops count];
vml = ["<cg_vml_:fill type=\"gradient\" method=\"linear sigma\" "];
vml.push("angle=\"" + ([aGradient.vml_gradient angle] + 90) +"\" ");
vml.push("colors=\"");
for (var i = 0; i < count; i++)
{
vml.push(([stops[i] position]*100).toFixed(0)+"% ");
vml.push([[[stops[i] color] colorForSlideBase:nil] cssString]);
if (i < count-1)
vml.push(",");
}
vml.push("\" />");
}
else
{
var colors = aGradient.colors,
count = colors.length;
vml = ["<cg_vml_:fill type=\"gradient\" "];
vml.push("colors=\"");
for (var i = 0; i < count; i++)
vml.push((aGradient.locations[i]*100).toFixed(0)+"% "+to_string(colors[i])+(i<count-1 ? "," : ""));
vml.push("\" />");
}
aContext.gState.gradient = vml.join("");
console.log(vml.join(""));
// if (aContext.buffer != nil)
// aContext.buffer += vml.join("");
// else
// aContext.DOMElement.innerHTML = vml.join("");
}
+9 -10
View File
@@ -446,23 +446,22 @@
return slider;
}
/*
var buttonBar = [[CPButtonBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 30.0)],
+ (CPButtonBar)themedButtonBar
{
var buttonBar = [[CPButtonBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 26.0)],
color = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"buttonbar-bezel.png" size:CGSizeMake(1.0, 30.0)],
[_CPCibCustomResource imageResourceWithName:"buttonbar-bezel.png" size:CGSizeMake(1.0, 30.0)],
[_CPCibCustomResource imageResourceWithName:"buttonbar-bezel-right.png" size:CGSizeMake(13.0, 30.0)]
[_CPCibCustomResource imageResourceWithName:"buttonbar-bezel.png" size:CGSizeMake(1.0, 26.0)],
[_CPCibCustomResource imageResourceWithName:"buttonbar-bezel.png" size:CGSizeMake(1.0, 26.0)],
[_CPCibCustomResource imageResourceWithName:"buttonbar-bezel-right.png" size:CGSizeMake(13.0, 26.0)]
]
isVertical:NO]];
[buttonBar setValue:color forThemeAttribute:@"bezel-color"];
[buttonBar setNeedsLayout];
views.push(buttonBar);
return views;
*/
return buttonBar;
}
@end
function PatternColor(anImage)
+3 -5
View File
@@ -251,15 +251,13 @@ var CPURLConnectionDelegate = nil;
if (!_isCanceled)
{
if (statusCode == 200 || (statusCode === 0 && _isLocalFileConnection))
if (statusCode == 401 && [CPURLConnectionDelegate respondsToSelector:@selector(connectionDidReceiveAuthenticationChallenge:)])
[CPURLConnectionDelegate connectionDidReceiveAuthenticationChallenge:self];
else
{
[_delegate connection:self didReceiveData:_XMLHTTPRequest.responseText];
[_delegate connectionDidFinishLoading:self];
}
else if (statusCode == 401 && [CPURLConnectionDelegate respondsToSelector:@selector(connectionDidReceiveAuthenticationChallenge:)])
[CPURLConnectionDelegate connectionDidReceiveAuthenticationChallenge:self];
else
[_delegate connection:self didFailWithError:_XMLHTTPRequest.status]
}
}
+8 -5
View File
@@ -31,14 +31,17 @@
{
var flags = [aCoder decodeIntForKey:"NSsFlags"];
_hasVerticalScroller = Boolean(flags & (1 << 4));
_hasHorizontalScroller = Boolean(flags & (1 << 5));
_autohidesScrollers = Boolean(flags & (1 << 9));
_verticalScroller = [aCoder decodeObjectForKey:"NSVScroller"];
_horizontalScroller = [aCoder decodeObjectForKey:"NSHScroller"];
_contentView = [aCoder decodeObjectForKey:"NSContentView"];
_hasVerticalScroller = !Boolean(flags & (1 << 4));
_hasHorizontalScroller = !Boolean(flags & (1 << 5));
_autohidesScrollers = Boolean(flags & (1 << 9));
[self setHasHorizontalScroller:!_hasHorizontalScroller];
[self setHasVerticalScroller:!_hasVerticalScroller];
//[aCoder decodeBytesForKey:"NSScrollAmts"];
_verticalLineScroll = 10.0;
_verticalPageScroll = 10.0;