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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 void Editor::registerCommandGroup(CompositeEditCommand* commandGroupWrapper) { | 729 void Editor::registerCommandGroup(CompositeEditCommand* commandGroupWrapper) { |
730 DCHECK(commandGroupWrapper->isCommandGroupWrapper()); | 730 DCHECK(commandGroupWrapper->isCommandGroupWrapper()); |
731 m_lastEditCommand = commandGroupWrapper; | 731 m_lastEditCommand = commandGroupWrapper; |
732 } | 732 } |
733 | 733 |
734 void Editor::clearLastEditCommand() { | 734 void Editor::clearLastEditCommand() { |
735 m_lastEditCommand.clear(); | 735 m_lastEditCommand.clear(); |
736 } | 736 } |
737 | 737 |
738 Element* Editor::findEventTargetFrom(const VisibleSelection& selection) const { | 738 Element* Editor::findEventTargetFrom(const VisibleSelection& selection) const { |
739 Element* target = selection.hasEditableStyle() | 739 Element* target = associatedElementOf(selection.start()); |
740 ? associatedElementOf(selection.start()) | |
741 : frame().document()->activeElement(); | |
742 if (!target) | 740 if (!target) |
743 target = frame().document()->body(); | 741 target = frame().document()->body(); |
744 | 742 |
745 return target; | 743 return target; |
746 } | 744 } |
747 | 745 |
748 Element* Editor::findEventTargetFromSelection() const { | 746 Element* Editor::findEventTargetFromSelection() const { |
749 return findEventTargetFrom(frame().selection().selection()); | 747 return findEventTargetFrom(frame().selection().selection()); |
750 } | 748 } |
751 | 749 |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 | 1701 |
1704 DEFINE_TRACE(Editor) { | 1702 DEFINE_TRACE(Editor) { |
1705 visitor->trace(m_frame); | 1703 visitor->trace(m_frame); |
1706 visitor->trace(m_lastEditCommand); | 1704 visitor->trace(m_lastEditCommand); |
1707 visitor->trace(m_undoStack); | 1705 visitor->trace(m_undoStack); |
1708 visitor->trace(m_mark); | 1706 visitor->trace(m_mark); |
1709 visitor->trace(m_typingStyle); | 1707 visitor->trace(m_typingStyle); |
1710 } | 1708 } |
1711 | 1709 |
1712 } // namespace blink | 1710 } // namespace blink |
OLD | NEW |