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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 260 } |
261 | 261 |
262 return insertTextWithoutSendingTextEvent(data, false, event); | 262 return insertTextWithoutSendingTextEvent(data, false, event); |
263 } | 263 } |
264 | 264 |
265 bool Editor::canEdit() const { | 265 bool Editor::canEdit() const { |
266 return frame().selection().rootEditableElement(); | 266 return frame().selection().rootEditableElement(); |
267 } | 267 } |
268 | 268 |
269 bool Editor::canEditRichly() const { | 269 bool Editor::canEditRichly() const { |
270 return frame().selection().isContentRichlyEditable(); | 270 return frame() |
| 271 .selection() |
| 272 .computeVisibleSelectionInDOMTreeDeprecated() |
| 273 .isContentRichlyEditable(); |
271 } | 274 } |
272 | 275 |
273 // WinIE uses onbeforecut and onbeforepaste to enables the cut and paste menu | 276 // WinIE uses onbeforecut and onbeforepaste to enables the cut and paste menu |
274 // items. They also send onbeforecopy, apparently for symmetry, but it doesn't | 277 // items. They also send onbeforecopy, apparently for symmetry, but it doesn't |
275 // affect the menu items. We need to use onbeforecopy as a real menu enabler | 278 // affect the menu items. We need to use onbeforecopy as a real menu enabler |
276 // because we allow elements that are not normally selectable to implement | 279 // because we allow elements that are not normally selectable to implement |
277 // copy/paste (like divs, or a document body). | 280 // copy/paste (like divs, or a document body). |
278 | 281 |
279 bool Editor::canDHTMLCut() { | 282 bool Editor::canDHTMLCut() { |
280 return !frame().selection().isInPasswordField() && | 283 return !frame().selection().isInPasswordField() && |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 void Editor::paste(EditorCommandSource source) { | 1142 void Editor::paste(EditorCommandSource source) { |
1140 DCHECK(frame().document()); | 1143 DCHECK(frame().document()); |
1141 if (tryDHTMLPaste(AllMimeTypes)) | 1144 if (tryDHTMLPaste(AllMimeTypes)) |
1142 return; // DHTML did the whole operation | 1145 return; // DHTML did the whole operation |
1143 if (!canPaste()) | 1146 if (!canPaste()) |
1144 return; | 1147 return; |
1145 spellChecker().updateMarkersForWordsAffectedByEditing(false); | 1148 spellChecker().updateMarkersForWordsAffectedByEditing(false); |
1146 ResourceFetcher* loader = frame().document()->fetcher(); | 1149 ResourceFetcher* loader = frame().document()->fetcher(); |
1147 ResourceCacheValidationSuppressor validationSuppressor(loader); | 1150 ResourceCacheValidationSuppressor validationSuppressor(loader); |
1148 | 1151 |
1149 PasteMode pasteMode = frame().selection().isContentRichlyEditable() | 1152 PasteMode pasteMode = frame().selection() |
| 1153 .computeVisibleSelectionInDOMTreeDeprecated() |
| 1154 .isContentRichlyEditable() |
1150 ? AllMimeTypes | 1155 ? AllMimeTypes |
1151 : PlainTextOnly; | 1156 : PlainTextOnly; |
1152 | 1157 |
1153 if (source == CommandFromMenuOrKeyBinding) { | 1158 if (source == CommandFromMenuOrKeyBinding) { |
1154 DataTransfer* dataTransfer = | 1159 DataTransfer* dataTransfer = |
1155 DataTransfer::create(DataTransfer::CopyAndPaste, DataTransferReadable, | 1160 DataTransfer::create(DataTransfer::CopyAndPaste, DataTransferReadable, |
1156 DataObject::createFromPasteboard(pasteMode)); | 1161 DataObject::createFromPasteboard(pasteMode)); |
1157 | 1162 |
1158 if (dispatchBeforeInputDataTransfer(findEventTargetFromSelection(), | 1163 if (dispatchBeforeInputDataTransfer(findEventTargetFromSelection(), |
1159 InputEvent::InputType::InsertFromPaste, | 1164 InputEvent::InputType::InsertFromPaste, |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1725 | 1730 |
1726 DEFINE_TRACE(Editor) { | 1731 DEFINE_TRACE(Editor) { |
1727 visitor->trace(m_frame); | 1732 visitor->trace(m_frame); |
1728 visitor->trace(m_lastEditCommand); | 1733 visitor->trace(m_lastEditCommand); |
1729 visitor->trace(m_undoStack); | 1734 visitor->trace(m_undoStack); |
1730 visitor->trace(m_mark); | 1735 visitor->trace(m_mark); |
1731 visitor->trace(m_typingStyle); | 1736 visitor->trace(m_typingStyle); |
1732 } | 1737 } |
1733 | 1738 |
1734 } // namespace blink | 1739 } // namespace blink |
OLD | NEW |