| 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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 LeadingWhitespacePosition(insertion_position, VP_DEFAULT_AFFINITY); | 464 LeadingWhitespacePosition(insertion_position, VP_DEFAULT_AFFINITY); |
| 465 // FIXME: leadingWhitespacePosition is returning the position before preserved | 465 // FIXME: leadingWhitespacePosition is returning the position before preserved |
| 466 // newlines for positions after the preserved newline, causing the newline to | 466 // newlines for positions after the preserved newline, causing the newline to |
| 467 // be turned into a nbsp. | 467 // be turned into a nbsp. |
| 468 if (leading_whitespace.IsNotNull() && | 468 if (leading_whitespace.IsNotNull() && |
| 469 leading_whitespace.AnchorNode()->IsTextNode()) { | 469 leading_whitespace.AnchorNode()->IsTextNode()) { |
| 470 Text* text_node = ToText(leading_whitespace.AnchorNode()); | 470 Text* text_node = ToText(leading_whitespace.AnchorNode()); |
| 471 DCHECK(!text_node->GetLayoutObject() || | 471 DCHECK(!text_node->GetLayoutObject() || |
| 472 text_node->GetLayoutObject()->Style()->CollapseWhiteSpace()) | 472 text_node->GetLayoutObject()->Style()->CollapseWhiteSpace()) |
| 473 << text_node; | 473 << text_node; |
| 474 ReplaceTextInNodePreservingMarkers( | 474 ReplaceTextInNode(text_node, |
| 475 text_node, leading_whitespace.ComputeOffsetInContainerNode(), 1, | 475 leading_whitespace.ComputeOffsetInContainerNode(), 1, |
| 476 NonBreakingSpaceString()); | 476 NonBreakingSpaceString()); |
| 477 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); | 477 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); |
| 478 } | 478 } |
| 479 | 479 |
| 480 // Split at pos if in the middle of a text node. | 480 // Split at pos if in the middle of a text node. |
| 481 Position position_after_split; | 481 Position position_after_split; |
| 482 if (insertion_position.IsOffsetInAnchor() && | 482 if (insertion_position.IsOffsetInAnchor() && |
| 483 insertion_position.ComputeContainerNode()->IsTextNode()) { | 483 insertion_position.ComputeContainerNode()->IsTextNode()) { |
| 484 Text* text_node = ToText(insertion_position.ComputeContainerNode()); | 484 Text* text_node = ToText(insertion_position.ComputeContainerNode()); |
| 485 int text_offset = insertion_position.OffsetInContainerNode(); | 485 int text_offset = insertion_position.OffsetInContainerNode(); |
| 486 bool at_end = static_cast<unsigned>(text_offset) >= text_node->length(); | 486 bool at_end = static_cast<unsigned>(text_offset) >= text_node->length(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 .Build()); | 587 .Build()); |
| 588 ApplyStyleAfterInsertion(start_block, editing_state); | 588 ApplyStyleAfterInsertion(start_block, editing_state); |
| 589 } | 589 } |
| 590 | 590 |
| 591 DEFINE_TRACE(InsertParagraphSeparatorCommand) { | 591 DEFINE_TRACE(InsertParagraphSeparatorCommand) { |
| 592 visitor->Trace(style_); | 592 visitor->Trace(style_); |
| 593 CompositeEditCommand::Trace(visitor); | 593 CompositeEditCommand::Trace(visitor); |
| 594 } | 594 } |
| 595 | 595 |
| 596 } // namespace blink | 596 } // namespace blink |
| OLD | NEW |