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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 #if ENABLE(DELETION_UI) | 542 #if ENABLE(DELETION_UI) |
543 m_deleteButtonController->respondToChangedSelection(oldSelection); | 543 m_deleteButtonController->respondToChangedSelection(oldSelection); |
544 #endif | 544 #endif |
545 m_alternativeTextController->respondToChangedSelection(oldSelection, options
); | 545 m_alternativeTextController->respondToChangedSelection(oldSelection, options
); |
546 } | 546 } |
547 | 547 |
548 void Editor::respondToChangedContents(const VisibleSelection& endingSelection) | 548 void Editor::respondToChangedContents(const VisibleSelection& endingSelection) |
549 { | 549 { |
550 if (AXObjectCache::accessibilityEnabled()) { | 550 if (AXObjectCache::accessibilityEnabled()) { |
551 Node* node = endingSelection.start().deprecatedNode(); | 551 Node* node = endingSelection.start().deprecatedNode(); |
552 if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache()) | 552 if (node) |
553 cache->postNotification(node, AXObjectCache::AXValueChanged, false); | 553 m_frame->document()->axObjectCache()->postNotification(node, AXObjec
tCache::AXValueChanged, false); |
554 } | 554 } |
555 | 555 |
556 updateMarkersForWordsAffectedByEditing(true); | 556 updateMarkersForWordsAffectedByEditing(true); |
557 | 557 |
558 if (client()) | 558 if (client()) |
559 client()->respondToChangedContents(); | 559 client()->respondToChangedContents(); |
560 } | 560 } |
561 | 561 |
562 bool Editor::hasBidiSelection() const | 562 bool Editor::hasBidiSelection() const |
563 { | 563 { |
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2266 while (ContainerNode* parent = root->parentNode()) | 2266 while (ContainerNode* parent = root->parentNode()) |
2267 root = parent; | 2267 root = parent; |
2268 | 2268 |
2269 int paragraphStartIndex = TextIterator::rangeLength(Range::creat
e(m_frame->document(), root, 0, paragraph.paragraphRange()->startContainer(), pa
ragraph.paragraphRange()->startOffset()).get()); | 2269 int paragraphStartIndex = TextIterator::rangeLength(Range::creat
e(m_frame->document(), root, 0, paragraph.paragraphRange()->startContainer(), pa
ragraph.paragraphRange()->startOffset()).get()); |
2270 int paragraphLength = TextIterator::rangeLength(paragraph.paragr
aphRange().get()); | 2270 int paragraphLength = TextIterator::rangeLength(paragraph.paragr
aphRange().get()); |
2271 applyCommand(SpellingCorrectionCommand::create(rangeToReplace, r
esult->replacement)); | 2271 applyCommand(SpellingCorrectionCommand::create(rangeToReplace, r
esult->replacement)); |
2272 // Recalculate newParagraphRange, since SpellingCorrectionComman
d modifies the DOM, such that the original paragraph range is no longer valid. R
adar: 10305315 Bugzilla: 89526 | 2272 // Recalculate newParagraphRange, since SpellingCorrectionComman
d modifies the DOM, such that the original paragraph range is no longer valid. R
adar: 10305315 Bugzilla: 89526 |
2273 RefPtr<Range> newParagraphRange = TextIterator::rangeFromLocatio
nAndLength(toContainerNode(root), paragraphStartIndex, paragraphLength + replace
mentLength - resultLength); | 2273 RefPtr<Range> newParagraphRange = TextIterator::rangeFromLocatio
nAndLength(toContainerNode(root), paragraphStartIndex, paragraphLength + replace
mentLength - resultLength); |
2274 paragraph = TextCheckingParagraph(TextIterator::subrange(newPara
graphRange.get(), resultLocation, replacementLength), newParagraphRange); | 2274 paragraph = TextCheckingParagraph(TextIterator::subrange(newPara
graphRange.get(), resultLocation, replacementLength), newParagraphRange); |
2275 | 2275 |
2276 if (AXObjectCache* cache = m_frame->document()->existingAXObject
Cache()) { | 2276 if (AXObjectCache::accessibilityEnabled()) { |
2277 if (Element* root = m_frame->selection()->selection().rootEd
itableElement()) | 2277 if (Element* root = m_frame->selection()->selection().rootEd
itableElement()) |
2278 cache->postNotification(root, AXObjectCache::AXAutocorre
ctionOccured, true); | 2278 m_frame->document()->axObjectCache()->postNotification(r
oot, AXObjectCache::AXAutocorrectionOccured, true); |
2279 } | 2279 } |
2280 | 2280 |
2281 selectionChanged = true; | 2281 selectionChanged = true; |
2282 offsetDueToReplacement += replacementLength - resultLength; | 2282 offsetDueToReplacement += replacementLength - resultLength; |
2283 if (resultLocation < selectionOffset) { | 2283 if (resultLocation < selectionOffset) { |
2284 selectionOffset += replacementLength - resultLength; | 2284 selectionOffset += replacementLength - resultLength; |
2285 if (ambiguousBoundaryOffset >= 0) | 2285 if (ambiguousBoundaryOffset >= 0) |
2286 ambiguousBoundaryOffset = selectionOffset - 1; | 2286 ambiguousBoundaryOffset = selectionOffset - 1; |
2287 } | 2287 } |
2288 | 2288 |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3097 { | 3097 { |
3098 return m_alternativeTextController->dictationAlternativesForMarker(marker); | 3098 return m_alternativeTextController->dictationAlternativesForMarker(marker); |
3099 } | 3099 } |
3100 | 3100 |
3101 void Editor::applyDictationAlternativelternative(const String& alternativeString
) | 3101 void Editor::applyDictationAlternativelternative(const String& alternativeString
) |
3102 { | 3102 { |
3103 m_alternativeTextController->applyDictationAlternative(alternativeString); | 3103 m_alternativeTextController->applyDictationAlternative(alternativeString); |
3104 } | 3104 } |
3105 | 3105 |
3106 } // namespace WebCore | 3106 } // namespace WebCore |
OLD | NEW |