OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
3 * Copyright (C) 2005 Alexey Proskuryakov. | 3 * Copyright (C) 2005 Alexey Proskuryakov. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 spliceBuffer(spaceCharacter, m_node, 0, runStart, runSta
rt + 1); | 608 spliceBuffer(spaceCharacter, m_node, 0, runStart, runSta
rt + 1); |
609 m_offset = runStart + 1; | 609 m_offset = runStart + 1; |
610 } else { | 610 } else { |
611 size_t subrunEnd = str.find('\n', runStart); | 611 size_t subrunEnd = str.find('\n', runStart); |
612 if (subrunEnd == kNotFound || subrunEnd > runEnd) { | 612 if (subrunEnd == kNotFound || subrunEnd > runEnd) { |
613 subrunEnd = runEnd; | 613 subrunEnd = runEnd; |
614 // Restore the collapsed space for copy & paste. | 614 // Restore the collapsed space for copy & paste. |
615 // See http://crbug.com/318925 | 615 // See http://crbug.com/318925 |
616 // For trailing space. | 616 // For trailing space. |
617 if (!nextTextBox && m_textBox->root().nextRootBox() && m
_textBox->root().lastChild() == m_textBox) { | 617 if (!nextTextBox && m_textBox->root().nextRootBox() && m
_textBox->root().lastChild() == m_textBox) { |
618 if (str.endsWith(' ') && subrunEnd == str.length() -
1 && str[subrunEnd - 1] != ' ') | 618 if (str.endsWith(' ') && subrunEnd == str.length() -
1 && str[subrunEnd - 1] != ' ') { |
619 ++subrunEnd; | 619 // If there is the leading space in the next lin
e, we don't need to restore the trailing space. |
| 620 // Example: <div style="width: 2em;"><b><i>foo <
/i></b> bar</div> |
| 621 String textOfNextline = m_textBox->root().nextRo
otBox()->firstChild()->getLineLayoutItem().node()->nodeValue(); |
| 622 if (textOfNextline[0] != ' ') |
| 623 ++subrunEnd; |
| 624 } |
620 } | 625 } |
621 // For leading space. | 626 // For leading space. |
622 if (!emitsImageAltText() && !doesNotBreakAtReplacedEleme
nt() && !forInnerText() | 627 if (!emitsImageAltText() && !doesNotBreakAtReplacedEleme
nt() && !forInnerText() |
623 && m_textBox->root().prevRootBox() && m_textBox->roo
t().firstChild() == m_textBox) { | 628 && m_textBox->root().prevRootBox() && m_textBox->roo
t().firstChild() == m_textBox) { |
624 InlineBox* lastChildOfPrevRoot = m_textBox->root().p
revRootBox()->lastChild(); | 629 InlineBox* lastChildOfPrevRoot = m_textBox->root().p
revRootBox()->lastChild(); |
625 if (m_textBox->getLineLayoutItem() != lastChildOfPre
vRoot->getLineLayoutItem() && !lastChildOfPrevRoot->getLineLayoutItem().isBR() | 630 if (m_textBox->getLineLayoutItem() != lastChildOfPre
vRoot->getLineLayoutItem() && !lastChildOfPrevRoot->getLineLayoutItem().isBR() |
626 && !lastChildOfPrevRoot->isInlineFlowBox()) { | 631 && !lastChildOfPrevRoot->isInlineFlowBox()) { |
627 if (runStart > 0 && str[0] == ' ' && str[1] != '
') | 632 if (runStart > 0 && str[0] == ' ' && str[1] != '
') |
628 --runStart; | 633 --runStart; |
629 } | 634 } |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 | 1222 |
1218 String plainText(const EphemeralRangeInFlatTree& range, TextIteratorBehaviorFlag
s behavior) | 1223 String plainText(const EphemeralRangeInFlatTree& range, TextIteratorBehaviorFlag
s behavior) |
1219 { | 1224 { |
1220 return createPlainText<EditingInFlatTreeStrategy>(range, behavior); | 1225 return createPlainText<EditingInFlatTreeStrategy>(range, behavior); |
1221 } | 1226 } |
1222 | 1227 |
1223 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>; | 1228 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>; |
1224 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingInFlatTreeStrat
egy>; | 1229 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingInFlatTreeStrat
egy>; |
1225 | 1230 |
1226 } // namespace blink | 1231 } // namespace blink |
OLD | NEW |