Changeset 190093 in webkit


Ignore:
Timestamp:
Sep 21, 2015 5:26:06 PM (9 years ago)
Author:
rniwa@webkit.org
Message:

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:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r190091 r190093  
     12015-09-21  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        The binding for getDistributedNodes unnecessarily makes a vector of nodes
     4        https://bugs.webkit.org/show_bug.cgi?id=149434
     5
     6        Reviewed by Darin Adler.
     7
     8        Added a jsArray for const Vector<T*>* so that we can generate the binding code for getDistributedNodes()
     9        without having to create Vector<RefPtr<Node>> out of Vector<Node*>*.
     10
     11        * bindings/js/JSDOMBinding.h:
     12        (WebCore::jsArray): Added.
     13        * html/HTMLSlotElement.cpp:
     14        (WebCore::HTMLSlotElement::assignedNodes):
     15        (WebCore::HTMLSlotElement::getDistributedNodes): Deleted.
     16        * html/HTMLSlotElement.h:
     17        * html/HTMLSlotElement.idl:
     18
    1192015-09-21  Brent Fulgham  <bfulgham@apple.com>
    220
  • trunk/Source/WebCore/bindings/js/JSDOMBinding.h

    r188187 r190093  
    456456}
    457457
     458template<typename T, size_t inlineCapacity> inline JSC::JSValue jsArray(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const Vector<T, inlineCapacity>* vector)
     459{
     460    if (!vector)
     461        return JSC::constructEmptyArray(exec, nullptr, globalObject, 0);
     462    return jsArray(exec, globalObject, *vector);
     463}
     464
    458465WEBCORE_EXPORT JSC::JSValue jsArray(JSC::ExecState*, JSDOMGlobalObject*, PassRefPtr<DOMStringList>);
    459466
  • trunk/Source/WebCore/html/HTMLSlotElement.cpp

    r190084 r190093  
    9595}
    9696
    97 Vector<RefPtr<Node>> HTMLSlotElement::getDistributedNodes() const
    98 {
    99     Vector<RefPtr<Node>> distributedNodes;
    100 
    101     if (auto* assignedNodes = this->assignedNodes()) {
    102         for (auto* node : *assignedNodes)
    103             distributedNodes.append(node);
    104     }
    105 
    106     return distributedNodes;
    10797}
    108 
    109 }
  • trunk/Source/WebCore/html/HTMLSlotElement.h

    r190084 r190093  
    3939    const Vector<Node*>* assignedNodes() const;
    4040
    41     Vector<RefPtr<Node>> getDistributedNodes() const;
    42 
    4341private:
    4442    HTMLSlotElement(const QualifiedName&, Document&);
  • trunk/Source/WebCore/html/HTMLSlotElement.idl

    r189950 r190093  
    3131
    3232    [Reflect] attribute DOMString name;
    33     sequence<Node> getDistributedNodes();
     33    [ImplementedAs=assignedNodes] sequence<Node> getDistributedNodes();
    3434
    3535};
Note: See TracChangeset for help on using the changeset viewer.