Move Objective-C bindings specific code into the bindings
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Aug 2016 19:33:47 +0000 (19:33 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Aug 2016 19:33:47 +0000 (19:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=160561

Reviewed by Tim Horton.

* bindings/objc/DOMDocument.mm:
(-[DOMDocument createEntityReference:]):
(-[DOMDocument getElementsByTagName:]):
(-[DOMDocument getElementsByTagNameNS:localName:]):
(-[DOMDocument getElementsByClassName:]):
* bindings/objc/DOMElement.mm:
(-[DOMElement getElementsByTagName:]):
(-[DOMElement getElementsByTagNameNS:localName:]):
(-[DOMElement getElementsByClassName:]):
* css/CSSCharsetRule.idl:
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::getElementsByTagNameForObjC): Deleted.
(WebCore::ContainerNode::getElementsByTagNameNSForObjC): Deleted.
(WebCore::ContainerNode::getElementsByClassNameForObjC): Deleted.
* dom/ContainerNode.h:
* dom/Document.cpp:
(WebCore::Document::createEntityReference): Deleted.
* dom/Document.h:
* dom/Document.idl:
* dom/Element.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204131 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/objc/DOMDocument.mm
Source/WebCore/bindings/objc/DOMElement.mm
Source/WebCore/css/CSSCharsetRule.idl
Source/WebCore/dom/ContainerNode.cpp
Source/WebCore/dom/ContainerNode.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Document.idl
Source/WebCore/dom/Element.idl

index 00f07e8..460029f 100644 (file)
@@ -1,5 +1,33 @@
 2016-08-04  Anders Carlsson  <andersca@apple.com>
 
+        Move Objective-C bindings specific code into the bindings
+        https://bugs.webkit.org/show_bug.cgi?id=160561
+
+        Reviewed by Tim Horton.
+
+        * bindings/objc/DOMDocument.mm:
+        (-[DOMDocument createEntityReference:]):
+        (-[DOMDocument getElementsByTagName:]):
+        (-[DOMDocument getElementsByTagNameNS:localName:]):
+        (-[DOMDocument getElementsByClassName:]):
+        * bindings/objc/DOMElement.mm:
+        (-[DOMElement getElementsByTagName:]):
+        (-[DOMElement getElementsByTagNameNS:localName:]):
+        (-[DOMElement getElementsByClassName:]):
+        * css/CSSCharsetRule.idl:
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::getElementsByTagNameForObjC): Deleted.
+        (WebCore::ContainerNode::getElementsByTagNameNSForObjC): Deleted.
+        (WebCore::ContainerNode::getElementsByClassNameForObjC): Deleted.
+        * dom/ContainerNode.h:
+        * dom/Document.cpp:
+        (WebCore::Document::createEntityReference): Deleted.
+        * dom/Document.h:
+        * dom/Document.idl:
+        * dom/Element.idl:
+
+2016-08-04  Anders Carlsson  <andersca@apple.com>
+
         Clean up the deprecated Objective-C binding methods
         https://bugs.webkit.org/show_bug.cgi?id=160558
 
index d1e9242..fc0f6ec 100644 (file)
 
 - (DOMEntityReference *)createEntityReference:(NSString *)name
 {
-    WebCore::JSMainThreadNullState state;
-    WebCore::ExceptionCode ec = 0;
-    DOMEntityReference *result = kit(WTF::getPtr(IMPL->createEntityReference(name, ec)));
-    WebCore::raiseOnDOMError(ec);
-    return result;
+    UNUSED_PARAM(name);
+
+    WebCore::raiseOnDOMError(WebCore::NOT_SUPPORTED_ERR);
+    return nil;
 }
 
 - (DOMNodeList *)getElementsByTagName:(NSString *)tagname
 {
+    if (!tagname)
+        return nullptr;
+
     WebCore::JSMainThreadNullState state;
-    return kit(WTF::getPtr(IMPL->getElementsByTagNameForObjC(tagname)));
+    return kit(static_cast<WebCore::NodeList*>(WTF::getPtr(IMPL->getElementsByTagName(tagname))));
 }
 
 - (DOMNode *)importNode:(DOMNode *)importedNode deep:(BOOL)deep
 
 - (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI localName:(NSString *)localName
 {
+    if (!localName)
+        return nullptr;
+
     WebCore::JSMainThreadNullState state;
-    return kit(WTF::getPtr(IMPL->getElementsByTagNameNSForObjC(namespaceURI, localName)));
+    return kit(static_cast<WebCore::NodeList*>(WTF::getPtr(IMPL->getElementsByTagNameNS(namespaceURI, localName))));
 }
 
 - (DOMNode *)adoptNode:(DOMNode *)source
 - (DOMNodeList *)getElementsByClassName:(NSString *)classNames
 {
     WebCore::JSMainThreadNullState state;
-    return kit(WTF::getPtr(IMPL->getElementsByClassNameForObjC(classNames)));
+    return kit(static_cast<WebCore::NodeList*>(WTF::getPtr(IMPL->getElementsByClassName(classNames))));
 }
 
 - (BOOL)hasFocus
index d2cafa0..8bbdc5b 100644 (file)
 
 - (DOMNodeList *)getElementsByTagName:(NSString *)name
 {
+    if (!name)
+        return nullptr;
+
     WebCore::JSMainThreadNullState state;
-    return kit(WTF::getPtr(IMPL->getElementsByTagNameForObjC(name)));
+    return kit(static_cast<WebCore::NodeList*>(WTF::getPtr(IMPL->getElementsByTagName(name))));
 }
 
 - (NSString *)getAttributeNS:(NSString *)namespaceURI localName:(NSString *)localName
 
 - (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI localName:(NSString *)localName
 {
+    if (!localName)
+        return nullptr;
+
     WebCore::JSMainThreadNullState state;
-    return kit(WTF::getPtr(IMPL->getElementsByTagNameNSForObjC(namespaceURI, localName)));
+    return kit(static_cast<WebCore::NodeList*>(WTF::getPtr(IMPL->getElementsByTagNameNS(namespaceURI, localName))));
 }
 
 - (DOMAttr *)getAttributeNodeNS:(NSString *)namespaceURI localName:(NSString *)localName
 - (DOMNodeList *)getElementsByClassName:(NSString *)name
 {
     WebCore::JSMainThreadNullState state;
-    return kit(WTF::getPtr(IMPL->getElementsByClassNameForObjC(name)));
+    return kit(static_cast<WebCore::NodeList*>(WTF::getPtr(IMPL->getElementsByClassName(name))));
 }
 
 - (BOOL)matches:(NSString *)selectors
index 8000fc0..aa1ae27 100644 (file)
 
 // Introduced in DOM Level 2:
 interface CSSCharsetRule : CSSRule {
-#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
-    readonly attribute DOMString? encoding;
-#else
     [SetterRaisesException] attribute DOMString? encoding;
-#endif
 };
 
index 6b55f9f..e02ccc0 100644 (file)
@@ -826,14 +826,6 @@ Ref<HTMLCollection> ContainerNode::getElementsByTagName(const AtomicString& loca
     return ensureRareData().ensureNodeLists().addCachedCollection<TagCollection>(*this, ByTag, localName);
 }
 
-RefPtr<NodeList> ContainerNode::getElementsByTagNameForObjC(const AtomicString& localName)
-{
-    if (localName.isNull())
-        return nullptr;
-
-    return getElementsByTagName(localName);
-}
-
 Ref<HTMLCollection> ContainerNode::getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName)
 {
     ASSERT(!localName.isNull());
@@ -844,14 +836,6 @@ Ref<HTMLCollection> ContainerNode::getElementsByTagNameNS(const AtomicString& na
     return ensureRareData().ensureNodeLists().addCachedCollectionWithQualifiedName(*this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localName);
 }
 
-RefPtr<NodeList> ContainerNode::getElementsByTagNameNSForObjC(const AtomicString& namespaceURI, const AtomicString& localName)
-{
-    if (localName.isNull())
-        return nullptr;
-
-    return getElementsByTagNameNS(namespaceURI, localName);
-}
-
 Ref<NodeList> ContainerNode::getElementsByName(const String& elementName)
 {
     return ensureRareData().ensureNodeLists().addCacheWithAtomicName<NameNodeList>(*this, elementName);
@@ -862,11 +846,6 @@ Ref<HTMLCollection> ContainerNode::getElementsByClassName(const AtomicString& cl
     return ensureRareData().ensureNodeLists().addCachedCollection<ClassCollection>(*this, ByClass, classNames);
 }
 
-Ref<NodeList> ContainerNode::getElementsByClassNameForObjC(const AtomicString& classNames)
-{
-    return getElementsByClassName(classNames);
-}
-
 Ref<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name)
 {
     ASSERT(hasTagName(HTMLNames::formTag) || hasTagName(HTMLNames::fieldsetTag));
index 5656a5b..9073e90 100644 (file)
@@ -89,12 +89,9 @@ public:
     RefPtr<NodeList> querySelectorAll(const String& selectors, ExceptionCode&);
 
     Ref<HTMLCollection> getElementsByTagName(const AtomicString&);
-    RefPtr<NodeList> getElementsByTagNameForObjC(const AtomicString&);
     Ref<HTMLCollection> getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName);
-    RefPtr<NodeList> getElementsByTagNameNSForObjC(const AtomicString& namespaceURI, const AtomicString& localName);
     Ref<NodeList> getElementsByName(const String& elementName);
     Ref<HTMLCollection> getElementsByClassName(const AtomicString& classNames);
-    Ref<NodeList> getElementsByClassNameForObjC(const AtomicString& classNames);
     Ref<RadioNodeList> radioNodeList(const AtomicString&);
 
     // From the ParentNode interface - https://dom.spec.whatwg.org/#interface-parentnode
index 711ff3a..91bddf2 100644 (file)
@@ -968,12 +968,6 @@ RefPtr<ProcessingInstruction> Document::createProcessingInstruction(const String
     return ProcessingInstruction::create(*this, target, data);
 }
 
-RefPtr<EntityReference> Document::createEntityReference(const String&, ExceptionCode& ec)
-{
-    ec = NOT_SUPPORTED_ERR;
-    return nullptr;
-}
-
 Ref<Text> Document::createEditingTextNode(const String& text)
 {
     return Text::createEditingText(*this, text);
index 2596abc..5e6624f 100644 (file)
@@ -391,7 +391,6 @@ public:
     RefPtr<ProcessingInstruction> createProcessingInstruction(const String& target, const String& data, ExceptionCode&);
     RefPtr<Attr> createAttribute(const String& name, ExceptionCode&);
     RefPtr<Attr> createAttributeNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&, bool shouldIgnoreNamespaceChecks = false);
-    RefPtr<EntityReference> createEntityReference(const String& name, ExceptionCode&);
     RefPtr<Node> importNode(Node& nodeToImport, bool deep, ExceptionCode&);
     WEBCORE_EXPORT RefPtr<Element> createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&);
     WEBCORE_EXPORT Ref<Element> createElement(const QualifiedName&, bool createdByParser);
index 388ec13..58a2fc9 100644 (file)
     [ObjCLegacyUnnamedParameters, NewObject, RaisesException] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
     [NewObject, RaisesException] Attr createAttribute(DOMString name);
 
-#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
-    [RaisesException] EntityReference createEntityReference(optional DOMString name);
-#endif
-
-#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
-    [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName(optional DOMString tagname);
-#else
     HTMLCollection getElementsByTagName(DOMString tagname);
-#endif
 
     // Introduced in DOM Level 2:
 
     [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName);
     [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Attr createAttributeNS(DOMString? namespaceURI, DOMString qualifiedName);
 
-#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
-    [ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS(optional DOMString namespaceURI, optional DOMString localName);
-#else
     HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);
-#endif
 
     // DOM Level 3 Core
 
     CanvasRenderingContext getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height);
 
     // HTML 5
-#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
-    [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName(optional DOMString classNames);
-#else
     HTMLCollection getElementsByClassName(DOMString classNames);
-#endif
 
     readonly attribute Element? activeElement;
     boolean hasFocus();
index 4617395..9bca396 100644 (file)
     [RaisesException, InvokesCustomElementLifecycleCallbacks] Attr? setAttributeNode(Attr newAttr);
     [RaisesException, InvokesCustomElementLifecycleCallbacks] Attr removeAttributeNode(Attr oldAttr);
 
-#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
-    [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName(DOMString name);
-#else
     HTMLCollection getElementsByTagName(DOMString name);
-#endif
 
     readonly attribute NamedNodeMap attributes;
     boolean hasAttributes();
 
     [ObjCLegacyUnnamedParameters, InvokesCustomElementLifecycleCallbacks] void removeAttributeNS(DOMString? namespaceURI, DOMString localName);
 
-#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
-    [ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);
-#else
     HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);
-#endif
 
     [ObjCLegacyUnnamedParameters] Attr? getAttributeNodeNS(DOMString? namespaceURI, DOMString localName);
     [RaisesException, InvokesCustomElementLifecycleCallbacks] Attr? setAttributeNodeNS(Attr newAttr);
     [ImplementedAs=cssomStyle] readonly attribute CSSStyleDeclaration style;
 
     // DOM 4
-#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
     [Reflect] attribute DOMString id;
-#endif
 
     // Common extensions
 
-#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
-    readonly attribute long offsetLeft;
-    readonly attribute long offsetTop;
-    readonly attribute long offsetWidth;
-    readonly attribute long offsetHeight;
-    readonly attribute long clientLeft;
-    readonly attribute long clientTop;
-    readonly attribute long clientWidth;
-    readonly attribute long clientHeight;
-#else
     readonly attribute double offsetLeft;
     readonly attribute double offsetTop;
     readonly attribute double offsetWidth;
@@ -99,7 +79,6 @@
     readonly attribute double clientTop;
     readonly attribute double clientWidth;
     readonly attribute double clientHeight;
-#endif
 
     attribute long scrollLeft;
     attribute long scrollTop;
     void scrollByPages(optional long pages = 0);
 
     // HTML 5
-#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
-    [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName(DOMString name);
-#else
     HTMLCollection getElementsByClassName(DOMString name);
-#endif
     [TreatNullAs=EmptyString, SetterRaisesException] attribute DOMString innerHTML;
     [TreatNullAs=EmptyString, SetterRaisesException] attribute DOMString outerHTML;