summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/objc
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings/objc')
-rw-r--r--WebCore/bindings/objc/DOM.mm17
-rw-r--r--WebCore/bindings/objc/DOMHTML.mm2
-rw-r--r--WebCore/bindings/objc/DOMInternal.mm10
-rw-r--r--WebCore/bindings/objc/DOMRGBColor.mm145
-rw-r--r--WebCore/bindings/objc/WebScriptObject.mm20
5 files changed, 33 insertions, 161 deletions
diff --git a/WebCore/bindings/objc/DOM.mm b/WebCore/bindings/objc/DOM.mm
index 3fd28d1..62bf1de 100644
--- a/WebCore/bindings/objc/DOM.mm
+++ b/WebCore/bindings/objc/DOM.mm
@@ -468,7 +468,7 @@ id <DOMEventTarget> kit(WebCore::EventTarget* eventTarget)
ASSERT(name);
WebCore::Element* element = core(self);
ASSERT(element);
- return element->document()->completeURL(parseURL(element->getAttribute(name)));
+ return element->document()->completeURL(deprecatedParseURL(element->getAttribute(name)));
}
- (BOOL)isFocused
@@ -503,6 +503,21 @@ id <DOMEventTarget> kit(WebCore::EventTarget* eventTarget)
@end
//------------------------------------------------------------------------------------------
+// DOMRGBColor
+
+@implementation DOMRGBColor (WebPrivate)
+
+// FIXME: This should be removed as soon as all internal Apple uses of it have been replaced with
+// calls to the public method - (NSColor *)color.
+- (NSColor *)_color
+{
+ return [self color];
+}
+
+@end
+
+
+//------------------------------------------------------------------------------------------
// DOMNodeFilter
DOMNodeFilter *kit(WebCore::NodeFilter* impl)
diff --git a/WebCore/bindings/objc/DOMHTML.mm b/WebCore/bindings/objc/DOMHTML.mm
index 8c0d30b..1043d8e 100644
--- a/WebCore/bindings/objc/DOMHTML.mm
+++ b/WebCore/bindings/objc/DOMHTML.mm
@@ -70,7 +70,7 @@
- (DOMDocumentFragment *)_createDocumentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString
{
- NSURL *baseURL = core(self)->completeURL(WebCore::parseURL(baseURLString));
+ NSURL *baseURL = core(self)->completeURL(WebCore::deprecatedParseURL(baseURLString));
return [self createDocumentFragmentWithMarkupString:markupString baseURL:baseURL];
}
diff --git a/WebCore/bindings/objc/DOMInternal.mm b/WebCore/bindings/objc/DOMInternal.mm
index eb98a8a..9b26e59 100644
--- a/WebCore/bindings/objc/DOMInternal.mm
+++ b/WebCore/bindings/objc/DOMInternal.mm
@@ -123,11 +123,13 @@ void removeDOMWrapper(DOMObjectInternal* impl)
frame = document->frame();
if (!frame)
return;
-
- JSC::ExecState *exec = frame->script()->globalObject()->globalExec();
-
+
+ // The global object which should own this node.
+ WebCore::JSDOMGlobalObject* globalObject = frame->script()->globalObject();
+ JSC::ExecState *exec = globalObject->globalExec();
+
// Get (or create) a cached JS object for the DOM node.
- JSC::JSObject *scriptImp = asObject(WebCore::toJS(exec, nodeImpl));
+ JSC::JSObject *scriptImp = asObject(WebCore::toJS(exec, globalObject, nodeImpl));
JSC::Bindings::RootObject* rootObject = frame->script()->bindingRootObject();
diff --git a/WebCore/bindings/objc/DOMRGBColor.mm b/WebCore/bindings/objc/DOMRGBColor.mm
deleted file mode 100644
index 27f8966..0000000
--- a/WebCore/bindings/objc/DOMRGBColor.mm
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "DOMInternal.h" // import first to make the private/public trick work
-#import "DOMRGBColorInternal.h"
-
-#import "CSSPrimitiveValue.h"
-#import "ColorMac.h"
-#import "DOMCSSPrimitiveValueInternal.h"
-#import "WebCoreObjCExtras.h"
-#import "WebScriptObjectPrivate.h"
-#import <runtime/InitializeThreading.h>
-
-static NSMapTable* RGBColorWrapperCache;
-
-static id getWrapperForRGB(WebCore::RGBA32 value)
-{
- if (!RGBColorWrapperCache)
- return nil;
- return static_cast<id>(NSMapGet(RGBColorWrapperCache, reinterpret_cast<const void*>(value)));
-}
-
-static void setWrapperForRGB(id wrapper, WebCore::RGBA32 value)
-{
- if (!RGBColorWrapperCache)
- // No need to retain/free either impl key, or id value. Items will be removed
- // from the cache in dealloc methods.
- RGBColorWrapperCache = createWrapperCacheWithIntegerKeys();
- NSMapInsert(RGBColorWrapperCache, reinterpret_cast<const void*>(value), wrapper);
-}
-
-static void removeWrapperForRGB(WebCore::RGBA32 value)
-{
- if (!RGBColorWrapperCache)
- return;
- NSMapRemove(RGBColorWrapperCache, reinterpret_cast<const void*>(value));
-}
-
-@implementation DOMRGBColor
-
-+ (void)initialize
-{
- JSC::initializeThreading();
-#ifndef BUILDING_ON_TIGER
- WebCoreObjCFinalizeOnMainThread(self);
-#endif
-}
-
-- (void)dealloc
-{
- if (WebCoreObjCScheduleDeallocateOnMainThread([DOMRGBColor class], self))
- return;
-
- removeWrapperForRGB(reinterpret_cast<uintptr_t>(_internal));
- _internal = 0;
- [super dealloc];
-}
-
-- (DOMCSSPrimitiveValue *)red
-{
- WebCore::RGBA32 rgb = reinterpret_cast<uintptr_t>(_internal);
- int value = (rgb >> 16) & 0xFF;
- return kit(WebCore::CSSPrimitiveValue::create(value, WebCore::CSSPrimitiveValue::CSS_NUMBER).get());
-}
-
-- (DOMCSSPrimitiveValue *)green
-{
- WebCore::RGBA32 rgb = reinterpret_cast<uintptr_t>(_internal);
- int value = (rgb >> 8) & 0xFF;
- return kit(WebCore::CSSPrimitiveValue::create(value, WebCore::CSSPrimitiveValue::CSS_NUMBER).get());
-}
-
-- (DOMCSSPrimitiveValue *)blue
-{
- WebCore::RGBA32 rgb = reinterpret_cast<uintptr_t>(_internal);
- int value = rgb & 0xFF;
- return kit(WebCore::CSSPrimitiveValue::create(value, WebCore::CSSPrimitiveValue::CSS_NUMBER).get());
-}
-
-- (DOMCSSPrimitiveValue *)alpha
-{
- WebCore::RGBA32 rgb = reinterpret_cast<uintptr_t>(_internal);
- float value = static_cast<float>(WebCore::Color(rgb).alpha()) / 0xFF;
- return kit(WebCore::CSSPrimitiveValue::create(value, WebCore::CSSPrimitiveValue::CSS_NUMBER).get());
-
-}
-
-- (NSColor *)color
-{
- WebCore::RGBA32 rgb = reinterpret_cast<uintptr_t>(_internal);
- return WebCore::nsColor(WebCore::Color(rgb));
-}
-
-@end
-
-@implementation DOMRGBColor (WebPrivate)
-
-// FIXME: this should be removed once all internal Apple uses of it have been replaced with
-// calls to the public method, color without the leading underscore.
-- (NSColor *)_color
-{
- return [self color];
-}
-
-@end
-
-WebCore::RGBA32 core(DOMRGBColor *color)
-{
- return color ? static_cast<WebCore::RGBA32>(reinterpret_cast<uintptr_t>(color->_internal)) : 0;
-}
-
-DOMRGBColor *kit(WebCore::RGBA32 value)
-{
- if (DOMRGBColor *wrapper = getWrapperForRGB(value))
- return [[wrapper retain] autorelease];
-
- DOMRGBColor *wrapper = [[DOMRGBColor alloc] _init];
- wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(value);
- setWrapperForRGB(wrapper, value);
- return [wrapper autorelease];
-}
diff --git a/WebCore/bindings/objc/WebScriptObject.mm b/WebCore/bindings/objc/WebScriptObject.mm
index 8889eac..1086204 100644
--- a/WebCore/bindings/objc/WebScriptObject.mm
+++ b/WebCore/bindings/objc/WebScriptObject.mm
@@ -280,7 +280,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
if (![self _isSafeScript])
return nil;
- JSLock lock(false);
+ JSLock lock(SilenceAssertionsOnly);
// Look up the function object.
ExecState* exec = [self _rootObject]->globalObject()->globalExec();
@@ -325,7 +325,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
ASSERT(!exec->hadException());
JSValue result;
- JSLock lock(false);
+ JSLock lock(SilenceAssertionsOnly);
[self _rootObject]->globalObject()->globalData()->timeoutChecker.start();
Completion completion = JSC::evaluate([self _rootObject]->globalObject()->globalExec(), [self _rootObject]->globalObject()->globalScopeChain(), makeSource(String(script)));
@@ -360,7 +360,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
ExecState* exec = [self _rootObject]->globalObject()->globalExec();
ASSERT(!exec->hadException());
- JSLock lock(false);
+ JSLock lock(SilenceAssertionsOnly);
PutPropertySlot slot;
[self _imp]->put(exec, Identifier(exec, String(key)), convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]), slot);
@@ -386,7 +386,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
// Need to scope this lock to ensure that we release the lock before calling
// [super valueForKey:key] which might throw an exception and bypass the JSLock destructor,
// leaving the lock permanently held
- JSLock lock(false);
+ JSLock lock(SilenceAssertionsOnly);
JSValue result = [self _imp]->get(exec, Identifier(exec, String(key)));
@@ -402,7 +402,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
if ([resultObj isKindOfClass:[WebUndefined class]])
resultObj = [super valueForKey:key]; // defaults to throwing an exception
- JSLock lock(false);
+ JSLock lock(SilenceAssertionsOnly);
_didExecute(self);
return resultObj;
@@ -416,7 +416,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
ExecState* exec = [self _rootObject]->globalObject()->globalExec();
ASSERT(!exec->hadException());
- JSLock lock(false);
+ JSLock lock(SilenceAssertionsOnly);
[self _imp]->deleteProperty(exec, Identifier(exec, String(key)));
if (exec->hadException()) {
@@ -434,7 +434,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
return @"Undefined";
}
- JSLock lock(false);
+ JSLock lock(SilenceAssertionsOnly);
ExecState* exec = [self _rootObject]->globalObject()->globalExec();
id result = convertValueToObjcValue(exec, [self _imp], ObjcObjectType).objectValue;
@@ -454,7 +454,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
ExecState* exec = [self _rootObject]->globalObject()->globalExec();
ASSERT(!exec->hadException());
- JSLock lock(false);
+ JSLock lock(SilenceAssertionsOnly);
JSValue result = [self _imp]->get(exec, index);
if (exec->hadException()) {
@@ -478,7 +478,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
ExecState* exec = [self _rootObject]->globalObject()->globalExec();
ASSERT(!exec->hadException());
- JSLock lock(false);
+ JSLock lock(SilenceAssertionsOnly);
[self _imp]->put(exec, index, convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]));
if (exec->hadException()) {
@@ -509,7 +509,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
if (value.isObject()) {
JSObject* object = asObject(value);
ExecState* exec = rootObject->globalObject()->globalExec();
- JSLock lock(false);
+ JSLock lock(SilenceAssertionsOnly);
if (object->classInfo() != &RuntimeObjectImp::s_info) {
JSValue runtimeObject = object->get(exec, Identifier(exec, "__apple_runtime_object"));