| 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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 | 863 |
| 864 String string = text.substring(upstream, length); | 864 String string = text.substring(upstream, length); |
| 865 // FIXME: Because of the problem mentioned at the top of this function, we | 865 // FIXME: Because of the problem mentioned at the top of this function, we |
| 866 // must also use nbsps at the start/end of the string because this function | 866 // must also use nbsps at the start/end of the string because this function |
| 867 // doesn't get all surrounding whitespace, just the whitespace in the | 867 // doesn't get all surrounding whitespace, just the whitespace in the |
| 868 // current text node. However, if the next sibling node is a text node | 868 // current text node. However, if the next sibling node is a text node |
| 869 // (not empty, see http://crbug.com/632300), we should use a plain space. | 869 // (not empty, see http://crbug.com/632300), we should use a plain space. |
| 870 // See http://crbug.com/310149 | 870 // See http://crbug.com/310149 |
| 871 const bool nextSiblingIsTextNode = | 871 const bool nextSiblingIsTextNode = |
| 872 textNode->nextSibling() && textNode->nextSibling()->isTextNode() && | 872 textNode->nextSibling() && textNode->nextSibling()->isTextNode() && |
| 873 toText(textNode->nextSibling())->data().length(); | 873 toText(textNode->nextSibling())->data().length() && |
| 874 toText(textNode->nextSibling())->data()[0] != ' '; |
| 874 const bool shouldEmitNBSPbeforeEnd = | 875 const bool shouldEmitNBSPbeforeEnd = |
| 875 (isEndOfParagraphDeprecated(visibleDownstreamPos) || | 876 (isEndOfParagraphDeprecated(visibleDownstreamPos) || |
| 876 (unsigned)downstream == text.length()) && | 877 (unsigned)downstream == text.length()) && |
| 877 !nextSiblingIsTextNode; | 878 !nextSiblingIsTextNode; |
| 878 String rebalancedString = stringWithRebalancedWhitespace( | 879 String rebalancedString = stringWithRebalancedWhitespace( |
| 879 string, isStartOfParagraphDeprecated(visibleUpstreamPos) || !upstream, | 880 string, isStartOfParagraphDeprecated(visibleUpstreamPos) || !upstream, |
| 880 shouldEmitNBSPbeforeEnd); | 881 shouldEmitNBSPbeforeEnd); |
| 881 | 882 |
| 882 if (string != rebalancedString) | 883 if (string != rebalancedString) |
| 883 replaceTextInNodePreservingMarkers(textNode, upstream, length, | 884 replaceTextInNodePreservingMarkers(textNode, upstream, length, |
| (...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1995 return node; | 1996 return node; |
| 1996 } | 1997 } |
| 1997 | 1998 |
| 1998 DEFINE_TRACE(CompositeEditCommand) { | 1999 DEFINE_TRACE(CompositeEditCommand) { |
| 1999 visitor->trace(m_commands); | 2000 visitor->trace(m_commands); |
| 2000 visitor->trace(m_composition); | 2001 visitor->trace(m_composition); |
| 2001 EditCommand::trace(visitor); | 2002 EditCommand::trace(visitor); |
| 2002 } | 2003 } |
| 2003 | 2004 |
| 2004 } // namespace blink | 2005 } // namespace blink |
| OLD | NEW |