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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 ASSERT(m_frame->document()); | 418 ASSERT(m_frame->document()); |
419 applyCommand(ReplaceSelectionCommand::create(*m_frame->document(), fragment,
options, EditActionPaste)); | 419 applyCommand(ReplaceSelectionCommand::create(*m_frame->document(), fragment,
options, EditActionPaste)); |
420 revealSelectionAfterEditingOperation(); | 420 revealSelectionAfterEditingOperation(); |
421 | 421 |
422 if (m_frame->selection().isInPasswordField() || !isContinuousSpellCheckingEn
abled()) | 422 if (m_frame->selection().isInPasswordField() || !isContinuousSpellCheckingEn
abled()) |
423 return; | 423 return; |
424 Node* nodeToCheck = m_frame->selection().rootEditableElement(); | 424 Node* nodeToCheck = m_frame->selection().rootEditableElement(); |
425 if (!nodeToCheck) | 425 if (!nodeToCheck) |
426 return; | 426 return; |
427 | 427 |
428 RefPtr<Range> rangeToCheck = Range::create(m_frame->document(), firstPositio
nInNode(nodeToCheck), lastPositionInNode(nodeToCheck)); | 428 RefPtr<Range> rangeToCheck = Range::create(*m_frame->document(), firstPositi
onInNode(nodeToCheck), lastPositionInNode(nodeToCheck)); |
429 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(resolveT
extCheckingTypeMask(TextCheckingTypeSpelling | TextCheckingTypeGrammar), TextChe
ckingProcessBatch, rangeToCheck, rangeToCheck)); | 429 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(resolveT
extCheckingTypeMask(TextCheckingTypeSpelling | TextCheckingTypeGrammar), TextChe
ckingProcessBatch, rangeToCheck, rangeToCheck)); |
430 } | 430 } |
431 | 431 |
432 void Editor::replaceSelectionWithText(const String& text, bool selectReplacement
, bool smartReplace) | 432 void Editor::replaceSelectionWithText(const String& text, bool selectReplacement
, bool smartReplace) |
433 { | 433 { |
434 replaceSelectionWithFragment(createFragmentFromText(selectedRange().get(), t
ext), selectReplacement, smartReplace, true); | 434 replaceSelectionWithFragment(createFragmentFromText(selectedRange().get(), t
ext), selectReplacement, smartReplace, true); |
435 } | 435 } |
436 | 436 |
437 PassRefPtr<Range> Editor::selectedRange() | 437 PassRefPtr<Range> Editor::selectedRange() |
438 { | 438 { |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1733 if (startOfFirstWord.isNull() || endOfFirstWord.isNull() || startOfLastWord.
isNull() || endOfLastWord.isNull()) | 1733 if (startOfFirstWord.isNull() || endOfFirstWord.isNull() || startOfLastWord.
isNull() || endOfLastWord.isNull()) |
1734 return; | 1734 return; |
1735 | 1735 |
1736 // Now we remove markers on everything between startOfFirstWord and endOfLas
tWord. | 1736 // Now we remove markers on everything between startOfFirstWord and endOfLas
tWord. |
1737 // However, if an autocorrection change a single word to multiple words, we
want to remove correction mark from all the | 1737 // However, if an autocorrection change a single word to multiple words, we
want to remove correction mark from all the |
1738 // resulted words even we only edit one of them. For example, assuming autoc
orrection changes "avantgarde" to "avant | 1738 // resulted words even we only edit one of them. For example, assuming autoc
orrection changes "avantgarde" to "avant |
1739 // garde", we will have CorrectionIndicator marker on both words and on the
whitespace between them. If we then edit garde, | 1739 // garde", we will have CorrectionIndicator marker on both words and on the
whitespace between them. If we then edit garde, |
1740 // we would like to remove the marker from word "avant" and whitespace as we
ll. So we need to get the continous range of | 1740 // we would like to remove the marker from word "avant" and whitespace as we
ll. So we need to get the continous range of |
1741 // of marker that contains the word in question, and remove marker on that w
hole range. | 1741 // of marker that contains the word in question, and remove marker on that w
hole range. |
1742 Document* document = m_frame->document(); | 1742 Document* document = m_frame->document(); |
1743 RefPtr<Range> wordRange = Range::create(document, startOfFirstWord.deepEquiv
alent(), endOfLastWord.deepEquivalent()); | 1743 ASSERT(document); |
| 1744 RefPtr<Range> wordRange = Range::create(*document, startOfFirstWord.deepEqui
valent(), endOfLastWord.deepEquivalent()); |
1744 | 1745 |
1745 document->markers()->removeMarkers(wordRange.get(), DocumentMarker::Spelling
| DocumentMarker::Grammar, DocumentMarkerController::RemovePartiallyOverlapping
Marker); | 1746 document->markers()->removeMarkers(wordRange.get(), DocumentMarker::Spelling
| DocumentMarker::Grammar, DocumentMarkerController::RemovePartiallyOverlapping
Marker); |
1746 } | 1747 } |
1747 | 1748 |
1748 PassRefPtr<Range> Editor::rangeForPoint(const IntPoint& windowPoint) | 1749 PassRefPtr<Range> Editor::rangeForPoint(const IntPoint& windowPoint) |
1749 { | 1750 { |
1750 Document* document = m_frame->documentAtPoint(windowPoint); | 1751 Document* document = m_frame->documentAtPoint(windowPoint); |
1751 if (!document) | 1752 if (!document) |
1752 return 0; | 1753 return 0; |
1753 | 1754 |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 return WebCore::unifiedTextCheckerEnabled(m_frame); | 2228 return WebCore::unifiedTextCheckerEnabled(m_frame); |
2228 } | 2229 } |
2229 | 2230 |
2230 void Editor::toggleOverwriteModeEnabled() | 2231 void Editor::toggleOverwriteModeEnabled() |
2231 { | 2232 { |
2232 m_overwriteModeEnabled = !m_overwriteModeEnabled; | 2233 m_overwriteModeEnabled = !m_overwriteModeEnabled; |
2233 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled); | 2234 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled); |
2234 }; | 2235 }; |
2235 | 2236 |
2236 } // namespace WebCore | 2237 } // namespace WebCore |
OLD | NEW |