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 14 matching lines...) Expand all Loading... |
25 #include "config.h" | 25 #include "config.h" |
26 #include "core/html/ClassList.h" | 26 #include "core/html/ClassList.h" |
27 | 27 |
28 | 28 |
29 namespace WebCore { | 29 namespace WebCore { |
30 | 30 |
31 using namespace HTMLNames; | 31 using namespace HTMLNames; |
32 | 32 |
33 ClassList::ClassList(Element* element) : m_element(element) { } | 33 ClassList::ClassList(Element* element) : m_element(element) { } |
34 | 34 |
| 35 #if !ENABLE(OILPAN) |
35 void ClassList::ref() | 36 void ClassList::ref() |
36 { | 37 { |
37 m_element->ref(); | 38 m_element->ref(); |
38 } | 39 } |
39 | 40 |
40 void ClassList::deref() | 41 void ClassList::deref() |
41 { | 42 { |
42 m_element->deref(); | 43 m_element->deref(); |
43 } | 44 } |
| 45 #endif |
44 | 46 |
45 unsigned ClassList::length() const | 47 unsigned ClassList::length() const |
46 { | 48 { |
47 return m_element->hasClass() ? classNames().size() : 0; | 49 return m_element->hasClass() ? classNames().size() : 0; |
48 } | 50 } |
49 | 51 |
50 const AtomicString ClassList::item(unsigned index) const | 52 const AtomicString ClassList::item(unsigned index) const |
51 { | 53 { |
52 if (index >= length()) | 54 if (index >= length()) |
53 return AtomicString(); | 55 return AtomicString(); |
54 return classNames()[index]; | 56 return classNames()[index]; |
55 } | 57 } |
56 | 58 |
57 bool ClassList::containsInternal(const AtomicString& token) const | 59 bool ClassList::containsInternal(const AtomicString& token) const |
58 { | 60 { |
59 return m_element->hasClass() && classNames().contains(token); | 61 return m_element->hasClass() && classNames().contains(token); |
60 } | 62 } |
61 | 63 |
62 const SpaceSplitString& ClassList::classNames() const | 64 const SpaceSplitString& ClassList::classNames() const |
63 { | 65 { |
64 ASSERT(m_element->hasClass()); | 66 ASSERT(m_element->hasClass()); |
65 if (m_element->document().inQuirksMode()) { | 67 if (m_element->document().inQuirksMode()) { |
66 if (!m_classNamesForQuirksMode) | 68 if (!m_classNamesForQuirksMode) |
67 m_classNamesForQuirksMode = adoptPtr(new SpaceSplitString(value(), f
alse)); | 69 m_classNamesForQuirksMode = adoptPtr(new SpaceSplitString(value(), f
alse)); |
68 return *m_classNamesForQuirksMode.get(); | 70 return *m_classNamesForQuirksMode.get(); |
69 } | 71 } |
70 return m_element->elementData()->classNames(); | 72 return m_element->elementData()->classNames(); |
71 } | 73 } |
72 | 74 |
| 75 void ClassList::trace(Visitor* visitor) |
| 76 { |
| 77 visitor->trace(m_element); |
| 78 DOMTokenList::trace(visitor); |
| 79 } |
| 80 |
73 } // namespace WebCore | 81 } // namespace WebCore |
OLD | NEW |