OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 InlineToAbstractInlineTextBoxHashMap::const_iterator it = | 66 InlineToAbstractInlineTextBoxHashMap::const_iterator it = |
67 gAbstractInlineTextBoxMap->find(inlineTextBox); | 67 gAbstractInlineTextBoxMap->find(inlineTextBox); |
68 if (it != gAbstractInlineTextBoxMap->end()) { | 68 if (it != gAbstractInlineTextBoxMap->end()) { |
69 it->value->detach(); | 69 it->value->detach(); |
70 gAbstractInlineTextBoxMap->erase(inlineTextBox); | 70 gAbstractInlineTextBoxMap->erase(inlineTextBox); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 AbstractInlineTextBox::~AbstractInlineTextBox() { | 74 AbstractInlineTextBox::~AbstractInlineTextBox() { |
75 ASSERT(!m_lineLayoutItem); | 75 DCHECK(!m_lineLayoutItem); |
76 ASSERT(!m_inlineTextBox); | 76 DCHECK(!m_inlineTextBox); |
77 } | 77 } |
78 | 78 |
79 void AbstractInlineTextBox::detach() { | 79 void AbstractInlineTextBox::detach() { |
80 if (Node* node = m_lineLayoutItem.node()) { | 80 if (Node* node = m_lineLayoutItem.node()) { |
81 if (AXObjectCache* cache = node->document().existingAXObjectCache()) | 81 if (AXObjectCache* cache = node->document().existingAXObjectCache()) |
82 cache->remove(this); | 82 cache->remove(this); |
83 } | 83 } |
84 | 84 |
85 m_lineLayoutItem = LineLayoutText(nullptr); | 85 m_lineLayoutItem = LineLayoutText(nullptr); |
86 m_inlineTextBox = nullptr; | 86 m_inlineTextBox = nullptr; |
87 } | 87 } |
88 | 88 |
89 PassRefPtr<AbstractInlineTextBox> AbstractInlineTextBox::nextInlineTextBox() | 89 PassRefPtr<AbstractInlineTextBox> AbstractInlineTextBox::nextInlineTextBox() |
90 const { | 90 const { |
91 ASSERT(!m_inlineTextBox || | 91 DCHECK(!m_inlineTextBox || |
92 !m_inlineTextBox->getLineLayoutItem().needsLayout()); | 92 !m_inlineTextBox->getLineLayoutItem().needsLayout()); |
93 if (!m_inlineTextBox) | 93 if (!m_inlineTextBox) |
94 return nullptr; | 94 return nullptr; |
95 | 95 |
96 return getOrCreate(m_lineLayoutItem, m_inlineTextBox->nextTextBox()); | 96 return getOrCreate(m_lineLayoutItem, m_inlineTextBox->nextTextBox()); |
97 } | 97 } |
98 | 98 |
99 LayoutRect AbstractInlineTextBox::localBounds() const { | 99 LayoutRect AbstractInlineTextBox::localBounds() const { |
100 if (!m_inlineTextBox || !m_lineLayoutItem) | 100 if (!m_inlineTextBox || !m_lineLayoutItem) |
101 return LayoutRect(); | 101 return LayoutRect(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 .substring(start, len) | 173 .substring(start, len) |
174 .simplifyWhiteSpace(WTF::DoNotStripWhiteSpace); | 174 .simplifyWhiteSpace(WTF::DoNotStripWhiteSpace); |
175 if (m_inlineTextBox->nextTextBox() && | 175 if (m_inlineTextBox->nextTextBox() && |
176 m_inlineTextBox->nextTextBox()->start() > m_inlineTextBox->end() && | 176 m_inlineTextBox->nextTextBox()->start() > m_inlineTextBox->end() && |
177 result.length() && !result.right(1).containsOnlyWhitespace()) | 177 result.length() && !result.right(1).containsOnlyWhitespace()) |
178 return result + " "; | 178 return result + " "; |
179 return result; | 179 return result; |
180 } | 180 } |
181 | 181 |
182 bool AbstractInlineTextBox::isFirst() const { | 182 bool AbstractInlineTextBox::isFirst() const { |
183 ASSERT(!m_inlineTextBox || | 183 DCHECK(!m_inlineTextBox || |
184 !m_inlineTextBox->getLineLayoutItem().needsLayout()); | 184 !m_inlineTextBox->getLineLayoutItem().needsLayout()); |
185 return !m_inlineTextBox || !m_inlineTextBox->prevTextBox(); | 185 return !m_inlineTextBox || !m_inlineTextBox->prevTextBox(); |
186 } | 186 } |
187 | 187 |
188 bool AbstractInlineTextBox::isLast() const { | 188 bool AbstractInlineTextBox::isLast() const { |
189 ASSERT(!m_inlineTextBox || | 189 DCHECK(!m_inlineTextBox || |
190 !m_inlineTextBox->getLineLayoutItem().needsLayout()); | 190 !m_inlineTextBox->getLineLayoutItem().needsLayout()); |
191 return !m_inlineTextBox || !m_inlineTextBox->nextTextBox(); | 191 return !m_inlineTextBox || !m_inlineTextBox->nextTextBox(); |
192 } | 192 } |
193 | 193 |
194 PassRefPtr<AbstractInlineTextBox> AbstractInlineTextBox::nextOnLine() const { | 194 PassRefPtr<AbstractInlineTextBox> AbstractInlineTextBox::nextOnLine() const { |
195 ASSERT(!m_inlineTextBox || | 195 DCHECK(!m_inlineTextBox || |
196 !m_inlineTextBox->getLineLayoutItem().needsLayout()); | 196 !m_inlineTextBox->getLineLayoutItem().needsLayout()); |
197 if (!m_inlineTextBox) | 197 if (!m_inlineTextBox) |
198 return nullptr; | 198 return nullptr; |
199 | 199 |
200 InlineBox* next = m_inlineTextBox->nextOnLine(); | 200 InlineBox* next = m_inlineTextBox->nextOnLine(); |
201 if (next && next->isInlineTextBox()) | 201 if (next && next->isInlineTextBox()) |
202 return getOrCreate(toInlineTextBox(next)->getLineLayoutItem(), | 202 return getOrCreate(toInlineTextBox(next)->getLineLayoutItem(), |
203 toInlineTextBox(next)); | 203 toInlineTextBox(next)); |
204 | 204 |
205 return nullptr; | 205 return nullptr; |
206 } | 206 } |
207 | 207 |
208 PassRefPtr<AbstractInlineTextBox> AbstractInlineTextBox::previousOnLine() | 208 PassRefPtr<AbstractInlineTextBox> AbstractInlineTextBox::previousOnLine() |
209 const { | 209 const { |
210 ASSERT(!m_inlineTextBox || | 210 DCHECK(!m_inlineTextBox || |
211 !m_inlineTextBox->getLineLayoutItem().needsLayout()); | 211 !m_inlineTextBox->getLineLayoutItem().needsLayout()); |
212 if (!m_inlineTextBox) | 212 if (!m_inlineTextBox) |
213 return nullptr; | 213 return nullptr; |
214 | 214 |
215 InlineBox* previous = m_inlineTextBox->prevOnLine(); | 215 InlineBox* previous = m_inlineTextBox->prevOnLine(); |
216 if (previous && previous->isInlineTextBox()) | 216 if (previous && previous->isInlineTextBox()) |
217 return getOrCreate(toInlineTextBox(previous)->getLineLayoutItem(), | 217 return getOrCreate(toInlineTextBox(previous)->getLineLayoutItem(), |
218 toInlineTextBox(previous)); | 218 toInlineTextBox(previous)); |
219 | 219 |
220 return nullptr; | 220 return nullptr; |
221 } | 221 } |
222 | 222 |
223 } // namespace blink | 223 } // namespace blink |
OLD | NEW |