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
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 47e4a0f..c6c98b9 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,216 @@
+2013-05-13 Anders Carlsson <andersca@apple.com>
+
+ Frame::editor() should return a reference
+ https://bugs.webkit.org/show_bug.cgi?id=116037
+
+ Reviewed by Darin Adler.
+
+ 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):
+
2013-05-15 Darin Adler <darin@apple.com>
[Mac] Make Clipboard class no longer polymorphic by removing the last virtual functions
diff --git a/Source/WebCore/accessibility/AccessibilityObject.cpp b/Source/WebCore/accessibility/AccessibilityObject.cpp
index e6cf3aa..9d21faa 100644
--- a/Source/WebCore/accessibility/AccessibilityObject.cpp
+++ b/Source/WebCore/accessibility/AccessibilityObject.cpp
@@ -320,11 +320,9 @@
if (!frame)
return false;
- Editor* editor = frame->editor();
- if (!editor)
- return false;
+ Editor& editor = frame->editor();
- TextCheckerClient* textChecker = editor->textChecker();
+ TextCheckerClient* textChecker = editor.textChecker();
if (!textChecker)
return false;
diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp
index b31453d..a33c593 100644
--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp
+++ b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp
@@ -79,7 +79,7 @@
coreObject->setSelectedVisiblePositionRange(coreObject->visiblePositionRangeForRange(PlainTextRange(*position, 0)));
coreObject->setFocused(true);
// FIXME: We should set position to the actual inserted text length, which may be less than that requested.
- if (document->frame()->editor()->insertTextWithoutSendingTextEvent(String::fromUTF8(string).substring(0, length), false, 0))
+ if (document->frame()->editor().insertTextWithoutSendingTextEvent(String::fromUTF8(string).substring(0, length), false, 0))
*position += length;
}
@@ -106,7 +106,7 @@
coreObject->setSelectedVisiblePositionRange(coreObject->visiblePositionRangeForRange(PlainTextRange(startPos, endPos - startPos)));
coreObject->setFocused(true);
- document->frame()->editor()->performDelete();
+ document->frame()->editor().performDelete();
}
static void webkitAccessibleEditableTextPasteText(AtkEditableText*, gint)
diff --git a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm b/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
index 447fc17..9f3a958 100644
--- a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
+++ b/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
@@ -724,7 +724,7 @@
{
if (unifiedTextCheckerEnabled(node->document()->frame())) {
// Check the spelling directly since document->markersForNode() does not store the misspelled marking when the cursor is in a word.
- TextCheckerClient* checker = node->document()->frame()->editor()->textChecker();
+ TextCheckerClient* checker = node->document()->frame()->editor().textChecker();
// checkTextOfParagraph is the only spelling/grammar checker implemented in WK1 and WK2
Vector<TextCheckingResult> results;
@@ -742,7 +742,7 @@
int currentPosition = 0;
while (charLength > 0) {
const UChar* charData = chars + currentPosition;
- TextCheckerClient* checker = node->document()->frame()->editor()->textChecker();
+ TextCheckerClient* checker = node->document()->frame()->editor().textChecker();
int misspellingLocation = -1;
int misspellingLength = 0;
diff --git a/Source/WebCore/dom/Clipboard.cpp b/Source/WebCore/dom/Clipboard.cpp
index 74469f0..9640c3b 100644
--- a/Source/WebCore/dom/Clipboard.cpp
+++ b/Source/WebCore/dom/Clipboard.cpp
@@ -345,7 +345,7 @@
// FIXME: This is a design mistake, a layering violation that should be fixed.
// The code to write the range to a pasteboard should be an Editor function that takes a pasteboard argument.
// FIXME: The frame argument seems redundant, since a Range is in a particular document, which has a corresponding frame.
- m_pasteboard->writeSelection(range, frame->editor()->smartInsertDeleteEnabled() && frame->selection()->granularity() == WordGranularity, frame, IncludeImageAltTextForClipboard);
+ m_pasteboard->writeSelection(range, frame->editor().smartInsertDeleteEnabled() && frame->selection()->granularity() == WordGranularity, frame, IncludeImageAltTextForClipboard);
}
void Clipboard::writePlainText(const String& text)
diff --git a/Source/WebCore/dom/ContainerNode.cpp b/Source/WebCore/dom/ContainerNode.cpp
index a50e15f..0111fe6 100644
--- a/Source/WebCore/dom/ContainerNode.cpp
+++ b/Source/WebCore/dom/ContainerNode.cpp
@@ -833,7 +833,7 @@
#if ENABLE(DELETION_UI)
HTMLElement* deleteButtonContainerElement = 0;
if (Frame* frame = document()->frame())
- deleteButtonContainerElement = frame->editor()->deleteButtonController()->containerElement();
+ deleteButtonContainerElement = frame->editor().deleteButtonController()->containerElement();
cloneChildNodesAvoidingDeleteButton(this, clone, deleteButtonContainerElement);
#else
cloneChildNodesAvoidingDeleteButton(this, clone, 0);
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index da44603..11cf856 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -370,7 +370,7 @@
if (!frame || !root)
return false;
- return frame->editor()->shouldBeginEditing(rangeOfContents(root).get());
+ return frame->editor().shouldBeginEditing(rangeOfContents(root).get());
}
static bool canAccessAncestor(const SecurityOrigin* activeSecurityOrigin, Frame* targetFrame)
@@ -3361,7 +3361,7 @@
return true;
if (oldFocusedNode->isRootEditableElement())
- frame()->editor()->didEndEditing();
+ frame()->editor().didEndEditing();
if (view()) {
Widget* oldWidget = widgetForNode(oldFocusedNode.get());
@@ -3410,7 +3410,7 @@
m_focusedNode->setFocus(true);
if (m_focusedNode->isRootEditableElement())
- frame()->editor()->didBeginEditing();
+ frame()->editor().didBeginEditing();
// eww, I suck. set the qt focus correctly
// ### find a better place in the code for this
@@ -4191,7 +4191,7 @@
document->updateStyleIfNeeded();
- return frame->editor()->command(commandName,
+ return frame->editor().command(commandName,
userInterface ? CommandFromDOMWithUserInterface : CommandFromDOM);
}
diff --git a/Source/WebCore/editing/AlternativeTextController.cpp b/Source/WebCore/editing/AlternativeTextController.cpp
index 613aaf9..9eeee2d 100644
--- a/Source/WebCore/editing/AlternativeTextController.cpp
+++ b/Source/WebCore/editing/AlternativeTextController.cpp
@@ -339,7 +339,7 @@
VisiblePosition start(selection.start(), selection.affinity());
VisiblePosition p = startOfWord(start, LeftWordIfOnBoundary);
VisibleSelection adjacentWords = VisibleSelection(p, start);
- m_frame->editor()->markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeSpelling | TextCheckingTypeReplacement | TextCheckingTypeShowCorrectionPanel, adjacentWords.toNormalizedRange().get(), 0);
+ m_frame->editor().markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeSpelling | TextCheckingTypeReplacement | TextCheckingTypeShowCorrectionPanel, adjacentWords.toNormalizedRange().get(), 0);
}
break;
case AlternativeTextTypeReversion: {
@@ -742,9 +742,9 @@
void AlternativeTextController::applyDictationAlternative(const String& alternativeString)
{
#if USE(DICTATION_ALTERNATIVES)
- Editor* editor = m_frame->editor();
- RefPtr<Range> selection = editor->selectedRange();
- if (!selection || !editor->shouldInsertText(alternativeString, selection.get(), EditorInsertActionPasted))
+ Editor& editor = m_frame->editor();
+ RefPtr<Range> selection = editor.selectedRange();
+ if (!selection || !editor.shouldInsertText(alternativeString, selection.get(), EditorInsertActionPasted))
return;
DocumentMarkerController* markers = selection->startContainer()->document()->markers();
Vector<DocumentMarker*> dictationAlternativesMarkers = markers->markersInRange(selection.get(), DocumentMarker::DictationAlternatives);
diff --git a/Source/WebCore/editing/CompositeEditCommand.cpp b/Source/WebCore/editing/CompositeEditCommand.cpp
index e7f9f00..d22f8b9 100644
--- a/Source/WebCore/editing/CompositeEditCommand.cpp
+++ b/Source/WebCore/editing/CompositeEditCommand.cpp
@@ -115,7 +115,7 @@
m_commands[i - 1]->doUnapply();
}
- frame->editor()->unappliedEditing(this);
+ frame->editor().unappliedEditing(this);
}
void EditCommandComposition::reapply()
@@ -138,7 +138,7 @@
m_commands[i]->doReapply();
}
- frame->editor()->reappliedEditing(this);
+ frame->editor().reappliedEditing(this);
}
void EditCommandComposition::append(SimpleEditCommand* command)
@@ -219,7 +219,7 @@
// Only need to call appliedEditing for top-level commands,
// and TypingCommands do it on their own (see TypingCommand::typingAddedToOpenCommand).
if (!callsAppliedEditingInDoApply())
- frame->editor()->appliedEditing(this);
+ frame->editor().appliedEditing(this);
setShouldRetainAutocorrectionIndicator(false);
}
@@ -1222,7 +1222,7 @@
// FIXME (5098931): We should add a new insert action "WebViewInsertActionMoved" and call shouldInsertFragment here.
setEndingSelection(VisibleSelection(start, end, DOWNSTREAM));
- document()->frame()->editor()->clearMisspellingsAndBadGrammar(endingSelection());
+ document()->frame()->editor().clearMisspellingsAndBadGrammar(endingSelection());
deleteSelection(false, false, false, false);
ASSERT(destination.deepEquivalent().anchorNode()->inDocument());
@@ -1255,7 +1255,7 @@
options |= ReplaceSelectionCommand::MatchStyle;
applyCommandToComposite(ReplaceSelectionCommand::create(document(), fragment, options));
- document()->frame()->editor()->markMisspellingsAndBadGrammar(endingSelection());
+ document()->frame()->editor().markMisspellingsAndBadGrammar(endingSelection());
// If the selection is in an empty paragraph, restore styles from the old empty paragraph to the new empty paragraph.
bool selectionIsEmptyParagraph = endingSelection().isCaret() && isStartOfParagraph(endingSelection().visibleStart()) && isEndOfParagraph(endingSelection().visibleStart());
diff --git a/Source/WebCore/editing/DeleteButton.cpp b/Source/WebCore/editing/DeleteButton.cpp
index 246a952..772b2a9 100644
--- a/Source/WebCore/editing/DeleteButton.cpp
+++ b/Source/WebCore/editing/DeleteButton.cpp
@@ -53,7 +53,7 @@
void DeleteButton::defaultEventHandler(Event* event)
{
if (event->type() == eventNames().clickEvent) {
- document()->frame()->editor()->deleteButtonController()->deleteTarget();
+ document()->frame()->editor().deleteButtonController()->deleteTarget();
event->setDefaultHandled();
return;
}
diff --git a/Source/WebCore/editing/DeleteButtonController.cpp b/Source/WebCore/editing/DeleteButtonController.cpp
index ed4b3b7..f5d6515 100644
--- a/Source/WebCore/editing/DeleteButtonController.cpp
+++ b/Source/WebCore/editing/DeleteButtonController.cpp
@@ -283,7 +283,7 @@
if (!enabled() || !element || !element->inDocument() || !isDeletableElement(element))
return;
- EditorClient* client = m_frame->editor()->client();
+ EditorClient* client = m_frame->editor().client();
if (!client || !client->shouldShowDeleteInterface(element))
return;
diff --git a/Source/WebCore/editing/DeleteButtonController.h b/Source/WebCore/editing/DeleteButtonController.h
index fa0cb9f..7a113a9 100644
--- a/Source/WebCore/editing/DeleteButtonController.h
+++ b/Source/WebCore/editing/DeleteButtonController.h
@@ -83,13 +83,13 @@
: m_frame(frame)
{
if (frame)
- frame->editor()->deleteButtonController()->disable();
+ frame->editor().deleteButtonController()->disable();
}
~DeleteButtonControllerDisableScope()
{
if (m_frame)
- m_frame->editor()->deleteButtonController()->enable();
+ m_frame->editor().deleteButtonController()->enable();
}
private:
diff --git a/Source/WebCore/editing/DeleteSelectionCommand.cpp b/Source/WebCore/editing/DeleteSelectionCommand.cpp
index 6e7f44a..43a8ec9 100644
--- a/Source/WebCore/editing/DeleteSelectionCommand.cpp
+++ b/Source/WebCore/editing/DeleteSelectionCommand.cpp
@@ -648,7 +648,7 @@
RefPtr<Range> range = Range::create(document(), startOfParagraphToMove.deepEquivalent().parentAnchoredEquivalent(), endOfParagraphToMove.deepEquivalent().parentAnchoredEquivalent());
RefPtr<Range> rangeToBeReplaced = Range::create(document(), mergeDestination.deepEquivalent().parentAnchoredEquivalent(), mergeDestination.deepEquivalent().parentAnchoredEquivalent());
- if (!document()->frame()->editor()->client()->shouldMoveRangeAfterDelete(range.get(), rangeToBeReplaced.get()))
+ if (!document()->frame()->editor().client()->shouldMoveRangeAfterDelete(range.get(), rangeToBeReplaced.get()))
return;
// moveParagraphs will insert placeholders if it removes blocks that would require their use, don't let block
@@ -794,7 +794,7 @@
if (!m_replace) {
Element* textControl = enclosingTextFormControl(m_selectionToDelete.start());
if (textControl && textControl->focused())
- document()->frame()->editor()->textWillBeDeletedInTextField(textControl);
+ document()->frame()->editor().textWillBeDeletedInTextField(textControl);
}
// save this to later make the selection with
@@ -854,7 +854,7 @@
if (!originalString.isEmpty()) {
if (Frame* frame = document()->frame())
- frame->editor()->deletedAutocorrectionAtPosition(m_endingPosition, originalString);
+ frame->editor().deletedAutocorrectionAtPosition(m_endingPosition, originalString);
}
setEndingSelection(VisibleSelection(m_endingPosition, affinity, endingSelection().isDirectional()));
diff --git a/Source/WebCore/editing/EditCommand.cpp b/Source/WebCore/editing/EditCommand.cpp
index be5ef15..eb52768 100644
--- a/Source/WebCore/editing/EditCommand.cpp
+++ b/Source/WebCore/editing/EditCommand.cpp
@@ -45,7 +45,7 @@
{
ASSERT(m_document);
ASSERT(m_document->frame());
- setStartingSelection(m_document->frame()->editor()->avoidIntersectionWithDeleteButtonController(m_document->frame()->selection()->selection()));
+ setStartingSelection(m_document->frame()->editor().avoidIntersectionWithDeleteButtonController(m_document->frame()->selection()->selection()));
setEndingSelection(m_startingSelection);
}
diff --git a/Source/WebCore/editing/EditingStyle.cpp b/Source/WebCore/editing/EditingStyle.cpp
index 18ee5e6..081c5de 100644
--- a/Source/WebCore/editing/EditingStyle.cpp
+++ b/Source/WebCore/editing/EditingStyle.cpp
@@ -1344,7 +1344,7 @@
RefPtr<MutableStylePropertySet> mutableStyle = getPropertiesNotIn(style->style(), computedStyle.get());
reconcileTextDecorationProperties(mutableStyle.get());
- if (!document->frame()->editor()->shouldStyleWithCSS())
+ if (!document->frame()->editor().shouldStyleWithCSS())
extractTextStyles(document, mutableStyle.get(), computedStyle->useFixedFontDefaultSize());
// Changing the whitespace style in a tab span would collapse the tab into a space.
diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp
index ad5dc1c..ec5c89d 100644
--- a/Source/WebCore/editing/Editor.cpp
+++ b/Source/WebCore/editing/Editor.cpp
@@ -2012,9 +2012,9 @@
frame()->selection()->setSelection(newSelection);
}
- if (!frame()->editor()->shouldInsertText(autocorrectedString, misspellingRange.get(), EditorInsertActionTyped))
+ if (!frame()->editor().shouldInsertText(autocorrectedString, misspellingRange.get(), EditorInsertActionTyped))
return;
- frame()->editor()->replaceSelectionWithText(autocorrectedString, false, false);
+ frame()->editor().replaceSelectionWithText(autocorrectedString, false, false);
// Reset the charet one character further.
frame()->selection()->moveTo(frame()->selection()->end());
diff --git a/Source/WebCore/editing/EditorCommand.cpp b/Source/WebCore/editing/EditorCommand.cpp
index b30ff8a..98c301b 100644
--- a/Source/WebCore/editing/EditorCommand.cpp
+++ b/Source/WebCore/editing/EditorCommand.cpp
@@ -105,11 +105,11 @@
// FIXME: We don't call shouldApplyStyle when the source is DOM; is there a good reason for that?
switch (source) {
case CommandFromMenuOrKeyBinding:
- frame->editor()->applyStyleToSelection(style, action);
+ frame->editor().applyStyleToSelection(style, action);
return true;
case CommandFromDOM:
case CommandFromDOMWithUserInterface:
- frame->editor()->applyStyle(style);
+ frame->editor().applyStyle(style);
return true;
}
ASSERT_NOT_REACHED();
@@ -164,10 +164,10 @@
// other: present throughout the selection
bool styleIsPresent;
- if (frame->editor()->behavior().shouldToggleStyleBasedOnStartOfSelection())
- styleIsPresent = frame->editor()->selectionStartHasStyle(propertyID, onValue);
+ if (frame->editor().behavior().shouldToggleStyleBasedOnStartOfSelection())
+ styleIsPresent = frame->editor().selectionStartHasStyle(propertyID, onValue);
else
- styleIsPresent = frame->editor()->selectionHasStyle(propertyID, onValue) == TrueTriState;
+ styleIsPresent = frame->editor().selectionHasStyle(propertyID, onValue) == TrueTriState;
RefPtr<EditingStyle> style = EditingStyle::create(propertyID, styleIsPresent ? offValue : onValue);
return applyCommandToFrame(frame, source, action, style->style());
@@ -180,11 +180,11 @@
// FIXME: We don't call shouldApplyStyle when the source is DOM; is there a good reason for that?
switch (source) {
case CommandFromMenuOrKeyBinding:
- frame->editor()->applyParagraphStyleToSelection(style.get(), action);
+ frame->editor().applyParagraphStyleToSelection(style.get(), action);
return true;
case CommandFromDOM:
case CommandFromDOMWithUserInterface:
- frame->editor()->applyParagraphStyle(style.get());
+ frame->editor().applyParagraphStyle(style.get());
return true;
}
ASSERT_NOT_REACHED();
@@ -218,7 +218,7 @@
return false;
RefPtr<Range> oldRange = frame->selection()->selection().toNormalizedRange();
EAffinity affinity = frame->selection()->affinity();
- if (!frame->editor()->client()->shouldChangeSelectedRange(oldRange.get(), newRange.get(), affinity, false))
+ if (!frame->editor().client()->shouldChangeSelectedRange(oldRange.get(), newRange.get(), affinity, false))
return false;
frame->selection()->setSelectedRange(newRange.get(), affinity, true);
return true;
@@ -226,16 +226,16 @@
static TriState stateStyle(Frame* frame, CSSPropertyID propertyID, const char* desiredValue)
{
- if (frame->editor()->behavior().shouldToggleStyleBasedOnStartOfSelection())
- return frame->editor()->selectionStartHasStyle(propertyID, desiredValue) ? TrueTriState : FalseTriState;
- return frame->editor()->selectionHasStyle(propertyID, desiredValue);
+ if (frame->editor().behavior().shouldToggleStyleBasedOnStartOfSelection())
+ return frame->editor().selectionStartHasStyle(propertyID, desiredValue) ? TrueTriState : FalseTriState;
+ return frame->editor().selectionHasStyle(propertyID, desiredValue);
}
static String valueStyle(Frame* frame, CSSPropertyID propertyID)
{
// FIXME: Rather than retrieving the style at the start of the current selection,
// we should retrieve the style present throughout the selection for non-Mac platforms.
- return frame->editor()->selectionStartCSSPropertyValue(propertyID);
+ return frame->editor().selectionStartCSSPropertyValue(propertyID);
}
static TriState stateTextWritingDirection(Frame* frame, WritingDirection direction)
@@ -281,7 +281,7 @@
static bool executeCopy(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->copy();
+ frame->editor().copy();
return true;
}
@@ -298,18 +298,18 @@
{
if (source == CommandFromMenuOrKeyBinding) {
UserTypingGestureIndicator typingGestureIndicator(frame);
- frame->editor()->cut();
+ frame->editor().cut();
} else
- frame->editor()->cut();
+ frame->editor().cut();
return true;
}
static bool executeDefaultParagraphSeparator(Frame* frame, Event*, EditorCommandSource, const String& value)
{
if (equalIgnoringCase(value, "div"))
- frame->editor()->setDefaultParagraphSeparator(EditorParagraphSeparatorIsDiv);
+ frame->editor().setDefaultParagraphSeparator(EditorParagraphSeparatorIsDiv);
else if (equalIgnoringCase(value, "p"))
- frame->editor()->setDefaultParagraphSeparator(EditorParagraphSeparatorIsP);
+ frame->editor().setDefaultParagraphSeparator(EditorParagraphSeparatorIsP);
return true;
}
@@ -320,7 +320,7 @@
case CommandFromMenuOrKeyBinding: {
// Doesn't modify the text if the current selection isn't a range.
UserTypingGestureIndicator typingGestureIndicator(frame);
- frame->editor()->performDelete();
+ frame->editor().performDelete();
return true;
}
case CommandFromDOM:
@@ -336,32 +336,32 @@
static bool executeDeleteBackward(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->deleteWithDirection(DirectionBackward, CharacterGranularity, false, true);
+ frame->editor().deleteWithDirection(DirectionBackward, CharacterGranularity, false, true);
return true;
}
static bool executeDeleteBackwardByDecomposingPreviousCharacter(Frame* frame, Event*, EditorCommandSource, const String&)
{
LOG_ERROR("DeleteBackwardByDecomposingPreviousCharacter is not implemented, doing DeleteBackward instead");
- frame->editor()->deleteWithDirection(DirectionBackward, CharacterGranularity, false, true);
+ frame->editor().deleteWithDirection(DirectionBackward, CharacterGranularity, false, true);
return true;
}
static bool executeDeleteForward(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->deleteWithDirection(DirectionForward, CharacterGranularity, false, true);
+ frame->editor().deleteWithDirection(DirectionForward, CharacterGranularity, false, true);
return true;
}
static bool executeDeleteToBeginningOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->deleteWithDirection(DirectionBackward, LineBoundary, true, false);
+ frame->editor().deleteWithDirection(DirectionBackward, LineBoundary, true, false);
return true;
}
static bool executeDeleteToBeginningOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->deleteWithDirection(DirectionBackward, ParagraphBoundary, true, false);
+ frame->editor().deleteWithDirection(DirectionBackward, ParagraphBoundary, true, false);
return true;
}
@@ -369,7 +369,7 @@
{
// Despite its name, this command should delete the newline at the end of
// a paragraph if you are at the end of a paragraph (like DeleteToEndOfParagraph).
- frame->editor()->deleteWithDirection(DirectionForward, LineBoundary, true, false);
+ frame->editor().deleteWithDirection(DirectionForward, LineBoundary, true, false);
return true;
}
@@ -377,40 +377,40 @@
{
// Despite its name, this command should delete the newline at the end of
// a paragraph if you are at the end of a paragraph.
- frame->editor()->deleteWithDirection(DirectionForward, ParagraphBoundary, true, false);
+ frame->editor().deleteWithDirection(DirectionForward, ParagraphBoundary, true, false);
return true;
}
static bool executeDeleteToMark(Frame* frame, Event*, EditorCommandSource, const String&)
{
- RefPtr<Range> mark = frame->editor()->mark().toNormalizedRange();
+ RefPtr<Range> mark = frame->editor().mark().toNormalizedRange();
if (mark) {
FrameSelection* selection = frame->selection();
- bool selected = selection->setSelectedRange(unionDOMRanges(mark.get(), frame->editor()->selectedRange().get()).get(), DOWNSTREAM, true);
+ bool selected = selection->setSelectedRange(unionDOMRanges(mark.get(), frame->editor().selectedRange().get()).get(), DOWNSTREAM, true);
ASSERT(selected);
if (!selected)
return false;
}
- frame->editor()->performDelete();
- frame->editor()->setMark(frame->selection()->selection());
+ frame->editor().performDelete();
+ frame->editor().setMark(frame->selection()->selection());
return true;
}
static bool executeDeleteWordBackward(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->deleteWithDirection(DirectionBackward, WordGranularity, true, false);
+ frame->editor().deleteWithDirection(DirectionBackward, WordGranularity, true, false);
return true;
}
static bool executeDeleteWordForward(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->deleteWithDirection(DirectionForward, WordGranularity, true, false);
+ frame->editor().deleteWithDirection(DirectionForward, WordGranularity, true, false);
return true;
}
static bool executeFindString(Frame* frame, Event*, EditorCommandSource, const String& value)
{
- return frame->editor()->findString(value, true, false, true, false);
+ return frame->editor().findString(value, true, false, true, false);
}
static bool executeFontName(Frame* frame, Event*, EditorCommandSource source, const String& value)
@@ -456,7 +456,7 @@
{
switch (source) {
case CommandFromMenuOrKeyBinding:
- frame->editor()->deleteWithDirection(DirectionForward, CharacterGranularity, false, true);
+ frame->editor().deleteWithDirection(DirectionForward, CharacterGranularity, false, true);
return true;
case CommandFromDOM:
case CommandFromDOMWithUserInterface:
@@ -472,7 +472,7 @@
static bool executeIgnoreSpelling(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->ignoreSpelling();
+ frame->editor().ignoreSpelling();
return true;
}
@@ -528,7 +528,7 @@
static bool executeInsertNewline(Frame* frame, Event* event, EditorCommandSource, const String&)
{
Frame* targetFrame = WebCore::targetFrame(frame, event);
- return targetFrame->eventHandler()->handleTextInputEvent("\n", event, targetFrame->editor()->canEditRichly() ? TextEventInputKeyboard : TextEventInputLineBreak);
+ return targetFrame->eventHandler()->handleTextInputEvent("\n", event, targetFrame->editor().canEditRichly() ? TextEventInputKeyboard : TextEventInputLineBreak);
}
static bool executeInsertNewlineInQuotedContent(Frame* frame, Event*, EditorCommandSource, const String&)
@@ -591,7 +591,7 @@
RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create();
style->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed);
style->setProperty(CSSPropertyDirection, CSSValueLtr);
- frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
+ frame->editor().applyStyle(style.get(), EditActionSetWritingDirection);
return true;
}
@@ -599,7 +599,7 @@
{
RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create();
style->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal);
- frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
+ frame->editor().applyStyle(style.get(), EditActionSetWritingDirection);
return true;
}
@@ -608,7 +608,7 @@
RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create();
style->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed);
style->setProperty(CSSPropertyDirection, CSSValueRtl);
- frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
+ frame->editor().applyStyle(style.get(), EditActionSetWritingDirection);
return true;
}
@@ -904,7 +904,7 @@
static bool executeToggleOverwrite(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->toggleOverwriteModeEnabled();
+ frame->editor().toggleOverwriteModeEnabled();
return true;
}
@@ -912,22 +912,22 @@
{
if (source == CommandFromMenuOrKeyBinding) {
UserTypingGestureIndicator typingGestureIndicator(frame);
- frame->editor()->paste();
+ frame->editor().paste();
} else
- frame->editor()->paste();
+ frame->editor().paste();
return true;
}
static bool executePasteGlobalSelection(Frame* frame, Event*, EditorCommandSource source, const String&)
{
- if (!frame->editor()->client()->supportsGlobalSelection())
+ if (!frame->editor().client()->supportsGlobalSelection())
return false;
ASSERT_UNUSED(source, source == CommandFromMenuOrKeyBinding);
UserTypingGestureIndicator typingGestureIndicator(frame);
bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode();
Pasteboard::generalPasteboard()->setSelectionMode(true);
- frame->editor()->paste();
+ frame->editor().paste();
Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode);
return true;
}
@@ -936,9 +936,9 @@
{
if (source == CommandFromMenuOrKeyBinding) {
UserTypingGestureIndicator typingGestureIndicator(frame);
- frame->editor()->pasteAsPlainText();
+ frame->editor().pasteAsPlainText();
} else
- frame->editor()->pasteAsPlainText();
+ frame->editor().pasteAsPlainText();
return true;
}
@@ -946,9 +946,9 @@
{
if (source == CommandFromMenuOrKeyBinding) {
UserTypingGestureIndicator typingGestureIndicator(frame);
- frame->editor()->pasteAsPlainText();
+ frame->editor().pasteAsPlainText();
} else
- frame->editor()->pasteAsPlainText();
+ frame->editor().pasteAsPlainText();
return true;
}
@@ -963,13 +963,13 @@
static bool executeRedo(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->redo();
+ frame->editor().redo();
return true;
}
static bool executeRemoveFormat(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->removeFormattingAndStyle();
+ frame->editor().removeFormattingAndStyle();
return true;
}
@@ -1026,8 +1026,8 @@
static bool executeSelectToMark(Frame* frame, Event*, EditorCommandSource, const String&)
{
- RefPtr<Range> mark = frame->editor()->mark().toNormalizedRange();
- RefPtr<Range> selection = frame->editor()->selectedRange();
+ RefPtr<Range> mark = frame->editor().mark().toNormalizedRange();
+ RefPtr<Range> selection = frame->editor().selectedRange();
if (!mark || !selection) {
systemBeep();
return false;
@@ -1043,7 +1043,7 @@
static bool executeSetMark(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->setMark(frame->selection()->selection());
+ frame->editor().setMark(frame->selection()->selection());
return true;
}
@@ -1055,13 +1055,13 @@
static bool executeStyleWithCSS(Frame* frame, Event*, EditorCommandSource, const String& value)
{
- frame->editor()->setShouldStyleWithCSS(!equalIgnoringCase(value, "false"));
+ frame->editor().setShouldStyleWithCSS(!equalIgnoringCase(value, "false"));
return true;
}
static bool executeUseCSS(Frame* frame, Event*, EditorCommandSource, const String& value)
{
- frame->editor()->setShouldStyleWithCSS(equalIgnoringCase(value, "false"));
+ frame->editor().setShouldStyleWithCSS(equalIgnoringCase(value, "false"));
return true;
}
@@ -1077,21 +1077,21 @@
static bool executeSwapWithMark(Frame* frame, Event*, EditorCommandSource, const String&)
{
- const VisibleSelection& mark = frame->editor()->mark();
+ const VisibleSelection& mark = frame->editor().mark();
const VisibleSelection& selection = frame->selection()->selection();
if (mark.isNone() || selection.isNone()) {
systemBeep();
return false;
}
frame->selection()->setSelection(mark);
- frame->editor()->setMark(selection);
+ frame->editor().setMark(selection);
return true;
}
#if PLATFORM(MAC)
static bool executeTakeFindStringFromSelection(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->takeFindStringFromSelection();
+ frame->editor().takeFindStringFromSelection();
return true;
}
#endif
@@ -1108,7 +1108,7 @@
static bool executeTranspose(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->transpose();
+ frame->editor().transpose();
return true;
}
@@ -1120,7 +1120,7 @@
static bool executeUndo(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->undo();
+ frame->editor().undo();
return true;
}
@@ -1143,15 +1143,15 @@
static bool executeYank(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->insertTextWithoutSendingTextEvent(frame->editor()->killRing()->yank(), false, 0);
- frame->editor()->killRing()->setToYankedState();
+ frame->editor().insertTextWithoutSendingTextEvent(frame->editor().killRing()->yank(), false, 0);
+ frame->editor().killRing()->setToYankedState();
return true;
}
static bool executeYankAndSelect(Frame* frame, Event*, EditorCommandSource, const String&)
{
- frame->editor()->insertTextWithoutSendingTextEvent(frame->editor()->killRing()->yank(), true, 0);
- frame->editor()->killRing()->setToYankedState();
+ frame->editor().insertTextWithoutSendingTextEvent(frame->editor().killRing()->yank(), true, 0);
+ frame->editor().killRing()->setToYankedState();
return true;
}
@@ -1175,7 +1175,7 @@
Settings* settings = frame->settings();
bool defaultValue = settings && settings->javaScriptCanAccessClipboard();
- EditorClient* client = frame->editor()->client();
+ EditorClient* client = frame->editor().client();
return client ? client->canCopyCut(frame, defaultValue) : defaultValue;
}
@@ -1187,7 +1187,7 @@
Settings* settings = frame->settings();
bool defaultValue = settings && settings->javaScriptCanAccessClipboard() && settings->DOMPasteAllowed();
- EditorClient* client = frame->editor()->client();
+ EditorClient* client = frame->editor().client();
return client ? client->canPaste(frame, defaultValue) : defaultValue;
}
@@ -1201,7 +1201,7 @@
static bool enabledVisibleSelection(Frame* frame, Event* event, EditorCommandSource)
{
// The term "visible" here includes a caret in editable text or a range in any text.
- const VisibleSelection& selection = frame->editor()->selectionForCommand(event);
+ const VisibleSelection& selection = frame->editor().selectionForCommand(event);
return (selection.isCaret() && selection.isContentEditable()) || selection.isRange();
}
@@ -1220,37 +1220,37 @@
static bool enabledVisibleSelectionAndMark(Frame* frame, Event* event, EditorCommandSource)
{
- const VisibleSelection& selection = frame->editor()->selectionForCommand(event);
+ const VisibleSelection& selection = frame->editor().selectionForCommand(event);
return ((selection.isCaret() && selection.isContentEditable()) || selection.isRange())
- && frame->editor()->mark().isCaretOrRange();
+ && frame->editor().mark().isCaretOrRange();
}
static bool enableCaretInEditableText(Frame* frame, Event* event, EditorCommandSource)
{
- const VisibleSelection& selection = frame->editor()->selectionForCommand(event);
+ const VisibleSelection& selection = frame->editor().selectionForCommand(event);
return selection.isCaret() && selection.isContentEditable();
}
static bool enabledCopy(Frame* frame, Event*, EditorCommandSource)
{
- return frame->editor()->canDHTMLCopy() || frame->editor()->canCopy();
+ return frame->editor().canDHTMLCopy() || frame->editor().canCopy();
}
static bool enabledCut(Frame* frame, Event*, EditorCommandSource)
{
- return frame->editor()->canDHTMLCut() || frame->editor()->canCut();
+ return frame->editor().canDHTMLCut() || frame->editor().canCut();
}
static bool enabledInEditableText(Frame* frame, Event* event, EditorCommandSource)
{
- return frame->editor()->selectionForCommand(event).rootEditableElement();
+ return frame->editor().selectionForCommand(event).rootEditableElement();
}
static bool enabledDelete(Frame* frame, Event* event, EditorCommandSource source)
{
switch (source) {
case CommandFromMenuOrKeyBinding:
- return frame->editor()->canDelete();
+ return frame->editor().canDelete();
case CommandFromDOM:
case CommandFromDOMWithUserInterface:
// "Delete" from DOM is like delete/backspace keypress, affects selected range if non-empty,
@@ -1274,7 +1274,7 @@
static bool enabledPaste(Frame* frame, Event*, EditorCommandSource)
{
- return frame->editor()->canPaste();
+ return frame->editor().canPaste();
}
static bool enabledRangeInEditableText(Frame* frame, Event*, EditorCommandSource)
@@ -1289,19 +1289,19 @@
static bool enabledRedo(Frame* frame, Event*, EditorCommandSource)
{
- return frame->editor()->canRedo();
+ return frame->editor().canRedo();
}
#if PLATFORM(MAC)
static bool enabledTakeFindStringFromSelection(Frame* frame, Event*, EditorCommandSource)
{
- return frame->editor()->canCopyExcludingStandaloneImages();
+ return frame->editor().canCopyExcludingStandaloneImages();
}
#endif
static bool enabledUndo(Frame* frame, Event*, EditorCommandSource)
{
- return frame->editor()->canUndo();
+ return frame->editor().canUndo();
}
// State functions
@@ -1323,7 +1323,7 @@
static TriState stateOrderedList(Frame* frame, Event*)
{
- return frame->editor()->selectionOrderedListState();
+ return frame->editor().selectionOrderedListState();
}
static TriState stateStrikethrough(Frame* frame, Event*)
@@ -1333,7 +1333,7 @@
static TriState stateStyleWithCSS(Frame* frame, Event*)
{
- return frame->editor()->shouldStyleWithCSS() ? TrueTriState : FalseTriState;
+ return frame->editor().shouldStyleWithCSS() ? TrueTriState : FalseTriState;
}
static TriState stateSubscript(Frame* frame, Event*)
@@ -1368,7 +1368,7 @@
static TriState stateUnorderedList(Frame* frame, Event*)
{
- return frame->editor()->selectionUnorderedListState();
+ return frame->editor().selectionUnorderedListState();
}
static TriState stateJustifyCenter(Frame* frame, Event*)
@@ -1405,7 +1405,7 @@
static String valueDefaultParagraphSeparator(Frame* frame, Event*)
{
- switch (frame->editor()->defaultParagraphSeparator()) {
+ switch (frame->editor().defaultParagraphSeparator()) {
case EditorParagraphSeparatorIsDiv:
return divTag.localName();
case EditorParagraphSeparatorIsP:
diff --git a/Source/WebCore/editing/FrameSelection.cpp b/Source/WebCore/editing/FrameSelection.cpp
index fd27ee2..978a3ec 100644
--- a/Source/WebCore/editing/FrameSelection.cpp
+++ b/Source/WebCore/editing/FrameSelection.cpp
@@ -102,7 +102,7 @@
static inline bool shouldAlwaysUseDirectionalSelection(Frame* frame)
{
- return !frame || frame->editor()->behavior().shouldConsiderSelectionAsDirectional();
+ return !frame || frame->editor().behavior().shouldConsiderSelectionAsDirectional();
}
FrameSelection::FrameSelection(Frame* frame)
@@ -327,11 +327,11 @@
m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation();
selectFrameElementInParentIfFullySelected();
notifyRendererOfSelectionChange(userTriggered);
- m_frame->editor()->respondToChangedSelection(oldSelection, options);
+ m_frame->editor().respondToChangedSelection(oldSelection, options);
if (userTriggered == UserTriggered) {
ScrollAlignment alignment;
- if (m_frame->editor()->behavior().shouldCenterAlignWhenSelectionIsRevealed())
+ if (m_frame->editor().behavior().shouldCenterAlignWhenSelectionIsRevealed())
alignment = (align == AlignCursorOnScrollAlways) ? ScrollAlignment::alignCenterAlways : ScrollAlignment::alignCenterIfNeeded;
else
alignment = (align == AlignCursorOnScrollAlways) ? ScrollAlignment::alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded;
@@ -586,7 +586,7 @@
{
VisiblePosition positionAfterCurrentWord = nextWordPosition(originalPosition);
- if (m_frame && m_frame->editor()->behavior().shouldSkipSpaceWhenMovingRight()) {
+ if (m_frame && m_frame->editor().behavior().shouldSkipSpaceWhenMovingRight()) {
// In order to skip spaces when moving right, we advance one
// word further and then move one word back. Given the
// semantics of previousWordPosition() this will put us at the
@@ -713,7 +713,7 @@
#if USE(ICU_UNICODE)
// Visual word movement relies on isWordTextBreak which is not implemented in WinCE and QT.
// https://bugs.webkit.org/show_bug.cgi?id=81136.
- bool skipsSpaceWhenMovingRight = m_frame && m_frame->editor()->behavior().shouldSkipSpaceWhenMovingRight();
+ bool skipsSpaceWhenMovingRight = m_frame && m_frame->editor().behavior().shouldSkipSpaceWhenMovingRight();
pos = rightWordPosition(VisiblePosition(m_selection.extent(), m_selection.affinity()), skipsSpaceWhenMovingRight);
break;
#endif
@@ -887,7 +887,7 @@
break;
case WordGranularity: {
#if USE(ICU_UNICODE)
- bool skipsSpaceWhenMovingRight = m_frame && m_frame->editor()->behavior().shouldSkipSpaceWhenMovingRight();
+ bool skipsSpaceWhenMovingRight = m_frame && m_frame->editor().behavior().shouldSkipSpaceWhenMovingRight();
pos = leftWordPosition(VisiblePosition(m_selection.extent(), m_selection.affinity()), skipsSpaceWhenMovingRight);
break;
#endif
@@ -1024,7 +1024,7 @@
if (!m_selection.isCaret()
&& (granularity == WordGranularity || granularity == ParagraphGranularity || granularity == LineGranularity)
- && m_frame && !m_frame->editor()->behavior().shouldExtendSelectionByWordOrLineAcrossCaret()) {
+ && m_frame && !m_frame->editor().behavior().shouldExtendSelectionByWordOrLineAcrossCaret()) {
// Don't let the selection go across the base position directly. Needed to match mac
// behavior when, for instance, word-selecting backwards starting with the caret in
// the middle of a word and then word-selecting forward, leaving the caret in the
@@ -1037,7 +1037,7 @@
// Standard Mac behavior when extending to a boundary is grow the selection rather than leaving the
// base in place and moving the extent. Matches NSTextView.
- if (!m_frame || !m_frame->editor()->behavior().shouldAlwaysGrowSelectionWhenExtendingToBoundary() || m_selection.isCaret() || !isBoundary(granularity))
+ if (!m_frame || !m_frame->editor().behavior().shouldAlwaysGrowSelectionWhenExtendingToBoundary() || m_selection.isCaret() || !isBoundary(granularity))
setExtent(position, userTriggered);
else {
TextDirection textDirection = directionOfEnclosingBlock();
@@ -1749,7 +1749,7 @@
inline static bool shouldStopBlinkingDueToTypingCommand(Frame* frame)
{
- return frame->editor()->lastEditCommand() && frame->editor()->lastEditCommand()->shouldStopCaretBlinking();
+ return frame->editor().lastEditCommand() && frame->editor().lastEditCommand()->shouldStopCaretBlinking();
}
void FrameSelection::updateAppearance()
@@ -1928,7 +1928,7 @@
bool FrameSelection::shouldDeleteSelection(const VisibleSelection& selection) const
{
- return m_frame->editor()->client()->shouldDeleteRange(selection.toNormalizedRange().get());
+ return m_frame->editor().client()->shouldDeleteRange(selection.toNormalizedRange().get());
}
FloatRect FrameSelection::bounds(bool clipToVisibleContent) const
@@ -2047,7 +2047,7 @@
bool FrameSelection::shouldChangeSelection(const VisibleSelection& newSelection) const
{
- return m_frame->editor()->shouldChangeSelection(selection(), newSelection, newSelection.affinity(), false);
+ return m_frame->editor().shouldChangeSelection(selection(), newSelection, newSelection.affinity(), false);
}
bool FrameSelection::dispatchSelectStart()
diff --git a/Source/WebCore/editing/InsertTextCommand.cpp b/Source/WebCore/editing/InsertTextCommand.cpp
index 9e9676d..3f01203 100644
--- a/Source/WebCore/editing/InsertTextCommand.cpp
+++ b/Source/WebCore/editing/InsertTextCommand.cpp
@@ -147,7 +147,7 @@
// anything other than NoSelection. The rest of this function requires a real endingSelection, so bail out.
if (endingSelection().isNone())
return;
- } else if (document()->frame()->editor()->isOverwriteModeEnabled()) {
+ } else if (document()->frame()->editor().isOverwriteModeEnabled()) {
if (performOverwrite(m_text, m_selectInsertedText))
return;
}
diff --git a/Source/WebCore/editing/SpellChecker.cpp b/Source/WebCore/editing/SpellChecker.cpp
index 67c5b25..c6e028f 100644
--- a/Source/WebCore/editing/SpellChecker.cpp
+++ b/Source/WebCore/editing/SpellChecker.cpp
@@ -212,7 +212,7 @@
return;
}
- m_frame->editor()->markAndReplaceFor(m_processingRequest, results);
+ m_frame->editor().markAndReplaceFor(m_processingRequest, results);
if (m_lastProcessedSequence < sequence)
m_lastProcessedSequence = sequence;
diff --git a/Source/WebCore/editing/SpellingCorrectionCommand.cpp b/Source/WebCore/editing/SpellingCorrectionCommand.cpp
index 3599add..28f4a6d 100644
--- a/Source/WebCore/editing/SpellingCorrectionCommand.cpp
+++ b/Source/WebCore/editing/SpellingCorrectionCommand.cpp
@@ -63,7 +63,7 @@
virtual void doUnapply() OVERRIDE
{
if (!m_hasBeenUndone) {
- document()->frame()->editor()->unappliedSpellCorrection(startingSelection(), m_corrected, m_correction);
+ document()->frame()->editor().unappliedSpellCorrection(startingSelection(), m_corrected, m_correction);
m_hasBeenUndone = true;
}
diff --git a/Source/WebCore/editing/TypingCommand.cpp b/Source/WebCore/editing/TypingCommand.cpp
index a9fba68..b0c429d 100644
--- a/Source/WebCore/editing/TypingCommand.cpp
+++ b/Source/WebCore/editing/TypingCommand.cpp
@@ -161,7 +161,7 @@
ASSERT(frame);
if (!text.isEmpty())
- document->frame()->editor()->updateMarkersForWordsAffectedByEditing(isSpaceOrNewline(text.characters()[0]));
+ document->frame()->editor().updateMarkersForWordsAffectedByEditing(isSpaceOrNewline(text.characters()[0]));
insertText(document, text, frame->selection()->selection(), options, composition);
}
@@ -237,7 +237,7 @@
{
ASSERT(frame);
- RefPtr<CompositeEditCommand> lastEditCommand = frame->editor()->lastEditCommand();
+ RefPtr<CompositeEditCommand> lastEditCommand = frame->editor().lastEditCommand();
if (!lastEditCommand || !lastEditCommand->isTypingCommand() || !static_cast<TypingCommand*>(lastEditCommand.get())->isOpenForMoreTyping())
return 0;
@@ -298,14 +298,14 @@
return;
#if PLATFORM(MAC)
- if (!frame->editor()->isContinuousSpellCheckingEnabled()
- && !frame->editor()->isAutomaticQuoteSubstitutionEnabled()
- && !frame->editor()->isAutomaticLinkDetectionEnabled()
- && !frame->editor()->isAutomaticDashSubstitutionEnabled()
- && !frame->editor()->isAutomaticTextReplacementEnabled())
- return;
+ if (!frame->editor().isContinuousSpellCheckingEnabled()
+ && !frame->editor().isAutomaticQuoteSubstitutionEnabled()
+ && !frame->editor().isAutomaticLinkDetectionEnabled()
+ && !frame->editor().isAutomaticDashSubstitutionEnabled()
+ && !frame->editor().isAutomaticTextReplacementEnabled())
+ return;
#else
- if (!frame->editor()->isContinuousSpellCheckingEnabled())
+ if (!frame->editor().isContinuousSpellCheckingEnabled())
return;
#endif
// Take a look at the selection that results after typing and determine whether we need to spellcheck.
@@ -322,9 +322,9 @@
String strippedPreviousWord;
if (range && (commandType == TypingCommand::InsertText || commandType == TypingCommand::InsertLineBreak || commandType == TypingCommand::InsertParagraphSeparator || commandType == TypingCommand::InsertParagraphSeparatorInQuotedContent))
strippedPreviousWord = plainText(range.get()).stripWhiteSpace();
- frame->editor()->markMisspellingsAfterTypingToWord(p1, endingSelection(), !strippedPreviousWord.isEmpty());
+ frame->editor().markMisspellingsAfterTypingToWord(p1, endingSelection(), !strippedPreviousWord.isEmpty());
} else if (commandType == TypingCommand::InsertText)
- frame->editor()->startAlternativeTextUITimer();
+ frame->editor().startAlternativeTextUITimer();
}
}
@@ -337,14 +337,14 @@
updatePreservesTypingStyle(commandTypeForAddedTyping);
#if PLATFORM(MAC)
- frame->editor()->appliedEditing(this);
+ frame->editor().appliedEditing(this);
// Since the spellchecking code may also perform corrections and other replacements, it should happen after the typing changes.
if (!m_shouldPreventSpellChecking)
markMisspellingsAfterTyping(commandTypeForAddedTyping);
#else
// The old spellchecking code requires that checking be done first, to prevent issues like that in 6864072, where <doesn't> is marked as misspelled.
markMisspellingsAfterTyping(commandTypeForAddedTyping);
- frame->editor()->appliedEditing(this);
+ frame->editor().appliedEditing(this);
#endif
}
@@ -427,7 +427,7 @@
if (!frame)
return;
- frame->editor()->updateMarkersForWordsAffectedByEditing(false);
+ frame->editor().updateMarkersForWordsAffectedByEditing(false);
VisibleSelection selectionToDelete;
VisibleSelection selectionAfterUndo;
@@ -514,7 +514,7 @@
return;
if (killRing)
- frame->editor()->addToKillRing(selectionToDelete.toNormalizedRange().get(), false);
+ frame->editor().addToKillRing(selectionToDelete.toNormalizedRange().get(), false);
// Make undo select everything that has been deleted, unless an undo will undo more than just this deletion.
// FIXME: This behaves like TextEdit except for the case where you open with text insertion and then delete
// more text than you insert. In that case all of the text that was around originally should be selected.
@@ -531,7 +531,7 @@
if (!frame)
return;
- frame->editor()->updateMarkersForWordsAffectedByEditing(false);
+ frame->editor().updateMarkersForWordsAffectedByEditing(false);
VisibleSelection selectionToDelete;
VisibleSelection selectionAfterUndo;
@@ -607,7 +607,7 @@
return;
if (killRing)
- frame->editor()->addToKillRing(selectionToDelete.toNormalizedRange().get(), false);
+ frame->editor().addToKillRing(selectionToDelete.toNormalizedRange().get(), false);
// make undo select what was deleted
setStartingSelection(selectionAfterUndo);
CompositeEditCommand::deleteSelection(selectionToDelete, m_smartDelete);
diff --git a/Source/WebCore/editing/htmlediting.cpp b/Source/WebCore/editing/htmlediting.cpp
index 2aaa730..9bd9474 100644
--- a/Source/WebCore/editing/htmlediting.cpp
+++ b/Source/WebCore/editing/htmlediting.cpp
@@ -855,7 +855,7 @@
PassRefPtr<HTMLElement> createDefaultParagraphElement(Document* document)
{
- switch (document->frame()->editor()->defaultParagraphSeparator()) {
+ switch (document->frame()->editor().defaultParagraphSeparator()) {
case EditorParagraphSeparatorIsDiv:
return HTMLDivElement::create(document);
case EditorParagraphSeparatorIsP:
diff --git a/Source/WebCore/editing/mac/EditorMac.mm b/Source/WebCore/editing/mac/EditorMac.mm
index 968d8e0..3da5e29 100644
--- a/Source/WebCore/editing/mac/EditorMac.mm
+++ b/Source/WebCore/editing/mac/EditorMac.mm
@@ -82,7 +82,7 @@
RefPtr<Range> range = selectedRange();
bool choosePlainText;
- m_frame->editor()->client()->setInsertionPasteboard(NSGeneralPboard);
+ m_frame->editor().client()->setInsertionPasteboard(NSGeneralPboard);
#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
RefPtr<DocumentFragment> fragment = pasteboard->documentFragment(m_frame, range, allowPlainText, choosePlainText);
if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted))
@@ -102,7 +102,7 @@
pasteAsFragment(fragment, canSmartReplaceWithPasteboard(pasteboard), false);
}
#endif
- m_frame->editor()->client()->setInsertionPasteboard(String());
+ m_frame->editor().client()->setInsertionPasteboard(String());
}
bool Editor::insertParagraphSeparatorInQuotedContent()
diff --git a/Source/WebCore/editing/markup.cpp b/Source/WebCore/editing/markup.cpp
index fda21d5..59d34fe 100644
--- a/Source/WebCore/editing/markup.cpp
+++ b/Source/WebCore/editing/markup.cpp
@@ -655,7 +655,7 @@
RefPtr<Range> updatedRangeRef;
if (frame) {
- updatedRangeRef = frame->editor()->avoidIntersectionWithDeleteButtonController(range);
+ updatedRangeRef = frame->editor().avoidIntersectionWithDeleteButtonController(range);
updatedRange = updatedRangeRef.get();
if (!updatedRange)
return emptyString();
@@ -769,7 +769,7 @@
HTMLElement* deleteButtonContainerElement = 0;
#if ENABLE(DELETION_UI)
if (Frame* frame = node->document()->frame()) {
- deleteButtonContainerElement = frame->editor()->deleteButtonController()->containerElement();
+ deleteButtonContainerElement = frame->editor().deleteButtonController()->containerElement();
if (node->isDescendantOf(deleteButtonContainerElement))
return "";
}
diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp
index 3b30344..726a319 100644
--- a/Source/WebCore/html/HTMLInputElement.cpp
+++ b/Source/WebCore/html/HTMLInputElement.cpp
@@ -430,7 +430,7 @@
return;
if (Frame* frame = document()->frame())
- frame->editor()->textFieldDidEndEditing(this);
+ frame->editor().textFieldDidEndEditing(this);
}
bool HTMLInputElement::shouldUseInputMethod()
diff --git a/Source/WebCore/html/HTMLTextAreaElement.cpp b/Source/WebCore/html/HTMLTextAreaElement.cpp
index 4620a8a..4e2c67a 100644
--- a/Source/WebCore/html/HTMLTextAreaElement.cpp
+++ b/Source/WebCore/html/HTMLTextAreaElement.cpp
@@ -283,7 +283,7 @@
return;
if (Frame* frame = document()->frame())
- frame->editor()->textDidChangeInTextArea(this);
+ frame->editor().textDidChangeInTextArea(this);
// When typing in a textarea, childrenChanged is not called, so we need to force the directionality check.
calculateAndAdjustDirectionality();
}
diff --git a/Source/WebCore/html/TextFieldInputType.cpp b/Source/WebCore/html/TextFieldInputType.cpp
index 36c1f85..61f10d5 100644
--- a/Source/WebCore/html/TextFieldInputType.cpp
+++ b/Source/WebCore/html/TextFieldInputType.cpp
@@ -146,7 +146,7 @@
if (!element()->focused())
return;
Frame* frame = element()->document()->frame();
- if (!frame || !frame->editor()->doTextFieldCommandFromEvent(element(), event))
+ if (!frame || !frame->editor().doTextFieldCommandFromEvent(element(), event))
return;
event->setDefaultHandled();
}
@@ -473,8 +473,8 @@
return;
if (Frame* frame = element()->document()->frame()) {
if (state == ValueChangeStateNone)
- frame->editor()->textFieldDidBeginEditing(element());
- frame->editor()->textDidChangeInTextField(element());
+ frame->editor().textFieldDidBeginEditing(element());
+ frame->editor().textDidChangeInTextField(element());
}
}
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index 3a4f6fd..b423eb2 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -482,7 +482,7 @@
Document* currentDocument = m_frame->document();
stopLoading(currentDocument && !currentDocument->inPageCache() ? UnloadEventPolicyUnloadAndPageHide : UnloadEventPolicyUnloadOnly);
- m_frame->editor()->clearUndoRedoOperations();
+ m_frame->editor().clearUndoRedoOperations();
return true;
}
@@ -495,7 +495,7 @@
}
m_frame->navigationScheduler()->cancel();
- m_frame->editor()->clearLastEditCommand();
+ m_frame->editor().clearLastEditCommand();
m_isComplete = false;
m_didCallImplicitClose = false;
@@ -544,7 +544,7 @@
void FrameLoader::clear(Document* newDocument, bool clearWindowProperties, bool clearScriptObjects, bool clearFrameView)
{
- m_frame->editor()->clear();
+ m_frame->editor().clear();
if (!m_needsClear)
return;
diff --git a/Source/WebCore/page/ContextMenuController.cpp b/Source/WebCore/page/ContextMenuController.cpp
index 0588f4c..49da1da 100644
--- a/Source/WebCore/page/ContextMenuController.cpp
+++ b/Source/WebCore/page/ContextMenuController.cpp
@@ -197,7 +197,7 @@
static void insertUnicodeCharacter(UChar character, Frame* frame)
{
String text(&character, 1);
- if (!frame->editor()->shouldInsertText(text, frame->selection()->toNormalizedRange().get(), EditorInsertActionTyped))
+ if (!frame->editor().shouldInsertText(text, frame->selection()->toNormalizedRange().get(), EditorInsertActionTyped))
return;
TypingCommand::insertText(frame->document(), text, 0, TypingCommand::TextCompositionNone);
@@ -232,7 +232,7 @@
m_client->downloadURL(m_hitTestResult.absoluteLinkURL());
break;
case ContextMenuItemTagCopyLinkToClipboard:
- frame->editor()->copyURL(m_hitTestResult.absoluteLinkURL(), m_hitTestResult.textContent());
+ frame->editor().copyURL(m_hitTestResult.absoluteLinkURL(), m_hitTestResult.textContent());
break;
case ContextMenuItemTagOpenImageInNewWindow:
openNewWindow(m_hitTestResult.absoluteImageURL(), frame);
@@ -244,18 +244,18 @@
case ContextMenuItemTagCopyImageToClipboard:
// FIXME: The Pasteboard class is not written yet
// For now, call into the client. This is temporary!
- frame->editor()->copyImage(m_hitTestResult);
+ frame->editor().copyImage(m_hitTestResult);
break;
#if PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
case ContextMenuItemTagCopyImageUrlToClipboard:
- frame->editor()->copyURL(m_hitTestResult.absoluteImageURL(), m_hitTestResult.textContent());
+ frame->editor().copyURL(m_hitTestResult.absoluteImageURL(), m_hitTestResult.textContent());
break;
#endif
case ContextMenuItemTagOpenMediaInNewWindow:
openNewWindow(m_hitTestResult.absoluteMediaURL(), frame);
break;
case ContextMenuItemTagCopyMediaLinkToClipboard:
- frame->editor()->copyURL(m_hitTestResult.absoluteMediaURL(), m_hitTestResult.textContent());
+ frame->editor().copyURL(m_hitTestResult.absoluteMediaURL(), m_hitTestResult.textContent());
break;
case ContextMenuItemTagToggleMediaControls:
m_hitTestResult.toggleMediaControlsDisplay();
@@ -281,7 +281,7 @@
break;
}
case ContextMenuItemTagCopy:
- frame->editor()->copy();
+ frame->editor().copy();
break;
case ContextMenuItemTagGoBack:
if (Page* page = frame->page())
@@ -298,14 +298,14 @@
frame->loader()->reload();
break;
case ContextMenuItemTagCut:
- frame->editor()->command("Cut").execute();
+ frame->editor().command("Cut").execute();
break;
case ContextMenuItemTagPaste:
- frame->editor()->command("Paste").execute();
+ frame->editor().command("Paste").execute();
break;
#if PLATFORM(GTK)
case ContextMenuItemTagDelete:
- frame->editor()->performDelete();
+ frame->editor().performDelete();
break;
case ContextMenuItemTagUnicodeInsertLRMMark:
insertUnicodeCharacter(leftToRightMark, frame);
@@ -340,22 +340,22 @@
#endif
#if PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL)
case ContextMenuItemTagSelectAll:
- frame->editor()->command("SelectAll").execute();
+ frame->editor().command("SelectAll").execute();
break;
#endif
case ContextMenuItemTagSpellingGuess: {
FrameSelection* frameSelection = frame->selection();
- if (frame->editor()->shouldInsertText(item->title(), frameSelection->toNormalizedRange().get(), EditorInsertActionPasted)) {
+ if (frame->editor().shouldInsertText(item->title(), frameSelection->toNormalizedRange().get(), EditorInsertActionPasted)) {
Document* document = frame->document();
ReplaceSelectionCommand::CommandOptions replaceOptions = ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting;
- if (frame->editor()->behavior().shouldAllowSpellingSuggestionsWithoutSelection()) {
+ if (frame->editor().behavior().shouldAllowSpellingSuggestionsWithoutSelection()) {
ASSERT(frameSelection->isCaretOrRange());
VisibleSelection wordSelection(frameSelection->base());
wordSelection.expandUsingGranularity(WordGranularity);
frameSelection->setSelection(wordSelection);
} else {
- ASSERT(frame->editor()->selectedText().length());
+ ASSERT(frame->editor().selectedText().length());
replaceOptions |= ReplaceSelectionCommand::SelectReplacement;
}
@@ -366,10 +366,10 @@
break;
}
case ContextMenuItemTagIgnoreSpelling:
- frame->editor()->ignoreSpelling();
+ frame->editor().ignoreSpelling();
break;
case ContextMenuItemTagLearnSpelling:
- frame->editor()->learnSpelling();
+ frame->editor().learnSpelling();
break;
case ContextMenuItemTagSearchWeb:
m_client->searchWithGoogle(frame);
@@ -388,13 +388,13 @@
frame->loader()->loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(m_hitTestResult.absoluteLinkURL(), frame->loader()->outgoingReferrer())), false, false, 0, 0, MaybeSendReferrer);
break;
case ContextMenuItemTagBold:
- frame->editor()->command("ToggleBold").execute();
+ frame->editor().command("ToggleBold").execute();
break;
case ContextMenuItemTagItalic:
- frame->editor()->command("ToggleItalic").execute();
+ frame->editor().command("ToggleItalic").execute();
break;
case ContextMenuItemTagUnderline:
- frame->editor()->toggleUnderline();
+ frame->editor().toggleUnderline();
break;
case ContextMenuItemTagOutline:
// We actually never enable this because CSS does not have a way to specify an outline font,
@@ -414,22 +414,22 @@
m_client->stopSpeaking();
break;
case ContextMenuItemTagDefaultDirection:
- frame->editor()->setBaseWritingDirection(NaturalWritingDirection);
+ frame->editor().setBaseWritingDirection(NaturalWritingDirection);
break;
case ContextMenuItemTagLeftToRight:
- frame->editor()->setBaseWritingDirection(LeftToRightWritingDirection);
+ frame->editor().setBaseWritingDirection(LeftToRightWritingDirection);
break;
case ContextMenuItemTagRightToLeft:
- frame->editor()->setBaseWritingDirection(RightToLeftWritingDirection);
+ frame->editor().setBaseWritingDirection(RightToLeftWritingDirection);
break;
case ContextMenuItemTagTextDirectionDefault:
- frame->editor()->command("MakeTextWritingDirectionNatural").execute();
+ frame->editor().command("MakeTextWritingDirectionNatural").execute();
break;
case ContextMenuItemTagTextDirectionLeftToRight:
- frame->editor()->command("MakeTextWritingDirectionLeftToRight").execute();
+ frame->editor().command("MakeTextWritingDirectionLeftToRight").execute();
break;
case ContextMenuItemTagTextDirectionRightToLeft:
- frame->editor()->command("MakeTextWritingDirectionRightToLeft").execute();
+ frame->editor().command("MakeTextWritingDirectionRightToLeft").execute();
break;
#if PLATFORM(MAC)
case ContextMenuItemTagSearchInSpotlight:
@@ -437,65 +437,65 @@
break;
#endif
case ContextMenuItemTagShowSpellingPanel:
- frame->editor()->showSpellingGuessPanel();
+ frame->editor().showSpellingGuessPanel();
break;
case ContextMenuItemTagCheckSpelling:
- frame->editor()->advanceToNextMisspelling();
+ frame->editor().advanceToNextMisspelling();
break;
case ContextMenuItemTagCheckSpellingWhileTyping:
- frame->editor()->toggleContinuousSpellChecking();
+ frame->editor().toggleContinuousSpellChecking();
break;
case ContextMenuItemTagCheckGrammarWithSpelling:
- frame->editor()->toggleGrammarChecking();
+ frame->editor().toggleGrammarChecking();
break;
#if PLATFORM(MAC)
case ContextMenuItemTagShowFonts:
- frame->editor()->showFontPanel();
+ frame->editor().showFontPanel();
break;
case ContextMenuItemTagStyles:
- frame->editor()->showStylesPanel();
+ frame->editor().showStylesPanel();
break;
case ContextMenuItemTagShowColors:
- frame->editor()->showColorPanel();
+ frame->editor().showColorPanel();
break;
#endif
#if USE(APPKIT)
case ContextMenuItemTagMakeUpperCase:
- frame->editor()->uppercaseWord();
+ frame->editor().uppercaseWord();
break;
case ContextMenuItemTagMakeLowerCase:
- frame->editor()->lowercaseWord();
+ frame->editor().lowercaseWord();
break;
case ContextMenuItemTagCapitalize:
- frame->editor()->capitalizeWord();
+ frame->editor().capitalizeWord();
break;
#endif
#if PLATFORM(MAC)
case ContextMenuItemTagChangeBack:
- frame->editor()->changeBackToReplacedString(m_hitTestResult.replacedString());
+ frame->editor().changeBackToReplacedString(m_hitTestResult.replacedString());
break;
#endif
#if USE(AUTOMATIC_TEXT_REPLACEMENT)
case ContextMenuItemTagShowSubstitutions:
- frame->editor()->showSubstitutionsPanel();
+ frame->editor().showSubstitutionsPanel();
break;
case ContextMenuItemTagSmartCopyPaste:
- frame->editor()->toggleSmartInsertDelete();
+ frame->editor().toggleSmartInsertDelete();
break;
case ContextMenuItemTagSmartQuotes:
- frame->editor()->toggleAutomaticQuoteSubstitution();
+ frame->editor().toggleAutomaticQuoteSubstitution();
break;
case ContextMenuItemTagSmartDashes:
- frame->editor()->toggleAutomaticDashSubstitution();
+ frame->editor().toggleAutomaticDashSubstitution();
break;
case ContextMenuItemTagSmartLinks:
- frame->editor()->toggleAutomaticLinkDetection();
+ frame->editor().toggleAutomaticLinkDetection();
break;
case ContextMenuItemTagTextReplacement:
- frame->editor()->toggleAutomaticTextReplacement();
+ frame->editor().toggleAutomaticTextReplacement();
break;
case ContextMenuItemTagCorrectSpellingAutomatically:
- frame->editor()->toggleAutomaticSpellingCorrection();
+ frame->editor().toggleAutomaticSpellingCorrection();
break;
#endif
#if ENABLE(INSPECTOR)
@@ -505,7 +505,7 @@
break;
#endif
case ContextMenuItemTagDictationAlternative:
- frame->editor()->applyDictationAlternativelternative(item->title());
+ frame->editor().applyDictationAlternativelternative(item->title());
break;
default:
break;
@@ -856,7 +856,7 @@
if (m_hitTestResult.isSelected()) {
if (selectionContainsPossibleWord(frame)) {
#if PLATFORM(MAC)
- String selectedString = frame->displayStringModifiedByEncoding(frame->editor()->selectedText());
+ String selectedString = frame->displayStringModifiedByEncoding(frame->editor().selectedText());
ContextMenuItem LookUpInDictionaryItem(ActionType, ContextMenuItemTagLookUpInDictionary, contextMenuItemTagLookUpInDictionary(selectedString));
#if INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM
@@ -923,13 +923,13 @@
bool inPasswordField = selection->isInPasswordField();
if (!inPasswordField) {
bool haveContextMenuItemsForMisspellingOrGrammer = false;
- bool spellCheckingEnabled = frame->editor()->isSpellCheckingEnabledFor(node);
+ bool spellCheckingEnabled = frame->editor().isSpellCheckingEnabledFor(node);
if (spellCheckingEnabled) {
// Consider adding spelling-related or grammar-related context menu items (never both, since a single selected range
// is never considered a misspelling and bad grammar at the same time)
bool misspelling;
bool badGrammar;
- Vector<String> guesses = frame->editor()->guessesForMisspelledOrUngrammatical(misspelling, badGrammar);
+ Vector<String> guesses = frame->editor().guessesForMisspelledOrUngrammatical(misspelling, badGrammar);
if (misspelling || badGrammar) {
size_t size = guesses.size();
if (!size) {
@@ -997,7 +997,7 @@
if (m_hitTestResult.isSelected() && !inPasswordField && selectionContainsPossibleWord(frame)) {
#if PLATFORM(MAC)
- String selectedString = frame->displayStringModifiedByEncoding(frame->editor()->selectedText());
+ String selectedString = frame->displayStringModifiedByEncoding(frame->editor().selectedText());
ContextMenuItem LookUpInDictionaryItem(ActionType, ContextMenuItemTagLookUpInDictionary, contextMenuItemTagLookUpInDictionary(selectedString));
#if INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM
@@ -1048,7 +1048,7 @@
appendItem(transformationsMenuItem, m_contextMenu.get());
#endif
#if PLATFORM(GTK)
- bool shouldShowFontMenu = frame->editor()->canEditRichly();
+ bool shouldShowFontMenu = frame->editor().canEditRichly();
#else
bool shouldShowFontMenu = true;
#endif
@@ -1064,7 +1064,7 @@
appendItem(SpeechMenuItem, m_contextMenu.get());
#endif
#if PLATFORM(GTK)
- EditorClient* client = frame->editor()->client();
+ EditorClient* client = frame->editor().client();
if (client && client->shouldShowUnicodeMenu()) {
ContextMenuItem UnicodeMenuItem(SubmenuType, ContextMenuItemTagUnicode, contextMenuItemTagUnicode());
createAndAppendUnicodeSubMenu(UnicodeMenuItem);
@@ -1079,7 +1079,7 @@
if (Page* page = frame->page()) {
if (Settings* settings = page->settings()) {
bool includeTextDirectionSubmenu = settings->textDirectionSubmenuInclusionBehavior() == TextDirectionSubmenuAlwaysIncluded
- || (settings->textDirectionSubmenuInclusionBehavior() == TextDirectionSubmenuAutomaticallyIncluded && frame->editor()->hasBidiSelection());
+ || (settings->textDirectionSubmenuInclusionBehavior() == TextDirectionSubmenuAutomaticallyIncluded && frame->editor().hasBidiSelection());
if (includeTextDirectionSubmenu) {
ContextMenuItem TextDirectionMenuItem(SubmenuType, ContextMenuItemTagTextDirectionMenu,
contextMenuItemTagTextDirectionMenu());
@@ -1140,7 +1140,7 @@
switch (item.action()) {
case ContextMenuItemTagCheckSpelling:
- shouldEnable = frame->editor()->canEdit();
+ shouldEnable = frame->editor().canEdit();
break;
case ContextMenuItemTagDefaultDirection:
shouldCheck = false;
@@ -1149,44 +1149,44 @@
case ContextMenuItemTagLeftToRight:
case ContextMenuItemTagRightToLeft: {
String direction = item.action() == ContextMenuItemTagLeftToRight ? "ltr" : "rtl";
- shouldCheck = frame->editor()->selectionHasStyle(CSSPropertyDirection, direction) != FalseTriState;
+ shouldCheck = frame->editor().selectionHasStyle(CSSPropertyDirection, direction) != FalseTriState;
shouldEnable = true;
break;
}
case ContextMenuItemTagTextDirectionDefault: {
- Editor::Command command = frame->editor()->command("MakeTextWritingDirectionNatural");
+ Editor::Command command = frame->editor().command("MakeTextWritingDirectionNatural");
shouldCheck = command.state() == TrueTriState;
shouldEnable = command.isEnabled();
break;
}
case ContextMenuItemTagTextDirectionLeftToRight: {
- Editor::Command command = frame->editor()->command("MakeTextWritingDirectionLeftToRight");
+ Editor::Command command = frame->editor().command("MakeTextWritingDirectionLeftToRight");
shouldCheck = command.state() == TrueTriState;
shouldEnable = command.isEnabled();
break;
}
case ContextMenuItemTagTextDirectionRightToLeft: {
- Editor::Command command = frame->editor()->command("MakeTextWritingDirectionRightToLeft");
+ Editor::Command command = frame->editor().command("MakeTextWritingDirectionRightToLeft");
shouldCheck = command.state() == TrueTriState;
shouldEnable = command.isEnabled();
break;
}
case ContextMenuItemTagCopy:
- shouldEnable = frame->editor()->canDHTMLCopy() || frame->editor()->canCopy();
+ shouldEnable = frame->editor().canDHTMLCopy() || frame->editor().canCopy();
break;
case ContextMenuItemTagCut:
- shouldEnable = frame->editor()->canDHTMLCut() || frame->editor()->canCut();
+ shouldEnable = frame->editor().canDHTMLCut() || frame->editor().canCut();
break;
case ContextMenuItemTagIgnoreSpelling:
case ContextMenuItemTagLearnSpelling:
shouldEnable = frame->selection()->isRange();
break;
case ContextMenuItemTagPaste:
- shouldEnable = frame->editor()->canDHTMLPaste() || frame->editor()->canPaste();
+ shouldEnable = frame->editor().canDHTMLPaste() || frame->editor().canPaste();
break;
#if PLATFORM(GTK)
case ContextMenuItemTagDelete:
- shouldEnable = frame->editor()->canDelete();
+ shouldEnable = frame->editor().canDelete();
break;
case ContextMenuItemTagInputMethods:
case ContextMenuItemTagUnicode:
@@ -1209,78 +1209,78 @@
break;
#endif
case ContextMenuItemTagUnderline: {
- shouldCheck = frame->editor()->selectionHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "underline") != FalseTriState;
- shouldEnable = frame->editor()->canEditRichly();
+ shouldCheck = frame->editor().selectionHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "underline") != FalseTriState;
+ shouldEnable = frame->editor().canEditRichly();
break;
}
case ContextMenuItemTagLookUpInDictionary:
shouldEnable = frame->selection()->isRange();
break;
case ContextMenuItemTagCheckGrammarWithSpelling:
- if (frame->editor()->isGrammarCheckingEnabled())
+ if (frame->editor().isGrammarCheckingEnabled())
shouldCheck = true;
shouldEnable = true;
break;
case ContextMenuItemTagItalic: {
- shouldCheck = frame->editor()->selectionHasStyle(CSSPropertyFontStyle, "italic") != FalseTriState;
- shouldEnable = frame->editor()->canEditRichly();
+ shouldCheck = frame->editor().selectionHasStyle(CSSPropertyFontStyle, "italic") != FalseTriState;
+ shouldEnable = frame->editor().canEditRichly();
break;
}
case ContextMenuItemTagBold: {
- shouldCheck = frame->editor()->selectionHasStyle(CSSPropertyFontWeight, "bold") != FalseTriState;
- shouldEnable = frame->editor()->canEditRichly();
+ shouldCheck = frame->editor().selectionHasStyle(CSSPropertyFontWeight, "bold") != FalseTriState;
+ shouldEnable = frame->editor().canEditRichly();
break;
}
case ContextMenuItemTagOutline:
shouldEnable = false;
break;
case ContextMenuItemTagShowSpellingPanel:
- if (frame->editor()->spellingPanelIsShowing())
+ if (frame->editor().spellingPanelIsShowing())
item.setTitle(contextMenuItemTagShowSpellingPanel(false));
else
item.setTitle(contextMenuItemTagShowSpellingPanel(true));
- shouldEnable = frame->editor()->canEdit();
+ shouldEnable = frame->editor().canEdit();
break;
case ContextMenuItemTagNoGuessesFound:
shouldEnable = false;
break;
case ContextMenuItemTagCheckSpellingWhileTyping:
- shouldCheck = frame->editor()->isContinuousSpellCheckingEnabled();
+ shouldCheck = frame->editor().isContinuousSpellCheckingEnabled();
break;
#if PLATFORM(MAC)
case ContextMenuItemTagSubstitutionsMenu:
case ContextMenuItemTagTransformationsMenu:
break;
case ContextMenuItemTagShowSubstitutions:
- if (frame->editor()->substitutionsPanelIsShowing())
+ if (frame->editor().substitutionsPanelIsShowing())
item.setTitle(contextMenuItemTagShowSubstitutions(false));
else
item.setTitle(contextMenuItemTagShowSubstitutions(true));
- shouldEnable = frame->editor()->canEdit();
+ shouldEnable = frame->editor().canEdit();
break;
case ContextMenuItemTagMakeUpperCase:
case ContextMenuItemTagMakeLowerCase:
case ContextMenuItemTagCapitalize:
case ContextMenuItemTagChangeBack:
- shouldEnable = frame->editor()->canEdit();
+ shouldEnable = frame->editor().canEdit();
break;
case ContextMenuItemTagCorrectSpellingAutomatically:
- shouldCheck = frame->editor()->isAutomaticSpellingCorrectionEnabled();
+ shouldCheck = frame->editor().isAutomaticSpellingCorrectionEnabled();
break;
case ContextMenuItemTagSmartCopyPaste:
- shouldCheck = frame->editor()->smartInsertDeleteEnabled();
+ shouldCheck = frame->editor().smartInsertDeleteEnabled();
break;
case ContextMenuItemTagSmartQuotes:
- shouldCheck = frame->editor()->isAutomaticQuoteSubstitutionEnabled();
+ shouldCheck = frame->editor().isAutomaticQuoteSubstitutionEnabled();
break;
case ContextMenuItemTagSmartDashes:
- shouldCheck = frame->editor()->isAutomaticDashSubstitutionEnabled();
+ shouldCheck = frame->editor().isAutomaticDashSubstitutionEnabled();
break;
case ContextMenuItemTagSmartLinks:
- shouldCheck = frame->editor()->isAutomaticLinkDetectionEnabled();
+ shouldCheck = frame->editor().isAutomaticLinkDetectionEnabled();
break;
case ContextMenuItemTagTextReplacement:
- shouldCheck = frame->editor()->isAutomaticTextReplacementEnabled();
+ shouldCheck = frame->editor().isAutomaticTextReplacementEnabled();
break;
case ContextMenuItemTagStopSpeaking:
shouldEnable = client() && client()->isSpeaking();
@@ -1303,7 +1303,7 @@
shouldEnable = !frame->loader()->documentLoader()->isLoadingInAPISense();
break;
case ContextMenuItemTagFontMenu:
- shouldEnable = frame->editor()->canEditRichly();
+ shouldEnable = frame->editor().canEditRichly();
break;
#else
case ContextMenuItemTagGoBack:
diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp
index b19dce5..d7b8ecb 100644
--- a/Source/WebCore/page/DOMWindow.cpp
+++ b/Source/WebCore/page/DOMWindow.cpp
@@ -1113,7 +1113,7 @@
return false;
// FIXME (13016): Support wholeWord, searchInFrames and showDialog
- return m_frame->editor()->findString(string, !backwards, caseSensitive, wrap, false);
+ return m_frame->editor().findString(string, !backwards, caseSensitive, wrap, false);
}
bool DOMWindow::offscreenBuffering() const
diff --git a/Source/WebCore/page/DragController.cpp b/Source/WebCore/page/DragController.cpp
index 79296ec..dd4bf5b 100644
--- a/Source/WebCore/page/DragController.cpp
+++ b/Source/WebCore/page/DragController.cpp
@@ -441,7 +441,7 @@
{
ASSERT(m_page->dragCaretController()->hasCaret());
String text = m_page->dragCaretController()->isContentRichlyEditable() ? "" : dragData->asPlainText(innerFrame);
- Node* target = innerFrame->editor()->findEventTargetFrom(m_page->dragCaretController()->caretPosition());
+ Node* target = innerFrame->editor().findEventTargetFrom(m_page->dragCaretController()->caretPosition());
return target->dispatchEvent(TextEvent::createForDrop(innerFrame->document()->domWindow(), text), IGNORE_EXCEPTION);
}
@@ -475,10 +475,10 @@
RefPtr<Range> innerRange = innerFrame->selection()->toNormalizedRange();
RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create();
style->setProperty(CSSPropertyColor, color.serialized(), false);
- if (!innerFrame->editor()->shouldApplyStyle(style.get(), innerRange.get()))
+ if (!innerFrame->editor().shouldApplyStyle(style.get(), innerRange.get()))
return false;
m_client->willPerformDragDestinationAction(DragDestinationActionEdit, dragData);
- innerFrame->editor()->applyStyle(style.get(), EditActionSetColor);
+ innerFrame->editor().applyStyle(style.get(), EditActionSetColor);
return true;
}
@@ -511,7 +511,7 @@
if (dragIsMove(innerFrame->selection(), dragData) || dragCaret.isContentRichlyEditable()) {
bool chosePlainText = false;
RefPtr<DocumentFragment> fragment = documentFragmentFromDragData(dragData, innerFrame.get(), range, true, chosePlainText);
- if (!fragment || !innerFrame->editor()->shouldInsertFragment(fragment, range, EditorInsertActionDropped)) {
+ if (!fragment || !innerFrame->editor().shouldInsertFragment(fragment, range, EditorInsertActionDropped)) {
return false;
}
@@ -519,7 +519,7 @@
if (dragIsMove(innerFrame->selection(), dragData)) {
// NSTextView behavior is to always smart delete on moving a selection,
// but only to smart insert if the selection granularity is word granularity.
- bool smartDelete = innerFrame->editor()->smartInsertDeleteEnabled();
+ bool smartDelete = innerFrame->editor().smartInsertDeleteEnabled();
bool smartInsert = smartDelete && innerFrame->selection()->granularity() == WordGranularity && dragData->canSmartReplace();
applyCommand(MoveSelectionCommand::create(fragment, dragCaret.base(), smartInsert, smartDelete));
} else {
@@ -534,7 +534,7 @@
}
} else {
String text = dragData->asPlainText(innerFrame.get());
- if (text.isEmpty() || !innerFrame->editor()->shouldInsertText(text, range.get(), EditorInsertActionDropped)) {
+ if (text.isEmpty() || !innerFrame->editor().shouldInsertText(text, range.get(), EditorInsertActionDropped)) {
return false;
}
@@ -789,7 +789,7 @@
if (state.m_dragType == DragSourceActionSelection) {
if (!clipboard->hasData()) {
if (enclosingTextFormControl(src->selection()->start()))
- clipboard->writePlainText(src->editor()->selectedTextForClipboard());
+ clipboard->writePlainText(src->editor().selectedTextForClipboard());
else {
RefPtr<Range> selectionRange = src->selection()->toNormalizedRange();
ASSERT(selectionRange);
diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp
index 5ae5d3f..56dca4c 100644
--- a/Source/WebCore/page/EventHandler.cpp
+++ b/Source/WebCore/page/EventHandler.cpp
@@ -503,7 +503,7 @@
{
if (m_mouseDownMayStartSelect) {
selectClosestWordFromHitTestResult(result.hitTestResult(),
- (result.event().clickCount() == 2 && m_frame->editor()->isSelectTrailingWhitespaceEnabled()) ? ShouldAppendTrailingWhitespace : DontAppendTrailingWhitespace);
+ (result.event().clickCount() == 2 && m_frame->editor().isSelectTrailingWhitespaceEnabled()) ? ShouldAppendTrailingWhitespace : DontAppendTrailingWhitespace);
}
}
@@ -605,7 +605,7 @@
pos = selectionInUserSelectAll.end();
}
- if (!m_frame->editor()->behavior().shouldConsiderSelectionAsDirectional() && pos.isNotNull()) {
+ if (!m_frame->editor().behavior().shouldConsiderSelectionAsDirectional() && pos.isNotNull()) {
// See <rdar://problem/3668157> REGRESSION (Mail): shift-click deselects when selection
// was created right-to-left
Position start = newSelection.start();
@@ -1974,8 +1974,8 @@
return false;
Frame* focusFrame = m_frame->page()->focusController()->focusedOrMainFrame();
// Do not paste here if the focus was moved somewhere else.
- if (m_frame == focusFrame && m_frame->editor()->client()->supportsGlobalSelection())
- return m_frame->editor()->command(ASCIILiteral("PasteGlobalSelection")).execute();
+ if (m_frame == focusFrame && m_frame->editor().client()->supportsGlobalSelection())
+ return m_frame->editor().command(ASCIILiteral("PasteGlobalSelection")).execute();
return false;
}
@@ -2902,7 +2902,7 @@
HitTestRequest request(HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
MouseEventWithHitTestResults mev = doc->prepareMouseEvent(request, viewportPos, event);
- if (m_frame->editor()->behavior().shouldSelectOnContextualMenuClick()
+ if (m_frame->editor().behavior().shouldSelectOnContextualMenuClick()
&& !m_frame->selection()->contains(viewportPos)
&& !mev.scrollbar()
// FIXME: In the editable case, word selection sometimes selects content that isn't underneath the mouse.
@@ -2946,7 +2946,7 @@
if (start.deprecatedNode() && (selection->rootEditableElement() || selection->isRange())) {
RefPtr<Range> selectionRange = selection->toNormalizedRange();
- IntRect firstRect = m_frame->editor()->firstRectForRange(selectionRange.get());
+ IntRect firstRect = m_frame->editor().firstRectForRange(selectionRange.get());
int x = rightAligned ? firstRect.maxX() : firstRect.x();
// In a multiline edit, firstRect.maxY() would endup on the next line, so -1.
@@ -3245,7 +3245,7 @@
// in order to match IE:
// 1. preventing default handling of keydown and keypress events has no effect on IM input;
// 2. if an input method handles the event, its keyCode is set to 229 in keydown event.
- m_frame->editor()->handleInputMethodKeydown(keydown.get());
+ m_frame->editor().handleInputMethodKeydown(keydown.get());
bool handledByInputMethod = keydown->defaultHandled();
@@ -3352,7 +3352,7 @@
void EventHandler::defaultKeyboardEventHandler(KeyboardEvent* event)
{
if (event->type() == eventNames().keydownEvent) {
- m_frame->editor()->handleKeyboardEvent(event);
+ m_frame->editor().handleKeyboardEvent(event);
if (event->defaultHandled())
return;
if (event->keyIdentifier() == "U+0009")
@@ -3370,7 +3370,7 @@
handleKeyboardSelectionMovement(m_frame->selection(), event);
}
if (event->type() == eventNames().keypressEvent) {
- m_frame->editor()->handleKeyboardEvent(event);
+ m_frame->editor().handleKeyboardEvent(event);
if (event->defaultHandled())
return;
if (event->charCode() == ' ')
@@ -3671,7 +3671,7 @@
void EventHandler::defaultTextInputEventHandler(TextEvent* event)
{
- if (m_frame->editor()->handleTextEvent(event))
+ if (m_frame->editor().handleTextEvent(event))
event->setDefaultHandled();
}
@@ -3704,7 +3704,7 @@
if (event->ctrlKey() || event->metaKey() || event->altKey() || event->altGraphKey())
return;
- if (!m_frame->editor()->behavior().shouldNavigateBackOnBackspace())
+ if (!m_frame->editor().behavior().shouldNavigateBackOnBackspace())
return;
Page* page = m_frame->page();
diff --git a/Source/WebCore/page/FocusController.cpp b/Source/WebCore/page/FocusController.cpp
index fc0f9f8..7b6b93a 100644
--- a/Source/WebCore/page/FocusController.cpp
+++ b/Source/WebCore/page/FocusController.cpp
@@ -537,7 +537,7 @@
if (!frame || !root)
return false;
- return frame->editor()->shouldEndEditing(rangeOfContents(root).get());
+ return frame->editor().shouldEndEditing(rangeOfContents(root).get());
}
static void clearSelectionIfNeeded(Frame* oldFocusedFrame, Frame* newFocusedFrame, Node* newFocusedNode)
diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp
index bc34b14..e888c7d 100644
--- a/Source/WebCore/page/Frame.cpp
+++ b/Source/WebCore/page/Frame.cpp
@@ -744,14 +744,14 @@
VisiblePosition previous = position.previous();
if (previous.isNotNull()) {
RefPtr<Range> previousCharacterRange = makeRange(previous, position);
- LayoutRect rect = editor()->firstRectForRange(previousCharacterRange.get());
+ LayoutRect rect = editor().firstRectForRange(previousCharacterRange.get());
if (rect.contains(framePoint))
return previousCharacterRange.release();
}
VisiblePosition next = position.next();
if (RefPtr<Range> nextCharacterRange = makeRange(position, next)) {
- LayoutRect rect = editor()->firstRectForRange(nextCharacterRange.get());
+ LayoutRect rect = editor().firstRectForRange(nextCharacterRange.get());
if (rect.contains(framePoint))
return nextCharacterRange.release();
}
diff --git a/Source/WebCore/page/Frame.h b/Source/WebCore/page/Frame.h
index cf6fe3c..3c2bade 100644
--- a/Source/WebCore/page/Frame.h
+++ b/Source/WebCore/page/Frame.h
@@ -113,7 +113,7 @@
Document* document() const;
FrameView* view() const;
- Editor* editor() const;
+ Editor& editor() const;
EventHandler* eventHandler() const;
FrameLoader* loader() const;
NavigationScheduler* navigationScheduler() const;
@@ -218,7 +218,7 @@
RefPtr<Document> m_doc;
OwnPtr<ScriptController> m_script;
- OwnPtr<Editor> m_editor;
+ const OwnPtr<Editor> m_editor;
OwnPtr<FrameSelection> m_selection;
OwnPtr<EventHandler> m_eventHandler;
OwnPtr<AnimationController> m_animationController;
@@ -289,9 +289,9 @@
return m_selection.get();
}
- inline Editor* Frame::editor() const
+ inline Editor& Frame::editor() const
{
- return m_editor.get();
+ return *m_editor;
}
inline AnimationController* Frame::animation() const
diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp
index 605ee42..244edf7 100644
--- a/Source/WebCore/page/Page.cpp
+++ b/Source/WebCore/page/Page.cpp
@@ -565,7 +565,7 @@
Frame* frame = focusController()->focusedOrMainFrame();
Frame* startFrame = frame;
do {
- if (frame->editor()->findString(target, (options & ~WrapAround) | StartInSelection)) {
+ if (frame->editor().findString(target, (options & ~WrapAround) | StartInSelection)) {
if (frame != startFrame)
startFrame->selection()->clear();
focusController()->setFocusedFrame(frame);
@@ -577,7 +577,7 @@
// Search contents of startFrame, on the other side of the selection that we did earlier.
// We cheat a bit and just research with wrap on
if (shouldWrap && !startFrame->selection()->isNone()) {
- bool found = startFrame->editor()->findString(target, options | WrapAround | StartInSelection);
+ bool found = startFrame->editor().findString(target, options | WrapAround | StartInSelection);
focusController()->setFocusedFrame(frame);
return found;
}
@@ -594,7 +594,7 @@
Frame* frame = mainFrame();
Frame* frameWithSelection = 0;
do {
- frame->editor()->countMatchesForText(target, 0, options, limit ? (limit - matchRanges->size()) : 0, true, matchRanges);
+ frame->editor().countMatchesForText(target, 0, options, limit ? (limit - matchRanges->size()) : 0, true, matchRanges);
if (frame->selection()->isRange())
frameWithSelection = frame;
frame = incrementFrame(frame, true, false);
@@ -627,7 +627,7 @@
Frame* frame = referenceRange ? referenceRange->ownerDocument()->frame() : mainFrame();
Frame* startFrame = frame;
do {
- if (RefPtr<Range> resultRange = frame->editor()->rangeOfString(target, frame == startFrame ? referenceRange : 0, options & ~WrapAround))
+ if (RefPtr<Range> resultRange = frame->editor().rangeOfString(target, frame == startFrame ? referenceRange : 0, options & ~WrapAround))
return resultRange.release();
frame = incrementFrame(frame, !(options & Backwards), shouldWrap);
@@ -636,7 +636,7 @@
// Search contents of startFrame, on the other side of the reference range that we did earlier.
// We cheat a bit and just search again with wrap on.
if (shouldWrap && referenceRange) {
- if (RefPtr<Range> resultRange = startFrame->editor()->rangeOfString(target, referenceRange, options | WrapAround | StartInSelection))
+ if (RefPtr<Range> resultRange = startFrame->editor().rangeOfString(target, referenceRange, options | WrapAround | StartInSelection))
return resultRange.release();
}
@@ -657,8 +657,8 @@
Frame* frame = mainFrame();
do {
- frame->editor()->setMarkedTextMatchesAreHighlighted(shouldHighlight);
- matches += frame->editor()->countMatchesForText(target, 0, options, limit ? (limit - matches) : 0, true, 0);
+ frame->editor().setMarkedTextMatchesAreHighlighted(shouldHighlight);
+ matches += frame->editor().countMatchesForText(target, 0, options, limit ? (limit - matches) : 0, true, 0);
frame = incrementFrame(frame, true, false);
} while (frame);
@@ -788,7 +788,7 @@
#endif
for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext())
- frame->editor()->deviceScaleFactorChanged();
+ frame->editor().deviceScaleFactorChanged();
pageCache()->markPagesForFullStyleRecalc(this);
}
diff --git a/Source/WebCore/page/TouchAdjustment.cpp b/Source/WebCore/page/TouchAdjustment.cpp
index cf37444..7b59df0 100644
--- a/Source/WebCore/page/TouchAdjustment.cpp
+++ b/Source/WebCore/page/TouchAdjustment.cpp
@@ -116,7 +116,7 @@
return true;
if (node->renderer()->canBeSelectionLeaf()) {
// If the context menu gesture will trigger a selection all selectable nodes are valid targets.
- if (node->renderer()->frame()->editor()->behavior().shouldSelectOnContextualMenuClick())
+ if (node->renderer()->frame()->editor().behavior().shouldSelectOnContextualMenuClick())
return true;
// Only the selected part of the renderer is a valid target, but this will be corrected in
// appendContextSubtargetsForNode.
@@ -157,7 +157,7 @@
Text* textNode = static_cast<WebCore::Text*>(node);
RenderText* textRenderer = static_cast<RenderText*>(textNode->renderer());
- if (textRenderer->frame()->editor()->behavior().shouldSelectOnContextualMenuClick()) {
+ if (textRenderer->frame()->editor().behavior().shouldSelectOnContextualMenuClick()) {
// Make subtargets out of every word.
String textValue = textNode->data();
TextBreakIterator* wordIterator = wordBreakIterator(textValue.characters(), textValue.length());
diff --git a/Source/WebCore/platform/gtk/ClipboardGtk.cpp b/Source/WebCore/platform/gtk/ClipboardGtk.cpp
index 77a6505..dd0a372 100644
--- a/Source/WebCore/platform/gtk/ClipboardGtk.cpp
+++ b/Source/WebCore/platform/gtk/ClipboardGtk.cpp
@@ -311,7 +311,7 @@
{
ASSERT(range);
- m_dataObject->setText(frame->editor()->selectedTextForClipboard());
+ m_dataObject->setText(frame->editor().selectedTextForClipboard());
m_dataObject->setMarkup(createMarkup(range, 0, AnnotateForInterchange, false, ResolveNonLocalURLs));
if (m_clipboard)
diff --git a/Source/WebCore/platform/gtk/PasteboardGtk.cpp b/Source/WebCore/platform/gtk/PasteboardGtk.cpp
index 40c5fe6..1a0bcbd 100644
--- a/Source/WebCore/platform/gtk/PasteboardGtk.cpp
+++ b/Source/WebCore/platform/gtk/PasteboardGtk.cpp
@@ -65,7 +65,7 @@
DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
dataObject->clearAll();
- dataObject->setText(shouldSerializeSelectedTextForClipboard == IncludeImageAltTextForClipboard ? frame->editor()->selectedTextForClipboard() : frame->editor()->selectedText());
+ dataObject->setText(shouldSerializeSelectedTextForClipboard == IncludeImageAltTextForClipboard ? frame->editor().selectedTextForClipboard() : frame->editor().selectedText());
dataObject->setMarkup(createMarkup(selectedRange, 0, AnnotateForInterchange, false, ResolveNonLocalURLs));
helper->writeClipboardContents(clipboard, canSmartCopyOrDelete ? PasteboardHelper::IncludeSmartPaste : PasteboardHelper::DoNotIncludeSmartPaste);
}
diff --git a/Source/WebCore/platform/mac/DragDataMac.mm b/Source/WebCore/platform/mac/DragDataMac.mm
index 27f1ed8..94f865a 100644
--- a/Source/WebCore/platform/mac/DragDataMac.mm
+++ b/Source/WebCore/platform/mac/DragDataMac.mm
@@ -162,7 +162,7 @@
NSString *scheme = [URLFromPasteboard scheme];
// Cannot drop other schemes unless <rdar://problem/10562662> and <rdar://problem/11187315> are fixed.
if ([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"])
- return [frame->editor()->client()->canonicalizeURL(URLFromPasteboard) absoluteString];
+ return [frame->editor().client()->canonicalizeURL(URLFromPasteboard) absoluteString];
}
if (types.contains(String(NSStringPboardType))) {
@@ -172,7 +172,7 @@
// The result of this function is used to initiate navigation, so we shouldn't allow arbitrary file URLs.
// FIXME: Should we allow only http family schemes, or anything non-local?
if ([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"])
- return [frame->editor()->client()->canonicalizeURL(URLFromPasteboard) absoluteString];
+ return [frame->editor().client()->canonicalizeURL(URLFromPasteboard) absoluteString];
}
if (types.contains(String(NSFilenamesPboardType))) {
@@ -182,7 +182,7 @@
BOOL isDirectory;
if ([[NSFileManager defaultManager] fileExistsAtPath:files[0] isDirectory:&isDirectory] && isDirectory)
return String();
- return [frame->editor()->client()->canonicalizeURL([NSURL fileURLWithPath:files[0]]) absoluteString];
+ return [frame->editor().client()->canonicalizeURL([NSURL fileURLWithPath:files[0]]) absoluteString];
}
}
diff --git a/Source/WebCore/platform/mac/PasteboardMac.mm b/Source/WebCore/platform/mac/PasteboardMac.mm
index a57df23..51c72a4 100644
--- a/Source/WebCore/platform/mac/PasteboardMac.mm
+++ b/Source/WebCore/platform/mac/PasteboardMac.mm
@@ -139,7 +139,7 @@
String Pasteboard::getStringSelection(Frame* frame, ShouldSerializeSelectedTextForClipboard shouldSerializeSelectedTextForClipboard)
{
- String text = shouldSerializeSelectedTextForClipboard == IncludeImageAltTextForClipboard ? frame->editor()->selectedTextForClipboard() : frame->editor()->selectedText();
+ String text = shouldSerializeSelectedTextForClipboard == IncludeImageAltTextForClipboard ? frame->editor().selectedTextForClipboard() : frame->editor().selectedText();
text.replace(noBreakSpace, ' ');
return text;
}
@@ -152,7 +152,7 @@
return SharedBuffer::wrapNSData((NSData *)data.get());
}
- RefPtr<Range> range = frame->editor()->selectedRange();
+ RefPtr<Range> range = frame->editor().selectedRange();
Node* commonAncestor = range->commonAncestorContainer(IGNORE_EXCEPTION);
ASSERT(commonAncestor);
Node* enclosingAnchor = enclosingNodeWithTag(firstPositionInNode(commonAncestor), HTMLNames::aTag);
@@ -180,7 +180,7 @@
void Pasteboard::writeSelectionForTypes(const Vector<String>& pasteboardTypes, bool canSmartCopyOrDelete, Frame* frame, ShouldSerializeSelectedTextForClipboard shouldSerializeSelectedTextForClipboard)
{
NSAttributedString* attributedString = nil;
- RetainPtr<WebHTMLConverter> converter = adoptNS([[WebHTMLConverter alloc] initWithDOMRange:kit(frame->editor()->selectedRange().get())]);
+ RetainPtr<WebHTMLConverter> converter = adoptNS([[WebHTMLConverter alloc] initWithDOMRange:kit(frame->editor().selectedRange().get())]);
if (converter)
attributedString = [converter.get() attributedString];
@@ -188,11 +188,11 @@
Vector<String> clientTypes;
Vector<RefPtr<SharedBuffer> > clientData;
- frame->editor()->client()->getClientPasteboardDataForRange(frame->editor()->selectedRange().get(), clientTypes, clientData);
+ frame->editor().client()->getClientPasteboardDataForRange(frame->editor().selectedRange().get(), clientTypes, clientData);
types.appendVector(clientTypes);
platformStrategies()->pasteboardStrategy()->setTypes(types, m_pasteboardName);
- frame->editor()->client()->didSetSelectionTypesForPasteboard();
+ frame->editor().client()->didSetSelectionTypesForPasteboard();
for (size_t i = 0; i < clientTypes.size(); ++i)
platformStrategies()->pasteboardStrategy()->setBufferForType(clientData[i], clientTypes[i], m_pasteboardName);
@@ -241,7 +241,7 @@
ASSERT(!url.isEmpty());
NSURL *cocoaURL = url;
- NSString *userVisibleString = frame->editor()->client()->userVisibleString(cocoaURL);
+ NSString *userVisibleString = frame->editor().client()->userVisibleString(cocoaURL);
NSString *title = (NSString*)titleStr;
if ([title length] == 0) {
@@ -380,7 +380,7 @@
// FIXME: using the editorClient to call into webkit, for now, since
// calling _web_userVisibleString from WebCore involves migrating a sizable web of
// helper code that should either be done in a separate patch or figured out in another way.
- string = frame->editor()->client()->userVisibleString([NSURL URLWithString:string]);
+ string = frame->editor().client()->userVisibleString([NSURL URLWithString:string]);
if ([string length] > 0)
return [string precomposedStringWithCanonicalMapping];
}
@@ -435,7 +435,7 @@
frame->page()->setDefersLoading(true);
Vector<RefPtr<ArchiveResource> > resources;
- RefPtr<DocumentFragment> fragment = frame->editor()->client()->documentFragmentFromAttributedString(string, resources);
+ RefPtr<DocumentFragment> fragment = frame->editor().client()->documentFragmentFromAttributedString(string, resources);
size_t size = resources.size();
if (size) {
@@ -513,7 +513,7 @@
for (size_t i = 0; i < paths.size(); i++) {
// Non-image file types; _web_userVisibleString is appropriate here because this will
// be pasted as visible text.
- NSString *url = frame->editor()->client()->userVisibleString([NSURL fileURLWithPath:paths[i]]);
+ NSString *url = frame->editor().client()->userVisibleString([NSURL fileURLWithPath:paths[i]]);
RefPtr<Node> textNode = frame->document()->createTextNode(url);
refNodesVector.append(textNode.get());
nodesVector.append(textNode.get());
diff --git a/Source/WebCore/platform/qt/ClipboardQt.cpp b/Source/WebCore/platform/qt/ClipboardQt.cpp
index 1becda3..597f7e1 100644
--- a/Source/WebCore/platform/qt/ClipboardQt.cpp
+++ b/Source/WebCore/platform/qt/ClipboardQt.cpp
@@ -313,7 +313,7 @@
if (!m_writableData)
m_writableData = new QMimeData;
- QString text = frame->editor()->selectedTextForClipboard();
+ QString text = frame->editor().selectedTextForClipboard();
text.replace(QChar(0xa0), QLatin1Char(' '));
m_writableData->setText(text);
m_writableData->setHtml(createMarkup(range, 0, AnnotateForInterchange, false, ResolveNonLocalURLs));
diff --git a/Source/WebCore/platform/qt/PasteboardQt.cpp b/Source/WebCore/platform/qt/PasteboardQt.cpp
index 550af7a..7264c09 100644
--- a/Source/WebCore/platform/qt/PasteboardQt.cpp
+++ b/Source/WebCore/platform/qt/PasteboardQt.cpp
@@ -62,7 +62,7 @@
void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame, ShouldSerializeSelectedTextForClipboard shouldSerializeSelectedTextForClipboard)
{
QMimeData* md = new QMimeData;
- QString text = shouldSerializeSelectedTextForClipboard == IncludeImageAltTextForClipboard ? frame->editor()->selectedTextForClipboard() : frame->editor()->selectedText();
+ QString text = shouldSerializeSelectedTextForClipboard == IncludeImageAltTextForClipboard ? frame->editor().selectedTextForClipboard() : frame->editor().selectedText();
text.replace(QChar(0xa0), QLatin1Char(' '));
md->setText(text);
diff --git a/Source/WebCore/platform/win/ClipboardWin.cpp b/Source/WebCore/platform/win/ClipboardWin.cpp
index 875197f..1ee82fd 100644
--- a/Source/WebCore/platform/win/ClipboardWin.cpp
+++ b/Source/WebCore/platform/win/ClipboardWin.cpp
@@ -751,7 +751,7 @@
if (medium.hGlobal && FAILED(m_writableDataObject->SetData(htmlFormat(), &medium, TRUE)))
::GlobalFree(medium.hGlobal);
- String str = frame->editor()->selectedTextForClipboard();
+ String str = frame->editor().selectedTextForClipboard();
replaceNewlinesWithWindowsStyleNewlines(str);
replaceNBSPWithSpace(str);
medium.hGlobal = createGlobalData(str);
@@ -759,7 +759,7 @@
::GlobalFree(medium.hGlobal);
medium.hGlobal = 0;
- if (frame->editor()->canSmartCopyOrDelete())
+ if (frame->editor().canSmartCopyOrDelete())
m_writableDataObject->SetData(smartPasteFormat(), &medium, TRUE);
}
diff --git a/Source/WebCore/platform/win/PasteboardWin.cpp b/Source/WebCore/platform/win/PasteboardWin.cpp
index e2d71d1..ac706c4 100644
--- a/Source/WebCore/platform/win/PasteboardWin.cpp
+++ b/Source/WebCore/platform/win/PasteboardWin.cpp
@@ -130,7 +130,7 @@
}
// Put plain string on the pasteboard. CF_UNICODETEXT covers CF_TEXT as well
- String str = shouldSerializeSelectedTextForClipboard == IncludeImageAltTextForClipboard ? frame->editor()->selectedTextForClipboard() : frame->editor()->selectedText();
+ String str = shouldSerializeSelectedTextForClipboard == IncludeImageAltTextForClipboard ? frame->editor().selectedTextForClipboard() : frame->editor().selectedText();
replaceNewlinesWithWindowsStyleNewlines(str);
replaceNBSPWithSpace(str);
if (::OpenClipboard(m_owner)) {
diff --git a/Source/WebCore/rendering/HitTestResult.cpp b/Source/WebCore/rendering/HitTestResult.cpp
index 652b18b..74109e1 100644
--- a/Source/WebCore/rendering/HitTestResult.cpp
+++ b/Source/WebCore/rendering/HitTestResult.cpp
@@ -640,7 +640,7 @@
if (!frame)
return Vector<String>();
- return frame->editor()->dictationAlternativesForMarker(marker);
+ return frame->editor().dictationAlternativesForMarker(marker);
}
Node* HitTestResult::targetNode() const
diff --git a/Source/WebCore/rendering/InlineTextBox.cpp b/Source/WebCore/rendering/InlineTextBox.cpp
index f26c19d..7026996 100644
--- a/Source/WebCore/rendering/InlineTextBox.cpp
+++ b/Source/WebCore/rendering/InlineTextBox.cpp
@@ -548,8 +548,8 @@
context->concatCTM(rotation(boxRect, Clockwise));
// Determine whether or not we have composition underlines to draw.
- bool containsComposition = renderer()->node() && renderer()->frame()->editor()->compositionNode() == renderer()->node();
- bool useCustomUnderlines = containsComposition && renderer()->frame()->editor()->compositionUsesCustomUnderlines();
+ bool containsComposition = renderer()->node() && renderer()->frame()->editor().compositionNode() == renderer()->node();
+ bool useCustomUnderlines = containsComposition && renderer()->frame()->editor().compositionUsesCustomUnderlines();
// Determine the text colors and selection colors.
Color textFillColor;
@@ -657,8 +657,8 @@
if (containsComposition && !useCustomUnderlines)
paintCompositionBackground(context, boxOrigin, styleToUse, font,
- renderer()->frame()->editor()->compositionStart(),
- renderer()->frame()->editor()->compositionEnd());
+ renderer()->frame()->editor().compositionStart(),
+ renderer()->frame()->editor().compositionEnd());
paintDocumentMarkers(context, boxOrigin, styleToUse, font, true);
@@ -785,7 +785,7 @@
paintDocumentMarkers(context, boxOrigin, styleToUse, font, false);
if (useCustomUnderlines) {
- const Vector<CompositionUnderline>& underlines = renderer()->frame()->editor()->customCompositionUnderlines();
+ const Vector<CompositionUnderline>& underlines = renderer()->frame()->editor().customCompositionUnderlines();
size_t numUnderlines = underlines.size();
for (size_t index = 0; index < numUnderlines; ++index) {
@@ -1359,7 +1359,7 @@
toRenderedDocumentMarker(marker)->setRenderedRect(markerRect);
// Optionally highlight the text
- if (renderer()->frame()->editor()->markedTextMatchesAreHighlighted()) {
+ if (renderer()->frame()->editor().markedTextMatchesAreHighlighted()) {
Color color = marker->activeMatch() ?
renderer()->theme()->platformActiveTextSearchHighlightColor() :
renderer()->theme()->platformInactiveTextSearchHighlightColor();
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index dfb4eb1..d709616 100644
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -5286,7 +5286,7 @@
}
}
- bool moveCaretToBoundary = document()->frame()->editor()->behavior().shouldMoveCaretToHorizontalBoundaryWhenPastTopOrBottom();
+ bool moveCaretToBoundary = document()->frame()->editor().behavior().shouldMoveCaretToHorizontalBoundaryWhenPastTopOrBottom();
if (!moveCaretToBoundary && !closestBox && lastRootBoxWithChildren) {
// y coordinate is below last root line box, pretend we hit it
diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp
index 17ea155..e945ef3 100644
--- a/Source/WebCore/testing/Internals.cpp
+++ b/Source/WebCore/testing/Internals.cpp
@@ -236,10 +236,10 @@
static SpellChecker* spellchecker(Document* document)
{
- if (!document || !document->frame() || !document->frame()->editor())
+ if (!document || !document->frame())
return 0;
- return document->frame()->editor()->spellChecker();
+ return document->frame()->editor().spellChecker();
}
const char* Internals::internalsId = "internals";
@@ -284,10 +284,10 @@
page->group().captionPreferences()->setCaptionsStyleSheetOverride(emptyString());
page->group().captionPreferences()->setTestingMode(false);
#endif
- if (!page->mainFrame()->editor()->isContinuousSpellCheckingEnabled())
- page->mainFrame()->editor()->toggleContinuousSpellChecking();
- if (page->mainFrame()->editor()->isOverwriteModeEnabled())
- page->mainFrame()->editor()->toggleOverwriteModeEnabled();
+ if (!page->mainFrame()->editor().isContinuousSpellCheckingEnabled())
+ page->mainFrame()->editor().toggleContinuousSpellChecking();
+ if (page->mainFrame()->editor().isOverwriteModeEnabled())
+ page->mainFrame()->editor().toggleOverwriteModeEnabled();
}
Internals::Internals(Document* document)
@@ -1426,7 +1426,7 @@
if (!document || !document->frame())
return 0;
- return document->frame()->editor()->selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length);
+ return document->frame()->editor().selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length);
}
bool Internals::hasAutocorrectedMarker(Document* document, int from, int length, ExceptionCode&)
@@ -1434,7 +1434,7 @@
if (!document || !document->frame())
return 0;
- return document->frame()->editor()->selectionStartHasMarkerFor(DocumentMarker::Autocorrected, from, length);
+ return document->frame()->editor().selectionStartHasMarkerFor(DocumentMarker::Autocorrected, from, length);
}
void Internals::setContinuousSpellCheckingEnabled(bool enabled, ExceptionCode&)
@@ -1442,8 +1442,8 @@
if (!contextDocument() || !contextDocument()->frame())
return;
- if (enabled != contextDocument()->frame()->editor()->isContinuousSpellCheckingEnabled())
- contextDocument()->frame()->editor()->toggleContinuousSpellChecking();
+ if (enabled != contextDocument()->frame()->editor().isContinuousSpellCheckingEnabled())
+ contextDocument()->frame()->editor().toggleContinuousSpellChecking();
}
void Internals::setAutomaticQuoteSubstitutionEnabled(bool enabled, ExceptionCode&)
@@ -1452,8 +1452,8 @@
return;
#if USE(AUTOMATIC_TEXT_REPLACEMENT)
- if (enabled != contextDocument()->frame()->editor()->isAutomaticQuoteSubstitutionEnabled())
- contextDocument()->frame()->editor()->toggleAutomaticQuoteSubstitution();
+ if (enabled != contextDocument()->frame()->editor().isAutomaticQuoteSubstitutionEnabled())
+ contextDocument()->frame()->editor().toggleAutomaticQuoteSubstitution();
#else
UNUSED_PARAM(enabled);
#endif
@@ -1465,8 +1465,8 @@
return;
#if USE(AUTOMATIC_TEXT_REPLACEMENT)
- if (enabled != contextDocument()->frame()->editor()->isAutomaticLinkDetectionEnabled())
- contextDocument()->frame()->editor()->toggleAutomaticLinkDetection();
+ if (enabled != contextDocument()->frame()->editor().isAutomaticLinkDetectionEnabled())
+ contextDocument()->frame()->editor().toggleAutomaticLinkDetection();
#else
UNUSED_PARAM(enabled);
#endif
@@ -1478,8 +1478,8 @@
return;
#if USE(AUTOMATIC_TEXT_REPLACEMENT)
- if (enabled != contextDocument()->frame()->editor()->isAutomaticDashSubstitutionEnabled())
- contextDocument()->frame()->editor()->toggleAutomaticDashSubstitution();
+ if (enabled != contextDocument()->frame()->editor().isAutomaticDashSubstitutionEnabled())
+ contextDocument()->frame()->editor().toggleAutomaticDashSubstitution();
#else
UNUSED_PARAM(enabled);
#endif
@@ -1491,8 +1491,8 @@
return;
#if USE(AUTOMATIC_TEXT_REPLACEMENT)
- if (enabled != contextDocument()->frame()->editor()->isAutomaticTextReplacementEnabled())
- contextDocument()->frame()->editor()->toggleAutomaticTextReplacement();
+ if (enabled != contextDocument()->frame()->editor().isAutomaticTextReplacementEnabled())
+ contextDocument()->frame()->editor().toggleAutomaticTextReplacement();
#else
UNUSED_PARAM(enabled);
#endif
@@ -1504,8 +1504,8 @@
return;
#if USE(AUTOMATIC_TEXT_REPLACEMENT)
- if (enabled != contextDocument()->frame()->editor()->isAutomaticSpellingCorrectionEnabled())
- contextDocument()->frame()->editor()->toggleAutomaticSpellingCorrection();
+ if (enabled != contextDocument()->frame()->editor().isAutomaticSpellingCorrectionEnabled())
+ contextDocument()->frame()->editor().toggleAutomaticSpellingCorrection();
#else
UNUSED_PARAM(enabled);
#endif
@@ -1516,7 +1516,7 @@
if (!document || !document->frame())
return 0;
- return document->frame()->editor()->isOverwriteModeEnabled();
+ return document->frame()->editor().isOverwriteModeEnabled();
}
void Internals::toggleOverwriteModeEnabled(Document* document, ExceptionCode&)
@@ -1524,7 +1524,7 @@
if (!document || !document->frame())
return;
- document->frame()->editor()->toggleOverwriteModeEnabled();
+ document->frame()->editor().toggleOverwriteModeEnabled();
}
#if ENABLE(INSPECTOR)
@@ -1619,7 +1619,7 @@
if (!document || !document->frame())
return 0;
- return document->frame()->editor()->selectionStartHasMarkerFor(DocumentMarker::Grammar, from, length);
+ return document->frame()->editor().selectionStartHasMarkerFor(DocumentMarker::Grammar, from, length);
}
unsigned Internals::numberOfScrollableAreas(Document* document, ExceptionCode&)
diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog
index 99326c0..b454538 100644
--- a/Source/WebKit/blackberry/ChangeLog
+++ b/Source/WebKit/blackberry/ChangeLog
@@ -1,3 +1,21 @@
+2013-05-13 Anders Carlsson <andersca@apple.com>
+
+ Frame::editor() should return a reference
+ https://bugs.webkit.org/show_bug.cgi?id=116037
+
+ Reviewed by Darin Adler.
+
+ * 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):
+
2013-05-14 Carlos Garcia Campos <cgarcia@igalia.com>
Remove WTF_USE_PLATFORM_STRATEGIES
diff --git a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp
index beed207..d5152e0 100644
--- a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp
+++ b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp
@@ -115,7 +115,7 @@
}
// Check if the node disables spell checking directly.
- return frame->editor()->isSpellCheckingEnabledInFocusedNode();
+ return frame->editor().isSpellCheckingEnabledInFocusedNode();
}
bool EditorClientBlackBerry::isContinuousSpellCheckingEnabled()
@@ -469,19 +469,19 @@
String commandName = interpretKeyEvent(event);
// Check to see we are not trying to insert text on key down.
- ASSERT(!(event->type() == eventNames().keydownEvent && frame->editor()->command(commandName).isTextInsertion()));
+ ASSERT(!(event->type() == eventNames().keydownEvent && frame->editor().command(commandName).isTextInsertion()));
if (!commandName.isEmpty()) {
// Hot key handling. Cancel processing mode.
if (commandName != "DeleteBackward")
m_webPagePrivate->m_inputHandler->setProcessingChange(false);
- if (frame->editor()->command(commandName).execute())
+ if (frame->editor().command(commandName).execute())
event->setDefaultHandled();
return;
}
- if (!frame->editor()->canEdit())
+ if (!frame->editor().canEdit())
return;
// Text insertion commands should only be triggered from keypressEvent.
@@ -501,7 +501,7 @@
return;
if (!platformEvent->text().isEmpty()) {
- if (frame->editor()->insertText(platformEvent->text(), event))
+ if (frame->editor().insertText(platformEvent->text(), event))
event->setDefaultHandled();
}
}
diff --git a/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp b/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp
index be96481..40421c3 100644
--- a/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp
+++ b/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp
@@ -266,7 +266,7 @@
bool elementHasContinuousSpellCheckingEnabled(const PassRefPtr<WebCore::Element> element)
{
- return element && element->document()->frame() && element->document()->frame()->editor()->isContinuousSpellCheckingEnabled();
+ return element && element->document()->frame() && element->document()->frame()->editor().isContinuousSpellCheckingEnabled();
}
// Check if this is an input field that will be focused & require input support.
diff --git a/Source/WebKit/blackberry/WebKitSupport/InPageSearchManager.cpp b/Source/WebKit/blackberry/WebKitSupport/InPageSearchManager.cpp
index a3380b3..4091dae 100644
--- a/Source/WebKit/blackberry/WebKitSupport/InPageSearchManager.cpp
+++ b/Source/WebKit/blackberry/WebKitSupport/InPageSearchManager.cpp
@@ -180,7 +180,7 @@
bool InPageSearchManager::findAndMarkText(const String& text, Range* range, Frame* frame, const FindOptions& options, bool isNewSearch, bool startFromSelection)
{
- if (RefPtr<Range> match = frame->editor()->findStringAndScrollToVisible(text, range, options)) {
+ if (RefPtr<Range> match = frame->editor().findStringAndScrollToVisible(text, range, options)) {
// Move the highlight to the new match.
setActiveMatchAndMarker(match);
if (isNewSearch) {
@@ -190,7 +190,7 @@
// because scopeStringMatches does not add any markers, it only counts the number.
// No need to unmarkAllTextMatches, it is already done from the caller because of newSearch
m_activeMatch->ownerDocument()->markers()->addTextMatchMarker(m_activeMatch.get(), true);
- frame->editor()->setMarkedTextMatchesAreHighlighted(true /* highlight */);
+ frame->editor().setMarkedTextMatchesAreHighlighted(true /* highlight */);
}
return true;
}
@@ -223,7 +223,7 @@
// all matches but count them.
m_webPage->m_page->unmarkAllTextMatches();
m_activeMatch->ownerDocument()->markers()->addTextMatchMarker(m_activeMatch.get(), true);
- frame->editor()->setMarkedTextMatchesAreHighlighted(true /* highlight */);
+ frame->editor().setMarkedTextMatchesAreHighlighted(true /* highlight */);
}
return true;
@@ -356,7 +356,7 @@
m_activeMatchIndex += matchCount;
} else {
if (m_highlightAllMatches)
- scopingFrame->editor()->setMarkedTextMatchesAreHighlighted(true /* highlight */);
+ scopingFrame->editor().setMarkedTextMatchesAreHighlighted(true /* highlight */);
m_activeMatchCount += matchCount;
m_webPage->m_client->updateFindStringResult(m_activeMatchCount, m_activeMatchIndex);
}
diff --git a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp
index 333d124..706f109 100644
--- a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp
+++ b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp
@@ -105,7 +105,7 @@
BlackBerry::Platform::String SelectionHandler::selectedText() const
{
- return m_webPage->focusedOrMainFrame()->editor()->selectedText();
+ return m_webPage->focusedOrMainFrame()->editor().selectedText();
}
WebCore::IntRect SelectionHandler::clippingRectForVisibleContent() const
diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog
index 86518b2..9ac4f75 100644
--- a/Source/WebKit/efl/ChangeLog
+++ b/Source/WebKit/efl/ChangeLog
@@ -1,3 +1,27 @@
+2013-05-13 Anders Carlsson <andersca@apple.com>
+
+ Frame::editor() should return a reference
+ https://bugs.webkit.org/show_bug.cgi?id=116037
+
+ Reviewed by Darin Adler.
+
+ * 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):
+
2013-05-12 Timothy Hatcher <timothy@apple.com>
Add support for updating the Web Inspector toolbar height.
diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp
index d0ce38a..224a4b7 100644
--- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp
+++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp
@@ -291,7 +291,7 @@
{
DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
- page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
+ page->focusController()->focusedOrMainFrame()->editor().command(name).execute(value);
}
bool DumpRenderTreeSupportEfl::findString(const Evas_Object* ewkView, const String& text, WebCore::FindOptions options)
@@ -328,7 +328,7 @@
{
DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false);
- return page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
+ return page->focusController()->focusedOrMainFrame()->editor().command(name).isEnabled();
}
void DumpRenderTreeSupportEfl::forceLayout(Evas_Object* ewkFrame)
@@ -550,14 +550,14 @@
if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
return;
- WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
- if (!editor || (!editor->canEdit() && !editor->hasComposition()))
+ WebCore::Editor& editor = page->focusController()->focusedOrMainFrame()->editor();
+ if (!editor.canEdit() && !editor.hasComposition())
return;
const String compositionString = String::fromUTF8(text);
Vector<WebCore::CompositionUnderline> underlines;
underlines.append(WebCore::CompositionUnderline(0, compositionString.length(), WebCore::Color(0, 0, 0), false));
- editor->setComposition(compositionString, underlines, start, start + length);
+ editor.setComposition(compositionString, underlines, start, start + length);
}
bool DumpRenderTreeSupportEfl::hasComposition(const Evas_Object* ewkView)
@@ -567,11 +567,7 @@
if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
return false;
- const WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
- if (!editor)
- return false;
-
- return editor->hasComposition();
+ return page->focusController()->focusedOrMainFrame()->editor().hasComposition();
}
bool DumpRenderTreeSupportEfl::compositionRange(Evas_Object* ewkView, int* start, int* length)
@@ -583,12 +579,12 @@
if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
return false;
- WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
- if (!editor || !editor->hasComposition())
+ WebCore::Editor& editor = page->focusController()->focusedOrMainFrame()->editor();
+ if (!editor.hasComposition())
return false;
- *start = editor->compositionStart();
- *length = editor->compositionEnd() - *start;
+ *start = editor.compositionStart();
+ *length = editor.compositionEnd() - *start;
return true;
}
@@ -599,40 +595,37 @@
if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
return;
- WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
- if (!editor)
- return;
+ WebCore::Editor& editor = page->focusController()->focusedOrMainFrame()->editor();
- if (!editor->hasComposition()) {
- editor->insertText(String::fromUTF8(text), 0);
+ if (!editor.hasComposition()) {
+ editor.insertText(String::fromUTF8(text), 0);
return;
}
if (text) {
- editor->confirmComposition(String::fromUTF8(text));
+ editor.confirmComposition(String::fromUTF8(text));
return;
}
- editor->confirmComposition();
+ editor.confirmComposition();
}
WebCore::IntRect DumpRenderTreeSupportEfl::firstRectForCharacterRange(Evas_Object* ewkView, int location, int length)
{
DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, WebCore::IntRect());
- if (!page->focusController() || !page->focusController()->focusedOrMainFrame() || !page->focusController()->focusedOrMainFrame()->editor())
+ if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
return WebCore::IntRect();
if ((location + length < location) && (location + length))
length = 0;
WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();
- WebCore::Editor* editor = frame->editor();
RefPtr<WebCore::Range> range = WebCore::TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length);
if (!range)
return WebCore::IntRect();
- return editor->firstRectForRange(range.get());
+ return frame->editor().firstRectForRange(range.get());
}
bool DumpRenderTreeSupportEfl::selectedRange(Evas_Object* ewkView, int* start, int* length)
diff --git a/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp
index 90902d7..24da51d 100644
--- a/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp
+++ b/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp
@@ -142,13 +142,13 @@
if (!coreFrame)
return;
- if (coreFrame->editor() && coreFrame->editor()->ignoreCompositionSelectionChange())
+ if (coreFrame->editor().ignoreCompositionSelectionChange())
return;
Evas_Object* webFrame = EWKPrivate::kitFrame(coreFrame);
ewk_frame_editor_client_selection_changed(webFrame);
- coreFrame->editor()->cancelCompositionIfSelectionIsInvalid();
+ coreFrame->editor().cancelCompositionIfSelectionIsInvalid();
}
void EditorClientEfl::didEndEditing()
@@ -324,7 +324,7 @@
}
}
- Editor::Command command = frame->editor()->command(interpretKeyEvent(event));
+ Editor::Command command = frame->editor().command(interpretKeyEvent(event));
if (keyEvent->type() == PlatformEvent::RawKeyDown) {
// WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated,
@@ -337,7 +337,7 @@
return true;
// Don't allow text insertion for nodes that cannot edit.
- if (!frame->editor()->canEdit())
+ if (!frame->editor().canEdit())
return false;
// Don't insert null or control characters as they can result in unexpected behaviour
@@ -348,7 +348,7 @@
if (keyEvent->ctrlKey() || keyEvent->altKey())
return false;
- return frame->editor()->insertText(event->keyEvent()->text(), event);
+ return frame->editor().insertText(event->keyEvent()->text(), event);
}
void EditorClientEfl::handleKeyboardEvent(KeyboardEvent* event)
diff --git a/Source/WebKit/efl/ewk/ewk_frame.cpp b/Source/WebKit/efl/ewk/ewk_frame.cpp
index f4d3c0e..ccf7e50 100644
--- a/Source/WebKit/efl/ewk/ewk_frame.cpp
+++ b/Source/WebKit/efl/ewk/ewk_frame.cpp
@@ -480,7 +480,7 @@
return true;
smartData->editable = editable;
if (editable)
- smartData->frame->editor()->applyEditingStyleToBodyElement();
+ smartData->frame->editor().applyEditingStyleToBodyElement();
return true;
}
@@ -488,7 +488,7 @@
{
EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0);
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, 0);
- WTF::CString selectedText = smartData->frame->editor()->selectedText().utf8();
+ WTF::CString selectedText = smartData->frame->editor().selectedText().utf8();
if (selectedText.isNull())
return 0;
return eina_stringshare_add(selectedText.data());
@@ -500,7 +500,7 @@
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(text, false);
- return smartData->frame->editor()->findString(WTF::String::fromUTF8(text), forward, caseSensitive, wrap, true);
+ return smartData->frame->editor().findString(WTF::String::fromUTF8(text), forward, caseSensitive, wrap, true);
}
unsigned int ewk_frame_text_matches_mark(Evas_Object* ewkFrame, const char* string, Eina_Bool caseSensitive, Eina_Bool highlight, unsigned int limit)
@@ -509,8 +509,8 @@
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, 0);
EINA_SAFETY_ON_NULL_RETURN_VAL(string, 0);
- smartData->frame->editor()->setMarkedTextMatchesAreHighlighted(highlight);
- return smartData->frame->editor()->countMatchesForText(WTF::String::fromUTF8(string), 0, caseSensitive, limit, true, 0);
+ smartData->frame->editor().setMarkedTextMatchesAreHighlighted(highlight);
+ return smartData->frame->editor().countMatchesForText(WTF::String::fromUTF8(string), 0, caseSensitive, limit, true, 0);
}
Eina_Bool ewk_frame_text_matches_unmark_all(Evas_Object* ewkFrame)
@@ -526,7 +526,7 @@
{
EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false);
- smartData->frame->editor()->setMarkedTextMatchesAreHighlighted(highlight);
+ smartData->frame->editor().setMarkedTextMatchesAreHighlighted(highlight);
return true;
}
@@ -534,7 +534,7 @@
{
EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false);
- return smartData->frame->editor()->markedTextMatchesAreHighlighted();
+ return smartData->frame->editor().markedTextMatchesAreHighlighted();
}
/**
diff --git a/Source/WebKit/efl/ewk/ewk_view.cpp b/Source/WebKit/efl/ewk/ewk_view.cpp
index f3fa8e1..4a8aaf3 100644
--- a/Source/WebKit/efl/ewk/ewk_view.cpp
+++ b/Source/WebKit/efl/ewk/ewk_view.cpp
@@ -1668,7 +1668,7 @@
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
- CString selectedString = priv->page->focusController()->focusedOrMainFrame()->editor()->selectedText().utf8();
+ CString selectedString = priv->page->focusController()->focusedOrMainFrame()->editor().selectedText().utf8();
if (selectedString.isNull())
return 0;
return eina_stringshare_add(selectedString.data());
@@ -1683,7 +1683,7 @@
if (!commandString)
return false;
- return priv->page->focusController()->focusedOrMainFrame()->editor()->command(commandString).execute(WTF::String::fromUTF8(value));
+ return priv->page->focusController()->focusedOrMainFrame()->editor().command(commandString).execute(WTF::String::fromUTF8(value));
}
Eina_Bool ewk_view_context_menu_forward_event(Evas_Object* ewkView, const Evas_Event_Mouse_Down* downEvent)
@@ -4102,11 +4102,11 @@
if (!focusedFrame)
return;
- WebCore::Editor* editor = focusedFrame->editor();
- if (!editor->canEdit())
+ WebCore::Editor& editor = focusedFrame->editor();
+ if (!editor.canEdit())
return;
- editor->setBaseWritingDirection(static_cast<WritingDirection>(direction));
+ editor.setBaseWritingDirection(static_cast<WritingDirection>(direction));
}
void ewk_view_did_first_visually_nonempty_layout(Evas_Object* ewkView)
diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog
index 87a01d1..6960d0b 100644
--- a/Source/WebKit/gtk/ChangeLog
+++ b/Source/WebKit/gtk/ChangeLog
@@ -1,3 +1,45 @@
+2013-05-13 Anders Carlsson <andersca@apple.com>
+
+ Frame::editor() should return a reference
+ https://bugs.webkit.org/show_bug.cgi?id=116037
+
+ Reviewed by Darin Adler.
+
+ * 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):
+
2013-05-14 Zan Dobersek <zdobersek@igalia.com>
[GTK] Move generated ColorData.cpp, WebKitFontFamilyNames.(cpp|h) build targets into libPlatform
diff --git a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
index 9a52e7f..9b538c4 100644
--- a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
+++ b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
@@ -599,7 +599,7 @@
// synced with cursor movement. For instance, a text field can move without
// the selection changing.
Frame* focusedFrame = core(m_webView)->focusController()->focusedOrMainFrame();
- if (focusedFrame && focusedFrame->editor()->canEdit())
+ if (focusedFrame && focusedFrame->editor().canEdit())
m_webView->priv->imFilter.setCursorRect(frame->selection()->absoluteCaretBounds());
}
diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
index 2a3d4ce..370cd31 100644
--- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
+++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
@@ -276,7 +276,7 @@
g_return_if_fail(name);
g_return_if_fail(value);
- core(webView)->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
+ core(webView)->focusController()->focusedOrMainFrame()->editor().command(name).execute(value);
}
bool DumpRenderTreeSupportGtk::isCommandEnabled(WebKitWebView* webView, const gchar* name)
@@ -284,7 +284,7 @@
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
g_return_val_if_fail(name, FALSE);
- return core(webView)->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
+ return core(webView)->focusController()->focusedOrMainFrame()->editor().command(name).isEnabled();
}
void DumpRenderTreeSupportGtk::setComposition(WebKitWebView* webView, const char* text, int start, int length)
@@ -296,14 +296,14 @@
if (!frame)
return;
- Editor* editor = frame->editor();
- if (!editor || (!editor->canEdit() && !editor->hasComposition()))
+ Editor& editor = frame->editor();
+ if (!editor.canEdit() && !editor.hasComposition())
return;
String compositionString = String::fromUTF8(text);
Vector<CompositionUnderline> underlines;
underlines.append(CompositionUnderline(0, compositionString.length(), Color(0, 0, 0), false));
- editor->setComposition(compositionString, underlines, start, start + length);
+ editor.setComposition(compositionString, underlines, start, start + length);
}
bool DumpRenderTreeSupportGtk::hasComposition(WebKitWebView* webView)
@@ -312,11 +312,8 @@
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
if (!frame)
return false;
- Editor* editor = frame->editor();
- if (!editor)
- return false;
- return editor->hasComposition();
+ return frame->editor().hasComposition();
}
bool DumpRenderTreeSupportGtk::compositionRange(WebKitWebView* webView, int* start, int* length)
@@ -329,12 +326,12 @@
if (!frame)
return false;
- Editor* editor = frame->editor();
- if (!editor || !editor->hasComposition())
+ Editor& editor = frame->editor();
+ if (!editor.hasComposition())
return false;
- *start = editor->compositionStart();
- *length = editor->compositionEnd() - *start;
+ *start = editor.compositionStart();
+ *length = editor.compositionEnd() - *start;
return true;
}
@@ -346,19 +343,17 @@
if (!frame)
return;
- Editor* editor = frame->editor();
- if (!editor)
- return;
+ Editor& editor = frame->editor();
- if (!editor->hasComposition()) {
- editor->insertText(String::fromUTF8(text), 0);
+ if (!editor.hasComposition()) {
+ editor.insertText(String::fromUTF8(text), 0);
return;
}
if (text) {
- editor->confirmComposition(String::fromUTF8(text));
+ editor.confirmComposition(String::fromUTF8(text));
return;
}
- editor->confirmComposition();
+ editor.confirmComposition();
}
void DumpRenderTreeSupportGtk::doCommand(WebKitWebView* webView, const char* command)
@@ -368,9 +363,7 @@
if (!frame)
return;
- Editor* editor = frame->editor();
- if (!editor)
- return;
+ Editor& editor = frame->editor();
String commandString(command);
// Remove ending : here.
@@ -383,7 +376,7 @@
firstChar.makeUpper();
commandString.insert(firstChar, 0);
- editor->command(commandString).execute();
+ editor.command(commandString).execute();
}
bool DumpRenderTreeSupportGtk::firstRectForCharacterRange(WebKitWebView* webView, int location, int length, cairo_rectangle_int_t* rect)
@@ -398,15 +391,13 @@
if (!frame)
return false;
- Editor* editor = frame->editor();
- if (!editor)
- return false;
+ Editor& editor = frame->editor();
RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length);
if (!range)
return false;
- *rect = editor->firstRectForRange(range.get());
+ *rect = editor.firstRectForRange(range.get());
return true;
}
diff --git a/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
index 57facaf..5090904 100644
--- a/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
+++ b/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
@@ -255,7 +255,7 @@
setSelectionPrimaryClipboardIfNeeded(m_webView);
#endif
- if (frame->editor()->cancelCompositionIfSelectionIsInvalid())
+ if (frame->editor().cancelCompositionIfSelectionIsInvalid())
m_webView->priv->imFilter.resetContext();
}
@@ -394,7 +394,7 @@
{
Vector<Editor::Command> commands;
for (size_t i = 0; i < m_pendingEditorCommands.size(); i++) {
- Editor::Command command = frame->editor()->command(m_pendingEditorCommands.at(i).utf8().data());
+ Editor::Command command = frame->editor().command(m_pendingEditorCommands.at(i).utf8().data());
if (command.isTextInsertion() && !allowTextInsertion)
return false;
@@ -455,7 +455,7 @@
}
// Only allow text insertion commands if the current node is editable.
- if (executePendingEditorCommands(frame, frame->editor()->canEdit())) {
+ if (executePendingEditorCommands(frame, frame->editor().canEdit())) {
event->setDefaultHandled();
return;
}
@@ -463,7 +463,7 @@
}
// Don't allow text insertion for nodes that cannot edit.
- if (!frame->editor()->canEdit())
+ if (!frame->editor().canEdit())
return;
// This is just a normal text insertion, so wait to execute the insertion
@@ -480,7 +480,7 @@
if (platformEvent->ctrlKey() || platformEvent->altKey())
return;
- if (frame->editor()->insertText(platformEvent->text(), event))
+ if (frame->editor().insertText(platformEvent->text(), event))
event->setDefaultHandled();
}
diff --git a/Source/WebKit/gtk/WebCoreSupport/WebViewInputMethodFilter.cpp b/Source/WebKit/gtk/WebCoreSupport/WebViewInputMethodFilter.cpp
index 3398911..9877fca 100644
--- a/Source/WebKit/gtk/WebCoreSupport/WebViewInputMethodFilter.cpp
+++ b/Source/WebKit/gtk/WebCoreSupport/WebViewInputMethodFilter.cpp
@@ -51,7 +51,7 @@
bool WebViewInputMethodFilter::canEdit()
{
Frame* frame = focusedOrMainFrame();
- return frame && frame->editor()->canEdit();
+ return frame && frame->editor().canEdit();
}
bool WebViewInputMethodFilter::sendSimpleKeyEvent(GdkEventKey* event, WTF::String simpleString, EventFakedForComposition)
@@ -76,42 +76,42 @@
void WebViewInputMethodFilter::confirmCompositionText(String text)
{
Frame* frame = focusedOrMainFrame();
- if (!frame || !frame->editor()->canEdit())
+ if (!frame || !frame->editor().canEdit())
return;
if (text.isNull()) {
confirmCurrentComposition();
return;
}
- frame->editor()->confirmComposition(m_confirmedComposition);
+ frame->editor().confirmComposition(m_confirmedComposition);
}
void WebViewInputMethodFilter::confirmCurrentComposition()
{
Frame* frame = focusedOrMainFrame();
- if (!frame || !frame->editor()->canEdit())
+ if (!frame || !frame->editor().canEdit())
return;
- frame->editor()->confirmComposition();
+ frame->editor().confirmComposition();
}
void WebViewInputMethodFilter::cancelCurrentComposition()
{
Frame* frame = focusedOrMainFrame();
- if (!frame || !frame->editor()->canEdit())
+ if (!frame || !frame->editor().canEdit())
return;
- frame->editor()->cancelComposition();
+ frame->editor().cancelComposition();
}
void WebViewInputMethodFilter::setPreedit(String newPreedit, int cursorOffset)
{
Frame* frame = focusedOrMainFrame();
- if (!frame || !frame->editor()->canEdit())
+ if (!frame || !frame->editor().canEdit())
return;
// TODO: We should parse the PangoAttrList that we get from the IM context here.
Vector<CompositionUnderline> underlines;
underlines.append(CompositionUnderline(0, newPreedit.length(), Color(1, 1, 1), false));
- frame->editor()->setComposition(newPreedit, underlines, m_cursorOffset, m_cursorOffset);
+ frame->editor().setComposition(newPreedit, underlines, m_cursorOffset, m_cursorOffset);
}
} // namespace WebKit
diff --git a/Source/WebKit/gtk/webkit/webkitwebframe.cpp b/Source/WebKit/gtk/webkit/webkitwebframe.cpp
index 3346164..163f6f0 100644
--- a/Source/WebKit/gtk/webkit/webkitwebframe.cpp
+++ b/Source/WebKit/gtk/webkit/webkitwebframe.cpp
@@ -1134,7 +1134,7 @@
Frame* coreFrame = core(frame);
bool selectReplacement = false;
bool smartReplace = true;
- coreFrame->editor()->replaceSelectionWithText(text, selectReplacement, smartReplace);
+ coreFrame->editor().replaceSelectionWithText(text, selectReplacement, smartReplace);
}
/**
diff --git a/Source/WebKit/gtk/webkit/webkitwebview.cpp b/Source/WebKit/gtk/webkit/webkitwebview.cpp
index 07666be..c582b66 100644
--- a/Source/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/Source/WebKit/gtk/webkit/webkitwebview.cpp
@@ -442,7 +442,7 @@
// selection->selection().firstRange can return 0 here, but if that was the case
// selection->selection().isNonOrphanedCaretOrRange() would have returned false
// above, so we do not have to check it.
- IntRect firstRect = frame->editor()->firstRectForRange(selection->selection().firstRange().get());
+ IntRect firstRect = frame->editor().firstRectForRange(selection->selection().firstRange().get());
return IntPoint(firstRect.x(), firstRect.maxY());
}
@@ -938,7 +938,7 @@
else
focusController->setFocusedFrame(core(webView)->mainFrame());
- if (focusController->focusedFrame()->editor()->canEdit())
+ if (focusController->focusedFrame()->editor().canEdit())
webView->priv->imFilter.notifyFocusedIn();
return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_in_event(widget, event);
}
@@ -1181,31 +1181,31 @@
static void webkit_web_view_real_select_all(WebKitWebView* webView)
{
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
- frame->editor()->command("SelectAll").execute();
+ frame->editor().command("SelectAll").execute();
}
static void webkit_web_view_real_cut_clipboard(WebKitWebView* webView)
{
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
- frame->editor()->command("Cut").execute();
+ frame->editor().command("Cut").execute();
}
static void webkit_web_view_real_copy_clipboard(WebKitWebView* webView)
{
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
- frame->editor()->command("Copy").execute();
+ frame->editor().command("Copy").execute();
}
static void webkit_web_view_real_undo(WebKitWebView* webView)
{
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
- frame->editor()->command("Undo").execute();
+ frame->editor().command("Undo").execute();
}
static void webkit_web_view_real_redo(WebKitWebView* webView)
{
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
- frame->editor()->command("Redo").execute();
+ frame->editor().command("Redo").execute();
}
static gboolean webkit_web_view_real_move_cursor (WebKitWebView* webView, GtkMovementStep step, gint count)
@@ -1264,7 +1264,7 @@
static void webkit_web_view_real_paste_clipboard(WebKitWebView* webView)
{
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
- frame->editor()->command("Paste").execute();
+ frame->editor().command("Paste").execute();
}
static gboolean webkit_web_view_real_should_allow_editing_action(WebKitWebView*)
@@ -4389,7 +4389,7 @@
Frame *frame = core(webView)->mainFrame();
do {
- frame->editor()->setMarkedTextMatchesAreHighlighted(shouldHighlight);
+ frame->editor().setMarkedTextMatchesAreHighlighted(shouldHighlight);
frame = frame->tree()->traverseNextWithWrap(false);
} while (frame);
}
@@ -4459,7 +4459,7 @@
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
- return frame->editor()->canCut() || frame->editor()->canDHTMLCut();
+ return frame->editor().canCut() || frame->editor().canDHTMLCut();
}
/**
@@ -4475,7 +4475,7 @@
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
- return frame->editor()->canCopy() || frame->editor()->canDHTMLCopy();
+ return frame->editor().canCopy() || frame->editor().canDHTMLCopy();
}
/**
@@ -4491,7 +4491,7 @@
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
- return frame->editor()->canPaste() || frame->editor()->canDHTMLPaste();
+ return frame->editor().canPaste() || frame->editor().canDHTMLPaste();
}
/**
@@ -4547,7 +4547,7 @@
g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
- frame->editor()->performDelete();
+ frame->editor().performDelete();
}
/**
@@ -4629,7 +4629,7 @@
g_return_if_fail(frame);
if (flag) {
- frame->editor()->applyEditingStyleToBodyElement();
+ frame->editor().applyEditingStyleToBodyElement();
// TODO: If the WebKitWebView is made editable and the selection is empty, set it to something.
//if (!webkit_web_view_get_selected_dom_range(webView))
// mainFrame->setSelectionFromNone();
@@ -5090,7 +5090,7 @@
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
- return frame->editor()->canUndo();
+ return frame->editor().canUndo();
}
/**
@@ -5125,7 +5125,7 @@
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
- return frame->editor()->canRedo();
+ return frame->editor().canRedo();
}
/**
diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog
index d34537d..ae5b8d1 100644
--- a/Source/WebKit/mac/ChangeLog
+++ b/Source/WebKit/mac/ChangeLog
@@ -1,3 +1,66 @@
+2013-05-13 Anders Carlsson <andersca@apple.com>
+
+ Frame::editor() should return a reference
+ https://bugs.webkit.org/show_bug.cgi?id=116037
+
+ Reviewed by Darin Adler.
+
+ * 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:]):
+
2013-05-15 Darin Adler <darin@apple.com>
[Mac] Remove the ClipboardMac class and header file
diff --git a/Source/WebKit/mac/WebView/WebFrame.mm b/Source/WebKit/mac/WebView/WebFrame.mm
index 6d3c6b0..a0354b4 100644
--- a/Source/WebKit/mac/WebView/WebFrame.mm
+++ b/Source/WebKit/mac/WebView/WebFrame.mm
@@ -493,7 +493,7 @@
- (NSString *)_selectedString
{
- return _private->coreFrame->displayStringModifiedByEncoding(_private->coreFrame->editor()->selectedText());
+ return _private->coreFrame->displayStringModifiedByEncoding(_private->coreFrame->editor().selectedText());
}
- (NSString *)_stringForRange:(DOMRange *)range
@@ -602,7 +602,7 @@
- (NSRect)_firstRectForDOMRange:(DOMRange *)range
{
- return _private->coreFrame->editor()->firstRectForRange(core(range));
+ return _private->coreFrame->editor().firstRectForRange(core(range));
}
- (void)_scrollDOMRangeToVisible:(DOMRange *)range
@@ -676,7 +676,7 @@
- (DOMRange *)_markDOMRange
{
- return kit(_private->coreFrame->editor()->mark().toNormalizedRange().get());
+ return kit(_private->coreFrame->editor().mark().toNormalizedRange().get());
}
// Given proposedRange, returns an extended range that includes adjacent whitespace that should
@@ -746,7 +746,7 @@
if (_private->coreFrame->selection()->isNone())
return;
- _private->coreFrame->editor()->insertParagraphSeparatorInQuotedContent();
+ _private->coreFrame->editor().insertParagraphSeparatorInQuotedContent();
}
- (VisiblePosition)_visiblePositionForPoint:(NSPoint)point
@@ -775,7 +775,7 @@
if (!_private->coreFrame || !style)
return;
// FIXME: We shouldn't have to create a copy here.
- _private->coreFrame->editor()->computeAndSetTypingStyle(core(style)->copyProperties().get(), undoAction);
+ _private->coreFrame->editor().computeAndSetTypingStyle(core(style)->copyProperties().get(), undoAction);
}
#if ENABLE(DRAG_SUPPORT)
@@ -928,7 +928,7 @@
{
if (_private->coreFrame->selection()->isNone() || !fragment)
return;
- _private->coreFrame->editor()->replaceSelectionWithFragment(core(fragment), selectReplacement, smartReplace, matchStyle);
+ _private->coreFrame->editor().replaceSelectionWithFragment(core(fragment), selectReplacement, smartReplace, matchStyle);
}
- (void)_replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace
diff --git a/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm b/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm
index 376df9b..d6120ae 100644
--- a/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm
+++ b/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm
@@ -220,7 +220,7 @@
return;
WebView *webView = [webFrame webView];
if ([webView mainFrame] == webFrame && [webView isEditable])
- core(webFrame)->editor()->applyEditingStyleToBodyElement();
+ core(webFrame)->editor().applyEditingStyleToBodyElement();
}
- (BOOL)canProvideDocumentSource
diff --git a/Source/WebKit/mac/WebView/WebHTMLView.mm b/Source/WebKit/mac/WebView/WebHTMLView.mm
index 8ff65ab..e1669d7 100644
--- a/Source/WebKit/mac/WebView/WebHTMLView.mm
+++ b/Source/WebKit/mac/WebView/WebHTMLView.mm
@@ -864,7 +864,7 @@
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard inContext:range allowPlainText:allowPlainText];
if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:range givenAction:WebViewInsertActionPasted])
- coreFrame->editor()->pasteAsFragment(core(fragment), [self _canSmartReplaceWithPasteboard:pasteboard], false);
+ coreFrame->editor().pasteAsFragment(core(fragment), [self _canSmartReplaceWithPasteboard:pasteboard], false);
#else
// Mail is ignoring the frament passed to the delegate and creates a new one.
// We want to avoid creating the fragment twice.
@@ -872,12 +872,12 @@
if ([self _shouldInsertFragment:nil replacingDOMRange:range givenAction:WebViewInsertActionPasted]) {
DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard inContext:range allowPlainText:allowPlainText];
if (fragment)
- coreFrame->editor()->pasteAsFragment(core(fragment), [self _canSmartReplaceWithPasteboard:pasteboard], false);
+ coreFrame->editor().pasteAsFragment(core(fragment), [self _canSmartReplaceWithPasteboard:pasteboard], false);
}
} else {
DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard inContext:range allowPlainText:allowPlainText];
if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:range givenAction:WebViewInsertActionPasted])
- coreFrame->editor()->pasteAsFragment(core(fragment), [self _canSmartReplaceWithPasteboard:pasteboard], false);
+ coreFrame->editor().pasteAsFragment(core(fragment), [self _canSmartReplaceWithPasteboard:pasteboard], false);
}
#endif
[webView _setInsertionPasteboard:nil];
@@ -983,7 +983,7 @@
- (BOOL)_shouldDeleteRange:(DOMRange *)range
{
Frame* coreFrame = core([self _frame]);
- return coreFrame && coreFrame->editor()->shouldDeleteRange(core(range));
+ return coreFrame && coreFrame->editor().shouldDeleteRange(core(range));
}
- (NSView *)_hitViewForEvent:(NSEvent *)event
@@ -1758,13 +1758,13 @@
- (BOOL)_canEdit
{
Frame* coreFrame = core([self _frame]);
- return coreFrame && coreFrame->editor()->canEdit();
+ return coreFrame && coreFrame->editor().canEdit();
}
- (BOOL)_canEditRichly
{
Frame* coreFrame = core([self _frame]);
- return coreFrame && coreFrame->editor()->canEditRichly();
+ return coreFrame && coreFrame->editor().canEditRichly();
}
- (BOOL)_canAlterCurrentSelection
@@ -1824,50 +1824,50 @@
- (DOMNode *)_insertOrderedList
{
Frame* coreFrame = core([self _frame]);
- return coreFrame ? kit(coreFrame->editor()->insertOrderedList().get()) : nil;
+ return coreFrame ? kit(coreFrame->editor().insertOrderedList().get()) : nil;
}
- (DOMNode *)_insertUnorderedList
{
Frame* coreFrame = core([self _frame]);
- return coreFrame ? kit(coreFrame->editor()->insertUnorderedList().get()) : nil;
+ return coreFrame ? kit(coreFrame->editor().insertUnorderedList().get()) : nil;
}
- (BOOL)_canIncreaseSelectionListLevel
{
Frame* coreFrame = core([self _frame]);
- return coreFrame && coreFrame->editor()->canIncreaseSelectionListLevel();
+ return coreFrame && coreFrame->editor().canIncreaseSelectionListLevel();
}
- (BOOL)_canDecreaseSelectionListLevel
{
Frame* coreFrame = core([self _frame]);
- return coreFrame && coreFrame->editor()->canDecreaseSelectionListLevel();
+ return coreFrame && coreFrame->editor().canDecreaseSelectionListLevel();
}
- (DOMNode *)_increaseSelectionListLevel
{
Frame* coreFrame = core([self _frame]);
- return coreFrame ? kit(coreFrame->editor()->increaseSelectionListLevel().get()) : nil;
+ return coreFrame ? kit(coreFrame->editor().increaseSelectionListLevel().get()) : nil;
}
- (DOMNode *)_increaseSelectionListLevelOrdered
{
Frame* coreFrame = core([self _frame]);
- return coreFrame ? kit(coreFrame->editor()->increaseSelectionListLevelOrdered().get()) : nil;
+ return coreFrame ? kit(coreFrame->editor().increaseSelectionListLevelOrdered().get()) : nil;
}
- (DOMNode *)_increaseSelectionListLevelUnordered
{
Frame* coreFrame = core([self _frame]);
- return coreFrame ? kit(coreFrame->editor()->increaseSelectionListLevelUnordered().get()) : nil;
+ return coreFrame ? kit(coreFrame->editor().increaseSelectionListLevelUnordered().get()) : nil;
}
- (void)_decreaseSelectionListLevel
{
Frame* coreFrame = core([self _frame]);
if (coreFrame)
- coreFrame->editor()->decreaseSelectionListLevel();
+ coreFrame->editor().decreaseSelectionListLevel();
}
- (void)_setHighlighter:(id<WebHTMLHighlighter>)highlighter ofType:(NSString*)type
@@ -2359,7 +2359,7 @@
Frame* coreFrame = core([self _frame]);
if (!coreFrame)
return Editor::Command();
- return coreFrame->editor()->command(commandNameForSelector(selector));
+ return coreFrame->editor().command(commandNameForSelector(selector));
}
- (Editor::Command)coreCommandByName:(const char*)name
@@ -2367,7 +2367,7 @@
Frame* coreFrame = core([self _frame]);
if (!coreFrame)
return Editor::Command();
- return coreFrame->editor()->command(name);
+ return coreFrame->editor().command(name);
}
- (void)executeCoreCommandBySelector:(SEL)selector
@@ -2593,7 +2593,7 @@
NSMenuItem *menuItem = (NSMenuItem *)item;
if ([menuItem isKindOfClass:[NSMenuItem class]]) {
String direction = writingDirection == NSWritingDirectionLeftToRight ? "ltr" : "rtl";
- [menuItem setState:frame->editor()->selectionHasStyle(CSSPropertyDirection, direction)];
+ [menuItem setState:frame->editor().selectionHasStyle(CSSPropertyDirection, direction)];
}
return [self _canEdit];
}
@@ -2610,7 +2610,7 @@
if ([menuItem isKindOfClass:[NSMenuItem class]]) {
// Take control of the title of the menu item instead of just checking/unchecking it because
// a check would be ambiguous.
- [menuItem setTitle:frame->editor()->selectionHasStyle(CSSPropertyDirection, "rtl")
+ [menuItem setTitle:frame->editor().selectionHasStyle(CSSPropertyDirection, "rtl")
? UI_STRING_INTERNAL("Left to Right", "Left to Right context menu item")
: UI_STRING_INTERNAL("Right to Left", "Right to Left context menu item")];
}
@@ -2641,11 +2641,11 @@
return [self _hasSelection];
if (action == @selector(paste:) || action == @selector(pasteAsPlainText:))
- return frame && (frame->editor()->canDHTMLPaste() || frame->editor()->canPaste());
+ return frame && (frame->editor().canDHTMLPaste() || frame->editor().canPaste());
if (action == @selector(pasteAsRichText:))
- return frame && (frame->editor()->canDHTMLPaste()
- || (frame->editor()->canPaste() && frame->selection()->isContentRichlyEditable()));
+ return frame && (frame->editor().canDHTMLPaste()
+ || (frame->editor().canPaste() && frame->selection()->isContentRichlyEditable()));
if (action == @selector(performFindPanelAction:))
return NO;
@@ -3803,7 +3803,7 @@
_private->_forceUpdateSecureInputState = NO;
// FIXME: Kill ring handling is mostly in WebCore, so this call should also be moved there.
- frame->editor()->setStartNewKillRingSequence(true);
+ frame->editor().setStartNewKillRingSequence(true);
Page* page = frame->page();
if (!page)
@@ -4231,7 +4231,7 @@
{
Frame* coreFrame = core([self _frame]);
NSAttributedString *string = [[NSAttributedString alloc] initWithString:@"x"
- attributes:coreFrame ? coreFrame->editor()->fontAttributesForSelectionStart() : nil];
+ attributes:coreFrame ? coreFrame->editor().fontAttributesForSelectionStart() : nil];
NSData *data = [string RTFFromRange:NSMakeRange(0, [string length]) documentAttributes:nil];
[string release];
return data;
@@ -4359,7 +4359,7 @@
{
if (Frame* coreFrame = core([self _frame])) {
// FIXME: We shouldn't have to make a copy here. We want callers of this function to work directly with StylePropertySet eventually.
- coreFrame->editor()->applyStyleToSelection(core(style)->copyProperties().get(), undoAction);
+ coreFrame->editor().applyStyleToSelection(core(style)->copyProperties().get(), undoAction);
}
}
@@ -4661,7 +4661,7 @@
if ([[webView _editingDelegateForwarder] webView:webView shouldApplyStyle:style toElementsInDOMRange:range]) {
if (Frame* coreFrame = core([self _frame])) {
// FIXME: We shouldn't have to make a copy here.
- coreFrame->editor()->applyStyle(core(style)->copyProperties().get(), [self _undoActionFromColorPanelWithSelector:selector]);
+ coreFrame->editor().applyStyle(core(style)->copyProperties().get(), [self _undoActionFromColorPanelWithSelector:selector]);
}
}
@@ -4748,7 +4748,7 @@
COMMAND_PROLOGUE
if (Frame* coreFrame = core([self _frame]))
- coreFrame->editor()->advanceToNextMisspelling();
+ coreFrame->editor().advanceToNextMisspelling();
}
- (void)showGuessPanel:(id)sender
@@ -4768,7 +4768,7 @@
}
if (Frame* coreFrame = core([self _frame]))
- coreFrame->editor()->advanceToNextMisspelling(true);
+ coreFrame->editor().advanceToNextMisspelling(true);
[spellingPanel orderFront:sender];
}
@@ -4836,7 +4836,7 @@
return;
WritingDirection direction = RightToLeftWritingDirection;
- switch (coreFrame->editor()->baseWritingDirectionForSelectionStart()) {
+ switch (coreFrame->editor().baseWritingDirectionForSelectionStart()) {
case LeftToRightWritingDirection:
break;
case RightToLeftWritingDirection:
@@ -4850,7 +4850,7 @@
}
if (Frame* coreFrame = core([self _frame]))
- coreFrame->editor()->setBaseWritingDirection(direction);
+ coreFrame->editor().setBaseWritingDirection(direction);
}
- (void)changeBaseWritingDirection:(id)sender
@@ -4867,7 +4867,7 @@
ASSERT(writingDirection != NSWritingDirectionNatural);
if (Frame* coreFrame = core([self _frame]))
- coreFrame->editor()->setBaseWritingDirection(writingDirection == NSWritingDirectionLeftToRight ? LeftToRightWritingDirection : RightToLeftWritingDirection);
+ coreFrame->editor().setBaseWritingDirection(writingDirection == NSWritingDirectionLeftToRight ? LeftToRightWritingDirection : RightToLeftWritingDirection);
}
static BOOL writingDirectionKeyBindingsEnabled()
@@ -4888,7 +4888,7 @@
}
if (Frame* coreFrame = core([self _frame]))
- coreFrame->editor()->setBaseWritingDirection(direction == NSWritingDirectionLeftToRight ? LeftToRightWritingDirection : RightToLeftWritingDirection);
+ coreFrame->editor().setBaseWritingDirection(direction == NSWritingDirectionLeftToRight ? LeftToRightWritingDirection : RightToLeftWritingDirection);
}
- (void)makeBaseWritingDirectionLeftToRight:(id)sender
@@ -5023,7 +5023,7 @@
bool multipleFonts = false;
NSFont *font = nil;
if (Frame* coreFrame = core([self _frame])) {
- if (const SimpleFontData* fd = coreFrame->editor()->fontForSelection(multipleFonts))
+ if (const SimpleFontData* fd = coreFrame->editor().fontForSelection(multipleFonts))
font = fd->getNSFont();
}
@@ -5563,7 +5563,7 @@
Frame* coreFrame = core(webFrame);
if (!coreFrame)
return NSMakeRange(0, 0);
- NSRange result = [webFrame _convertToNSRange:coreFrame->editor()->compositionRange().get()];
+ NSRange result = [webFrame _convertToNSRange:coreFrame->editor().compositionRange().get()];
LOG(TextInput, "markedRange -> (%u, %u)", result.location, result.length);
return result;
@@ -5607,12 +5607,12 @@
- (BOOL)hasMarkedText
{
Frame* coreFrame = core([self _frame]);
- BOOL result = coreFrame && coreFrame->editor()->hasComposition();
+ BOOL result = coreFrame && coreFrame->editor().hasComposition();
if (result) {
// A saved command can confirm a composition, but it cannot start a new one.
[self _executeSavedKeypressCommands];
- result = coreFrame->editor()->hasComposition();
+ result = coreFrame->editor().hasComposition();
}
LOG(TextInput, "hasMarkedText -> %u", result);
@@ -5634,7 +5634,7 @@
}
if (Frame* coreFrame = core([self _frame]))
- coreFrame->editor()->confirmComposition();
+ coreFrame->editor().confirmComposition();
}
static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnderline>& result)
@@ -5702,7 +5702,7 @@
if (replacementRange.location != NSNotFound)
[[self _frame] _selectNSRange:replacementRange];
- coreFrame->editor()->setComposition(text, underlines, newSelRange.location, NSMaxRange(newSelRange));
+ coreFrame->editor().setComposition(text, underlines, newSelRange.location, NSMaxRange(newSelRange));
}
- (void)doCommandBySelector:(SEL)selector
@@ -5720,7 +5720,7 @@
// As in insertText:, we assume that the call comes from an input method if there is marked text.
RefPtr<Frame> coreFrame = core([self _frame]);
- bool isFromInputMethod = coreFrame && coreFrame->editor()->hasComposition();
+ bool isFromInputMethod = coreFrame && coreFrame->editor().hasComposition();
if (event && shouldSaveCommand && !isFromInputMethod)
event->keypressCommands().append(KeypressCommand(NSStringFromSelector(selector)));
@@ -5774,7 +5774,7 @@
RefPtr<Frame> coreFrame = core([self _frame]);
NSString *text;
NSRange replacementRange = { NSNotFound, 0 };
- bool isFromInputMethod = coreFrame && coreFrame->editor()->hasComposition();
+ bool isFromInputMethod = coreFrame && coreFrame->editor().hasComposition();
Vector<DictationAlternative> dictationAlternativeLocations;
if (isAttributedString) {
@@ -5810,7 +5810,7 @@
return;
}
- if (!coreFrame || !coreFrame->editor()->canEdit())
+ if (!coreFrame || !coreFrame->editor().canEdit())
return;
if (replacementRange.location != NSNotFound)
@@ -5819,17 +5819,17 @@
bool eventHandled = false;
String eventText = text;
eventText.replace(NSBackTabCharacter, NSTabCharacter); // same thing is done in KeyEventMac.mm in WebCore
- if (!coreFrame->editor()->hasComposition()) {
+ if (!coreFrame->editor().hasComposition()) {
// An insertText: might be handled by other responders in the chain if we don't handle it.
// One example is space bar that results in scrolling down the page.
if (!dictationAlternativeLocations.isEmpty())
- eventHandled = coreFrame->editor()->insertDictatedText(eventText, dictationAlternativeLocations, event);
+ eventHandled = coreFrame->editor().insertDictatedText(eventText, dictationAlternativeLocations, event);
else
- eventHandled = coreFrame->editor()->insertText(eventText, event);
+ eventHandled = coreFrame->editor().insertText(eventText, event);
} else {
eventHandled = true;
- coreFrame->editor()->confirmComposition(eventText);
+ coreFrame->editor().confirmComposition(eventText);
}
if (parameters)
@@ -5884,15 +5884,15 @@
[self _updateSecureInputState];
- if (!coreFrame->editor()->hasComposition() || coreFrame->editor()->ignoreCompositionSelectionChange())
+ if (!coreFrame->editor().hasComposition() || coreFrame->editor().ignoreCompositionSelectionChange())
return;
unsigned start;
unsigned end;
- if (coreFrame->editor()->getCompositionSelection(start, end))
+ if (coreFrame->editor().getCompositionSelection(start, end))
[[NSInputManager currentInputManager] markedTextSelectionChanged:NSMakeRange(start, end - start) client:self];
else {
- coreFrame->editor()->cancelComposition();
+ coreFrame->editor().cancelComposition();
[[NSInputManager currentInputManager] markedTextAbandoned:self];
}
}
@@ -6060,7 +6060,7 @@
if (!coreFrame)
return 0;
- return coreFrame->editor()->countMatchesForText(string, core(range), coreOptions(options), limit, markMatches, 0);
+ return coreFrame->editor().countMatchesForText(string, core(range), coreOptions(options), limit, markMatches, 0);
}
- (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue
@@ -6068,13 +6068,13 @@
Frame* coreFrame = core([self _frame]);
if (!coreFrame)
return;
- coreFrame->editor()->setMarkedTextMatchesAreHighlighted(newValue);
+ coreFrame->editor().setMarkedTextMatchesAreHighlighted(newValue);
}
- (BOOL)markedTextMatchesAreHighlighted
{
Frame* coreFrame = core([self _frame]);
- return coreFrame && coreFrame->editor()->markedTextMatchesAreHighlighted();
+ return coreFrame && coreFrame->editor().markedTextMatchesAreHighlighted();
}
- (void)unmarkAllTextMatches
@@ -6110,7 +6110,7 @@
if (![string length])
return NO;
Frame* coreFrame = core([self _frame]);
- return coreFrame && coreFrame->editor()->findString(string, coreOptions(options));
+ return coreFrame && coreFrame->editor().findString(string, coreOptions(options));
}
@end
diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm
index 1f81e3b..805cdb9 100644
--- a/Source/WebKit/mac/WebView/WebView.mm
+++ b/Source/WebKit/mac/WebView/WebView.mm
@@ -2427,7 +2427,7 @@
Frame* coreFrame = [self _mainCoreFrame];
if (!coreFrame)
return;
- coreFrame->editor()->command(name).execute(value);
+ coreFrame->editor().command(name).execute(value);
}
- (void)_setCustomHTMLTokenizerTimeDelay:(double)timeDelay
@@ -5382,7 +5382,7 @@
Page* page = core(self);
if (!page)
return nil;
- return kit(page->mainFrame()->editor()->rangeForPoint(IntPoint([self convertPoint:point toView:nil])).get());
+ return kit(page->mainFrame()->editor().rangeForPoint(IntPoint([self convertPoint:point toView:nil])).get());
}
- (BOOL)_shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag
@@ -5443,7 +5443,7 @@
Frame* mainFrame = [self _mainCoreFrame];
if (mainFrame) {
if (flag) {
- mainFrame->editor()->applyEditingStyleToBodyElement();
+ mainFrame->editor().applyEditingStyleToBodyElement();
// If the WebView is made editable and the selection is empty, set it to something.
if (![self selectedDOMRange])
mainFrame->selection()->setSelectionFromNone();
@@ -5730,7 +5730,7 @@
WebFrame *webFrame = [self _selectedOrMainFrame];
Frame* coreFrame = core(webFrame);
if (coreFrame)
- coreFrame->editor()->deleteSelectionWithSmartDelete([(WebHTMLView *)[[webFrame frameView] documentView] _canSmartCopyOrDelete]);
+ coreFrame->editor().deleteSelectionWithSmartDelete([(WebHTMLView *)[[webFrame frameView] documentView] _canSmartCopyOrDelete]);
}
- (void)applyStyle:(DOMCSSStyleDeclaration *)style
@@ -5741,7 +5741,7 @@
Frame* coreFrame = core(webFrame);
// FIXME: We shouldn't have to make a copy here.
if (coreFrame)
- coreFrame->editor()->applyStyle(core(style)->copyProperties().get());
+ coreFrame->editor().applyStyle(core(style)->copyProperties().get());
}
@end
@@ -5788,7 +5788,7 @@
{
Frame* coreFrame = core([self _selectedOrMainFrame]);
if (coreFrame)
- return coreFrame->editor()->fontAttributesForSelectionStart();
+ return coreFrame->editor().fontAttributesForSelectionStart();
return nil;
}
@@ -5832,7 +5832,7 @@
Node* coreStartNode= core(startNode);
if (coreStartNode->document() != coreFrame->document())
return;
- return coreFrame->editor()->simplifyMarkup(coreStartNode, core(endNode));
+ return coreFrame->editor().simplifyMarkup(coreStartNode, core(endNode));
}
@end
@@ -6567,7 +6567,7 @@
WebFrame *webFrame = [self _selectedOrMainFrame];
Frame* coreFrame = core(webFrame);
if (coreFrame)
- coreFrame->editor()->handleAlternativeTextUIResult(text);
+ coreFrame->editor().handleAlternativeTextUIResult(text);
}
#endif
diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog
index ceaf36e..591afcd 100644
--- a/Source/WebKit/qt/ChangeLog
+++ b/Source/WebKit/qt/ChangeLog
@@ -1,3 +1,23 @@
+2013-05-13 Anders Carlsson <andersca@apple.com>
+
+ Frame::editor() should return a reference
+ https://bugs.webkit.org/show_bug.cgi?id=116037
+
+ Reviewed by Darin Adler.
+
+ * 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):
+
2013-05-15 Jocelyn Turcotte <jocelyn.turcotte@digia.com>
[Qt] Fix a crash under ~PingLoader when the QNAM on the page has been destroyed.
diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
index c38524f..8884e49 100644
--- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
@@ -329,12 +329,12 @@
void DumpRenderTreeSupportQt::executeCoreCommandByName(QWebPageAdapter* adapter, const QString& name, const QString& value)
{
- adapter->page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
+ adapter->page->focusController()->focusedOrMainFrame()->editor().command(name).execute(value);
}
bool DumpRenderTreeSupportQt::isCommandEnabled(QWebPageAdapter *adapter, const QString& name)
{
- return adapter->page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
+ return adapter->page->focusController()->focusedOrMainFrame()->editor().command(name).isEnabled();
}
QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPageAdapter *adapter)
@@ -374,7 +374,7 @@
if (!range)
return QVariantList();
- QRect resultRect = frame->editor()->firstRectForRange(range.get());
+ QRect resultRect = frame->editor().firstRectForRange(range.get());
rect << resultRect.x() << resultRect.y() << resultRect.width() << resultRect.height();
return rect;
}
@@ -751,17 +751,17 @@
if (!frame)
return;
- Editor* editor = frame->editor();
- if (!editor || (!editor->hasComposition() && !text))
+ Editor& editor = frame->editor();
+ if (!editor.hasComposition() && !text)
return;
- if (editor->hasComposition()) {
+ if (editor.hasComposition()) {
if (text)
- editor->confirmComposition(String::fromUTF8(text));
+ editor.confirmComposition(String::fromUTF8(text));
else
- editor->confirmComposition();
+ editor.confirmComposition();
} else
- editor->insertText(String::fromUTF8(text), 0);
+ editor.insertText(String::fromUTF8(text), 0);
}
void DumpRenderTreeSupportQt::injectInternalsObject(QWebFrameAdapter* adapter)
diff --git a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
index d82d0e5..825aca3 100644
--- a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
@@ -206,12 +206,12 @@
if (supportsGlobalSelection() && frame->selection()->isRange()) {
bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode();
Pasteboard::generalPasteboard()->setSelectionMode(true);
- Pasteboard::generalPasteboard()->writeSelection(frame->selection()->toNormalizedRange().get(), frame->editor()->canSmartCopyOrDelete(), frame);
+ Pasteboard::generalPasteboard()->writeSelection(frame->selection()->toNormalizedRange().get(), frame->editor().canSmartCopyOrDelete(), frame);
Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode);
}
m_page->respondToChangedSelection();
- if (!frame->editor()->ignoreCompositionSelectionChange())
+ if (!frame->editor().ignoreCompositionSelectionChange())
emit m_page->microFocusChanged();
}
@@ -248,7 +248,7 @@
{
#ifndef QT_NO_UNDOSTACK
Frame* frame = m_page->page->focusController()->focusedOrMainFrame();
- if (m_inUndoRedo || (frame && !frame->editor()->lastEditCommand() /* HACK!! Don't recreate undos */))
+ if (m_inUndoRedo || (frame && !frame->editor().lastEditCommand() /* HACK!! Don't recreate undos */))
return;
m_page->registerUndoStep(step);
#endif // QT_NO_UNDOSTACK
@@ -455,7 +455,7 @@
// WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated,
// so we leave it upon WebCore to either handle them immediately (e.g. Tab that changes focus) or let a keypress event be generated
// (e.g. Tab that inserts a Tab character, or Enter).
- if (frame->editor()->command(cmd).isTextInsertion()
+ if (frame->editor().command(cmd).isTextInsertion()
&& kevent->type() == PlatformEvent::RawKeyDown)
return;
@@ -467,7 +467,7 @@
{
String commandName = editorCommandForKeyDownEvent(event);
if (!commandName.isEmpty()) {
- if (frame->editor()->command(commandName).execute()) // Event handled.
+ if (frame->editor().command(commandName).execute()) // Event handled.
event->setDefaultHandled();
return;
}
@@ -495,7 +495,7 @@
}
if (shouldInsertText) {
- frame->editor()->insertText(kevent->text(), event);
+ frame->editor().insertText(kevent->text(), event);
event->setDefaultHandled();
return;
}
@@ -526,7 +526,7 @@
{
String commandName = editorCommandForKeyDownEvent(event);
ASSERT(!commandName.isEmpty());
- frame->editor()->command(commandName).execute();
+ frame->editor().command(commandName).execute();
event->setDefaultHandled();
return;
}
diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
index fa4e4c0..4760d7f 100644
--- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
@@ -309,12 +309,12 @@
Frame* frame = page->focusController()->focusedOrMainFrame();
if (frame->selection()->selection().selectionType() == VisibleSelection::NoSelection)
return QString();
- return frame->editor()->selectedText();
+ return frame->editor().selectedText();
}
QString QWebPageAdapter::selectedHtml() const
{
- return page->focusController()->focusedOrMainFrame()->editor()->selectedRange()->toHTML();
+ return page->focusController()->focusedOrMainFrame()->editor().selectedRange()->toHTML();
}
bool QWebPageAdapter::isContentEditable() const
@@ -329,7 +329,7 @@
Frame* frame = mainFrameAdapter()->frame;
if (editable) {
- frame->editor()->applyEditingStyleToBodyElement();
+ frame->editor().applyEditingStyleToBodyElement();
// FIXME: mac port calls this if there is no selectedDOMRange
// frame->setSelectionFromNone();
}
@@ -567,9 +567,9 @@
void QWebPageAdapter::inputMethodEvent(QInputMethodEvent *ev)
{
WebCore::Frame *frame = page->focusController()->focusedOrMainFrame();
- WebCore::Editor *editor = frame->editor();
+ WebCore::Editor &editor = frame->editor();
- if (!editor->canEdit()) {
+ if (!editor.canEdit()) {
ev->ignore();
return;
}
@@ -610,12 +610,12 @@
}
if (!ev->preeditString().isEmpty())
- editor->setComposition(ev->preeditString(), underlines, qMin(a.start, (a.start + a.length)), qMax(a.start, (a.start + a.length)));
+ editor.setComposition(ev->preeditString(), underlines, qMin(a.start, (a.start + a.length)), qMax(a.start, (a.start + a.length)));
else {
// If we are in the middle of a composition, an empty pre-edit string and a selection of zero
// cancels the current composition
- if (editor->hasComposition() && !(a.start + a.length))
- editor->setComposition(QString(), underlines, 0, 0);
+ if (editor.hasComposition() && !(a.start + a.length))
+ editor.setComposition(QString(), underlines, 0, 0);
}
break;
}
@@ -630,16 +630,16 @@
if (isHTMLTextFormControlElement(node))
toHTMLTextFormControlElement(node)->setSelectionRange(start, start + ev->replacementLength());
// Commit regardless of whether commitString is empty, to get rid of selection.
- editor->confirmComposition(ev->commitString());
+ editor.confirmComposition(ev->commitString());
} else if (!ev->commitString().isEmpty()) {
- if (editor->hasComposition())
- editor->confirmComposition(ev->commitString());
+ if (editor.hasComposition())
+ editor.confirmComposition(ev->commitString());
else
- editor->insertText(ev->commitString(), 0);
+ editor.insertText(ev->commitString(), 0);
} else if (!hasSelection && !ev->preeditString().isEmpty())
- editor->setComposition(ev->preeditString(), underlines, 0, 0);
- else if (ev->preeditString().isEmpty() && editor->hasComposition())
- editor->confirmComposition(String());
+ editor.setComposition(ev->preeditString(), underlines, 0, 0);
+ else if (ev->preeditString().isEmpty() && editor.hasComposition())
+ editor.confirmComposition(String());
ev->accept();
}
@@ -650,7 +650,7 @@
if (!frame)
return QVariant();
- WebCore::Editor* editor = frame->editor();
+ WebCore::Editor& editor = frame->editor();
RenderObject* renderer = 0;
RenderTextControl* renderTextControl = 0;
@@ -678,14 +678,14 @@
return QVariant(QFont());
}
case Qt::ImCursorPosition: {
- if (editor->hasComposition())
+ if (editor.hasComposition())
return QVariant(frame->selection()->end().offsetInContainerNode());
return QVariant(frame->selection()->extent().offsetInContainerNode());
}
case Qt::ImSurroundingText: {
if (renderTextControl && renderTextControl->textFormControlElement()) {
QString text = renderTextControl->textFormControlElement()->value();
- RefPtr<Range> range = editor->compositionRange();
+ RefPtr<Range> range = editor.compositionRange();
if (range)
text.remove(range->startPosition().offsetInContainerNode(), TextIterator::rangeLength(range.get()));
return QVariant(text);
@@ -693,7 +693,7 @@
return QVariant();
}
case Qt::ImCurrentSelection: {
- if (!editor->hasComposition() && renderTextControl && renderTextControl->textFormControlElement()) {
+ if (!editor.hasComposition() && renderTextControl && renderTextControl->textFormControlElement()) {
int start = frame->selection()->start().offsetInContainerNode();
int end = frame->selection()->end().offsetInContainerNode();
if (end > start)
@@ -703,7 +703,7 @@
}
case Qt::ImAnchorPosition: {
- if (editor->hasComposition())
+ if (editor.hasComposition())
return QVariant(frame->selection()->start().offsetInContainerNode());
return QVariant(frame->selection()->base().offsetInContainerNode());
}
@@ -955,7 +955,7 @@
void QWebPageAdapter::updateActionInternal(QWebPageAdapter::MenuAction action, const char* commandName, bool* enabled, bool* checked)
{
WebCore::FrameLoader* loader = mainFrameAdapter()->frame->loader();
- WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
+ WebCore::Editor& editor = page->focusController()->focusedOrMainFrame()->editor();
switch (action) {
case QWebPageAdapter::Back:
@@ -973,14 +973,14 @@
case QWebPageAdapter::SetTextDirectionDefault:
case QWebPageAdapter::SetTextDirectionLeftToRight:
case QWebPageAdapter::SetTextDirectionRightToLeft:
- *enabled = editor->canEdit();
+ *enabled = editor.canEdit();
*checked = false;
break;
default: {
// if it's an editor command, let its logic determine state
if (commandName) {
- Editor::Command command = editor->command(commandName);
+ Editor::Command command = editor.command(commandName);
*enabled = command.isEnabled();
if (*enabled)
*checked = command.state() != FalseTriState;
@@ -997,7 +997,7 @@
Frame* frame = page->focusController()->focusedOrMainFrame();
if (!frame)
return;
- Editor* editor = frame->editor();
+ Editor& editor = frame->editor();
// Convenience
QWebHitTestResultPrivate hitTest;
@@ -1028,10 +1028,10 @@
#if defined(Q_WS_X11)
bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode();
Pasteboard::generalPasteboard()->setSelectionMode(true);
- editor->copyURL(hitTestResult->linkUrl, hitTestResult->linkText);
+ editor.copyURL(hitTestResult->linkUrl, hitTestResult->linkText);
Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode);
#endif
- editor->copyURL(hitTestResult->linkUrl, hitTestResult->linkText);
+ editor.copyURL(hitTestResult->linkUrl, hitTestResult->linkText);
break;
}
case OpenImageInNewWindow:
@@ -1058,13 +1058,13 @@
break;
case SetTextDirectionDefault:
- editor->setBaseWritingDirection(NaturalWritingDirection);
+ editor.setBaseWritingDirection(NaturalWritingDirection);
break;
case SetTextDirectionLeftToRight:
- editor->setBaseWritingDirection(LeftToRightWritingDirection);
+ editor.setBaseWritingDirection(LeftToRightWritingDirection);
break;
case SetTextDirectionRightToLeft:
- editor->setBaseWritingDirection(RightToLeftWritingDirection);
+ editor.setBaseWritingDirection(RightToLeftWritingDirection);
break;
#if ENABLE(INSPECTOR)
case InspectElement: {
@@ -1075,7 +1075,7 @@
#endif
default:
if (commandName)
- editor->command(commandName).execute();
+ editor.command(commandName).execute();
break;
}
}
@@ -1314,8 +1314,8 @@
bool QWebPageAdapter::handleShortcutOverrideEvent(QKeyEvent* event)
{
WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();
- WebCore::Editor* editor = frame->editor();
- if (!editor->canEdit())
+ WebCore::Editor& editor = frame->editor();
+ if (!editor.canEdit())
return false;
if (event->modifiers() == Qt::NoModifier
|| event->modifiers() == Qt::ShiftModifier
diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog
index 8261b68..0d6a1bb 100644
--- a/Source/WebKit/win/ChangeLog
+++ b/Source/WebKit/win/ChangeLog
@@ -1,3 +1,47 @@
+2013-05-13 Anders Carlsson <andersca@apple.com>
+
+ Frame::editor() should return a reference
+ https://bugs.webkit.org/show_bug.cgi?id=116037
+
+ Reviewed by Darin Adler.
+
+ * 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):
+
2013-05-15 Patrick Gansterer <paroga@webkit.org>
Remove unnecessary dependecy on CoreFoundation from WebDatabaseManager
diff --git a/Source/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp b/Source/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp
index 7e6f00e..f74bffb 100644
--- a/Source/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp
+++ b/Source/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp
@@ -111,7 +111,7 @@
void WebContextMenuClient::searchWithGoogle(const Frame* frame)
{
- String searchString = frame->editor()->selectedText();
+ String searchString = frame->editor().selectedText();
searchString.stripWhiteSpace();
String encoded = encodeWithURLEscapeSequences(searchString);
encoded.replace("%20", "+");
diff --git a/Source/WebKit/win/WebFrame.cpp b/Source/WebKit/win/WebFrame.cpp
index 70cb52a..16ca45e 100644
--- a/Source/WebKit/win/WebFrame.cpp
+++ b/Source/WebKit/win/WebFrame.cpp
@@ -1005,7 +1005,7 @@
Frame* coreFrame = core(this);
if (!coreFrame)
return E_FAIL;
- *result = coreFrame->editor()->selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length);
+ *result = coreFrame->editor().selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length);
return S_OK;
}
@@ -1021,16 +1021,16 @@
HRESULT WebFrame::setTextDirection(BSTR direction)
{
Frame* coreFrame = core(this);
- if (!coreFrame || !coreFrame->editor())
+ if (!coreFrame)
return E_FAIL;
String directionString(direction, SysStringLen(direction));
if (directionString == "auto")
- coreFrame->editor()->setBaseWritingDirection(NaturalWritingDirection);
+ coreFrame->editor().setBaseWritingDirection(NaturalWritingDirection);
else if (directionString == "ltr")
- coreFrame->editor()->setBaseWritingDirection(LeftToRightWritingDirection);
+ coreFrame->editor().setBaseWritingDirection(LeftToRightWritingDirection);
else if (directionString == "rtl")
- coreFrame->editor()->setBaseWritingDirection(RightToLeftWritingDirection);
+ coreFrame->editor().setBaseWritingDirection(RightToLeftWritingDirection);
return S_OK;
}
@@ -1052,7 +1052,7 @@
if (!coreFrame)
return E_FAIL;
- String text = coreFrame->displayStringModifiedByEncoding(coreFrame->editor()->selectedText());
+ String text = coreFrame->displayStringModifiedByEncoding(coreFrame->editor().selectedText());
*result = BString(text).release();
return S_OK;
@@ -1064,7 +1064,7 @@
if (!coreFrame)
return E_FAIL;
- if (!coreFrame->editor()->command("SelectAll").execute())
+ if (!coreFrame->editor().command("SelectAll").execute())
return E_FAIL;
return S_OK;
diff --git a/Source/WebKit/win/WebView.cpp b/Source/WebKit/win/WebView.cpp
index e4776fd..c18ba76 100644
--- a/Source/WebKit/win/WebView.cpp
+++ b/Source/WebKit/win/WebView.cpp
@@ -1812,11 +1812,11 @@
Frame* frame = m_page->focusController()->focusedOrMainFrame();
switch (LOWORD(wParam)) {
case SelectAll:
- return frame->editor()->command("SelectAll").execute();
+ return frame->editor().command("SelectAll").execute();
case Undo:
- return frame->editor()->command("Undo").execute();
+ return frame->editor().command("Undo").execute();
case Redo:
- return frame->editor()->command("Redo").execute();
+ return frame->editor().command("Redo").execute();
}
return false;
}
@@ -1963,7 +1963,7 @@
if (!keyEvent || keyEvent->isSystemKey()) // do not treat this as text input if it's a system key event
return false;
- Editor::Command command = frame->editor()->command(interpretKeyEvent(evt));
+ Editor::Command command = frame->editor().command(interpretKeyEvent(evt));
if (keyEvent->type() == PlatformEvent::RawKeyDown) {
// WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated,
@@ -1979,7 +1979,7 @@
if (evt->charCode() < ' ')
return false;
- return frame->editor()->insertText(evt->keyEvent()->text(), evt);
+ return frame->editor().insertText(evt->keyEvent()->text(), evt);
}
bool WebView::keyDown(WPARAM virtualKeyCode, LPARAM keyData, bool systemKeyDown)
@@ -3429,7 +3429,7 @@
HRESULT STDMETHODCALLTYPE WebView::executeCoreCommandByName(BSTR name, BSTR value)
{
- m_page->focusController()->focusedOrMainFrame()->editor()->command(toString(name)).execute(toString(value));
+ m_page->focusController()->focusedOrMainFrame()->editor().command(toString(name)).execute(toString(value));
return S_OK;
}
@@ -3656,7 +3656,7 @@
if (!focusedFrame)
return E_FAIL;
- String frameSelectedText = focusedFrame->editor()->selectedText();
+ String frameSelectedText = focusedFrame->editor().selectedText();
*text = SysAllocStringLen(frameSelectedText.characters(), frameSelectedText.length());
if (!*text && frameSelectedText.length())
return E_OUTOFMEMORY;
@@ -4241,38 +4241,38 @@
HRESULT STDMETHODCALLTYPE WebView::cutEnabled(
/* [retval][out] */ BOOL* enabled)
{
- Editor* editor = m_page->focusController()->focusedOrMainFrame()->editor();
- *enabled = editor->canCut() || editor->canDHTMLCut();
+ Editor& editor = m_page->focusController()->focusedOrMainFrame()->editor();
+ *enabled = editor.canCut() || editor.canDHTMLCut();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::copyEnabled(
/* [retval][out] */ BOOL* enabled)
{
- Editor* editor = m_page->focusController()->focusedOrMainFrame()->editor();
- *enabled = editor->canCopy() || editor->canDHTMLCopy();
+ Editor& editor = m_page->focusController()->focusedOrMainFrame()->editor();
+ *enabled = editor.canCopy() || editor.canDHTMLCopy();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::pasteEnabled(
/* [retval][out] */ BOOL* enabled)
{
- Editor* editor = m_page->focusController()->focusedOrMainFrame()->editor();
- *enabled = editor->canPaste() || editor->canDHTMLPaste();
+ Editor& editor = m_page->focusController()->focusedOrMainFrame()->editor();
+ *enabled = editor.canPaste() || editor.canDHTMLPaste();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::deleteEnabled(
/* [retval][out] */ BOOL* enabled)
{
- *enabled = m_page->focusController()->focusedOrMainFrame()->editor()->canDelete();
+ *enabled = m_page->focusController()->focusedOrMainFrame()->editor().canDelete();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::editingEnabled(
/* [retval][out] */ BOOL* enabled)
{
- *enabled = m_page->focusController()->focusedOrMainFrame()->editor()->canEdit();
+ *enabled = m_page->focusController()->focusedOrMainFrame()->editor().canEdit();
return S_OK;
}
@@ -4324,7 +4324,7 @@
/* [in] */ BSTR text)
{
Position start = m_page->mainFrame()->selection()->selection().start();
- m_page->focusController()->focusedOrMainFrame()->editor()->insertText(toString(text), 0);
+ m_page->focusController()->focusedOrMainFrame()->editor().insertText(toString(text), 0);
m_page->mainFrame()->selection()->setBase(start);
return S_OK;
}
@@ -4345,8 +4345,8 @@
HRESULT STDMETHODCALLTYPE WebView::deleteSelection( void)
{
- Editor* editor = m_page->focusController()->focusedOrMainFrame()->editor();
- editor->deleteSelectionWithSmartDelete(editor->canSmartCopyOrDelete());
+ Editor& editor = m_page->focusController()->focusedOrMainFrame()->editor();
+ editor.deleteSelectionWithSmartDelete(editor.canSmartCopyOrDelete());
return S_OK;
}
@@ -4368,28 +4368,28 @@
HRESULT STDMETHODCALLTYPE WebView::copy(
/* [in] */ IUnknown* /*sender*/)
{
- m_page->focusController()->focusedOrMainFrame()->editor()->command("Copy").execute();
+ m_page->focusController()->focusedOrMainFrame()->editor().command("Copy").execute();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::cut(
/* [in] */ IUnknown* /*sender*/)
{
- m_page->focusController()->focusedOrMainFrame()->editor()->command("Cut").execute();
+ m_page->focusController()->focusedOrMainFrame()->editor().command("Cut").execute();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::paste(
/* [in] */ IUnknown* /*sender*/)
{
- m_page->focusController()->focusedOrMainFrame()->editor()->command("Paste").execute();
+ m_page->focusController()->focusedOrMainFrame()->editor().command("Paste").execute();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::copyURL(
/* [in] */ BSTR url)
{
- m_page->focusController()->focusedOrMainFrame()->editor()->copyURL(MarshallingHelpers::BSTRToKURL(url), "");
+ m_page->focusController()->focusedOrMainFrame()->editor().copyURL(MarshallingHelpers::BSTRToKURL(url), "");
return S_OK;
}
@@ -4411,7 +4411,7 @@
HRESULT STDMETHODCALLTYPE WebView::delete_(
/* [in] */ IUnknown* /*sender*/)
{
- m_page->focusController()->focusedOrMainFrame()->editor()->command("Delete").execute();
+ m_page->focusController()->focusedOrMainFrame()->editor().command("Delete").execute();
return S_OK;
}
@@ -4493,7 +4493,7 @@
return E_FAIL;
}
- core(m_mainFrame)->editor()->advanceToNextMisspelling();
+ core(m_mainFrame)->editor().advanceToNextMisspelling();
return S_OK;
}
@@ -4512,7 +4512,7 @@
m_editingDelegate->showSpellingUI(FALSE);
}
- core(m_mainFrame)->editor()->advanceToNextMisspelling(true);
+ core(m_mainFrame)->editor().advanceToNextMisspelling(true);
m_editingDelegate->showSpellingUI(TRUE);
return S_OK;
}
@@ -5339,7 +5339,7 @@
HRESULT STDMETHODCALLTYPE WebView::clearUndoRedoOperations()
{
if (Frame* frame = m_page->focusController()->focusedOrMainFrame())
- frame->editor()->clearUndoRedoOperations();
+ frame->editor().clearUndoRedoOperations();
return S_OK;
}
@@ -5454,7 +5454,7 @@
if (RefPtr<Range> range = targetFrame->selection()->selection().toNormalizedRange()) {
ExceptionCode ec = 0;
RefPtr<Range> tempRange = range->cloneRange(ec);
- caret = targetFrame->editor()->firstRectForRange(tempRange.get());
+ caret = targetFrame->editor().firstRectForRange(tempRange.get());
}
caret = targetFrame->view()->contentsToWindow(caret);
CANDIDATEFORM form;
@@ -5472,7 +5472,7 @@
void WebView::resetIME(Frame* targetFrame)
{
if (targetFrame)
- targetFrame->editor()->cancelComposition();
+ targetFrame->editor().cancelComposition();
if (HIMC hInputContext = getIMMContext()) {
IMMDict::dict().notifyIME(hInputContext, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
@@ -5487,7 +5487,7 @@
if (!targetFrame)
return;
- if (!targetFrame->editor()->cancelCompositionIfSelectionIsInvalid())
+ if (!targetFrame->editor().cancelCompositionIfSelectionIsInvalid())
resetIME(targetFrame);
}
@@ -5643,7 +5643,7 @@
return true;
Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
- if (!targetFrame || !targetFrame->editor()->canEdit())
+ if (!targetFrame || !targetFrame->editor().canEdit())
return true;
prepareCandidateWindow(targetFrame, hInputContext);
@@ -5653,7 +5653,7 @@
if (!getCompositionString(hInputContext, GCS_RESULTSTR, compositionString) && lparam)
return true;
- targetFrame->editor()->confirmComposition(compositionString);
+ targetFrame->editor().confirmComposition(compositionString);
} else {
String compositionString;
if (!getCompositionString(hInputContext, GCS_COMPSTR, compositionString))
@@ -5674,7 +5674,7 @@
int cursorPosition = LOWORD(IMMDict::dict().getCompositionString(hInputContext, GCS_CURSORPOS, 0, 0));
- targetFrame->editor()->setComposition(compositionString, underlines, cursorPosition, 0);
+ targetFrame->editor().setComposition(compositionString, underlines, cursorPosition, 0);
}
return true;
@@ -5686,8 +5686,8 @@
// If the composition hasn't been confirmed yet, it needs to be cancelled.
// This happens after deleting the last character from inline input hole.
Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
- if (targetFrame && targetFrame->editor()->hasComposition())
- targetFrame->editor()->confirmComposition(String());
+ if (targetFrame && targetFrame->editor().hasComposition())
+ targetFrame->editor().confirmComposition(String());
if (m_inIMEComposition)
m_inIMEComposition--;
@@ -5712,14 +5712,14 @@
LRESULT WebView::onIMERequestCharPosition(Frame* targetFrame, IMECHARPOSITION* charPos)
{
- if (charPos->dwCharPos && !targetFrame->editor()->hasComposition())
+ if (charPos->dwCharPos && !targetFrame->editor().hasComposition())
return 0;
IntRect caret;
- if (RefPtr<Range> range = targetFrame->editor()->hasComposition() ? targetFrame->editor()->compositionRange() : targetFrame->selection()->selection().toNormalizedRange()) {
+ if (RefPtr<Range> range = targetFrame->editor().hasComposition() ? targetFrame->editor().compositionRange() : targetFrame->selection()->selection().toNormalizedRange()) {
ExceptionCode ec = 0;
RefPtr<Range> tempRange = range->cloneRange(ec);
tempRange->setStart(tempRange->startContainer(ec), tempRange->startOffset(ec) + charPos->dwCharPos, ec);
- caret = targetFrame->editor()->firstRectForRange(tempRange.get());
+ caret = targetFrame->editor().firstRectForRange(tempRange.get());
}
caret = targetFrame->view()->contentsToWindow(caret);
charPos->pt.x = caret.x();
@@ -5752,7 +5752,7 @@
{
LOG(TextInput, "onIMERequest %s", imeRequestName(request).latin1().data());
Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
- if (!targetFrame || !targetFrame->editor()->canEdit())
+ if (!targetFrame || !targetFrame->editor().canEdit())
return 0;
switch (request) {
@@ -6883,14 +6883,14 @@
return E_FAIL;
Frame* frame = m_page->focusController()->focusedOrMainFrame();
- if (!frame || !frame->editor()->canEdit())
+ if (!frame || !frame->editor().canEdit())
return E_FAIL;
String compositionStr = toString(composition);
Vector<CompositionUnderline> underlines;
underlines.append(CompositionUnderline(0, compositionStr.length(), Color(Color::black), false));
- frame->editor()->setComposition(compositionStr, underlines, from, from + length);
+ frame->editor().setComposition(compositionStr, underlines, from, from + length);
return S_OK;
}
@@ -6904,7 +6904,7 @@
if (!frame)
return E_FAIL;
- *result = frame && frame->editor()->hasComposition();
+ *result = frame && frame->editor().hasComposition();
return S_OK;
}
@@ -6915,15 +6915,15 @@
return E_FAIL;
Frame* frame = m_page->focusController()->focusedOrMainFrame();
- if (!frame || !frame->editor()->canEdit())
+ if (!frame || !frame->editor().canEdit())
return E_FAIL;
String compositionStr = toString(composition);
if (compositionStr.isNull())
- frame->editor()->confirmComposition();
+ frame->editor().confirmComposition();
- frame->editor()->confirmComposition(compositionStr);
+ frame->editor().confirmComposition(compositionStr);
return S_OK;
}
@@ -6934,10 +6934,10 @@
return E_FAIL;
Frame* frame = m_page->focusController()->focusedOrMainFrame();
- if (!frame || !frame->editor()->canEdit())
+ if (!frame || !frame->editor().canEdit())
return E_FAIL;
- RefPtr<Range> range = frame->editor()->compositionRange();
+ RefPtr<Range> range = frame->editor().compositionRange();
if (!range)
return E_FAIL;
@@ -6978,7 +6978,7 @@
ASSERT(range->startContainer());
ASSERT(range->endContainer());
- IntRect rect = frame->editor()->firstRectForRange(range.get());
+ IntRect rect = frame->editor().firstRectForRange(range.get());
resultIntRect = frame->view()->contentsToWindow(rect);
resultRect->left = resultIntRect.x();
@@ -6998,7 +6998,7 @@
if (!frame)
return E_FAIL;
- RefPtr<Range> range = frame->editor()->selectedRange();
+ RefPtr<Range> range = frame->editor().selectedRange();
size_t locationSize;
size_t lengthSize;
diff --git a/Source/WebKit/wince/ChangeLog b/Source/WebKit/wince/ChangeLog
index ecb9a2c..d9bcf11 100644
--- a/Source/WebKit/wince/ChangeLog
+++ b/Source/WebKit/wince/ChangeLog
@@ -1,3 +1,13 @@
+2013-05-13 Anders Carlsson <andersca@apple.com>
+
+ Frame::editor() should return a reference
+ https://bugs.webkit.org/show_bug.cgi?id=116037
+
+ Reviewed by Darin Adler.
+
+ * WebCoreSupport/EditorClientWinCE.cpp:
+ (WebKit::EditorClientWinCE::handleEditingKeyboardEvent):
+
2013-04-29 Patrick Gansterer <paroga@webkit.org>
Unreviewed build fix.
diff --git a/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp b/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp
index c91ec9f..6458df6 100644
--- a/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp
+++ b/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp
@@ -395,7 +395,7 @@
}
}
- Editor::Command command = frame->editor()->command(interpretKeyEvent(event));
+ Editor::Command command = frame->editor().command(interpretKeyEvent(event));
if (keyEvent->type() == PlatformEvent::RawKeyDown) {
// WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated,
@@ -415,7 +415,7 @@
if (keyEvent->ctrlKey() || keyEvent->altKey())
return false;
- return frame->editor()->insertText(event->keyEvent()->text(), event);
+ return frame->editor().insertText(event->keyEvent()->text(), event);
}
void EditorClientWinCE::handleKeyboardEvent(KeyboardEvent* event)
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 268e486..464787d 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,62 @@
+2013-05-13 Anders Carlsson <andersca@apple.com>
+
+ Frame::editor() should return a reference
+ https://bugs.webkit.org/show_bug.cgi?id=116037
+
+ Reviewed by Darin Adler.
+
+ * 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):
+
2013-05-15 Anders Carlsson <andersca@apple.com>
Need a way for NPAPI plug-ins to open preference panes
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp
index 98a404c..90a5148 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp
@@ -77,7 +77,7 @@
#if !PLATFORM(MAC)
void WebContextMenuClient::searchWithGoogle(const Frame* frame)
{
- String searchString = frame->editor()->selectedText();
+ String searchString = frame->editor().selectedText();
searchString.stripWhiteSpace();
String encoded = encodeWithURLEscapeSequences(searchString);
encoded.replace("%20", "+");
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
index c173abc..a8b62d1 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
@@ -210,7 +210,7 @@
if (supportsGlobalSelection() && frame->selection()->isRange()) {
bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode();
Pasteboard::generalPasteboard()->setSelectionMode(true);
- Pasteboard::generalPasteboard()->writeSelection(frame->selection()->toNormalizedRange().get(), frame->editor()->canSmartCopyOrDelete(), frame);
+ Pasteboard::generalPasteboard()->writeSelection(frame->selection()->toNormalizedRange().get(), frame->editor().canSmartCopyOrDelete(), frame);
Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode);
}
}
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp
index 7010a8f..c42ec37 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp
@@ -50,7 +50,7 @@
void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event)
{
Frame* frame = m_page->corePage()->focusController()->focusedOrMainFrame();
- if (!frame || !frame->editor()->canEdit())
+ if (!frame || !frame->editor().canEdit())
return;
// FIXME: sending sync message might make input lagging.
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
index 67fdc1f..9889a9d 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
@@ -50,7 +50,7 @@
{
Vector<Editor::Command> commands;
for (size_t i = 0; i < pendingEditorCommands.size(); i++) {
- Editor::Command command = frame->editor()->command(pendingEditorCommands.at(i).utf8().data());
+ Editor::Command command = frame->editor().command(pendingEditorCommands.at(i).utf8().data());
if (command.isTextInsertion() && !allowTextInsertion)
return false;
@@ -95,14 +95,14 @@
}
// Only allow text insertion commands if the current node is editable.
- if (executePendingEditorCommands(frame, pendingEditorCommands, frame->editor()->canEdit())) {
+ if (executePendingEditorCommands(frame, pendingEditorCommands, frame->editor().canEdit())) {
event->setDefaultHandled();
return;
}
}
// Don't allow text insertion for nodes that cannot edit.
- if (!frame->editor()->canEdit())
+ if (!frame->editor().canEdit())
return;
// This is just a normal text insertion, so wait to execute the insertion
@@ -119,7 +119,7 @@
if (platformEvent->ctrlKey() || platformEvent->altKey())
return;
- if (frame->editor()->insertText(platformEvent->text(), event))
+ if (frame->editor().insertText(platformEvent->text(), event))
event->setDefaultHandled();
}
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm
index 0fca3b9..3c230eb 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm
@@ -63,7 +63,7 @@
void WebContextMenuClient::searchWithGoogle(const Frame* frame)
{
- String searchString = frame->editor()->selectedText();
+ String searchString = frame->editor().selectedText();
searchString.stripWhiteSpace();
m_page->send(Messages::WebPageProxy::SearchTheWeb(searchString));
@@ -85,7 +85,7 @@
if (!selectionFrame)
selectionFrame = mainFrame;
- String selectedString = selectionFrame->displayStringModifiedByEncoding(selectionFrame->editor()->selectedText());
+ String selectedString = selectionFrame->displayStringModifiedByEncoding(selectionFrame->editor().selectedText());
if (selectedString.isEmpty())
return;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
index 8235bc6..e0b8ac8 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
@@ -136,12 +136,12 @@
static void changeWordCase(WebPage* page, SEL selector)
{
Frame* frame = page->corePage()->focusController()->focusedOrMainFrame();
- if (!frame->editor()->canEdit())
+ if (!frame->editor().canEdit())
return;
- frame->editor()->command("selectWord").execute();
+ frame->editor().command("selectWord").execute();
- NSString *selectedString = frame->displayStringModifiedByEncoding(frame->editor()->selectedText());
+ NSString *selectedString = frame->displayStringModifiedByEncoding(frame->editor().selectedText());
page->replaceSelectionWithText(frame, [selectedString performSelector:selector]);
}
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
index e26056e..726ca06 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
@@ -324,7 +324,7 @@
if (!m_coreFrame)
return String();
- return m_coreFrame->displayStringModifiedByEncoding(m_coreFrame->editor()->selectedText());
+ return m_coreFrame->displayStringModifiedByEncoding(m_coreFrame->editor().selectedText());
}
IntSize WebFrame::size() const
@@ -700,15 +700,15 @@
void WebFrame::setTextDirection(const String& direction)
{
- if (!m_coreFrame || !m_coreFrame->editor())
+ if (!m_coreFrame)
return;
if (direction == "auto")
- m_coreFrame->editor()->setBaseWritingDirection(NaturalWritingDirection);
+ m_coreFrame->editor().setBaseWritingDirection(NaturalWritingDirection);
else if (direction == "ltr")
- m_coreFrame->editor()->setBaseWritingDirection(LeftToRightWritingDirection);
+ m_coreFrame->editor().setBaseWritingDirection(LeftToRightWritingDirection);
else if (direction == "rtl")
- m_coreFrame->editor()->setBaseWritingDirection(RightToLeftWritingDirection);
+ m_coreFrame->editor().setBaseWritingDirection(RightToLeftWritingDirection);
}
#if PLATFORM(MAC)
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index 9947eeb..f01d5ca 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -601,8 +601,8 @@
result.isContentEditable = frame->selection()->isContentEditable();
result.isContentRichlyEditable = frame->selection()->isContentRichlyEditable();
result.isInPasswordField = frame->selection()->isInPasswordField();
- result.hasComposition = frame->editor()->hasComposition();
- result.shouldIgnoreCompositionSelectionChange = frame->editor()->ignoreCompositionSelectionChange();
+ result.hasComposition = frame->editor().hasComposition();
+ result.shouldIgnoreCompositionSelectionChange = frame->editor().ignoreCompositionSelectionChange();
#if PLATFORM(QT)
size_t location = 0;
@@ -641,8 +641,8 @@
result.editorRect = frame->view()->contentsToWindow(selectionRoot->pixelSnappedBoundingBox());
RefPtr<Range> range;
- if (result.hasComposition && (range = frame->editor()->compositionRange())) {
- frame->editor()->getCompositionSelection(result.anchorPosition, result.cursorPosition);
+ if (result.hasComposition && (range = frame->editor().compositionRange())) {
+ frame->editor().getCompositionSelection(result.anchorPosition, result.cursorPosition);
result.compositionRect = frame->view()->contentsToWindow(range->boundingBox());
}
@@ -657,7 +657,7 @@
}
if (range)
- result.cursorRect = frame->view()->contentsToWindow(frame->editor()->firstRectForRange(range.get()));
+ result.cursorRect = frame->view()->contentsToWindow(frame->editor().firstRectForRange(range.get()));
// FIXME: We should only transfer innerText when it changes and do this on the UI side.
if (result.isContentEditable && !result.isInPasswordField) {
@@ -768,7 +768,7 @@
return;
}
- frame->editor()->command(commandName).execute(argument);
+ frame->editor().command(commandName).execute(argument);
}
bool WebPage::isEditingCommandEnabled(const String& commandName)
@@ -780,7 +780,7 @@
if (PluginView* pluginView = focusedPluginViewForFrame(frame))
return pluginView->isEditingCommandEnabled(commandName);
- Editor::Command command = frame->editor()->command(commandName);
+ Editor::Command command = frame->editor().command(commandName);
return command.isSupported() && command.isEnabled();
}
@@ -1778,7 +1778,7 @@
if (PluginView* pluginView = focusedPluginViewForFrame(frame))
isEnabled = pluginView->isEditingCommandEnabled(commandName);
else {
- Editor::Command command = frame->editor()->command(commandName);
+ Editor::Command command = frame->editor().command(commandName);
state = command.state();
isEnabled = command.isSupported() && command.isEnabled();
}
@@ -2560,7 +2560,7 @@
if (!keyEvent)
return false;
- Editor::Command command = frame->editor()->command(interpretKeyEvent(evt));
+ Editor::Command command = frame->editor().command(interpretKeyEvent(evt));
if (keyEvent->type() == PlatformEvent::RawKeyDown) {
// WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated,
@@ -2573,14 +2573,14 @@
return true;
// Don't allow text insertion for nodes that cannot edit.
- if (!frame->editor()->canEdit())
+ if (!frame->editor().canEdit())
return false;
// Don't insert null or control characters as they can result in unexpected behaviour
if (evt->charCode() < ' ')
return false;
- return frame->editor()->insertText(evt->keyEvent()->text(), evt);
+ return frame->editor().insertText(evt->keyEvent()->text(), evt);
}
#endif
@@ -2859,7 +2859,7 @@
void WebPage::advanceToNextMisspelling(bool startBeforeSelection)
{
Frame* frame = m_page->focusController()->focusedOrMainFrame();
- frame->editor()->advanceToNextMisspelling(startBeforeSelection);
+ frame->editor().advanceToNextMisspelling(startBeforeSelection);
}
void WebPage::changeSpellingToWord(const String& word)
@@ -2886,17 +2886,17 @@
#if USE(APPKIT)
void WebPage::uppercaseWord()
{
- m_page->focusController()->focusedOrMainFrame()->editor()->uppercaseWord();
+ m_page->focusController()->focusedOrMainFrame()->editor().uppercaseWord();
}
void WebPage::lowercaseWord()
{
- m_page->focusController()->focusedOrMainFrame()->editor()->lowercaseWord();
+ m_page->focusController()->focusedOrMainFrame()->editor().lowercaseWord();
}
void WebPage::capitalizeWord()
{
- m_page->focusController()->focusedOrMainFrame()->editor()->capitalizeWord();
+ m_page->focusController()->focusedOrMainFrame()->editor().capitalizeWord();
}
#endif
@@ -2933,7 +2933,7 @@
{
bool selectReplacement = true;
bool smartReplace = false;
- return frame->editor()->replaceSelectionWithText(text, selectReplacement, smartReplace);
+ return frame->editor().replaceSelectionWithText(text, selectReplacement, smartReplace);
}
void WebPage::clearSelection()
@@ -3596,7 +3596,7 @@
Frame* frame = m_page->focusController()->focusedOrMainFrame();
if (!frame)
return;
- frame->editor()->handleAlternativeTextUIResult(result);
+ frame->editor().handleAlternativeTextUIResult(result);
}
#endif
@@ -3618,29 +3618,29 @@
void WebPage::setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length)
{
Frame* frame = m_page->focusController()->focusedOrMainFrame();
- if (!frame || !frame->editor()->canEdit())
+ if (!frame || !frame->editor().canEdit())
return;
Vector<CompositionUnderline> underlines;
underlines.append(CompositionUnderline(0, compositionString.length(), Color(Color::black), false));
- frame->editor()->setComposition(compositionString, underlines, from, from + length);
+ frame->editor().setComposition(compositionString, underlines, from, from + length);
}
bool WebPage::hasCompositionForTesting()
{
Frame* frame = m_page->focusController()->focusedOrMainFrame();
- return frame && frame->editor()->hasComposition();
+ return frame && frame->editor().hasComposition();
}
void WebPage::confirmCompositionForTesting(const String& compositionString)
{
Frame* frame = m_page->focusController()->focusedOrMainFrame();
- if (!frame || !frame->editor()->canEdit())
+ if (!frame || !frame->editor().canEdit())
return;
if (compositionString.isNull())
- frame->editor()->confirmComposition();
- frame->editor()->confirmComposition(compositionString);
+ frame->editor().confirmComposition();
+ frame->editor().confirmComposition(compositionString);
}
void WebPage::numWheelEventHandlersChanged(unsigned numWheelEventHandlers)
@@ -3796,19 +3796,19 @@
{
Frame* targetFrame = page->corePage()->focusController()->focusedOrMainFrame();
- if (!targetFrame || !targetFrame->editor())
+ if (!targetFrame)
return 0;
- Editor* editor = targetFrame->editor();
- if (!editor->canEdit())
+ Editor& editor = targetFrame->editor();
+ if (!editor.canEdit())
return 0;
- if (editor->hasComposition()) {
+ if (editor.hasComposition()) {
// We should verify the parent node of this IME composition node are
// editable because JavaScript may delete a parent node of the composition
// node. In this case, WebKit crashes while deleting texts from the parent
// node, which doesn't exist any longer.
- if (PassRefPtr<Range> range = editor->compositionRange()) {
+ if (PassRefPtr<Range> range = editor.compositionRange()) {
Node* node = range->startContainer();
if (!node || !node->isContentEditable())
return 0;
@@ -3825,8 +3825,7 @@
return;
}
- Editor* editor = targetFrame->editor();
- editor->confirmComposition(compositionString);
+ targetFrame->editor().confirmComposition(compositionString);
if (selectionStart == -1) {
send(Messages::WebPageProxy::EditorStateChanged(editorState()));
@@ -3858,19 +3857,19 @@
Element* scope = targetFrame->selection()->rootEditableElement();
RefPtr<Range> replacementRange = TextIterator::rangeFromLocationAndLength(scope, replacementStart, replacementLength);
- targetFrame->editor()->setIgnoreCompositionSelectionChange(true);
+ targetFrame->editor().setIgnoreCompositionSelectionChange(true);
targetFrame->selection()->setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
- targetFrame->editor()->setIgnoreCompositionSelectionChange(false);
+ targetFrame->editor().setIgnoreCompositionSelectionChange(false);
}
- targetFrame->editor()->setComposition(text, underlines, selectionStart, selectionEnd);
+ targetFrame->editor().setComposition(text, underlines, selectionStart, selectionEnd);
send(Messages::WebPageProxy::EditorStateChanged(editorState()));
}
void WebPage::cancelComposition()
{
if (Frame* targetFrame = targetFrameForEditing(this))
- targetFrame->editor()->cancelComposition();
+ targetFrame->editor().cancelComposition();
send(Messages::WebPageProxy::EditorStateChanged(editorState()));
}
#endif
diff --git a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp
index e473103..c6c41f10 100644
--- a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp
@@ -178,16 +178,16 @@
if (!frame)
return 0;
- Editor* editor = frame->editor();
- if (!editor->canEdit())
+ Editor& editor = frame->editor();
+ if (!editor.canEdit())
return 0;
- if (editor->hasComposition()) {
+ if (editor.hasComposition()) {
// We should verify the parent node of this IME composition node are
// editable because JavaScript may delete a parent node of the composition
// node. In this case, WebKit crashes while deleting texts from the parent
// node, which doesn't exist any longer.
- if (PassRefPtr<Range> range = editor->compositionRange()) {
+ if (PassRefPtr<Range> range = editor.compositionRange()) {
Node* node = range->startContainer();
if (!node || !node->isContentEditable())
return 0;
@@ -203,7 +203,7 @@
if (!targetFrame)
return;
- targetFrame->editor()->confirmComposition(compositionString);
+ targetFrame->editor().confirmComposition(compositionString);
}
void WebPage::setComposition(const String& compositionString, const Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition)
@@ -212,7 +212,7 @@
if (!targetFrame)
return;
- targetFrame->editor()->setComposition(compositionString, underlines, cursorPosition, 0);
+ targetFrame->editor().setComposition(compositionString, underlines, cursorPosition, 0);
}
void WebPage::cancelComposition()
@@ -221,7 +221,7 @@
if (!frame)
return;
- frame->editor()->cancelComposition();
+ frame->editor().cancelComposition();
}
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
index b712530..78a78c1 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
@@ -168,16 +168,16 @@
bool eventWasHandled = false;
for (size_t i = 0; i < commands.size(); ++i) {
if (commands[i].commandName == "insertText:") {
- ASSERT(!frame->editor()->hasComposition());
+ ASSERT(!frame->editor().hasComposition());
- if (!frame->editor()->canEdit())
+ if (!frame->editor().canEdit())
continue;
// An insertText: might be handled by other responders in the chain if we don't handle it.
// One example is space bar that results in scrolling down the page.
- eventWasHandled |= frame->editor()->insertText(commands[i].text, event);
+ eventWasHandled |= frame->editor().insertText(commands[i].text, event);
} else {
- Editor::Command command = frame->editor()->command(commandNameForSelectorName(commands[i].commandName));
+ Editor::Command command = frame->editor().command(commandNameForSelectorName(commands[i].commandName));
if (command.isSupported()) {
bool commandExecutedByEditor = command.execute(event);
eventWasHandled |= commandExecutedByEditor;
@@ -233,7 +233,7 @@
// (e.g. Tab that inserts a Tab character, or Enter).
bool haveTextInsertionCommands = false;
for (size_t i = 0; i < commands.size(); ++i) {
- if (frame->editor()->command(commandNameForSelectorName(commands[i].commandName)).isTextInsertion())
+ if (frame->editor().command(commandNameForSelectorName(commands[i].commandName)).isTextInsertion())
haveTextInsertionCommands = true;
}
// If there are no text insertion commands, default keydown handler is the right time to execute the commands.
@@ -265,7 +265,7 @@
frame->selection()->setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
}
- frame->editor()->setComposition(text, underlines, selectionStart, selectionEnd);
+ frame->editor().setComposition(text, underlines, selectionStart, selectionEnd);
}
newState = editorState();
@@ -275,7 +275,7 @@
{
Frame* frame = m_page->focusController()->focusedOrMainFrame();
- frame->editor()->confirmComposition();
+ frame->editor().confirmComposition();
newState = editorState();
}
@@ -284,7 +284,7 @@
{
Frame* frame = m_page->focusController()->focusedOrMainFrame();
- frame->editor()->cancelComposition();
+ frame->editor().cancelComposition();
newState = editorState();
}
@@ -299,13 +299,13 @@
frame->selection()->setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
}
- if (!frame->editor()->hasComposition()) {
+ if (!frame->editor().hasComposition()) {
// An insertText: might be handled by other responders in the chain if we don't handle it.
// One example is space bar that results in scrolling down the page.
- handled = frame->editor()->insertText(text, m_keyboardEventBeingInterpreted);
+ handled = frame->editor().insertText(text, m_keyboardEventBeingInterpreted);
} else {
handled = true;
- frame->editor()->confirmComposition(text);
+ frame->editor().confirmComposition(text);
}
newState = editorState();
@@ -321,8 +321,8 @@
frame->selection()->setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
}
- ASSERT(!frame->editor()->hasComposition());
- handled = frame->editor()->insertDictatedText(text, dictationAlternativeLocations, m_keyboardEventBeingInterpreted);
+ ASSERT(!frame->editor().hasComposition());
+ handled = frame->editor().insertDictatedText(text, dictationAlternativeLocations, m_keyboardEventBeingInterpreted);
newState = editorState();
}
@@ -334,7 +334,7 @@
if (!frame)
return;
- RefPtr<Range> range = frame->editor()->compositionRange();
+ RefPtr<Range> range = frame->editor().compositionRange();
size_t locationSize;
size_t lengthSize;
if (range && TextIterator::getLocationAndLengthFromRange(frame->selection()->rootEditableElementOrDocumentElement(), range.get(), locationSize, lengthSize)) {
@@ -437,7 +437,7 @@
ASSERT(range->startContainer());
ASSERT(range->endContainer());
- IntRect rect = frame->editor()->firstRectForRange(range.get());
+ IntRect rect = frame->editor().firstRectForRange(range.get());
resultRect = frame->view()->contentsToWindow(rect);
}
@@ -654,7 +654,7 @@
result = false;
return;
}
- frame->editor()->readSelectionFromPasteboard(pasteboardName);
+ frame->editor().readSelectionFromPasteboard(pasteboardName);
result = true;
}
@@ -676,7 +676,7 @@
if (frame->selection()->isNone())
return;
- stringValue = frame->editor()->stringSelectionForPasteboard();
+ stringValue = frame->editor().stringSelectionForPasteboard();
}
void WebPage::getDataSelectionForPasteboard(const String pasteboardType, SharedMemory::Handle& handle, uint64_t& size)
@@ -685,7 +685,7 @@
if (!frame || frame->selection()->isNone())
return;
- RefPtr<SharedBuffer> buffer = frame->editor()->dataSelectionForPasteboard(pasteboardType);
+ RefPtr<SharedBuffer> buffer = frame->editor().dataSelectionForPasteboard(pasteboardType);
if (!buffer) {
size = 0;
return;