https://bugs.webkit.org/show_bug.cgi?id=149434
Reviewed by Darin Adler.
Added a jsArray for const Vector<T*>* so that we can generate the binding code for getDistributedNodes()
without having to create Vector<RefPtr<Node>> out of Vector<Node*>*.
* bindings/js/JSDOMBinding.h:
(WebCore::jsArray): Added.
* html/HTMLSlotElement.cpp:
(WebCore::HTMLSlotElement::assignedNodes):
(WebCore::HTMLSlotElement::getDistributedNodes): Deleted.
* html/HTMLSlotElement.h:
* html/HTMLSlotElement.idl:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190093
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-09-21 Ryosuke Niwa <rniwa@webkit.org>
+
+ The binding for getDistributedNodes unnecessarily makes a vector of nodes
+ https://bugs.webkit.org/show_bug.cgi?id=149434
+
+ Reviewed by Darin Adler.
+
+ Added a jsArray for const Vector<T*>* so that we can generate the binding code for getDistributedNodes()
+ without having to create Vector<RefPtr<Node>> out of Vector<Node*>*.
+
+ * bindings/js/JSDOMBinding.h:
+ (WebCore::jsArray): Added.
+ * html/HTMLSlotElement.cpp:
+ (WebCore::HTMLSlotElement::assignedNodes):
+ (WebCore::HTMLSlotElement::getDistributedNodes): Deleted.
+ * html/HTMLSlotElement.h:
+ * html/HTMLSlotElement.idl:
+
2015-09-21 Brent Fulgham <bfulgham@apple.com>
[Win] Show tiled drawing debug overlay on Windows
return JSC::constructArray(exec, nullptr, globalObject, list);
}
+template<typename T, size_t inlineCapacity> inline JSC::JSValue jsArray(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const Vector<T, inlineCapacity>* vector)
+{
+ if (!vector)
+ return JSC::constructEmptyArray(exec, nullptr, globalObject, 0);
+ return jsArray(exec, globalObject, *vector);
+}
+
WEBCORE_EXPORT JSC::JSValue jsArray(JSC::ExecState*, JSDOMGlobalObject*, PassRefPtr<DOMStringList>);
inline PassRefPtr<JSC::ArrayBufferView> toArrayBufferView(JSC::JSValue value)
return shadowRoot->assignedNodesForSlot(*this);
}
-Vector<RefPtr<Node>> HTMLSlotElement::getDistributedNodes() const
-{
- Vector<RefPtr<Node>> distributedNodes;
-
- if (auto* assignedNodes = this->assignedNodes()) {
- for (auto* node : *assignedNodes)
- distributedNodes.append(node);
- }
-
- return distributedNodes;
-}
-
}
const Vector<Node*>* assignedNodes() const;
- Vector<RefPtr<Node>> getDistributedNodes() const;
-
private:
HTMLSlotElement(const QualifiedName&, Document&);
] interface HTMLSlotElement : HTMLElement {
[Reflect] attribute DOMString name;
- sequence<Node> getDistributedNodes();
+ [ImplementedAs=assignedNodes] sequence<Node> getDistributedNodes();
};