OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 String string = text.substring(upstream, length); | 756 String string = text.substring(upstream, length); |
757 // FIXME: Because of the problem mentioned at the top of this function, we | 757 // FIXME: Because of the problem mentioned at the top of this function, we |
758 // must also use nbsps at the start/end of the string because this function | 758 // must also use nbsps at the start/end of the string because this function |
759 // doesn't get all surrounding whitespace, just the whitespace in the | 759 // doesn't get all surrounding whitespace, just the whitespace in the |
760 // current text node. However, if the next sibling node is a text node | 760 // current text node. However, if the next sibling node is a text node |
761 // (not empty, see http://crbug.com/632300), we should use a plain space. | 761 // (not empty, see http://crbug.com/632300), we should use a plain space. |
762 // See http://crbug.com/310149 | 762 // See http://crbug.com/310149 |
763 const bool nextSiblingIsTextNode = | 763 const bool nextSiblingIsTextNode = |
764 textNode->nextSibling() && textNode->nextSibling()->isTextNode() && | 764 textNode->nextSibling() && textNode->nextSibling()->isTextNode() && |
765 toText(textNode->nextSibling())->data().length() && | 765 toText(textNode->nextSibling())->data().length() && |
766 toText(textNode->nextSibling())->data()[0] != ' '; | 766 !isWhitespace(toText(textNode->nextSibling())->data()[0]); |
767 const bool shouldEmitNBSPbeforeEnd = | 767 const bool shouldEmitNBSPbeforeEnd = |
768 (isEndOfParagraph(visibleDownstreamPos) || | 768 (isEndOfParagraph(visibleDownstreamPos) || |
769 (unsigned)downstream == text.length()) && | 769 (unsigned)downstream == text.length()) && |
770 !nextSiblingIsTextNode; | 770 !nextSiblingIsTextNode; |
771 String rebalancedString = stringWithRebalancedWhitespace( | 771 String rebalancedString = stringWithRebalancedWhitespace( |
772 string, isStartOfParagraph(visibleUpstreamPos) || !upstream, | 772 string, isStartOfParagraph(visibleUpstreamPos) || !upstream, |
773 shouldEmitNBSPbeforeEnd); | 773 shouldEmitNBSPbeforeEnd); |
774 | 774 |
775 if (string != rebalancedString) | 775 if (string != rebalancedString) |
776 replaceTextInNodePreservingMarkers(textNode, upstream, length, | 776 replaceTextInNodePreservingMarkers(textNode, upstream, length, |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1971 | 1971 |
1972 DEFINE_TRACE(CompositeEditCommand) { | 1972 DEFINE_TRACE(CompositeEditCommand) { |
1973 visitor->trace(m_commands); | 1973 visitor->trace(m_commands); |
1974 visitor->trace(m_startingSelection); | 1974 visitor->trace(m_startingSelection); |
1975 visitor->trace(m_endingSelection); | 1975 visitor->trace(m_endingSelection); |
1976 visitor->trace(m_undoStep); | 1976 visitor->trace(m_undoStep); |
1977 EditCommand::trace(visitor); | 1977 EditCommand::trace(visitor); |
1978 } | 1978 } |
1979 | 1979 |
1980 } // namespace blink | 1980 } // namespace blink |
OLD | NEW |