| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #ifndef ClassList_h | 25 #ifndef ClassList_h |
| 26 #define ClassList_h | 26 #define ClassList_h |
| 27 | 27 |
| 28 #include "core/HTMLNames.h" | 28 #include "core/HTMLNames.h" |
| 29 #include "core/dom/DOMTokenList.h" | 29 #include "core/dom/DOMTokenList.h" |
| 30 #include "core/dom/Element.h" | 30 #include "core/dom/Element.h" |
| 31 #include "core/dom/SpaceSplitString.h" | 31 #include "core/dom/SpaceSplitString.h" |
| 32 #include "wtf/OwnPtr.h" | 32 #include "wtf/OwnPtr.h" |
| 33 #include "wtf/PassOwnPtr.h" | |
| 34 | 33 |
| 35 namespace blink { | 34 namespace blink { |
| 36 | 35 |
| 37 class Element; | 36 class Element; |
| 38 | 37 |
| 39 typedef int ExceptionCode; | 38 typedef int ExceptionCode; |
| 40 | 39 |
| 41 class ClassList final : public DOMTokenList { | 40 class ClassList final : public DOMTokenList { |
| 42 public: | 41 public: |
| 43 static PassOwnPtrWillBeRawPtr<ClassList> create(Element* element) | 42 static PassRefPtrWillBeRawPtr<ClassList> create(Element* element) |
| 44 { | 43 { |
| 45 return adoptPtrWillBeNoop(new ClassList(element)); | 44 return adoptRefWillBeNoop(new ClassList(element)); |
| 46 } | 45 } |
| 47 | 46 |
| 48 #if !ENABLE(OILPAN) | |
| 49 void ref() override; | |
| 50 void deref() override; | |
| 51 #endif | |
| 52 | |
| 53 unsigned length() const override; | 47 unsigned length() const override; |
| 54 const AtomicString item(unsigned index) const override; | 48 const AtomicString item(unsigned index) const override; |
| 55 | 49 |
| 56 Element* element() override { return m_element; } | 50 Element* element() override { return m_element; } |
| 57 | 51 |
| 58 void clearValueForQuirksMode() { m_classNamesForQuirksMode = nullptr; } | 52 void clearValueForQuirksMode() { m_classNamesForQuirksMode = nullptr; } |
| 59 | 53 |
| 60 DECLARE_VIRTUAL_TRACE(); | 54 DECLARE_VIRTUAL_TRACE(); |
| 61 | 55 |
| 62 private: | 56 private: |
| 63 explicit ClassList(Element*); | 57 explicit ClassList(Element*); |
| 64 | 58 |
| 65 bool containsInternal(const AtomicString&) const override; | 59 bool containsInternal(const AtomicString&) const override; |
| 66 | 60 |
| 67 const SpaceSplitString& classNames() const; | 61 const SpaceSplitString& classNames() const; |
| 68 | 62 |
| 69 const AtomicString& value() const override { return m_element->getAttribute(
HTMLNames::classAttr); } | 63 const AtomicString& value() const override { return m_element->getAttribute(
HTMLNames::classAttr); } |
| 70 void setValue(const AtomicString& value) override { m_element->setAttribute(
HTMLNames::classAttr, value); } | 64 void setValue(const AtomicString& value) override { m_element->setAttribute(
HTMLNames::classAttr, value); } |
| 71 | 65 |
| 72 RawPtrWillBeMember<Element> m_element; | 66 RawPtrWillBeMember<Element> m_element; |
| 73 mutable OwnPtr<SpaceSplitString> m_classNamesForQuirksMode; | 67 mutable OwnPtr<SpaceSplitString> m_classNamesForQuirksMode; |
| 74 }; | 68 }; |
| 75 | 69 |
| 76 } // namespace blink | 70 } // namespace blink |
| 77 | 71 |
| 78 #endif // ClassList_h | 72 #endif // ClassList_h |
| OLD | NEW |