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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 // See bug crbug.com/317365. | 604 // See bug crbug.com/317365. |
605 if (layoutObject->style()->whiteSpace() == PRE_LINE) | 605 if (layoutObject->style()->whiteSpace() == PRE_LINE) |
606 spliceBuffer('\n', m_node, 0, runStart, runStart); | 606 spliceBuffer('\n', m_node, 0, runStart, runStart); |
607 else | 607 else |
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 at the end of text for co
py & paste. | 614 // Restore the collapsed trailing space for copy & paste
. |
615 // See http://crbug.com/318925 | 615 // See http://crbug.com/318925 |
616 if (str.endsWith(' ') && subrunEnd == str.length() - 1 &
& str[subrunEnd - 1] != ' ') { | 616 if (!nextTextBox && m_textBox->root().nextRootBox() && m
_textBox->root().lastChild() == m_textBox) { |
617 Node* nextNode = Strategy::nextSibling(*m_node); | 617 if (str.endsWith(' ') && subrunEnd == str.length() -
1 && str[subrunEnd - 1] != ' ') |
618 if (nextNode && isInline(nextNode)) | |
619 ++subrunEnd; | 618 ++subrunEnd; |
620 } | 619 } |
621 } | 620 } |
622 | 621 |
623 m_offset = subrunEnd; | 622 m_offset = subrunEnd; |
624 emitText(m_node, layoutObject, runStart, subrunEnd); | 623 emitText(m_node, layoutObject, runStart, subrunEnd); |
625 } | 624 } |
626 | 625 |
627 // If we are doing a subrun that doesn't go to the end of the te
xt box, | 626 // If we are doing a subrun that doesn't go to the end of the te
xt box, |
628 // come back again to finish handling this text box; don't advan
ce to the next one. | 627 // come back again to finish handling this text box; don't advan
ce to the next one. |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 if (range.isNull()) | 1215 if (range.isNull()) |
1217 return emptyString(); | 1216 return emptyString(); |
1218 DocumentLifecycle::DisallowTransitionScope disallowTransition(range.startPos
ition().document()->lifecycle()); | 1217 DocumentLifecycle::DisallowTransitionScope disallowTransition(range.startPos
ition().document()->lifecycle()); |
1219 return createPlainText<EditingInFlatTreeStrategy>(range, behavior); | 1218 return createPlainText<EditingInFlatTreeStrategy>(range, behavior); |
1220 } | 1219 } |
1221 | 1220 |
1222 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>; | 1221 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>; |
1223 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingInFlatTreeStrat
egy>; | 1222 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingInFlatTreeStrat
egy>; |
1224 | 1223 |
1225 } // namespace blink | 1224 } // namespace blink |
OLD | NEW |