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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // callers should check isMarker() before calling element(). | 70 // callers should check isMarker() before calling element(). |
71 ASSERT(m_item); | 71 ASSERT(m_item); |
72 return m_item->element(); | 72 return m_item->element(); |
73 } | 73 } |
74 void replaceElement(PassRefPtrWillBeRawPtr<HTMLStackItem> item) { m_item
= item; } | 74 void replaceElement(PassRefPtrWillBeRawPtr<HTMLStackItem> item) { m_item
= item; } |
75 | 75 |
76 // Needed for use with Vector. These are super-hot and must be inline. | 76 // Needed for use with Vector. These are super-hot and must be inline. |
77 bool operator==(Element* element) const { return !m_item ? !element : m_
item->element() == element; } | 77 bool operator==(Element* element) const { return !m_item ? !element : m_
item->element() == element; } |
78 bool operator!=(Element* element) const { return !m_item ? !!element : m
_item->element() != element; } | 78 bool operator!=(Element* element) const { return !m_item ? !!element : m
_item->element() != element; } |
79 | 79 |
80 void trace(Visitor* visitor) { visitor->trace(m_item); } | 80 DEFINE_INLINE_TRACE() { visitor->trace(m_item); } |
81 | 81 |
82 private: | 82 private: |
83 RefPtrWillBeMember<HTMLStackItem> m_item; | 83 RefPtrWillBeMember<HTMLStackItem> m_item; |
84 }; | 84 }; |
85 | 85 |
86 class Bookmark { | 86 class Bookmark { |
87 public: | 87 public: |
88 explicit Bookmark(Entry* entry) | 88 explicit Bookmark(Entry* entry) |
89 : m_hasBeenMoved(false) | 89 : m_hasBeenMoved(false) |
90 , m_mark(entry) | 90 , m_mark(entry) |
(...skipping 27 matching lines...) Expand all Loading... |
118 Bookmark bookmarkFor(Element*); | 118 Bookmark bookmarkFor(Element*); |
119 void swapTo(Element* oldElement, PassRefPtrWillBeRawPtr<HTMLStackItem> newIt
em, const Bookmark&); | 119 void swapTo(Element* oldElement, PassRefPtrWillBeRawPtr<HTMLStackItem> newIt
em, const Bookmark&); |
120 | 120 |
121 void appendMarker(); | 121 void appendMarker(); |
122 // clearToLastMarker also clears the marker (per the HTML5 spec). | 122 // clearToLastMarker also clears the marker (per the HTML5 spec). |
123 void clearToLastMarker(); | 123 void clearToLastMarker(); |
124 | 124 |
125 const Entry& at(size_t i) const { return m_entries[i]; } | 125 const Entry& at(size_t i) const { return m_entries[i]; } |
126 Entry& at(size_t i) { return m_entries[i]; } | 126 Entry& at(size_t i) { return m_entries[i]; } |
127 | 127 |
128 void trace(Visitor* visitor) { visitor->trace(m_entries); } | 128 DEFINE_INLINE_TRACE() { visitor->trace(m_entries); } |
129 | 129 |
130 #ifndef NDEBUG | 130 #ifndef NDEBUG |
131 void show(); | 131 void show(); |
132 #endif | 132 #endif |
133 | 133 |
134 private: | 134 private: |
135 Entry* first() { return &at(0); } | 135 Entry* first() { return &at(0); } |
136 | 136 |
137 // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#
list-of-active-formatting-elements | 137 // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#
list-of-active-formatting-elements |
138 // These functions enforce the "Noah's Ark" condition, which removes redunda
nt mis-nested elements. | 138 // These functions enforce the "Noah's Ark" condition, which removes redunda
nt mis-nested elements. |
139 void tryToEnsureNoahsArkConditionQuickly(HTMLStackItem*, WillBeHeapVector<Ra
wPtrWillBeMember<HTMLStackItem>>& remainingCandiates); | 139 void tryToEnsureNoahsArkConditionQuickly(HTMLStackItem*, WillBeHeapVector<Ra
wPtrWillBeMember<HTMLStackItem>>& remainingCandiates); |
140 void ensureNoahsArkCondition(HTMLStackItem*); | 140 void ensureNoahsArkCondition(HTMLStackItem*); |
141 | 141 |
142 WillBeHeapVector<Entry> m_entries; | 142 WillBeHeapVector<Entry> m_entries; |
143 }; | 143 }; |
144 | 144 |
145 } // namespace blink | 145 } // namespace blink |
146 | 146 |
147 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::HTMLFormattingElementList::Ent
ry); | 147 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::HTMLFormattingElementList::Ent
ry); |
148 | 148 |
149 #endif // HTMLFormattingElementList_h | 149 #endif // HTMLFormattingElementList_h |
OLD | NEW |