This commit is contained in:
Antoine Mercadal committed 2013-02-15 22:29:20 -08:00
commit 46022b0588
3 files changed
+45 -10

No files matched your search

+3
View File
@@ -202,6 +202,9 @@ if (typeof document != "undefined")
{
PLATFORM_FEATURES[CPHTMLCanvasFeature] = YES;
// Any browser that supports canvas supports CSS opacity
PLATFORM_FEATURES[CPOpacityRequiresFilterFeature] = NO;
// Detect canvas setTransform/transform support
var context = document.createElement("canvas").getContext("2d");
+41 -9
View File
@@ -241,8 +241,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
if (_effectiveScrollMode !== CPWebViewScrollAppKit)
return;
var win = null;
try { win = [self DOMWindow]; } catch (e) {}
var win = [self DOMWindow];
if (win && win.addEventListener)
{
@@ -278,8 +277,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
[_frameView setFrameSize:CGSizeMake(CGRectGetMaxX(visibleRect), CGRectGetMaxY(visibleRect))];
// try to get the document size so we can correctly set the frame
var win = null;
try { win = [self DOMWindow]; } catch (e) {}
var win = [self DOMWindow];
if (win && win.document && win.document.body)
{
@@ -580,6 +578,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
{
if (_mainFrameURL)
[_backwardStack addObject:_mainFrameURL];
_mainFrameURL = URLString;
[_forwardStack removeAllObjects];
@@ -597,6 +596,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
{
if (_mainFrameURL)
[_forwardStack addObject:_mainFrameURL];
_mainFrameURL = [_backwardStack lastObject];
[_backwardStack removeLastObject];
@@ -604,6 +604,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
return YES;
}
return NO;
}
@@ -618,6 +619,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
{
if (_mainFrameURL)
[_backwardStack addObject:_mainFrameURL];
_mainFrameURL = [_forwardStack lastObject];
[_forwardStack removeLastObject];
@@ -625,6 +627,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
return YES;
}
return NO;
}
@@ -672,7 +675,14 @@ CPWebViewAppKitScrollMaxPollCount = 3;
*/
- (DOMWindow)DOMWindow
{
return (_iframe.contentDocument && _iframe.contentDocument.defaultView) || _iframe.contentWindow;
try
{
return (_iframe.contentDocument && _iframe.contentDocument.defaultView) || _iframe.contentWindow;
}
catch (e)
{
return nil;
}
}
/*!
@@ -683,6 +693,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
- (CPWebScriptObject)windowScriptObject
{
var win = [self DOMWindow];
if (!_wso || win != [_wso window])
{
if (win)
@@ -690,6 +701,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
else
_wso = nil;
}
return _wso;
}
@@ -727,6 +739,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
- (DOMCSSStyleDeclaration)computedStyleForElement:(DOMElement)element pseudoElement:(CPString)pseudoElement
{
var win = [[self windowScriptObject] window];
if (win)
{
// FIXME: IE version?
@@ -759,6 +772,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
{
if (drawsBackground == _drawsBackground)
return;
_drawsBackground = drawsBackground;
[self _applyBackgroundColor];
@@ -864,38 +878,47 @@ CPWebViewAppKitScrollMaxPollCount = 3;
{
return _downloadDelegate;
}
- (void)setDownloadDelegate:(id)anObject
{
_downloadDelegate = anObject;
}
- (id)frameLoadDelegate
{
return _frameLoadDelegate;
}
- (void)setFrameLoadDelegate:(id)anObject
{
_frameLoadDelegate = anObject;
}
- (id)policyDelegate
{
return _policyDelegate;
}
- (void)setPolicyDelegate:(id)anObject
{
_policyDelegate = anObject;
}
- (id)resourceLoadDelegate
{
return _resourceLoadDelegate;
}
- (void)setResourceLoadDelegate:(id)anObject
{
_resourceLoadDelegate = anObject;
}
- (id)UIDelegate
{
return _UIDelegate;
}
- (void)setUIDelegate:(id)anObject
{
_UIDelegate = anObject;
@@ -922,6 +945,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
{
_window = aWindow;
}
return self;
}
@@ -936,9 +960,12 @@ CPWebViewAppKitScrollMaxPollCount = 3;
// Would using "with" be better here?
if (typeof _window[methodName] == "function")
{
try {
try
{
return _window[methodName].apply(args);
} catch (e) {
}
catch (e)
{
}
}
return undefined;
@@ -952,11 +979,15 @@ CPWebViewAppKitScrollMaxPollCount = 3;
*/
- (id)evaluateWebScript:(CPString)script
{
try {
try
{
return _window.eval(script);
} catch (e) {
}
catch (e)
{
// FIX ME: if we fail inside here, shouldn't we return an exception?
}
return undefined;
}
@@ -1031,6 +1062,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
- (BOOL)_passesSameOriginPolicy
{
var documentURL = [CPURL URLWithString:window.location.href];
if ([documentURL isFileURL] && CPFeatureIsCompatible(CPSOPDisabledFromFileURLs))
return YES;
+1 -1
View File
@@ -46,7 +46,7 @@
var frame = [self frame];
if ([self sliderType] === CPCircularSlider)
[self setFrameSize:CGSizeMake(frame.size.width + 4.0, frame.size.height + 2.0)];
[self setFrameSize:CGSizeMake(frame.size.width + 2.0, frame.size.height + 2.0)];
else
[self setFrame:CGRectMake(frame.origin.x + 2, frame.origin.y, frame.size.width - 4, frame.size.height)];
}