Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp

Issue 2280513004: Restore a collapsed trailing space of text used for line break (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 space at the end of text for co py & 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 (layoutObject->needToRestoreCollapsedSpace()) {
617 Node* nextNode = Strategy::nextSibling(*m_node); 617 if (str.endsWith(' ') && 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 1210
1212 String plainText(const EphemeralRangeInFlatTree& range, TextIteratorBehaviorFlag s behavior) 1211 String plainText(const EphemeralRangeInFlatTree& range, TextIteratorBehaviorFlag s behavior)
1213 { 1212 {
1214 return createPlainText<EditingInFlatTreeStrategy>(range, behavior); 1213 return createPlainText<EditingInFlatTreeStrategy>(range, behavior);
1215 } 1214 }
1216 1215
1217 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>; 1216 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>;
1218 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingInFlatTreeStrat egy>; 1217 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingInFlatTreeStrat egy>;
1219 1218
1220 } // namespace blink 1219 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698