| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 180 } |
| 181 return selection; | 181 return selection; |
| 182 } | 182 } |
| 183 | 183 |
| 184 // Function considers Mac editing behavior a fallback when Page or Settings is | 184 // Function considers Mac editing behavior a fallback when Page or Settings is |
| 185 // not available. | 185 // not available. |
| 186 EditingBehavior Editor::behavior() const { | 186 EditingBehavior Editor::behavior() const { |
| 187 if (!frame().settings()) | 187 if (!frame().settings()) |
| 188 return EditingBehavior(EditingMacBehavior); | 188 return EditingBehavior(EditingMacBehavior); |
| 189 | 189 |
| 190 return EditingBehavior(frame().settings()->editingBehaviorType()); | 190 return EditingBehavior(frame().settings()->getEditingBehaviorType()); |
| 191 } | 191 } |
| 192 | 192 |
| 193 static EditorClient& emptyEditorClient() { | 193 static EditorClient& emptyEditorClient() { |
| 194 DEFINE_STATIC_LOCAL(EmptyEditorClient, client, ()); | 194 DEFINE_STATIC_LOCAL(EmptyEditorClient, client, ()); |
| 195 return client; | 195 return client; |
| 196 } | 196 } |
| 197 | 197 |
| 198 EditorClient& Editor::client() const { | 198 EditorClient& Editor::client() const { |
| 199 if (Page* page = frame().page()) | 199 if (Page* page = frame().page()) |
| 200 return page->editorClient(); | 200 return page->editorClient(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 return canEdit(); | 296 return canEdit(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 bool Editor::canDelete() const { | 299 bool Editor::canDelete() const { |
| 300 FrameSelection& selection = frame().selection(); | 300 FrameSelection& selection = frame().selection(); |
| 301 return selection.isRange() && selection.rootEditableElement(); | 301 return selection.isRange() && selection.rootEditableElement(); |
| 302 } | 302 } |
| 303 | 303 |
| 304 bool Editor::smartInsertDeleteEnabled() const { | 304 bool Editor::smartInsertDeleteEnabled() const { |
| 305 if (Settings* settings = frame().settings()) | 305 if (Settings* settings = frame().settings()) |
| 306 return settings->smartInsertDeleteEnabled(); | 306 return settings->getSmartInsertDeleteEnabled(); |
| 307 return false; | 307 return false; |
| 308 } | 308 } |
| 309 | 309 |
| 310 bool Editor::canSmartCopyOrDelete() const { | 310 bool Editor::canSmartCopyOrDelete() const { |
| 311 return smartInsertDeleteEnabled() && | 311 return smartInsertDeleteEnabled() && |
| 312 frame().selection().granularity() == WordGranularity; | 312 frame().selection().granularity() == WordGranularity; |
| 313 } | 313 } |
| 314 | 314 |
| 315 bool Editor::isSelectTrailingWhitespaceEnabled() const { | 315 bool Editor::isSelectTrailingWhitespaceEnabled() const { |
| 316 if (Settings* settings = frame().settings()) | 316 if (Settings* settings = frame().settings()) |
| 317 return settings->selectTrailingWhitespaceEnabled(); | 317 return settings->getSelectTrailingWhitespaceEnabled(); |
| 318 return false; | 318 return false; |
| 319 } | 319 } |
| 320 | 320 |
| 321 bool Editor::deleteWithDirection(EditCommandSource source, | 321 bool Editor::deleteWithDirection(EditCommandSource source, |
| 322 DeleteDirection direction, | 322 DeleteDirection direction, |
| 323 TextGranularity granularity, | 323 TextGranularity granularity, |
| 324 bool killRing, | 324 bool killRing, |
| 325 bool isTypingAction) { | 325 bool isTypingAction) { |
| 326 if (!canEdit()) | 326 if (!canEdit()) |
| 327 return false; | 327 return false; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 | 690 |
| 691 Node* startContainer = range.startPosition().computeContainerNode(); | 691 Node* startContainer = range.startPosition().computeContainerNode(); |
| 692 Node* endContainer = range.endPosition().computeContainerNode(); | 692 Node* endContainer = range.endPosition().computeContainerNode(); |
| 693 if (!startContainer || !endContainer) | 693 if (!startContainer || !endContainer) |
| 694 return false; | 694 return false; |
| 695 | 695 |
| 696 return hasEditableStyle(*startContainer) && hasEditableStyle(*endContainer); | 696 return hasEditableStyle(*startContainer) && hasEditableStyle(*endContainer); |
| 697 } | 697 } |
| 698 | 698 |
| 699 void Editor::respondToChangedContents(const VisibleSelection& endingSelection) { | 699 void Editor::respondToChangedContents(const VisibleSelection& endingSelection) { |
| 700 if (frame().settings() && frame().settings()->accessibilityEnabled()) { | 700 if (frame().settings() && frame().settings()->getAccessibilityEnabled()) { |
| 701 Node* node = endingSelection.start().anchorNode(); | 701 Node* node = endingSelection.start().anchorNode(); |
| 702 if (AXObjectCache* cache = frame().document()->existingAXObjectCache()) | 702 if (AXObjectCache* cache = frame().document()->existingAXObjectCache()) |
| 703 cache->handleEditableTextContentChanged(node); | 703 cache->handleEditableTextContentChanged(node); |
| 704 } | 704 } |
| 705 | 705 |
| 706 spellChecker().updateMarkersForWordsAffectedByEditing(true); | 706 spellChecker().updateMarkersForWordsAffectedByEditing(true); |
| 707 client().respondToChangedContents(); | 707 client().respondToChangedContents(); |
| 708 } | 708 } |
| 709 | 709 |
| 710 void Editor::removeFormattingAndStyle(EditCommandSource source) { | 710 void Editor::removeFormattingAndStyle(EditCommandSource source) { |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 } | 1707 } |
| 1708 | 1708 |
| 1709 DEFINE_TRACE(Editor) { | 1709 DEFINE_TRACE(Editor) { |
| 1710 visitor->trace(m_frame); | 1710 visitor->trace(m_frame); |
| 1711 visitor->trace(m_lastEditCommand); | 1711 visitor->trace(m_lastEditCommand); |
| 1712 visitor->trace(m_undoStack); | 1712 visitor->trace(m_undoStack); |
| 1713 visitor->trace(m_mark); | 1713 visitor->trace(m_mark); |
| 1714 } | 1714 } |
| 1715 | 1715 |
| 1716 } // namespace blink | 1716 } // namespace blink |
| OLD | NEW |