Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/layout/line/AbstractInlineTextBox.h" | 32 #include "core/layout/line/AbstractInlineTextBox.h" |
| 33 | 33 |
| 34 #include "core/dom/AXObjectCache.h" | |
| 34 #include "core/editing/iterators/TextIterator.h" | 35 #include "core/editing/iterators/TextIterator.h" |
| 35 #include "platform/text/TextBreakIterator.h" | 36 #include "platform/text/TextBreakIterator.h" |
| 36 | 37 |
| 37 namespace blink { | 38 namespace blink { |
| 38 | 39 |
| 39 AbstractInlineTextBox::InlineToAbstractInlineTextBoxHashMap* AbstractInlineTextB ox::gAbstractInlineTextBoxMap = nullptr; | 40 AbstractInlineTextBox::InlineToAbstractInlineTextBoxHashMap* AbstractInlineTextB ox::gAbstractInlineTextBoxMap = nullptr; |
| 40 | 41 |
| 41 PassRefPtr<AbstractInlineTextBox> AbstractInlineTextBox::getOrCreate(LayoutText* layoutText, InlineTextBox* inlineTextBox) | 42 PassRefPtr<AbstractInlineTextBox> AbstractInlineTextBox::getOrCreate(LayoutText* layoutText, InlineTextBox* inlineTextBox) |
| 42 { | 43 { |
| 43 if (!inlineTextBox) | 44 if (!inlineTextBox) |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 60 if (!gAbstractInlineTextBoxMap) | 61 if (!gAbstractInlineTextBoxMap) |
| 61 return; | 62 return; |
| 62 | 63 |
| 63 InlineToAbstractInlineTextBoxHashMap::const_iterator it = gAbstractInlineTex tBoxMap->find(inlineTextBox); | 64 InlineToAbstractInlineTextBoxHashMap::const_iterator it = gAbstractInlineTex tBoxMap->find(inlineTextBox); |
| 64 if (it != gAbstractInlineTextBoxMap->end()) { | 65 if (it != gAbstractInlineTextBoxMap->end()) { |
| 65 it->value->detach(); | 66 it->value->detach(); |
| 66 gAbstractInlineTextBoxMap->remove(inlineTextBox); | 67 gAbstractInlineTextBoxMap->remove(inlineTextBox); |
| 67 } | 68 } |
| 68 } | 69 } |
| 69 | 70 |
| 70 void AbstractInlineTextBox::detach() | 71 void AbstractInlineTextBox::detach() |
|
haraken
2015/06/24 23:37:34
Add an ASSERT to ~AbstractInlineTextBox to verify
keishi
2015/06/25 03:29:27
Done.
| |
| 71 { | 72 { |
| 73 if (Node* node = m_layoutText->node()) { | |
| 74 if (AXObjectCache* cache = node->document().existingAXObjectCache()) | |
| 75 cache->remove(this); | |
| 76 } | |
| 77 | |
| 72 m_layoutText = 0; | 78 m_layoutText = 0; |
| 73 m_inlineTextBox = 0; | 79 m_inlineTextBox = 0; |
| 74 } | 80 } |
| 75 | 81 |
| 76 PassRefPtr<AbstractInlineTextBox> AbstractInlineTextBox::nextInlineTextBox() con st | 82 PassRefPtr<AbstractInlineTextBox> AbstractInlineTextBox::nextInlineTextBox() con st |
| 77 { | 83 { |
| 78 ASSERT(!m_inlineTextBox || !m_inlineTextBox->layoutObject().needsLayout()); | 84 ASSERT(!m_inlineTextBox || !m_inlineTextBox->layoutObject().needsLayout()); |
| 79 if (!m_inlineTextBox) | 85 if (!m_inlineTextBox) |
| 80 return nullptr; | 86 return nullptr; |
| 81 | 87 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 return nullptr; | 197 return nullptr; |
| 192 | 198 |
| 193 InlineBox* previous = m_inlineTextBox->prevOnLine(); | 199 InlineBox* previous = m_inlineTextBox->prevOnLine(); |
| 194 if (previous && previous->isInlineTextBox()) | 200 if (previous && previous->isInlineTextBox()) |
| 195 return getOrCreate(&toInlineTextBox(previous)->layoutObject(), toInlineT extBox(previous)); | 201 return getOrCreate(&toInlineTextBox(previous)->layoutObject(), toInlineT extBox(previous)); |
| 196 | 202 |
| 197 return nullptr; | 203 return nullptr; |
| 198 } | 204 } |
| 199 | 205 |
| 200 } // namespace blink | 206 } // namespace blink |
| OLD | NEW |