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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
450 | 450 |
451 Text* textNode = toText(m_node); | 451 Text* textNode = toText(m_node); |
452 LayoutText* layoutObject = textNode->layoutObject(); | 452 LayoutText* layoutObject = textNode->layoutObject(); |
453 | 453 |
454 m_lastTextNode = textNode; | 454 m_lastTextNode = textNode; |
455 String str = layoutObject->text(); | 455 String str = layoutObject->text(); |
456 | 456 |
457 // handle pre-formatted text | 457 // handle pre-formatted text |
458 if (!layoutObject->style()->collapseWhiteSpace()) { | 458 if (!layoutObject->style()->collapseWhiteSpace()) { |
459 int runStart = m_offset; | 459 int runStart = m_offset; |
460 if (m_lastTextNodeEndedWithCollapsedSpace && hasVisibleTextNode(layoutOb ject)) { | 460 if (m_lastTextNodeEndedWithCollapsedSpace && hasVisibleTextNode(layoutOb ject) && runStart > 0 && str[runStart - 1] == ' ') { |
461 emitCharacter(spaceCharacter, textNode, 0, runStart, runStart); | 461 emitCharacter(spaceCharacter, textNode, 0, runStart, runStart); |
462 return false; | 462 return false; |
463 } | 463 } |
464 if (!m_handledFirstLetter && layoutObject->isTextFragment() && !m_offset ) { | 464 if (!m_handledFirstLetter && layoutObject->isTextFragment() && !m_offset ) { |
465 handleTextNodeFirstLetter(toLayoutTextFragment(layoutObject)); | 465 handleTextNodeFirstLetter(toLayoutTextFragment(layoutObject)); |
466 if (m_firstLetterText) { | 466 if (m_firstLetterText) { |
467 String firstLetter = m_firstLetterText->text(); | 467 String firstLetter = m_firstLetterText->text(); |
468 emitText(textNode, m_firstLetterText, m_offset, m_offset + first Letter.length()); | 468 emitText(textNode, m_firstLetterText, m_offset, m_offset + first Letter.length()); |
469 m_firstLetterText = nullptr; | 469 m_firstLetterText = nullptr; |
470 m_textBox = 0; | 470 m_textBox = 0; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
663 return false; | 663 return false; |
664 | 664 |
665 LayoutObject* layoutObject = m_node->layoutObject(); | 665 LayoutObject* layoutObject = m_node->layoutObject(); |
666 if (layoutObject->style()->visibility() != VISIBLE && !ignoresStyleVisibilit y()) | 666 if (layoutObject->style()->visibility() != VISIBLE && !ignoresStyleVisibilit y()) |
667 return false; | 667 return false; |
668 | 668 |
669 if (emitsObjectReplacementCharacter()) { | 669 if (emitsObjectReplacementCharacter()) { |
670 emitCharacter(objectReplacementCharacter, Strategy::parent(*m_node), m_n ode, 0, 1); | 670 emitCharacter(objectReplacementCharacter, Strategy::parent(*m_node), m_n ode, 0, 1); |
671 return true; | 671 return true; |
672 } | 672 } |
673 | 673 if (m_lastTextNode) { |
674 if (m_lastTextNodeEndedWithCollapsedSpace) { | 674 String str = m_lastTextNode->layoutObject()->text(); |
675 emitCharacter(spaceCharacter, Strategy::parent(*m_lastTextNode), m_lastT extNode, 1, 1); | 675 if (m_lastTextNodeEndedWithCollapsedSpace && m_offset > 0 && str[m_offse t-1] == ' ') { |
yosin_UTC9
2016/01/20 01:40:22
Please inserts spaces around '-'
nit: str[m_offset
ramya.v
2016/01/20 03:42:56
Done.
| |
676 return false; | 676 emitCharacter(spaceCharacter, Strategy::parent(*m_lastTextNode), m_l astTextNode, 1, 1); |
677 return false; | |
678 } | |
677 } | 679 } |
678 | 680 |
679 if (entersTextControls() && layoutObject->isTextControl()) { | 681 if (entersTextControls() && layoutObject->isTextControl()) { |
680 // The shadow tree should be already visited. | 682 // The shadow tree should be already visited. |
681 return true; | 683 return true; |
682 } | 684 } |
683 | 685 |
684 if (emitsCharactersBetweenAllVisiblePositions()) { | 686 if (emitsCharactersBetweenAllVisiblePositions()) { |
685 // We want replaced elements to behave like punctuation for boundary | 687 // We want replaced elements to behave like punctuation for boundary |
686 // finding, and to simply take up space for the selection preservation | 688 // finding, and to simply take up space for the selection preservation |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1119 | 1121 |
1120 String plainText(const EphemeralRangeInComposedTree& range, TextIteratorBehavior Flags behavior) | 1122 String plainText(const EphemeralRangeInComposedTree& range, TextIteratorBehavior Flags behavior) |
1121 { | 1123 { |
1122 return createPlainText<EditingInComposedTreeStrategy>(range, behavior); | 1124 return createPlainText<EditingInComposedTreeStrategy>(range, behavior); |
1123 } | 1125 } |
1124 | 1126 |
1125 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>; | 1127 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>; |
1126 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingInComposedTreeS trategy>; | 1128 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingInComposedTreeS trategy>; |
1127 | 1129 |
1128 } // namespace blink | 1130 } // namespace blink |
OLD | NEW |