Frame::editor() should return a reference
https://bugs.webkit.org/show_bug.cgi?id=116037

Reviewed by Darin Adler.

Source/WebCore:

A frame's editor can never be null. Change Frame::editor() to return a reference to reflect this.
Also, make Frame::m_editor a const member variable so nobody will accidentally set it to null.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::hasMisspelling):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(AXAttributeStringSetSpelling):
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::cloneChildNodes):
* dom/Document.cpp:
(WebCore::acceptsEditingFocus):
(WebCore::Document::setFocusedNode):
(WebCore::command):
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::timerFired):
(WebCore::AlternativeTextController::applyDictationAlternative):
* editing/CompositeEditCommand.cpp:
(WebCore::EditCommandComposition::unapply):
(WebCore::EditCommandComposition::reapply):
(WebCore::CompositeEditCommand::apply):
(WebCore::CompositeEditCommand::moveParagraphs):
* editing/DeleteButton.cpp:
(WebCore::DeleteButton::defaultEventHandler):
* editing/DeleteButtonController.cpp:
(WebCore::DeleteButtonController::show):
* editing/DeleteButtonController.h:
(WebCore::DeleteButtonControllerDisableScope::DeleteButtonControllerDisableScope):
(WebCore::DeleteButtonControllerDisableScope::~DeleteButtonControllerDisableScope):
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::mergeParagraphs):
(WebCore::DeleteSelectionCommand::doApply):
* editing/EditCommand.cpp:
(WebCore::EditCommand::EditCommand):
* editing/EditingStyle.cpp:
(WebCore::StyleChange::StyleChange):
* editing/Editor.cpp:
(WebCore::Editor::markMisspellingsAfterTypingToWord):
* editing/EditorCommand.cpp:
(WebCore::applyCommandToFrame):
(WebCore::executeToggleStyle):
(WebCore::executeApplyParagraphStyle):
(WebCore::expandSelectionToGranularity):
(WebCore::stateStyle):
(WebCore::valueStyle):
(WebCore::executeCopy):
(WebCore::executeCut):
(WebCore::executeDefaultParagraphSeparator):
(WebCore::executeDelete):
(WebCore::executeDeleteBackward):
(WebCore::executeDeleteBackwardByDecomposingPreviousCharacter):
(WebCore::executeDeleteForward):
(WebCore::executeDeleteToBeginningOfLine):
(WebCore::executeDeleteToBeginningOfParagraph):
(WebCore::executeDeleteToEndOfLine):
(WebCore::executeDeleteToEndOfParagraph):
(WebCore::executeDeleteToMark):
(WebCore::executeDeleteWordBackward):
(WebCore::executeDeleteWordForward):
(WebCore::executeFindString):
(WebCore::executeForwardDelete):
(WebCore::executeIgnoreSpelling):
(WebCore::executeInsertNewline):
(WebCore::executeMakeTextWritingDirectionLeftToRight):
(WebCore::executeMakeTextWritingDirectionNatural):
(WebCore::executeMakeTextWritingDirectionRightToLeft):
(WebCore::executeToggleOverwrite):
(WebCore::executePaste):
(WebCore::executePasteGlobalSelection):
(WebCore::executePasteAndMatchStyle):
(WebCore::executePasteAsPlainText):
(WebCore::executeRedo):
(WebCore::executeRemoveFormat):
(WebCore::executeSelectToMark):
(WebCore::executeSetMark):
(WebCore::executeStyleWithCSS):
(WebCore::executeUseCSS):
(WebCore::executeSwapWithMark):
(WebCore::executeTakeFindStringFromSelection):
(WebCore::executeTranspose):
(WebCore::executeUndo):
(WebCore::executeYank):
(WebCore::executeYankAndSelect):
(WebCore::supportedCopyCut):
(WebCore::supportedPaste):
(WebCore::enabledVisibleSelection):
(WebCore::enabledVisibleSelectionAndMark):
(WebCore::enableCaretInEditableText):
(WebCore::enabledCopy):
(WebCore::enabledCut):
(WebCore::enabledInEditableText):
(WebCore::enabledDelete):
(WebCore::enabledPaste):
(WebCore::enabledRedo):
(WebCore::enabledTakeFindStringFromSelection):
(WebCore::enabledUndo):
(WebCore::stateOrderedList):
(WebCore::stateStyleWithCSS):
(WebCore::stateUnorderedList):
(WebCore::valueDefaultParagraphSeparator):
* editing/FrameSelection.cpp:
(WebCore::shouldAlwaysUseDirectionalSelection):
(WebCore::FrameSelection::setSelection):
(WebCore::FrameSelection::nextWordPositionForPlatform):
(WebCore::FrameSelection::modifyMovingRight):
(WebCore::FrameSelection::modifyMovingLeft):
(WebCore::FrameSelection::modify):
(WebCore::shouldStopBlinkingDueToTypingCommand):
(WebCore::FrameSelection::shouldDeleteSelection):
(WebCore::FrameSelection::shouldChangeSelection):
* editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::doApply):
* editing/SpellChecker.cpp:
(WebCore::SpellChecker::didCheck):
* editing/SpellingCorrectionCommand.cpp:
* editing/TypingCommand.cpp:
(WebCore::TypingCommand::insertText):
(WebCore::TypingCommand::lastTypingCommandIfStillOpenForTyping):
(WebCore::TypingCommand::markMisspellingsAfterTyping):
(WebCore::TypingCommand::typingAddedToOpenCommand):
(WebCore::TypingCommand::deleteKeyPressed):
(WebCore::TypingCommand::forwardDeleteKeyPressed):
* editing/htmlediting.cpp:
(WebCore::createDefaultParagraphElement):
* editing/mac/EditorMac.mm:
(WebCore::Editor::pasteWithPasteboard):
* editing/markup.cpp:
(WebCore::createMarkup):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::endEditing):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::subtreeHasChanged):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::handleKeydownEvent):
(WebCore::TextFieldInputType::didSetValueByUserEdit):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::closeURL):
(WebCore::FrameLoader::didOpenURL):
(WebCore::FrameLoader::clear):
* page/ContextMenuController.cpp:
(WebCore::insertUnicodeCharacter):
(WebCore::ContextMenuController::contextMenuItemSelected):
(WebCore::ContextMenuController::populate):
(WebCore::ContextMenuController::checkOrEnableIfNeeded):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::find):
* page/DragController.cpp:
(WebCore::DragController::dispatchTextInputEventFor):
(WebCore::DragController::concludeEditDrag):
(WebCore::DragController::startDrag):
* page/EventHandler.cpp:
(WebCore::EventHandler::selectClosestWordFromMouseEvent):
(WebCore::EventHandler::handleMousePressEventSingleClick):
(WebCore::EventHandler::handlePasteGlobalSelection):
(WebCore::EventHandler::sendContextMenuEvent):
(WebCore::EventHandler::sendContextMenuEventForKey):
(WebCore::EventHandler::keyEvent):
(WebCore::EventHandler::defaultKeyboardEventHandler):
(WebCore::EventHandler::defaultTextInputEventHandler):
(WebCore::EventHandler::defaultBackspaceEventHandler):
* page/FocusController.cpp:
(WebCore::relinquishesEditingFocus):
* page/Frame.cpp:
(WebCore::Frame::rangeForPoint):
* page/Frame.h:
(Frame):
(WebCore::Frame::editor):
* page/Page.cpp:
(WebCore::Page::findString):
(WebCore::Page::findStringMatchingRanges):
(WebCore::Page::rangeOfString):
(WebCore::Page::markAllMatchesForText):
(WebCore::Page::setDeviceScaleFactor):
* platform/mac/ClipboardMac.mm:
(WebCore::ClipboardMac::writeRange):
* platform/mac/DragDataMac.mm:
(WebCore::DragData::asURL):
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::getStringSelection):
(WebCore::Pasteboard::getDataSelection):
(WebCore::Pasteboard::writeSelectionForTypes):
(WebCore::writeURLForTypes):
(WebCore::Pasteboard::plainText):
(WebCore::documentFragmentWithRTF):
(WebCore::Pasteboard::documentFragment):
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::dictationAlternatives):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paint):
(WebCore::InlineTextBox::paintTextMatchMarker):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::positionForPointWithInlineChildren):
* testing/Internals.cpp:
(WebCore::spellchecker):
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::hasSpellingMarker):
(WebCore::Internals::hasAutocorrectedMarker):
(WebCore::Internals::setContinuousSpellCheckingEnabled):
(WebCore::Internals::setAutomaticQuoteSubstitutionEnabled):
(WebCore::Internals::setAutomaticLinkDetectionEnabled):
(WebCore::Internals::setAutomaticDashSubstitutionEnabled):
(WebCore::Internals::setAutomaticTextReplacementEnabled):
(WebCore::Internals::setAutomaticSpellingCorrectionEnabled):
(WebCore::Internals::isOverwriteModeEnabled):
(WebCore::Internals::toggleOverwriteModeEnabled):
(WebCore::Internals::hasGrammarMarker):

Source/WebKit/blackberry:

* WebCoreSupport/EditorClientBlackBerry.cpp:
(WebCore::EditorClientBlackBerry::shouldSpellCheckFocusedField):
(WebCore::EditorClientBlackBerry::handleKeyboardEvent):
* WebKitSupport/DOMSupport.cpp:
(BlackBerry::WebKit::DOMSupport::elementHasContinuousSpellCheckingEnabled):
* WebKitSupport/InPageSearchManager.cpp:
(BlackBerry::WebKit::InPageSearchManager::findAndMarkText):
(BlackBerry::WebKit::InPageSearchManager::scopeStringMatches):
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::selectedText):

Source/WebKit/efl:

* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
(DumpRenderTreeSupportEfl::executeCoreCommandByName):
(DumpRenderTreeSupportEfl::isCommandEnabled):
* WebCoreSupport/EditorClientEfl.cpp:
(WebCore::EditorClientEfl::respondToChangedSelection):
(WebCore::EditorClientEfl::handleEditingKeyboardEvent):
* ewk/ewk_frame.cpp:
(ewk_frame_editable_set):
(ewk_frame_selection_get):
(ewk_frame_text_search):
(ewk_frame_text_matches_mark):
(ewk_frame_text_matches_highlight_set):
(ewk_frame_text_matches_highlight_get):
* ewk/ewk_view.cpp:
(ewk_view_selection_get):
(ewk_view_editor_command_execute):

Source/WebKit/gtk:

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::paint):
* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::executeCoreCommandByName):
(DumpRenderTreeSupportGtk::isCommandEnabled):
* WebCoreSupport/EditorClientGtk.cpp:
(WebKit::EditorClient::respondToChangedSelection):
(WebKit::EditorClient::executePendingEditorCommands):
(WebKit::EditorClient::handleKeyboardEvent):
* WebCoreSupport/WebViewInputMethodFilter.cpp:
(WebKit::WebViewInputMethodFilter::canEdit):
(WebKit::WebViewInputMethodFilter::confirmCompositionText):
(WebKit::WebViewInputMethodFilter::confirmCurrentComposition):
(WebKit::WebViewInputMethodFilter::cancelCurrentComposition):
(WebKit::WebViewInputMethodFilter::setPreedit):
* webkit/webkitwebframe.cpp:
(webkit_web_frame_replace_selection):
* webkit/webkitwebview.cpp:
(getLocationForKeyboardGeneratedContextMenu):
(webkit_web_view_focus_in_event):
(webkit_web_view_real_select_all):
(webkit_web_view_real_cut_clipboard):
(webkit_web_view_real_copy_clipboard):
(webkit_web_view_real_undo):
(webkit_web_view_real_redo):
(webkit_web_view_real_paste_clipboard):
(webkit_web_view_set_highlight_text_matches):
(webkit_web_view_can_cut_clipboard):
(webkit_web_view_can_copy_clipboard):
(webkit_web_view_can_paste_clipboard):
(webkit_web_view_delete_selection):
(webkit_web_view_set_editable):
(webkit_web_view_can_undo):
(webkit_web_view_can_redo):

Source/WebKit/mac:

* WebView/WebFrame.mm:
(-[WebFrame _selectedString]):
(-[WebFrame _firstRectForDOMRange:]):
(-[WebFrame _markDOMRange]):
(-[WebFrame _insertParagraphSeparatorInQuotedContent]):
(-[WebFrame _setTypingStyle:withUndoAction:]):
(-[WebFrame _replaceSelectionWithFragment:selectReplacement:smartReplace:matchStyle:]):
* WebView/WebHTMLRepresentation.mm:
(-[WebHTMLRepresentation finishedLoadingWithDataSource:]):
* WebView/WebHTMLView.mm:
(-[WebHTMLView _pasteWithPasteboard:allowPlainText:]):
(-[WebHTMLView _shouldDeleteRange:]):
(-[WebHTMLView _canEdit]):
(-[WebHTMLView _canEditRichly]):
(-[WebHTMLView _insertOrderedList]):
(-[WebHTMLView _insertUnorderedList]):
(-[WebHTMLView _canIncreaseSelectionListLevel]):
(-[WebHTMLView _canDecreaseSelectionListLevel]):
(-[WebHTMLView _increaseSelectionListLevel]):
(-[WebHTMLView _increaseSelectionListLevelOrdered]):
(-[WebHTMLView _increaseSelectionListLevelUnordered]):
(-[WebHTMLView _decreaseSelectionListLevel]):
(-[WebHTMLView Editor::coreCommandBySelector:]):
(-[WebHTMLView Editor::coreCommandByName:]):
(-[WebHTMLView validateUserInterfaceItemWithoutDelegate:]):
(-[WebHTMLView becomeFirstResponder]):
(-[WebHTMLView _selectionStartFontAttributesAsRTF]):
(-[WebHTMLView _applyStyleToSelection:withUndoAction:]):
(-[WebHTMLView _changeCSSColorUsingSelector:inRange:]):
(-[WebHTMLView checkSpelling:]):
(-[WebHTMLView showGuessPanel:]):
(-[WebHTMLView toggleBaseWritingDirection:]):
(-[WebHTMLView changeBaseWritingDirection:]):
(-[WebHTMLView _changeBaseWritingDirectionTo:]):
(-[WebHTMLView _updateFontPanel]):
(-[WebHTMLView markedRange]):
(-[WebHTMLView hasMarkedText]):
(-[WebHTMLView unmarkText]):
(-[WebHTMLView setMarkedText:selectedRange:]):
(-[WebHTMLView doCommandBySelector:]):
(-[WebHTMLView insertText:]):
(-[WebHTMLView _updateSelectionForInputManager]):
(-[WebHTMLView countMatchesForText:inDOMRange:options:limit:markMatches:]):
(-[WebHTMLView setMarkedTextMatchesAreHighlighted:]):
(-[WebHTMLView markedTextMatchesAreHighlighted]):
(-[WebHTMLView _findString:options:]):
* WebView/WebView.mm:
(-[WebView _executeCoreCommandByName:value:]):
(-[WebView editableDOMRangeForPoint:]):
(-[WebView setEditable:]):
(-[WebView deleteSelection]):
(-[WebView applyStyle:]):
(-[WebView typingAttributes]):
(-[WebView _simplifyMarkup:endNode:]):
(-[WebView handleAcceptedAlternativeText:]):

Source/WebKit/qt:

* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::executeCoreCommandByName):
(DumpRenderTreeSupportQt::isCommandEnabled):
(DumpRenderTreeSupportQt::firstRectForCharacterRange):
* WebCoreSupport/EditorClientQt.cpp:
(WebCore::EditorClientQt::respondToChangedSelection):
(WebCore::EditorClientQt::registerUndoStep):
(WebCore::EditorClientQt::handleKeyboardEvent):
* WebCoreSupport/QWebPageAdapter.cpp:
(QWebPageAdapter::selectedText):
(QWebPageAdapter::selectedHtml):
(QWebPageAdapter::setContentEditable):

Source/WebKit/win:

* WebCoreSupport/WebContextMenuClient.cpp:
(WebContextMenuClient::searchWithGoogle):
* WebFrame.cpp:
(WebFrame::hasSpellingMarker):
(WebFrame::setTextDirection):
(WebFrame::selectedString):
(WebFrame::selectAll):
* WebView.cpp:
(WebView::execCommand):
(WebView::handleEditingKeyboardEvent):
(WebView::executeCoreCommandByName):
(WebView::selectedText):
(WebView::deleteEnabled):
(WebView::editingEnabled):
(WebView::replaceSelectionWithText):
(WebView::copy):
(WebView::cut):
(WebView::paste):
(WebView::copyURL):
(WebView::delete_):
(WebView::checkSpelling):
(WebView::showGuessPanel):
(WebView::clearUndoRedoOperations):
(WebView::prepareCandidateWindow):
(WebView::resetIME):
(WebView::updateSelectionForIME):
(WebView::onIMEComposition):
(WebView::onIMEEndComposition):
(WebView::onIMERequestCharPosition):
(WebView::onIMERequest):
(WebView::setCompositionForTesting):
(WebView::hasCompositionForTesting):
(WebView::confirmCompositionForTesting):
(WebView::compositionRangeForTesting):
(WebView::firstRectForCharacterRangeForTesting):
(WebView::selectedRangeForTesting):

Source/WebKit/wince:

* WebCoreSupport/EditorClientWinCE.cpp:
(WebKit::EditorClientWinCE::handleEditingKeyboardEvent):

Source/WebKit2:

* WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
(WebKit::WebContextMenuClient::searchWithGoogle):
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::updateGlobalSelection):
* WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp:
(WebKit::WebEditorClient::handleInputMethodKeydown):
* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
(WebKit::WebEditorClient::executePendingEditorCommands):
(WebKit::WebEditorClient::handleKeyboardEvent):
* WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
(WebKit::WebContextMenuClient::searchWithGoogle):
(WebKit::WebContextMenuClient::searchWithSpotlight):
* WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
(WebKit::changeWordCase):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::selectionAsString):
(WebKit::WebFrame::setTextDirection):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState):
(WebKit::WebPage::executeEditingCommand):
(WebKit::WebPage::isEditingCommandEnabled):
(WebKit::WebPage::validateCommand):
(WebKit::WebPage::handleEditingKeyboardEvent):
(WebKit::WebPage::advanceToNextMisspelling):
(WebKit::WebPage::uppercaseWord):
(WebKit::WebPage::lowercaseWord):
(WebKit::WebPage::capitalizeWord):
(WebKit::WebPage::replaceSelectionWithText):
(WebKit::WebPage::handleAlternativeTextUIResult):
(WebKit::WebPage::setCompositionForTesting):
(WebKit::WebPage::hasCompositionForTesting):
(WebKit::WebPage::confirmCompositionForTesting):
(WebKit::WebPage::setComposition):
(WebKit::WebPage::cancelComposition):
* WebProcess/WebPage/efl/WebPageEfl.cpp:
(WebKit::WebPage::confirmComposition):
(WebKit::WebPage::setComposition):
(WebKit::WebPage::cancelComposition):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::executeKeypressCommandsInternal):
(WebKit::WebPage::handleEditingKeyboardEvent):
(WebKit::WebPage::setComposition):
(WebKit::WebPage::confirmComposition):
(WebKit::WebPage::cancelComposition):
(WebKit::WebPage::insertText):
(WebKit::WebPage::insertDictatedText):
(WebKit::WebPage::getMarkedRange):
(WebKit::WebPage::firstRectForCharacterRange):
(WebKit::WebPage::readSelectionFromPasteboard):
(WebKit::WebPage::getStringSelectionForPasteboard):
(WebKit::WebPage::getDataSelectionForPasteboard):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150140 268f45cc-cd09-0410-ab3c-d52691b4dbfc
93 files changed