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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 Text* textNode = toText(node); | 668 Text* textNode = toText(node); |
669 | 669 |
670 if (textNode->length() == 0) | 670 if (textNode->length() == 0) |
671 return; | 671 return; |
672 RenderObject* renderer = textNode->renderer(); | 672 RenderObject* renderer = textNode->renderer(); |
673 if (renderer && !renderer->style()->collapseWhiteSpace()) | 673 if (renderer && !renderer->style()->collapseWhiteSpace()) |
674 return; | 674 return; |
675 | 675 |
676 // Delete collapsed whitespace so that inserting nbsps doesn't uncollapse it
. | 676 // Delete collapsed whitespace so that inserting nbsps doesn't uncollapse it
. |
677 Position upstreamPos = position.upstream(); | 677 Position upstreamPos = position.upstream(); |
678 deleteInsignificantText(position.upstream(), position.downstream()); | 678 deleteInsignificantText(upstreamPos, position.downstream()); |
679 position = upstreamPos.downstream(); | 679 position = upstreamPos.downstream(); |
680 | 680 |
681 VisiblePosition visiblePos(position); | 681 VisiblePosition visiblePos(position); |
682 VisiblePosition previousVisiblePos(visiblePos.previous()); | 682 VisiblePosition previousVisiblePos(visiblePos.previous()); |
683 replaceCollapsibleWhitespaceWithNonBreakingSpaceIfNeeded(previousVisiblePos)
; | 683 replaceCollapsibleWhitespaceWithNonBreakingSpaceIfNeeded(previousVisiblePos)
; |
684 replaceCollapsibleWhitespaceWithNonBreakingSpaceIfNeeded(visiblePos); | 684 replaceCollapsibleWhitespaceWithNonBreakingSpaceIfNeeded(visiblePos); |
685 } | 685 } |
686 | 686 |
687 void CompositeEditCommand::replaceCollapsibleWhitespaceWithNonBreakingSpaceIfNee
ded(const VisiblePosition& visiblePosition) | 687 void CompositeEditCommand::replaceCollapsibleWhitespaceWithNonBreakingSpaceIfNee
ded(const VisiblePosition& visiblePosition) |
688 { | 688 { |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 return node.release(); | 1456 return node.release(); |
1457 } | 1457 } |
1458 | 1458 |
1459 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) | 1459 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) |
1460 { | 1460 { |
1461 RefPtr<Element> breakNode = document.createElement(brTag, false); | 1461 RefPtr<Element> breakNode = document.createElement(brTag, false); |
1462 return breakNode.release(); | 1462 return breakNode.release(); |
1463 } | 1463 } |
1464 | 1464 |
1465 } // namespace WebCore | 1465 } // namespace WebCore |
OLD | NEW |