| 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 unsigned count, | 542 unsigned count, |
| 543 const String& replacement_text) { | 543 const String& replacement_text) { |
| 544 // SetCharacterDataCommand is never aborted. | 544 // SetCharacterDataCommand is never aborted. |
| 545 ApplyCommandToComposite( | 545 ApplyCommandToComposite( |
| 546 SetCharacterDataCommand::Create(node, offset, count, replacement_text), | 546 SetCharacterDataCommand::Create(node, offset, count, replacement_text), |
| 547 ASSERT_NO_EDITING_ABORT); | 547 ASSERT_NO_EDITING_ABORT); |
| 548 } | 548 } |
| 549 | 549 |
| 550 Position CompositeEditCommand::ReplaceSelectedTextInNode(const String& text) { | 550 Position CompositeEditCommand::ReplaceSelectedTextInNode(const String& text) { |
| 551 Position start = EndingSelection().Start(); | 551 Position start = EndingSelection().Start(); |
| 552 Position end = EndingSelection().end(); | 552 Position end = EndingSelection().End(); |
| 553 if (start.ComputeContainerNode() != end.ComputeContainerNode() || | 553 if (start.ComputeContainerNode() != end.ComputeContainerNode() || |
| 554 !start.ComputeContainerNode()->IsTextNode() || | 554 !start.ComputeContainerNode()->IsTextNode() || |
| 555 IsTabHTMLSpanElementTextNode(start.ComputeContainerNode())) | 555 IsTabHTMLSpanElementTextNode(start.ComputeContainerNode())) |
| 556 return Position(); | 556 return Position(); |
| 557 | 557 |
| 558 Text* text_node = ToText(start.ComputeContainerNode()); | 558 Text* text_node = ToText(start.ComputeContainerNode()); |
| 559 ReplaceTextInNode(text_node, start.OffsetInContainerNode(), | 559 ReplaceTextInNode(text_node, start.OffsetInContainerNode(), |
| 560 end.OffsetInContainerNode() - start.OffsetInContainerNode(), | 560 end.OffsetInContainerNode() - start.OffsetInContainerNode(), |
| 561 text); | 561 text); |
| 562 | 562 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 pos.OffsetInContainerNode(), 1, NonBreakingSpaceString()); | 773 pos.OffsetInContainerNode(), 1, NonBreakingSpaceString()); |
| 774 } | 774 } |
| 775 | 775 |
| 776 void CompositeEditCommand::RebalanceWhitespace() { | 776 void CompositeEditCommand::RebalanceWhitespace() { |
| 777 VisibleSelection selection = EndingSelection(); | 777 VisibleSelection selection = EndingSelection(); |
| 778 if (selection.IsNone()) | 778 if (selection.IsNone()) |
| 779 return; | 779 return; |
| 780 | 780 |
| 781 RebalanceWhitespaceAt(selection.Start()); | 781 RebalanceWhitespaceAt(selection.Start()); |
| 782 if (selection.IsRange()) | 782 if (selection.IsRange()) |
| 783 RebalanceWhitespaceAt(selection.end()); | 783 RebalanceWhitespaceAt(selection.End()); |
| 784 } | 784 } |
| 785 | 785 |
| 786 void CompositeEditCommand::DeleteInsignificantText(Text* text_node, | 786 void CompositeEditCommand::DeleteInsignificantText(Text* text_node, |
| 787 unsigned start, | 787 unsigned start, |
| 788 unsigned end) { | 788 unsigned end) { |
| 789 if (!text_node || start >= end) | 789 if (!text_node || start >= end) |
| 790 return; | 790 return; |
| 791 | 791 |
| 792 GetDocument().UpdateStyleAndLayout(); | 792 GetDocument().UpdateStyleAndLayout(); |
| 793 | 793 |
| (...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1975 | 1975 |
| 1976 DEFINE_TRACE(CompositeEditCommand) { | 1976 DEFINE_TRACE(CompositeEditCommand) { |
| 1977 visitor->Trace(commands_); | 1977 visitor->Trace(commands_); |
| 1978 visitor->Trace(starting_selection_); | 1978 visitor->Trace(starting_selection_); |
| 1979 visitor->Trace(ending_selection_); | 1979 visitor->Trace(ending_selection_); |
| 1980 visitor->Trace(undo_step_); | 1980 visitor->Trace(undo_step_); |
| 1981 EditCommand::Trace(visitor); | 1981 EditCommand::Trace(visitor); |
| 1982 } | 1982 } |
| 1983 | 1983 |
| 1984 } // namespace blink | 1984 } // namespace blink |
| OLD | NEW |