Changeset 154348 in webkit
- Timestamp:
- Aug 20, 2013 11:59:17 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r154347 r154348 1 2013-08-20 Pratik Solanki <psolanki@apple.com> 2 3 <https://webkit.org/b/120029> Document::markers() should return a reference 4 5 Reviewed by Andreas Kling. 6 7 Document::m_markers is never NULL so return a reference from Document::markers(). Also mark 8 m_markers as const and initialize it in member initialization. 9 10 * dom/Document.cpp: 11 (WebCore::Document::Document): 12 * dom/Document.h: 13 (WebCore::Document::markers): 14 * editing/AlternativeTextController.cpp: 15 (WebCore::AlternativeTextController::isSpellingMarkerAllowed): 16 (WebCore::AlternativeTextController::applyAlternativeTextToRange): 17 (WebCore::AlternativeTextController::respondToUnappliedSpellCorrection): 18 (WebCore::AlternativeTextController::handleAlternativeTextUIResult): 19 (WebCore::AlternativeTextController::respondToChangedSelection): 20 (WebCore::AlternativeTextController::respondToAppliedEditing): 21 (WebCore::AlternativeTextController::respondToUnappliedEditing): 22 (WebCore::AlternativeTextController::markReversed): 23 (WebCore::AlternativeTextController::markCorrection): 24 (WebCore::AlternativeTextController::recordSpellcheckerResponseForModifiedCorrection): 25 (WebCore::AlternativeTextController::markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand): 26 (WebCore::AlternativeTextController::processMarkersOnTextToBeReplacedByResult): 27 (WebCore::AlternativeTextController::applyDictationAlternative): 28 * editing/CompositeEditCommand.cpp: 29 (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers): 30 * editing/DeleteSelectionCommand.cpp: 31 (WebCore::DeleteSelectionCommand::originalStringForAutocorrectionAtBeginningOfSelection): 32 * editing/DictationCommand.cpp: 33 (WebCore::DictationMarkerSupplier::addMarkersToTextNode): 34 * editing/Editor.cpp: 35 (WebCore::Editor::ignoreSpelling): 36 (WebCore::Editor::learnSpelling): 37 (WebCore::Editor::advanceToNextMisspelling): 38 (WebCore::Editor::clearMisspellingsAndBadGrammar): 39 (WebCore::Editor::markAndReplaceFor): 40 (WebCore::Editor::changeBackToReplacedString): 41 (WebCore::Editor::updateMarkersForWordsAffectedByEditing): 42 (WebCore::Editor::countMatchesForText): 43 (WebCore::Editor::setMarkedTextMatchesAreHighlighted): 44 (WebCore::Editor::respondToChangedSelection): 45 (WebCore::Editor::selectionStartHasMarkerFor): 46 * editing/SpellChecker.cpp: 47 (WebCore::SpellChecker::didCheckSucceed): 48 * editing/SplitTextNodeCommand.cpp: 49 (WebCore::SplitTextNodeCommand::doApply): 50 (WebCore::SplitTextNodeCommand::doUnapply): 51 * editing/TextCheckingHelper.cpp: 52 (WebCore::TextCheckingHelper::findFirstMisspelling): 53 (WebCore::TextCheckingHelper::findFirstGrammarDetail): 54 * page/FrameView.cpp: 55 (WebCore::FrameView::getTickmarks): 56 (WebCore::FrameView::paintContents): 57 * page/Page.cpp: 58 (WebCore::Page::unmarkAllTextMatches): 59 * rendering/HitTestResult.cpp: 60 (WebCore::HitTestResult::spellingToolTip): 61 (WebCore::HitTestResult::replacedString): 62 (WebCore::HitTestResult::dictationAlternatives): 63 * rendering/InlineTextBox.cpp: 64 (WebCore::InlineTextBox::paintDocumentMarkers): 65 * rendering/svg/SVGInlineFlowBox.cpp: 66 (WebCore::SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer): 67 * testing/Internals.cpp: 68 (WebCore::Internals::markerCountForNode): 69 (WebCore::Internals::markerAt): 70 (WebCore::Internals::addTextMatchMarker): 71 1 72 2013-08-20 Pratik Solanki <psolanki@apple.com> 2 73 -
trunk/Source/WebCore/dom/Document.cpp
r154286 r154348 421 421 , m_ignoreDestructiveWriteCount(0) 422 422 , m_titleSetExplicitly(false) 423 , m_markers(adoptPtr(new DocumentMarkerController)) 423 424 , m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFired) 424 425 , m_cssTarget(0) … … 490 491 if ((frame && frame->ownerElement()) || !url.isEmpty()) 491 492 setURL(url); 492 493 m_markers = adoptPtr(new DocumentMarkerController);494 493 495 494 if (m_frame) -
trunk/Source/WebCore/dom/Document.h
r154291 r154348 845 845 HTMLHeadElement* head(); 846 846 847 DocumentMarkerController * markers() const { return m_markers.get(); }847 DocumentMarkerController& markers() const { return *m_markers; } 848 848 849 849 bool directionSetOnDocumentElement() const { return m_directionSetOnDocumentElement; } … … 1381 1381 1382 1382 OwnPtr<AXObjectCache> m_axObjectCache; 1383 OwnPtr<DocumentMarkerController> m_markers;1383 const OwnPtr<DocumentMarkerController> m_markers; 1384 1384 1385 1385 Timer<Document> m_updateFocusAppearanceTimer; -
trunk/Source/WebCore/editing/AlternativeTextController.cpp
r154286 r154348 198 198 bool AlternativeTextController::isSpellingMarkerAllowed(PassRefPtr<Range> misspellingRange) const 199 199 { 200 return !m_frame->document()->markers() ->hasMarkers(misspellingRange.get(), DocumentMarker::SpellCheckingExemption);200 return !m_frame->document()->markers().hasMarkers(misspellingRange.get(), DocumentMarker::SpellCheckingExemption); 201 201 } 202 202 … … 290 290 return; 291 291 292 DocumentMarkerController *markers = replacementRange->startContainer()->document()->markers();292 DocumentMarkerController& markers = replacementRange->startContainer()->document()->markers(); 293 293 size_t size = markerTypesToAdd.size(); 294 294 for (size_t i = 0; i < size; ++i) 295 markers ->addMarker(replacementRange.get(), markerTypesToAdd[i], markerDescriptionForAppliedAlternativeText(alternativeType, markerTypesToAdd[i]));295 markers.addMarker(replacementRange.get(), markerTypesToAdd[i], markerDescriptionForAppliedAlternativeText(alternativeType, markerTypesToAdd[i])); 296 296 } 297 297 … … 325 325 RefPtr<Range> range = Range::create(m_frame->document(), m_frame->selection().selection().start(), m_frame->selection().selection().end()); 326 326 327 DocumentMarkerController *markers = m_frame->document()->markers();328 markers ->removeMarkers(range.get(), DocumentMarker::Spelling | DocumentMarker::Autocorrected, DocumentMarkerController::RemovePartiallyOverlappingMarker);329 markers ->addMarker(range.get(), DocumentMarker::Replacement);330 markers ->addMarker(range.get(), DocumentMarker::SpellCheckingExemption);327 DocumentMarkerController& markers = m_frame->document()->markers(); 328 markers.removeMarkers(range.get(), DocumentMarker::Spelling | DocumentMarker::Autocorrected, DocumentMarkerController::RemovePartiallyOverlappingMarker); 329 markers.addMarker(range.get(), DocumentMarker::Replacement); 330 markers.addMarker(range.get(), DocumentMarker::SpellCheckingExemption); 331 331 } 332 332 … … 413 413 applyAlternativeTextToRange(rangeWithAlternative, result, m_alternativeTextInfo.type, markerTypesForAutocorrection()); 414 414 else if (!m_isDismissedByEditing) 415 rangeWithAlternative->startContainer()->document()->markers() ->addMarker(rangeWithAlternative, DocumentMarker::RejectedCorrection, m_alternativeTextInfo.originalText);415 rangeWithAlternative->startContainer()->document()->markers().addMarker(rangeWithAlternative, DocumentMarker::RejectedCorrection, m_alternativeTextInfo.originalText); 416 416 break; 417 417 case AlternativeTextTypeReversion: … … 474 474 475 475 Node* node = position.containerNode(); 476 Vector<DocumentMarker*> markers = node->document()->markers() ->markersFor(node);476 Vector<DocumentMarker*> markers = node->document()->markers().markersFor(node); 477 477 size_t markerCount = markers.size(); 478 478 for (size_t i = 0; i < markerCount; ++i) { … … 489 489 { 490 490 if (command->isTopLevelCommand() && !command->shouldRetainAutocorrectionIndicator()) 491 m_frame->document()->markers() ->removeMarkers(DocumentMarker::CorrectionIndicator);491 m_frame->document()->markers().removeMarkers(DocumentMarker::CorrectionIndicator); 492 492 493 493 markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand(command); … … 502 502 if (!range) 503 503 return; 504 DocumentMarkerController *markers = m_frame->document()->markers();505 markers ->addMarker(range.get(), DocumentMarker::Replacement);506 markers ->addMarker(range.get(), DocumentMarker::SpellCheckingExemption);504 DocumentMarkerController& markers = m_frame->document()->markers(); 505 markers.addMarker(range.get(), DocumentMarker::Replacement); 506 markers.addMarker(range.get(), DocumentMarker::SpellCheckingExemption); 507 507 } 508 508 … … 543 543 void AlternativeTextController::markReversed(PassRefPtr<Range> changedRange) 544 544 { 545 changedRange->startContainer()->document()->markers() ->removeMarkers(changedRange.get(), DocumentMarker::Autocorrected, DocumentMarkerController::RemovePartiallyOverlappingMarker);546 changedRange->startContainer()->document()->markers() ->addMarker(changedRange.get(), DocumentMarker::SpellCheckingExemption);545 changedRange->startContainer()->document()->markers().removeMarkers(changedRange.get(), DocumentMarker::Autocorrected, DocumentMarkerController::RemovePartiallyOverlappingMarker); 546 changedRange->startContainer()->document()->markers().addMarker(changedRange.get(), DocumentMarker::SpellCheckingExemption); 547 547 } 548 548 … … 550 550 { 551 551 Vector<DocumentMarker::MarkerType> markerTypesToAdd = markerTypesForAutocorrection(); 552 DocumentMarkerController *markers = replacedRange->startContainer()->document()->markers();552 DocumentMarkerController& markers = replacedRange->startContainer()->document()->markers(); 553 553 for (size_t i = 0; i < markerTypesToAdd.size(); ++i) { 554 554 DocumentMarker::MarkerType markerType = markerTypesToAdd[i]; 555 555 if (markerType == DocumentMarker::Replacement || markerType == DocumentMarker::Autocorrected) 556 markers ->addMarker(replacedRange.get(), markerType, replacedString);556 markers.addMarker(replacedRange.get(), markerType, replacedString); 557 557 else 558 markers ->addMarker(replacedRange.get(), markerType);558 markers.addMarker(replacedRange.get(), markerType); 559 559 } 560 560 } … … 564 564 if (!rangeOfCorrection) 565 565 return; 566 DocumentMarkerController *markers = rangeOfCorrection->startContainer()->document()->markers();567 Vector<DocumentMarker*> correctedOnceMarkers = markers ->markersInRange(rangeOfCorrection, DocumentMarker::Autocorrected);566 DocumentMarkerController& markers = rangeOfCorrection->startContainer()->document()->markers(); 567 Vector<DocumentMarker*> correctedOnceMarkers = markers.markersInRange(rangeOfCorrection, DocumentMarker::Autocorrected); 568 568 if (correctedOnceMarkers.isEmpty()) 569 569 return; … … 578 578 } 579 579 580 markers ->removeMarkers(rangeOfCorrection, DocumentMarker::Autocorrected, DocumentMarkerController::RemovePartiallyOverlappingMarker);580 markers.removeMarkers(rangeOfCorrection, DocumentMarker::Autocorrected, DocumentMarkerController::RemovePartiallyOverlappingMarker); 581 581 } 582 582 … … 605 605 // whitespace. So if the user types the same original word again at this position, we 606 606 // won't autocorrect it again. 607 m_frame->document()->markers() ->addMarker(precedingCharacterRange.get(), DocumentMarker::DeletedAutocorrection, m_originalStringForLastDeletedAutocorrection);607 m_frame->document()->markers().addMarker(precedingCharacterRange.get(), DocumentMarker::DeletedAutocorrection, m_originalStringForLastDeletedAutocorrection); 608 608 } 609 609 610 610 bool AlternativeTextController::processMarkersOnTextToBeReplacedByResult(const TextCheckingResult* result, Range* rangeWithAlternative, const String& stringToBeReplaced) 611 611 { 612 DocumentMarkerController *markerController = m_frame->document()->markers();613 if (markerController ->hasMarkers(rangeWithAlternative, DocumentMarker::Replacement)) {612 DocumentMarkerController& markerController = m_frame->document()->markers(); 613 if (markerController.hasMarkers(rangeWithAlternative, DocumentMarker::Replacement)) { 614 614 if (result->type == TextCheckingTypeCorrection) 615 615 recordSpellcheckerResponseForModifiedCorrection(rangeWithAlternative, stringToBeReplaced, result->replacement); … … 617 617 } 618 618 619 if (markerController ->hasMarkers(rangeWithAlternative, DocumentMarker::RejectedCorrection))619 if (markerController.hasMarkers(rangeWithAlternative, DocumentMarker::RejectedCorrection)) 620 620 return false; 621 621 … … 624 624 RefPtr<Range> precedingCharacterRange = Range::create(m_frame->document(), precedingCharacterPosition, beginningOfRange); 625 625 626 Vector<DocumentMarker*> markers = markerController ->markersInRange(precedingCharacterRange.get(), DocumentMarker::DeletedAutocorrection);626 Vector<DocumentMarker*> markers = markerController.markersInRange(precedingCharacterRange.get(), DocumentMarker::DeletedAutocorrection); 627 627 628 628 for (size_t i = 0; i < markers.size(); ++i) { … … 747 747 if (!selection || !editor.shouldInsertText(alternativeString, selection.get(), EditorInsertActionPasted)) 748 748 return; 749 DocumentMarkerController *markers = selection->startContainer()->document()->markers();750 Vector<DocumentMarker*> dictationAlternativesMarkers = markers ->markersInRange(selection.get(), DocumentMarker::DictationAlternatives);749 DocumentMarkerController& markers = selection->startContainer()->document()->markers(); 750 Vector<DocumentMarker*> dictationAlternativesMarkers = markers.markersInRange(selection.get(), DocumentMarker::DictationAlternatives); 751 751 for (size_t i = 0; i < dictationAlternativesMarkers.size(); ++i) 752 752 removeDictationAlternativesForMarker(dictationAlternativesMarkers[i]); -
trunk/Source/WebCore/editing/CompositeEditCommand.cpp
r153942 r154348 535 535 { 536 536 RefPtr<Text> node(prpNode); 537 DocumentMarkerController *markerController = document()->markers();537 DocumentMarkerController& markerController = document()->markers(); 538 538 Vector<DocumentMarker> markers; 539 copyMarkers(markerController ->markersInRange(Range::create(document(), node, offset, node, offset + count).get(), DocumentMarker::AllMarkers()), markers);539 copyMarkers(markerController.markersInRange(Range::create(document(), node, offset, node, offset + count).get(), DocumentMarker::AllMarkers()), markers); 540 540 replaceTextInNode(node, offset, count, replacementText); 541 541 RefPtr<Range> newRange = Range::create(document(), node, offset, node, offset + replacementText.length()); 542 542 for (size_t i = 0; i < markers.size(); ++i) 543 markerController ->addMarker(newRange.get(), markers[i].type(), markers[i].description());543 markerController.addMarker(newRange.get(), markers[i].type(), markers[i].description()); 544 544 } 545 545 -
trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp
r154286 r154348 756 756 757 757 RefPtr<Range> rangeOfFirstCharacter = Range::create(document(), startOfSelection.deepEquivalent(), nextPosition.deepEquivalent()); 758 Vector<DocumentMarker*> markers = document()->markers() ->markersInRange(rangeOfFirstCharacter.get(), DocumentMarker::Autocorrected);758 Vector<DocumentMarker*> markers = document()->markers().markersInRange(rangeOfFirstCharacter.get(), DocumentMarker::Autocorrected); 759 759 for (size_t i = 0; i < markers.size(); ++i) { 760 760 const DocumentMarker* marker = markers[i]; -
trunk/Source/WebCore/editing/DictationCommand.cpp
r154286 r154348 65 65 { 66 66 Document* document = textNode->document(); 67 DocumentMarkerController * markerController =document->markers();67 DocumentMarkerController& markerController = document->markers(); 68 68 for (size_t i = 0; i < m_alternatives.size(); ++i) { 69 69 const DictationAlternative& alternative = m_alternatives[i]; 70 markerController ->addMarkerToNode(textNode, alternative.rangeStart + offsetOfInsertion, alternative.rangeLength, DocumentMarker::DictationAlternatives, DictationMarkerDetails::create(textToBeInserted.substring(alternative.rangeStart, alternative.rangeLength), alternative.dictationContext));71 markerController ->addMarkerToNode(textNode, alternative.rangeStart + offsetOfInsertion, alternative.rangeLength, DocumentMarker::SpellCheckingExemption);70 markerController.addMarkerToNode(textNode, alternative.rangeStart + offsetOfInsertion, alternative.rangeLength, DocumentMarker::DictationAlternatives, DictationMarkerDetails::create(textToBeInserted.substring(alternative.rangeStart, alternative.rangeLength), alternative.dictationContext)); 71 markerController.addMarkerToNode(textNode, alternative.rangeStart + offsetOfInsertion, alternative.rangeLength, DocumentMarker::SpellCheckingExemption); 72 72 } 73 73 } -
trunk/Source/WebCore/editing/Editor.cpp
r154286 r154348 1593 1593 RefPtr<Range> selectedRange = m_frame.selection().toNormalizedRange(); 1594 1594 if (selectedRange) 1595 m_frame.document()->markers() ->removeMarkers(selectedRange.get(), DocumentMarker::Spelling);1595 m_frame.document()->markers().removeMarkers(selectedRange.get(), DocumentMarker::Spelling); 1596 1596 1597 1597 String text = selectedText(); … … 1609 1609 RefPtr<Range> selectedRange = m_frame.selection().toNormalizedRange(); 1610 1610 if (selectedRange) 1611 m_frame.document()->markers() ->removeMarkers(selectedRange.get(), DocumentMarker::Spelling);1611 m_frame.document()->markers().removeMarkers(selectedRange.get(), DocumentMarker::Spelling); 1612 1612 1613 1613 String text = selectedText(); … … 1773 1773 1774 1774 client()->updateSpellingUIWithGrammarString(badGrammarPhrase, grammarDetail); 1775 m_frame.document()->markers() ->addMarker(badGrammarRange.get(), DocumentMarker::Grammar, grammarDetail.userDescription);1775 m_frame.document()->markers().addMarker(badGrammarRange.get(), DocumentMarker::Grammar, grammarDetail.userDescription); 1776 1776 } else 1777 1777 #endif … … 1785 1785 1786 1786 client()->updateSpellingUIWithMisspelledWord(misspelledWord); 1787 m_frame.document()->markers() ->addMarker(misspellingRange.get(), DocumentMarker::Spelling);1787 m_frame.document()->markers().addMarker(misspellingRange.get(), DocumentMarker::Spelling); 1788 1788 } 1789 1789 } … … 1918 1918 RefPtr<Range> selectedRange = movingSelection.toNormalizedRange(); 1919 1919 if (selectedRange) { 1920 m_frame.document()->markers() ->removeMarkers(selectedRange.get(), DocumentMarker::Spelling);1921 m_frame.document()->markers() ->removeMarkers(selectedRange.get(), DocumentMarker::Grammar);1920 m_frame.document()->markers().removeMarkers(selectedRange.get(), DocumentMarker::Spelling); 1921 m_frame.document()->markers().removeMarkers(selectedRange.get(), DocumentMarker::Grammar); 1922 1922 } 1923 1923 } … … 2215 2215 if (!m_alternativeTextController->isSpellingMarkerAllowed(misspellingRange)) 2216 2216 continue; 2217 misspellingRange->startContainer()->document()->markers() ->addMarker(misspellingRange.get(), DocumentMarker::Spelling, replacement);2217 misspellingRange->startContainer()->document()->markers().addMarker(misspellingRange.get(), DocumentMarker::Spelling, replacement); 2218 2218 } else if (shouldMarkGrammar && resultType == TextCheckingTypeGrammar && paragraph.checkingRangeCovers(resultLocation, resultLength)) { 2219 2219 ASSERT(resultLength > 0 && resultLocation >= 0); … … 2224 2224 if (paragraph.checkingRangeCovers(resultLocation + detail.location, detail.length)) { 2225 2225 RefPtr<Range> badGrammarRange = paragraph.subrange(resultLocation + detail.location, detail.length); 2226 badGrammarRange->startContainer()->document()->markers() ->addMarker(badGrammarRange.get(), DocumentMarker::Grammar, detail.userDescription);2226 badGrammarRange->startContainer()->document()->markers().addMarker(badGrammarRange.get(), DocumentMarker::Grammar, detail.userDescription); 2227 2227 } 2228 2228 } … … 2333 2333 replaceSelectionWithText(replacedString, false, false); 2334 2334 RefPtr<Range> changedRange = paragraph.subrange(paragraph.checkingStart(), replacedString.length()); 2335 changedRange->startContainer()->document()->markers() ->addMarker(changedRange.get(), DocumentMarker::Replacement, String());2335 changedRange->startContainer()->document()->markers().addMarker(changedRange.get(), DocumentMarker::Replacement, String()); 2336 2336 m_alternativeTextController->markReversed(changedRange.get()); 2337 2337 } … … 2366 2366 { 2367 2367 Document* document = m_frame.document(); 2368 if (!document || !document->markers() ->hasMarkers())2368 if (!document || !document->markers().hasMarkers()) 2369 2369 return; 2370 2370 … … 2432 2432 RefPtr<Range> wordRange = Range::create(document, startOfFirstWord.deepEquivalent(), endOfLastWord.deepEquivalent()); 2433 2433 2434 Vector<DocumentMarker*> markers = document->markers() ->markersInRange(wordRange.get(), DocumentMarker::DictationAlternatives);2434 Vector<DocumentMarker*> markers = document->markers().markersInRange(wordRange.get(), DocumentMarker::DictationAlternatives); 2435 2435 for (size_t i = 0; i < markers.size(); ++i) 2436 2436 m_alternativeTextController->removeDictationAlternativesForMarker(markers[i]); 2437 2437 2438 document->markers() ->removeMarkers(wordRange.get(), DocumentMarker::Spelling | DocumentMarker::Grammar | DocumentMarker::CorrectionIndicator | DocumentMarker::SpellCheckingExemption | DocumentMarker::DictationAlternatives, DocumentMarkerController::RemovePartiallyOverlappingMarker);2439 document->markers() ->clearDescriptionOnMarkersIntersectingRange(wordRange.get(), DocumentMarker::Replacement);2438 document->markers().removeMarkers(wordRange.get(), DocumentMarker::Spelling | DocumentMarker::Grammar | DocumentMarker::CorrectionIndicator | DocumentMarker::SpellCheckingExemption | DocumentMarker::DictationAlternatives, DocumentMarkerController::RemovePartiallyOverlappingMarker); 2439 document->markers().clearDescriptionOnMarkersIntersectingRange(wordRange.get(), DocumentMarker::Replacement); 2440 2440 } 2441 2441 … … 2918 2918 2919 2919 if (markMatches) 2920 m_frame.document()->markers() ->addMarker(resultRange.get(), DocumentMarker::TextMatch);2920 m_frame.document()->markers().addMarker(resultRange.get(), DocumentMarker::TextMatch); 2921 2921 2922 2922 // Stop looking if we hit the specified limit. A limit of 0 means no limit. … … 2961 2961 2962 2962 m_areMarkedTextMatchesHighlighted = flag; 2963 m_frame.document()->markers() ->repaintMarkers(DocumentMarker::TextMatch);2963 m_frame.document()->markers().repaintMarkers(DocumentMarker::TextMatch); 2964 2964 } 2965 2965 … … 3002 3002 if (!textChecker() || textChecker()->shouldEraseMarkersAfterChangeSelection(TextCheckingTypeSpelling)) { 3003 3003 if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange()) 3004 m_frame.document()->markers() ->removeMarkers(wordRange.get(), DocumentMarker::Spelling);3004 m_frame.document()->markers().removeMarkers(wordRange.get(), DocumentMarker::Spelling); 3005 3005 } 3006 3006 if (!textChecker() || textChecker()->shouldEraseMarkersAfterChangeSelection(TextCheckingTypeGrammar)) { 3007 3007 if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRange()) 3008 m_frame.document()->markers() ->removeMarkers(sentenceRange.get(), DocumentMarker::Grammar);3008 m_frame.document()->markers().removeMarkers(sentenceRange.get(), DocumentMarker::Grammar); 3009 3009 } 3010 3010 } … … 3012 3012 // When continuous spell checking is off, existing markers disappear after the selection changes. 3013 3013 if (!isContinuousSpellCheckingEnabled) 3014 m_frame.document()->markers() ->removeMarkers(DocumentMarker::Spelling);3014 m_frame.document()->markers().removeMarkers(DocumentMarker::Spelling); 3015 3015 if (!isContinuousGrammarCheckingEnabled) 3016 m_frame.document()->markers() ->removeMarkers(DocumentMarker::Grammar);3016 m_frame.document()->markers().removeMarkers(DocumentMarker::Grammar); 3017 3017 3018 3018 notifyComponentsOnChangedSelection(oldSelection, options); … … 3045 3045 unsigned int startOffset = static_cast<unsigned int>(from); 3046 3046 unsigned int endOffset = static_cast<unsigned int>(from + length); 3047 Vector<DocumentMarker*> markers = m_frame.document()->markers() ->markersFor(node);3047 Vector<DocumentMarker*> markers = m_frame.document()->markers().markersFor(node); 3048 3048 for (size_t i = 0; i < markers.size(); ++i) { 3049 3049 DocumentMarker* marker = markers[i]; -
trunk/Source/WebCore/editing/SpellChecker.cpp
r154219 r154348 233 233 markers |= DocumentMarker::Grammar; 234 234 if (markers) 235 m_frame->document()->markers() ->removeMarkers(m_processingRequest->checkingRange().get(), markers);235 m_frame->document()->markers().removeMarkers(m_processingRequest->checkingRange().get(), markers); 236 236 } 237 237 didCheck(sequence, results); -
trunk/Source/WebCore/editing/SplitTextNodeCommand.cpp
r142375 r154348 61 61 m_text1 = Text::create(document(), prefixText); 62 62 ASSERT(m_text1); 63 document()->markers() ->copyMarkers(m_text2.get(), 0, m_offset, m_text1.get(), 0);63 document()->markers().copyMarkers(m_text2.get(), 0, m_offset, m_text1.get(), 0); 64 64 65 65 insertText1AndTrimText2(); … … 77 77 m_text2->insertData(0, prefixText, ASSERT_NO_EXCEPTION); 78 78 79 document()->markers() ->copyMarkers(m_text1.get(), 0, prefixText.length(), m_text2.get(), 0);79 document()->markers().copyMarkers(m_text1.get(), 0, prefixText.length(), m_text2.get(), 0); 80 80 m_text1->remove(ASSERT_NO_EXCEPTION); 81 81 } -
trunk/Source/WebCore/editing/TextCheckingHelper.cpp
r154219 r154348 276 276 277 277 // Store marker for misspelled word. 278 misspellingRange->startContainer()->document()->markers() ->addMarker(misspellingRange.get(), DocumentMarker::Spelling);278 misspellingRange->startContainer()->document()->markers().addMarker(misspellingRange.get(), DocumentMarker::Spelling); 279 279 280 280 // Bail out if we're marking only the first misspelling, and not all instances. … … 438 438 if (markAll) { 439 439 RefPtr<Range> badGrammarRange = TextIterator::subrange(m_range.get(), badGrammarPhraseLocation - startOffset + detail->location, detail->length); 440 badGrammarRange->startContainer()->document()->markers() ->addMarker(badGrammarRange.get(), DocumentMarker::Grammar, detail->userDescription);440 badGrammarRange->startContainer()->document()->markers().addMarker(badGrammarRange.get(), DocumentMarker::Grammar, detail->userDescription); 441 441 } 442 442 -
trunk/Source/WebCore/page/FrameView.cpp
r154286 r154348 3066 3066 void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const 3067 3067 { 3068 tickmarks = frame().document()->markers() ->renderedRectsForMarkers(DocumentMarker::TextMatch);3068 tickmarks = frame().document()->markers().renderedRectsForMarkers(DocumentMarker::TextMatch); 3069 3069 } 3070 3070 … … 3543 3543 3544 3544 if (m_paintBehavior == PaintBehaviorNormal) 3545 document->markers() ->invalidateRenderedRectsForMarkersInRect(rect);3545 document->markers().invalidateRenderedRectsForMarkersInRect(rect); 3546 3546 3547 3547 if (document->printing()) -
trunk/Source/WebCore/page/Page.cpp
r154291 r154348 699 699 Frame* frame = mainFrame(); 700 700 do { 701 frame->document()->markers() ->removeMarkers(DocumentMarker::TextMatch);701 frame->document()->markers().removeMarkers(DocumentMarker::TextMatch); 702 702 frame = incrementFrame(frame, true, false); 703 703 } while (frame); -
trunk/Source/WebCore/rendering/HitTestResult.cpp
r154286 r154348 197 197 return String(); 198 198 199 DocumentMarker* marker = m_innerNonSharedNode->document()->markers() ->markerContainingPoint(m_hitTestLocation.point(), DocumentMarker::Grammar);199 DocumentMarker* marker = m_innerNonSharedNode->document()->markers().markerContainingPoint(m_hitTestLocation.point(), DocumentMarker::Grammar); 200 200 if (!marker) 201 201 return String(); … … 213 213 return String(); 214 214 215 DocumentMarker* marker = m_innerNonSharedNode->document()->markers() ->markerContainingPoint(m_hitTestLocation.point(), DocumentMarker::Replacement);215 DocumentMarker* marker = m_innerNonSharedNode->document()->markers().markerContainingPoint(m_hitTestLocation.point(), DocumentMarker::Replacement); 216 216 if (!marker) 217 217 return String(); … … 663 663 return Vector<String>(); 664 664 665 DocumentMarker* marker = m_innerNonSharedNode->document()->markers() ->markerContainingPoint(pointInInnerNodeFrame(), DocumentMarker::DictationAlternatives);665 DocumentMarker* marker = m_innerNonSharedNode->document()->markers().markerContainingPoint(pointInInnerNodeFrame(), DocumentMarker::DictationAlternatives); 666 666 if (!marker) 667 667 return Vector<String>(); -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r154272 r154348 1416 1416 return; 1417 1417 1418 Vector<DocumentMarker*> markers = renderer()->document()->markers() ->markersFor(renderer()->node());1418 Vector<DocumentMarker*> markers = renderer()->document()->markers().markersFor(renderer()->node()); 1419 1419 Vector<DocumentMarker*>::const_iterator markerIt = markers.begin(); 1420 1420 -
trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp
r152827 r154348 93 93 AffineTransform fragmentTransform; 94 94 Document* document = textRenderer->document(); 95 Vector<DocumentMarker*> markers = document->markers() ->markersFor(textRenderer->node());95 Vector<DocumentMarker*> markers = document->markers().markersFor(textRenderer->node()); 96 96 97 97 Vector<DocumentMarker*>::iterator markerEnd = markers.end(); -
trunk/Source/WebCore/testing/Internals.cpp
r154327 r154348 818 818 } 819 819 820 return node->document()->markers() ->markersFor(node, markerTypes).size();820 return node->document()->markers().markersFor(node, markerTypes).size(); 821 821 } 822 822 … … 834 834 } 835 835 836 Vector<DocumentMarker*> markers = node->document()->markers() ->markersFor(node, markerTypes);836 Vector<DocumentMarker*> markers = node->document()->markers().markersFor(node, markerTypes); 837 837 if (markers.size() <= index) 838 838 return 0; … … 859 859 { 860 860 range->ownerDocument()->updateLayoutIgnorePendingStylesheets(); 861 range->ownerDocument()->markers() ->addTextMatchMarker(range, isActive);861 range->ownerDocument()->markers().addTextMatchMarker(range, isActive); 862 862 } 863 863 -
trunk/Source/WebKit/blackberry/ChangeLog
r154286 r154348 1 2013-08-20 Pratik Solanki <psolanki@apple.com> 2 3 <https://webkit.org/b/120029> Document::markers() should return a reference 4 5 Reviewed by Andreas Kling. 6 7 Document::m_markers is never NULL so return a reference from Document::markers(). Also mark 8 m_markers as const and initialize it in member initialization. 9 10 * WebKitSupport/InPageSearchManager.cpp: 11 (BlackBerry::WebKit::InPageSearchManager::findAndMarkText): 12 (BlackBerry::WebKit::InPageSearchManager::setActiveMatchAndMarker): 13 (BlackBerry::WebKit::InPageSearchManager::scopeStringMatches): 14 * WebKitSupport/InputHandler.cpp: 15 (BlackBerry::WebKit::InputHandler::shouldRequestSpellCheckingOptionsForPoint): 16 (BlackBerry::WebKit::InputHandler::addAttributedTextMarker): 17 (BlackBerry::WebKit::InputHandler::removeAttributedTextMarker): 18 1 19 2013-08-19 Pratik Solanki <psolanki@apple.com> 2 20 -
trunk/Source/WebKit/blackberry/WebKitSupport/InPageSearchManager.cpp
r154286 r154348 190 190 // because scopeStringMatches does not add any markers, it only counts the number. 191 191 // No need to unmarkAllTextMatches, it is already done from the caller because of newSearch 192 m_activeMatch->ownerDocument()->markers() ->addTextMatchMarker(m_activeMatch.get(), true);192 m_activeMatch->ownerDocument()->markers().addTextMatchMarker(m_activeMatch.get(), true); 193 193 frame->editor().setMarkedTextMatchesAreHighlighted(true /* highlight */); 194 194 } … … 223 223 // all matches but count them. 224 224 m_webPage->m_page->unmarkAllTextMatches(); 225 m_activeMatch->ownerDocument()->markers() ->addTextMatchMarker(m_activeMatch.get(), true);225 m_activeMatch->ownerDocument()->markers().addTextMatchMarker(m_activeMatch.get(), true); 226 226 frame->editor().setMarkedTextMatchesAreHighlighted(true /* highlight */); 227 227 } … … 249 249 if (m_activeMatch.get()) { 250 250 if (Document* doc = m_activeMatch->ownerDocument()) 251 doc->markers() ->setMarkersActive(m_activeMatch.get(), false);251 doc->markers().setMarkersActive(m_activeMatch.get(), false); 252 252 } 253 253 … … 255 255 if (m_activeMatch.get()) { 256 256 if (Document* doc = m_activeMatch->ownerDocument()) 257 doc->markers() ->setMarkersActive(m_activeMatch.get(), true);257 doc->markers().setMarkersActive(m_activeMatch.get(), true); 258 258 } 259 259 } … … 344 344 } 345 345 if (!locateActiveMatchOnly && m_highlightAllMatches) 346 resultRange->ownerDocument()->markers() ->addTextMatchMarker(resultRange.get(), foundActiveMatch);346 resultRange->ownerDocument()->markers().addTextMatchMarker(resultRange.get(), foundActiveMatch); 347 347 348 348 searchRange->setStart(resultRange->endContainer(ec), resultRange->endOffset(ec), ec); -
trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp
r154286 r154348 765 765 ASSERT(document); 766 766 767 RenderedDocumentMarker* marker = document->markers() ->renderedMarkerContainingPoint(contentPos, DocumentMarker::Spelling);767 RenderedDocumentMarker* marker = document->markers().renderedMarkerContainingPoint(contentPos, DocumentMarker::Spelling); 768 768 if (!marker) 769 769 return false; … … 1957 1957 1958 1958 RefPtr<Range> markerRange = DOMSupport::visibleSelectionForRangeInputElement(m_currentFocusElement.get(), start, end).toNormalizedRange(); 1959 m_currentFocusElement->document()->markers() ->addMarker(markerRange.get(), DocumentMarker::AttributeText, WTF::String("Input Marker"), style);1959 m_currentFocusElement->document()->markers().addMarker(markerRange.get(), DocumentMarker::AttributeText, WTF::String("Input Marker"), style); 1960 1960 } 1961 1961 … … 1964 1964 // Remove all attribute text markers. 1965 1965 if (m_currentFocusElement && m_currentFocusElement->document()) 1966 m_currentFocusElement->document()->markers() ->removeMarkers(DocumentMarker::AttributeText);1966 m_currentFocusElement->document()->markers().removeMarkers(DocumentMarker::AttributeText); 1967 1967 1968 1968 m_composingTextStart = 0; -
trunk/Source/WebKit/efl/ChangeLog
r154286 r154348 1 2013-08-20 Pratik Solanki <psolanki@apple.com> 2 3 <https://webkit.org/b/120029> Document::markers() should return a reference 4 5 Reviewed by Andreas Kling. 6 7 Document::m_markers is never NULL so return a reference from Document::markers(). Also mark 8 m_markers as const and initialize it in member initialization. 9 10 * ewk/ewk_frame.cpp: 11 (ewk_frame_text_matches_unmark_all): 12 (ewk_frame_text_matches_nth_pos_get): 13 1 14 2013-08-19 Pratik Solanki <psolanki@apple.com> 2 15 -
trunk/Source/WebKit/efl/ewk/ewk_frame.cpp
r154286 r154348 519 519 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false); 520 520 521 smartData->frame->document()->markers() ->removeMarkers(WebCore::DocumentMarker::TextMatch);521 smartData->frame->document()->markers().removeMarkers(WebCore::DocumentMarker::TextMatch); 522 522 return true; 523 523 } … … 559 559 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false); 560 560 561 Vector<WebCore::IntRect> intRects = smartData->frame->document()->markers() ->renderedRectsForMarkers(WebCore::DocumentMarker::TextMatch);561 Vector<WebCore::IntRect> intRects = smartData->frame->document()->markers().renderedRectsForMarkers(WebCore::DocumentMarker::TextMatch); 562 562 563 563 /* remove useless values */ -
trunk/Source/WebKit/mac/ChangeLog
r154314 r154348 1 2013-08-20 Pratik Solanki <psolanki@apple.com> 2 3 <https://webkit.org/b/120029> Document::markers() should return a reference 4 5 Reviewed by Andreas Kling. 6 7 Document::m_markers is never NULL so return a reference from Document::markers(). Also mark 8 m_markers as const and initialize it in member initialization. 9 10 * WebView/WebFrame.mm: 11 (-[WebFrame _unmarkAllBadGrammar]): 12 (-[WebFrame _unmarkAllMisspellings]): 13 * WebView/WebHTMLView.mm: 14 (-[WebHTMLView unmarkAllTextMatches]): 15 (-[WebHTMLView rectsForTextMatches]): 16 1 17 2013-08-19 Ryosuke Niwa <rniwa@webkit.org> 2 18 -
trunk/Source/WebKit/mac/WebView/WebFrame.mm
r154286 r154348 394 394 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { 395 395 if (Document* document = frame->document()) 396 document->markers() ->removeMarkers(DocumentMarker::Grammar);396 document->markers().removeMarkers(DocumentMarker::Grammar); 397 397 } 398 398 } … … 403 403 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { 404 404 if (Document* document = frame->document()) 405 document->markers() ->removeMarkers(DocumentMarker::Spelling);405 document->markers().removeMarkers(DocumentMarker::Spelling); 406 406 } 407 407 } -
trunk/Source/WebKit/mac/WebView/WebHTMLView.mm
r154314 r154348 6082 6082 if (!document) 6083 6083 return; 6084 document->markers() ->removeMarkers(DocumentMarker::TextMatch);6084 document->markers().removeMarkers(DocumentMarker::TextMatch); 6085 6085 } 6086 6086 … … 6094 6094 return [NSArray array]; 6095 6095 6096 Vector<IntRect> rects = document->markers() ->renderedRectsForMarkers(DocumentMarker::TextMatch);6096 Vector<IntRect> rects = document->markers().renderedRectsForMarkers(DocumentMarker::TextMatch); 6097 6097 unsigned count = rects.size(); 6098 6098 NSMutableArray *result = [NSMutableArray arrayWithCapacity:count]; -
trunk/Source/WebKit/win/ChangeLog
r154286 r154348 1 2013-08-20 Pratik Solanki <psolanki@apple.com> 2 3 <https://webkit.org/b/120029> Document::markers() should return a reference 4 5 Reviewed by Andreas Kling. 6 7 Document::m_markers is never NULL so return a reference from Document::markers(). Also mark 8 m_markers as const and initialize it in member initialization. 9 10 * WebFrame.cpp: 11 (WebFrame::unmarkAllMisspellings): 12 (WebFrame::unmarkAllBadGrammar): 13 * WebView.cpp: 14 (WebView::rectsForTextMatches): 15 1 16 2013-08-19 Pratik Solanki <psolanki@apple.com> 2 17 -
trunk/Source/WebKit/win/WebFrame.cpp
r154286 r154348 2551 2551 return; 2552 2552 2553 doc->markers() ->removeMarkers(DocumentMarker::Spelling);2553 doc->markers().removeMarkers(DocumentMarker::Spelling); 2554 2554 } 2555 2555 } … … 2563 2563 return; 2564 2564 2565 doc->markers() ->removeMarkers(DocumentMarker::Grammar);2565 doc->markers().removeMarkers(DocumentMarker::Grammar); 2566 2566 } 2567 2567 } -
trunk/Source/WebKit/win/WebView.cpp
r154286 r154348 3539 3539 if (Document* document = frame->document()) { 3540 3540 IntRect visibleRect = frame->view()->visibleContentRect(); 3541 Vector<IntRect> frameRects = document->markers() ->renderedRectsForMarkers(DocumentMarker::TextMatch);3541 Vector<IntRect> frameRects = document->markers().renderedRectsForMarkers(DocumentMarker::TextMatch); 3542 3542 IntPoint frameOffset(-frame->view()->scrollOffset().width(), -frame->view()->scrollOffset().height()); 3543 3543 frameOffset = frame->view()->convertToContainingWindow(frameOffset); -
trunk/Source/WebKit2/ChangeLog
r154335 r154348 1 2013-08-20 Pratik Solanki <psolanki@apple.com> 2 3 <https://webkit.org/b/120029> Document::markers() should return a reference 4 5 Reviewed by Andreas Kling. 6 7 Document::m_markers is never NULL so return a reference from Document::markers(). Also mark 8 m_markers as const and initialize it in member initialization. 9 10 * WebProcess/WebPage/FindController.cpp: 11 (WebKit::FindController::rectsForTextMatches): 12 * WebProcess/WebPage/WebPage.cpp: 13 (WebKit::WebPage::unmarkAllMisspellings): 14 (WebKit::WebPage::unmarkAllBadGrammar): 15 1 16 2013-08-20 Gavin Barraclough <barraclough@apple.com> 2 17 -
trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp
r154286 r154348 357 357 358 358 IntRect visibleRect = frame->view()->visibleContentRect(); 359 Vector<IntRect> frameRects = document->markers() ->renderedRectsForMarkers(DocumentMarker::TextMatch);359 Vector<IntRect> frameRects = document->markers().renderedRectsForMarkers(DocumentMarker::TextMatch); 360 360 IntPoint frameOffset(-frame->view()->scrollOffsetRelativeToDocument().width(), -frame->view()->scrollOffsetRelativeToDocument().height()); 361 361 frameOffset = frame->view()->convertToContainingWindow(frameOffset); -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r154286 r154348 2952 2952 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { 2953 2953 if (Document* document = frame->document()) 2954 document->markers() ->removeMarkers(DocumentMarker::Spelling);2954 document->markers().removeMarkers(DocumentMarker::Spelling); 2955 2955 } 2956 2956 } … … 2960 2960 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { 2961 2961 if (Document* document = frame->document()) 2962 document->markers() ->removeMarkers(DocumentMarker::Grammar);2962 document->markers().removeMarkers(DocumentMarker::Grammar); 2963 2963 } 2964 2964 }
Note: See TracChangeset
for help on using the changeset viewer.