OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 bool Editor::CanSmartReplaceWithPasteboard(Pasteboard* pasteboard) { | 648 bool Editor::CanSmartReplaceWithPasteboard(Pasteboard* pasteboard) { |
649 return SmartInsertDeleteEnabled() && pasteboard->CanSmartReplace(); | 649 return SmartInsertDeleteEnabled() && pasteboard->CanSmartReplace(); |
650 } | 650 } |
651 | 651 |
652 void Editor::ReplaceSelectionWithFragment(DocumentFragment* fragment, | 652 void Editor::ReplaceSelectionWithFragment(DocumentFragment* fragment, |
653 bool select_replacement, | 653 bool select_replacement, |
654 bool smart_replace, | 654 bool smart_replace, |
655 bool match_style, | 655 bool match_style, |
656 InputEvent::InputType input_type) { | 656 InputEvent::InputType input_type) { |
657 DCHECK(!GetFrame().GetDocument()->NeedsLayoutTreeUpdate()); | 657 DCHECK(!GetFrame().GetDocument()->NeedsLayoutTreeUpdate()); |
658 if (GetFrame() | 658 const VisibleSelection& selection = |
659 .Selection() | 659 GetFrame().Selection().ComputeVisibleSelectionInDOMTree(); |
660 .ComputeVisibleSelectionInDOMTreeDeprecated() | 660 if (selection.IsNone() || !selection.IsContentEditable() || !fragment) |
661 .IsNone() || | |
662 !GetFrame() | |
663 .Selection() | |
664 .ComputeVisibleSelectionInDOMTreeDeprecated() | |
665 .IsContentEditable() || | |
666 !fragment) | |
667 return; | 661 return; |
668 | 662 |
669 ReplaceSelectionCommand::CommandOptions options = | 663 ReplaceSelectionCommand::CommandOptions options = |
670 ReplaceSelectionCommand::kPreventNesting | | 664 ReplaceSelectionCommand::kPreventNesting | |
671 ReplaceSelectionCommand::kSanitizeFragment; | 665 ReplaceSelectionCommand::kSanitizeFragment; |
672 if (select_replacement) | 666 if (select_replacement) |
673 options |= ReplaceSelectionCommand::kSelectReplacement; | 667 options |= ReplaceSelectionCommand::kSelectReplacement; |
674 if (smart_replace) | 668 if (smart_replace) |
675 options |= ReplaceSelectionCommand::kSmartReplace; | 669 options |= ReplaceSelectionCommand::kSmartReplace; |
676 if (match_style) | 670 if (match_style) |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 | 1841 |
1848 DEFINE_TRACE(Editor) { | 1842 DEFINE_TRACE(Editor) { |
1849 visitor->Trace(frame_); | 1843 visitor->Trace(frame_); |
1850 visitor->Trace(last_edit_command_); | 1844 visitor->Trace(last_edit_command_); |
1851 visitor->Trace(undo_stack_); | 1845 visitor->Trace(undo_stack_); |
1852 visitor->Trace(mark_); | 1846 visitor->Trace(mark_); |
1853 visitor->Trace(typing_style_); | 1847 visitor->Trace(typing_style_); |
1854 } | 1848 } |
1855 | 1849 |
1856 } // namespace blink | 1850 } // namespace blink |
OLD | NEW |