| 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 20 matching lines...) Expand all Loading... |
| 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/editing/iterators/TextIterator.h" | 34 #include "core/editing/iterators/TextIterator.h" |
| 35 #include "platform/text/TextBreakIterator.h" | 35 #include "platform/text/TextBreakIterator.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 AbstractInlineTextBox::InlineToAbstractInlineTextBoxHashMap* AbstractInlineTextB
ox::gAbstractInlineTextBoxMap = 0; | 39 AbstractInlineTextBox::InlineToAbstractInlineTextBoxHashMap* AbstractInlineTextB
ox::gAbstractInlineTextBoxMap = 0; |
| 40 | 40 |
| 41 PassRefPtr<AbstractInlineTextBox> AbstractInlineTextBox::getOrCreate(LayoutText*
renderText, InlineTextBox* inlineTextBox) | 41 PassRefPtr<AbstractInlineTextBox> AbstractInlineTextBox::getOrCreate(LayoutText*
layoutText, InlineTextBox* inlineTextBox) |
| 42 { | 42 { |
| 43 if (!inlineTextBox) | 43 if (!inlineTextBox) |
| 44 return nullptr; | 44 return nullptr; |
| 45 | 45 |
| 46 if (!gAbstractInlineTextBoxMap) | 46 if (!gAbstractInlineTextBoxMap) |
| 47 gAbstractInlineTextBoxMap = new InlineToAbstractInlineTextBoxHashMap(); | 47 gAbstractInlineTextBoxMap = new InlineToAbstractInlineTextBoxHashMap(); |
| 48 | 48 |
| 49 InlineToAbstractInlineTextBoxHashMap::const_iterator it = gAbstractInlineTex
tBoxMap->find(inlineTextBox); | 49 InlineToAbstractInlineTextBoxHashMap::const_iterator it = gAbstractInlineTex
tBoxMap->find(inlineTextBox); |
| 50 if (it != gAbstractInlineTextBoxMap->end()) | 50 if (it != gAbstractInlineTextBoxMap->end()) |
| 51 return it->value; | 51 return it->value; |
| 52 | 52 |
| 53 RefPtr<AbstractInlineTextBox> obj = adoptRef(new AbstractInlineTextBox(rende
rText, inlineTextBox)); | 53 RefPtr<AbstractInlineTextBox> obj = adoptRef(new AbstractInlineTextBox(layou
tText, inlineTextBox)); |
| 54 gAbstractInlineTextBoxMap->set(inlineTextBox, obj); | 54 gAbstractInlineTextBoxMap->set(inlineTextBox, obj); |
| 55 return obj; | 55 return obj; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void AbstractInlineTextBox::willDestroy(InlineTextBox* inlineTextBox) | 58 void AbstractInlineTextBox::willDestroy(InlineTextBox* inlineTextBox) |
| 59 { | 59 { |
| 60 if (!gAbstractInlineTextBoxMap) | 60 if (!gAbstractInlineTextBoxMap) |
| 61 return; | 61 return; |
| 62 | 62 |
| 63 InlineToAbstractInlineTextBoxHashMap::const_iterator it = gAbstractInlineTex
tBoxMap->find(inlineTextBox); | 63 InlineToAbstractInlineTextBoxHashMap::const_iterator it = gAbstractInlineTex
tBoxMap->find(inlineTextBox); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 return plainText(range.get(), TextIteratorIgnoresStyleVisibility); | 152 return plainText(range.get(), TextIteratorIgnoresStyleVisibility); |
| 153 } | 153 } |
| 154 | 154 |
| 155 String result = m_renderText->text().substring(start, len).simplifyWhiteSpac
e(WTF::DoNotStripWhiteSpace); | 155 String result = m_renderText->text().substring(start, len).simplifyWhiteSpac
e(WTF::DoNotStripWhiteSpace); |
| 156 if (m_inlineTextBox->nextTextBox() && m_inlineTextBox->nextTextBox()->start(
) > m_inlineTextBox->end() && result.length() && !result.right(1).containsOnlyWh
itespace()) | 156 if (m_inlineTextBox->nextTextBox() && m_inlineTextBox->nextTextBox()->start(
) > m_inlineTextBox->end() && result.length() && !result.right(1).containsOnlyWh
itespace()) |
| 157 return result + " "; | 157 return result + " "; |
| 158 return result; | 158 return result; |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace blink | 161 } // namespace blink |
| OLD | NEW |