Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(793)

Unified Diff: sky/engine/core/dom/DOMTokenList.h

Issue 789843004: Merge ClassList into DOMTokenList. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/core.gni ('k') | sky/engine/core/dom/DOMTokenList.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/dom/DOMTokenList.h
diff --git a/sky/engine/core/dom/DOMTokenList.h b/sky/engine/core/dom/DOMTokenList.h
index 5e6d30b36f739601cd573af4426030efcee5586f..4d9dbb4139fe254150e43679cbc09411ed705f56 100644
--- a/sky/engine/core/dom/DOMTokenList.h
+++ b/sky/engine/core/dom/DOMTokenList.h
@@ -27,6 +27,7 @@
#include "sky/engine/bindings/core/v8/ScriptWrappable.h"
#include "sky/engine/platform/heap/Handle.h"
+#include "sky/engine/wtf/PassOwnPtr.h"
#include "sky/engine/wtf/Vector.h"
#include "sky/engine/wtf/text/AtomicString.h"
@@ -34,44 +35,49 @@ namespace blink {
class Element;
class ExceptionState;
+class SpaceSplitString;
-class DOMTokenList : public ScriptWrappable {
+class DOMTokenList final : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
WTF_MAKE_FAST_ALLOCATED;
WTF_MAKE_NONCOPYABLE(DOMTokenList);
public:
- DOMTokenList()
+ static PassOwnPtr<DOMTokenList> create(Element& element)
{
+ return adoptPtr(new DOMTokenList(element));
}
- virtual ~DOMTokenList() { }
-#if !ENABLE(OILPAN)
- virtual void ref() = 0;
- virtual void deref() = 0;
-#endif
+ ~DOMTokenList() { }
- virtual unsigned length() const = 0;
- virtual const AtomicString item(unsigned index) const = 0;
+ void ref();
+ void deref();
+
+ unsigned length() const;
+ const AtomicString item(unsigned index) const;
bool contains(const AtomicString&, ExceptionState&) const;
- virtual void add(const Vector<String>&, ExceptionState&);
+ void add(const Vector<String>&, ExceptionState&);
void add(const AtomicString&, ExceptionState&);
- virtual void remove(const Vector<String>&, ExceptionState&);
+ void remove(const Vector<String>&, ExceptionState&);
void remove(const AtomicString&, ExceptionState&);
bool toggle(const AtomicString&, ExceptionState&);
bool toggle(const AtomicString&, bool force, ExceptionState&);
const AtomicString& toString() const { return value(); }
- virtual Element* element() { return 0; }
+ Element* element() { return m_element.get(); }
+
+ const AtomicString& value() const;
+ void setValue(const AtomicString& value);
-protected:
- virtual const AtomicString& value() const = 0;
- virtual void setValue(const AtomicString&) = 0;
+private:
+ DOMTokenList(Element&);
- virtual void addInternal(const AtomicString&);
- virtual bool containsInternal(const AtomicString&) const = 0;
- virtual void removeInternal(const AtomicString&);
+ const SpaceSplitString& classNames() const;
+
+ void addInternal(const AtomicString&);
+ bool containsInternal(const AtomicString&) const;
+ void removeInternal(const AtomicString&);
static bool validateToken(const String&, ExceptionState&);
static bool validateTokens(const Vector<String>&, ExceptionState&);
@@ -79,6 +85,8 @@ protected:
static AtomicString addTokens(const AtomicString&, const Vector<String>&);
static AtomicString removeToken(const AtomicString&, const AtomicString&);
static AtomicString removeTokens(const AtomicString&, const Vector<String>&);
+
+ RawPtr<Element> m_element;
};
} // namespace blink
« no previous file with comments | « sky/engine/core/core.gni ('k') | sky/engine/core/dom/DOMTokenList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698