| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 if (!startContainer || !endContainer) | 251 if (!startContainer || !endContainer) |
| 252 return false; | 252 return false; |
| 253 | 253 |
| 254 if (!startContainer->hasEditableStyle() || !endContainer->hasEditableStyle()
) | 254 if (!startContainer->hasEditableStyle() || !endContainer->hasEditableStyle()
) |
| 255 return false; | 255 return false; |
| 256 | 256 |
| 257 if (range.isCollapsed()) { | 257 if (range.isCollapsed()) { |
| 258 VisiblePosition start(range.startPosition(), DOWNSTREAM); | 258 VisiblePosition start(range.startPosition(), DOWNSTREAM); |
| 259 VisiblePosition previous = start.previous(); | 259 VisiblePosition previous = start.previous(); |
| 260 // FIXME: We sometimes allow deletions at the start of editable roots, l
ike when the caret is in an empty list item. | 260 // FIXME: We sometimes allow deletions at the start of editable roots, l
ike when the caret is in an empty list item. |
| 261 if (previous.isNull() || previous.deepEquivalent().deprecatedNode()->roo
tEditableElement() != startContainer->rootEditableElement()) | 261 if (previous.isNull() || previous.deepEquivalent().anchorNode()->rootEdi
tableElement() != startContainer->rootEditableElement()) |
| 262 return false; | 262 return false; |
| 263 } | 263 } |
| 264 return true; | 264 return true; |
| 265 } | 265 } |
| 266 | 266 |
| 267 bool Editor::smartInsertDeleteEnabled() const | 267 bool Editor::smartInsertDeleteEnabled() const |
| 268 { | 268 { |
| 269 if (Settings* settings = frame().settings()) | 269 if (Settings* settings = frame().settings()) |
| 270 return settings->smartInsertDeleteEnabled(); | 270 return settings->smartInsertDeleteEnabled(); |
| 271 return false; | 271 return false; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 | 536 |
| 537 void Editor::notifyComponentsOnChangedSelection(const VisibleSelection& oldSelec
tion, FrameSelection::SetSelectionOptions options) | 537 void Editor::notifyComponentsOnChangedSelection(const VisibleSelection& oldSelec
tion, FrameSelection::SetSelectionOptions options) |
| 538 { | 538 { |
| 539 client().respondToChangedSelection(m_frame, frame().selection().selectionTyp
e()); | 539 client().respondToChangedSelection(m_frame, frame().selection().selectionTyp
e()); |
| 540 setStartNewKillRingSequence(true); | 540 setStartNewKillRingSequence(true); |
| 541 } | 541 } |
| 542 | 542 |
| 543 void Editor::respondToChangedContents(const VisibleSelection& endingSelection) | 543 void Editor::respondToChangedContents(const VisibleSelection& endingSelection) |
| 544 { | 544 { |
| 545 if (frame().settings() && frame().settings()->accessibilityEnabled()) { | 545 if (frame().settings() && frame().settings()->accessibilityEnabled()) { |
| 546 Node* node = endingSelection.start().deprecatedNode(); | 546 Node* node = endingSelection.start().anchorNode(); |
| 547 if (AXObjectCache* cache = frame().document()->existingAXObjectCache()) | 547 if (AXObjectCache* cache = frame().document()->existingAXObjectCache()) |
| 548 cache->handleEditableTextContentChanged(node); | 548 cache->handleEditableTextContentChanged(node); |
| 549 } | 549 } |
| 550 | 550 |
| 551 spellChecker().updateMarkersForWordsAffectedByEditing(true); | 551 spellChecker().updateMarkersForWordsAffectedByEditing(true); |
| 552 client().respondToChangedContents(); | 552 client().respondToChangedContents(); |
| 553 } | 553 } |
| 554 | 554 |
| 555 void Editor::removeFormattingAndStyle() | 555 void Editor::removeFormattingAndStyle() |
| 556 { | 556 { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 if (!selection.isContentEditable()) | 757 if (!selection.isContentEditable()) |
| 758 return false; | 758 return false; |
| 759 | 759 |
| 760 spellChecker().updateMarkersForWordsAffectedByEditing(isSpaceOrNewline(text[
0])); | 760 spellChecker().updateMarkersForWordsAffectedByEditing(isSpaceOrNewline(text[
0])); |
| 761 | 761 |
| 762 // Get the selection to use for the event that triggered this insertText. | 762 // Get the selection to use for the event that triggered this insertText. |
| 763 // If the event handler changed the selection, we may want to use a differen
t selection | 763 // If the event handler changed the selection, we may want to use a differen
t selection |
| 764 // that is contained in the event target. | 764 // that is contained in the event target. |
| 765 selection = selectionForCommand(triggeringEvent); | 765 selection = selectionForCommand(triggeringEvent); |
| 766 if (selection.isContentEditable()) { | 766 if (selection.isContentEditable()) { |
| 767 if (Node* selectionStart = selection.start().deprecatedNode()) { | 767 if (Node* selectionStart = selection.start().anchorNode()) { |
| 768 RefPtrWillBeRawPtr<Document> document(selectionStart->document()); | 768 RefPtrWillBeRawPtr<Document> document(selectionStart->document()); |
| 769 | 769 |
| 770 // Insert the text | 770 // Insert the text |
| 771 TypingCommand::Options options = 0; | 771 TypingCommand::Options options = 0; |
| 772 if (selectInsertedText) | 772 if (selectInsertedText) |
| 773 options |= TypingCommand::SelectInsertedText; | 773 options |= TypingCommand::SelectInsertedText; |
| 774 TypingCommand::insertText(*document.get(), text, selection, options,
triggeringEvent && triggeringEvent->isComposition() ? TypingCommand::TextCompos
itionConfirm : TypingCommand::TextCompositionNone); | 774 TypingCommand::insertText(*document.get(), text, selection, options,
triggeringEvent && triggeringEvent->isComposition() ? TypingCommand::TextCompos
itionConfirm : TypingCommand::TextCompositionNone); |
| 775 | 775 |
| 776 // Reveal the current selection | 776 // Reveal the current selection |
| 777 if (LocalFrame* editedFrame = document->frame()) { | 777 if (LocalFrame* editedFrame = document->frame()) { |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 } | 1291 } |
| 1292 | 1292 |
| 1293 DEFINE_TRACE(Editor) | 1293 DEFINE_TRACE(Editor) |
| 1294 { | 1294 { |
| 1295 visitor->trace(m_frame); | 1295 visitor->trace(m_frame); |
| 1296 visitor->trace(m_lastEditCommand); | 1296 visitor->trace(m_lastEditCommand); |
| 1297 visitor->trace(m_mark); | 1297 visitor->trace(m_mark); |
| 1298 } | 1298 } |
| 1299 | 1299 |
| 1300 } // namespace blink | 1300 } // namespace blink |
| OLD | NEW |