OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006 Apple Computer, 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 leadingWhitespacePosition(insertionPosition, VP_DEFAULT_AFFINITY); | 457 leadingWhitespacePosition(insertionPosition, VP_DEFAULT_AFFINITY); |
458 // FIXME: leadingWhitespacePosition is returning the position before preserved | 458 // FIXME: leadingWhitespacePosition is returning the position before preserved |
459 // newlines for positions after the preserved newline, causing the newline to | 459 // newlines for positions after the preserved newline, causing the newline to |
460 // be turned into a nbsp. | 460 // be turned into a nbsp. |
461 if (leadingWhitespace.isNotNull() && | 461 if (leadingWhitespace.isNotNull() && |
462 leadingWhitespace.anchorNode()->isTextNode()) { | 462 leadingWhitespace.anchorNode()->isTextNode()) { |
463 Text* textNode = toText(leadingWhitespace.anchorNode()); | 463 Text* textNode = toText(leadingWhitespace.anchorNode()); |
464 DCHECK(!textNode->layoutObject() || | 464 DCHECK(!textNode->layoutObject() || |
465 textNode->layoutObject()->style()->collapseWhiteSpace()) | 465 textNode->layoutObject()->style()->collapseWhiteSpace()) |
466 << textNode; | 466 << textNode; |
467 replaceTextInNodePreservingMarkers( | 467 replaceTextInNode(textNode, |
468 textNode, leadingWhitespace.computeOffsetInContainerNode(), 1, | 468 leadingWhitespace.computeOffsetInContainerNode(), 1, |
469 nonBreakingSpaceString()); | 469 nonBreakingSpaceString()); |
470 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 470 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
471 } | 471 } |
472 | 472 |
473 // Split at pos if in the middle of a text node. | 473 // Split at pos if in the middle of a text node. |
474 Position positionAfterSplit; | 474 Position positionAfterSplit; |
475 if (insertionPosition.isOffsetInAnchor() && | 475 if (insertionPosition.isOffsetInAnchor() && |
476 insertionPosition.computeContainerNode()->isTextNode()) { | 476 insertionPosition.computeContainerNode()->isTextNode()) { |
477 Text* textNode = toText(insertionPosition.computeContainerNode()); | 477 Text* textNode = toText(insertionPosition.computeContainerNode()); |
478 int textOffset = insertionPosition.offsetInContainerNode(); | 478 int textOffset = insertionPosition.offsetInContainerNode(); |
479 bool atEnd = static_cast<unsigned>(textOffset) >= textNode->length(); | 479 bool atEnd = static_cast<unsigned>(textOffset) >= textNode->length(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 .build()); | 577 .build()); |
578 applyStyleAfterInsertion(startBlock, editingState); | 578 applyStyleAfterInsertion(startBlock, editingState); |
579 } | 579 } |
580 | 580 |
581 DEFINE_TRACE(InsertParagraphSeparatorCommand) { | 581 DEFINE_TRACE(InsertParagraphSeparatorCommand) { |
582 visitor->trace(m_style); | 582 visitor->trace(m_style); |
583 CompositeEditCommand::trace(visitor); | 583 CompositeEditCommand::trace(visitor); |
584 } | 584 } |
585 | 585 |
586 } // namespace blink | 586 } // namespace blink |
OLD | NEW |