Remove live ranges from Editor.h and EditorClient.h
https://bugs.webkit.org/show_bug.cgi?id=214261
Reviewed by Sam Weinig.
Source/WebCore:
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::misspellingRange const): Update since
rangeForTextCheckingResult no longer returns a live range.
(WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection const):
Update since rangeOfString no longer returns a live range.
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(accessibilityTextOperationForParameterizedAttribute): Use makeSimpleRange.
* dom/Document.cpp:
(WebCore::acceptsEditingFocus): Use makeRangeSelectingNodeContents
since shouldBeginEditing no longer takes a live range.
* dom/Range.h: Exxported makeSimpleRange for use outside WebCore.
* dom/SimpleRange.cpp:
(WebCore::makeSimpleRange): Added. Takes two optional boundary points and
returns an optional range.
* dom/SimpleRange.h: Added the above.
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::timerFired): Removed calls to
crateLiveRange since markAllMisspellingsAndBadGrammarInRanges no
longer takes live ranges.
(WebCore::AlternativeTextController::applyDictationAlternative):
Updates since shouldInsertText no longer takes a live range.
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::mergeParagraphs): Updated since
shouldMoveRangeAfterDelete no longer takes live ranges.
* editing/Editor.cpp:
(WebCore::Editor::canDeleteRange const): Updated to not take a
live range.
(WebCore::Editor::deleteWithDirection): Updated since
addRangeToKillRing no longer takes a live range.
(WebCore::Editor::pasteAsPlainTextWithPasteboard): Updated since
shouldInsertText no longer takes a live range.
(WebCore::Editor::shouldInsertFragment): No longer take a live range.
(WebCore::Editor::replaceSelectionWithText): Updated since
selectedRange no longer returns a live range.
(WebCore::Editor::selectedRange): Do not return a live range.
(WebCore::Editor::shouldDeleteRange const): Do not take a live range.
(WebCore::Editor::shouldInsertText const): Ditto.
(WebCore::Editor::shouldApplyStyle): Ditto. Also take a const& to
the style instead of a non-const*.
(WebCore::Editor::applyStyleToSelection): Pass a style reference
and a non-live range.
(WebCore::Editor::applyParagraphStyleToSelection): Updated for
the change above.
(WebCore::Editor::insertTextWithoutSendingTextEvent): No need to
pass a live range any more.
(WebCore::Editor::insertLineBreak): Ditto.
(WebCore::Editor::insertParagraphSeparator): Ditto.
(WebCore::Editor::performCutOrCopy): Updated to not use live range.
(WebCore::Editor::performDelete): Ditto.
(WebCore::Editor::shouldEndEditing): Do not take a live range.
(WebCore::Editor::shouldBeginEditing): Ditto.
(WebCore::Editor::willWriteSelectionToPasteboard): Ditto.
(WebCore::Editor::selectComposition): Update since compositionRange
is not a live range.
(WebCore::Editor::markMisspellingsAfterTypingToWord): Update since
we don't need to pass live ranges to markAllMisspellingsAndBadGrammarInRanges.
(WebCore::Editor::markMisspellingsOrBadGrammar): Don't return a
live range in tthe out argument.
(WebCore::Editor::markMisspellings): Ditto.
(WebCore::Editor::markBadGrammar): Update for the above.
(WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Do not
take live ranges for the arguments.
(WebCore::Editor::replaceRangeForSpellChecking): Do not take a live range.
(WebCore::Editor::markAndReplaceFor): Update since shouldInsertText does
not take a live range any more.
(WebCore::Editor::changeBackToReplacedString): Update to not use live
ranges as much.
(WebCore::Editor::markMisspellingsAndBadGrammar): Updae since
we don't need to pass live ranges to markAllMisspellingsAndBadGrammarInRanges.
(WebCore::Editor::rangeForPoint): Don't return a live range.
(WebCore::Editor::compositionRange const): Ditto.
(WebCore::Editor::transpose): Updated since we don't pass a live range.
(WebCore::Editor::firstRectForRange const): Don't take a live range.
(WebCore::Editor::shouldChangeSelection const): Updated since we don't
need to pass a live range.
(WebCore::Editor::findString): Ditto.
(WebCore::start): Added. Helper to make rangeOfString easier to read.
(WebCore::end): Ditto.
(WebCore::makeBoundaryPointAfterNodeContents): Ditto.
(WebCore::makeBoundaryPointAfterNode): Ditto.
(WebCore::collapseIfRootsDiffer): Ditto.
(WebCore::Editor::rangeOfString): Updated to not take or return a
live range and not use it internally either.
(WebCore::isFrameInRange): Don't take a live range.
(WebCore::Editor::countMatchesForText): Don't take or return live ranges.
(WebCore::Editor::contextRangeForCandidateRequest const): Don't return
a live range.
(WebCore::Editor::rangeForTextCheckingResult const): Ditto.
(WebCore::Editor::handleAcceptedCandidate): Update for the above.
(WebCore::Editor::adjustedSelectionRange): Don't return a live range.
* editing/Editor.h: Updated for all the chagnes above.
* editing/EditorCommand.cpp:
(WebCore::expandSelectionToGranularity): Updated to reduce the use of
live ranges.
(WebCore::unionRanges): Updated to no longer take or return a live
range. Still uses live ranges in the algorithm for now.
(WebCore::executeDeleteToMark): Updated since selectedRange no longer
returns a live range.
(WebCore::executeSelectToMark): Update to use the new unionRanges.
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::shouldDeleteSelection const): Updated
since shouldDeleteRange no longer requires a live range.
* editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::getPasteboardTypesAndDataForAttachment): Updated
for changes to use fewer live ranges.
(WebCore::Editor::writeSelectionToPasteboard): Ditto.
(WebCore::Editor::writeSelection): Ditto.
(WebCore::Editor::replaceSelectionWithAttributedString): Ditto.
* editing/gtk/EditorGtk.cpp:
(WebCore::Editor::pasteWithPasteboard): Ditto.
* editing/ios/EditorIOS.mm:
(WebCore::Editor::writeImageToPasteboard): Ditto.
(WebCore::Editor::pasteWithPasteboard): Ditto.
* editing/libwpe/EditorLibWPE.cpp:
(WebCore::createFragmentFromPasteboardData): Ditto.
(WebCore::Editor::pasteWithPasteboard): Ditto.
* editing/mac/EditorMac.mm:
(WebCore::Editor::pasteWithPasteboard): Ditto.
(WebCore::Editor::replaceNodeFromPasteboard): Ditto.
(WebCore::Editor::dataSelectionForPasteboard): Ditto.
* editing/win/EditorWin.cpp:
(WebCore::Editor::pasteWithPasteboard): Ditto.
* html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::createTDForFilename):
Removed a WTFMove that messes up the return value optimization.
Noticed while fixing errors caused by live range changes.
* loader/EmptyClients.cpp: Updated for changes to EditorClient.
* page/ContextMenuController.cpp:
(WebCore::insertUnicodeCharacter): Updated to use fewer live ranges.
(WebCore::ContextMenuController::contextMenuItemSelected): DItto.
* page/DragController.cpp:
(WebCore::DragController::concludeEditDrag): Ditto.
(WebCore::DragController::startDrag): Ditto.
* page/EditorClient.h: Don't take or return live ranges.
* page/EventHandler.cpp:
(WebCore::EventHandler::sendContextMenuEventForKey): Simplified
since we don't need to use a live range.
* page/FocusController.cpp:
(WebCore::relinquishesEditingFocus): Changed argument type to be
more specific, and changed to not use a live range.
(WebCore::FocusController::setFocusedElement): Updated for the above.
* page/Frame.cpp:
(WebCore::Frame::rangeForPoint): Updated to not use live ranges.
* page/Page.cpp:
(WebCore::Page::findStringMatchingRanges): Updated to not use
live ranges as much.
(WebCore::Page::rangeOfString): Ditto.
(WebCore::Page::findMatchesForText): Ditto.
* testing/Internals.cpp:
(WebCore::Internals::rangeOfString): Updated since return value
of the Editor member function is no longer a live range.
(WebCore::Internals::countMatchesForText): Ditto.
Source/WebKit:
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView rectForPage:]): Use NSZeroRect.
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::shouldDeleteRange): Updated for live
range changes and also removed gratuitous call to notImplemented
since the function is implemented.
(WebKit::WebEditorClient::shouldBeginEditing): Ditto.
(WebKit::WebEditorClient::shouldEndEditing): Ditto.
(WebKit::WebEditorClient::shouldInsertNode): Ditto.
(WebKit::WebEditorClient::shouldInsertText): Ditto.
(WebKit::WebEditorClient::shouldChangeSelectedRange): Ditto.
(WebKit::WebEditorClient::shouldApplyStyle): Ditto.
(WebKit::WebEditorClient::shouldMoveRangeAfterDelete): Ditto.
(WebKit::WebEditorClient::didBeginEditing): Ditto.
(WebKit::WebEditorClient::didEndEditing): Ditto.
(WebKit::WebEditorClient::willWriteSelectionToPasteboard): Ditto.
(WebKit::WebEditorClient::getClientPasteboardData): Ditto.
(WebKit::WebEditorClient::performTwoStepDrop): Ditto.
(WebKit::WebEditorClient::overflowScrollPositionChanged): Ditto.
(WebKit::WebEditorClient::subFrameScrollPositionChanged): Ditto.
(WebKit::WebEditorClient::setInputMethodState): Ditto.
* WebProcess/WebCoreSupport/WebEditorClient.h: Updated
for changes to EditorClient.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::getMarkedRangeAsync): Updated to reduce
the use of local values and live ranges.
(WebKit::WebPage::getSelectedRangeAsync): Ditto.
(WebKit::WebPage::characterIndexForPointAsync): Ditto.
(WebKit::WebPage::firstRectForCharacterRangeAsync): Ditto.
(WebKit::WebPage::setCompositionAsync): Ditto.
* WebProcess/WebPage/glib/WebPageGLib.cpp:
(WebKit::WebPage::getPlatformEditorState const): Ditto.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPlatformEditorState const): Ditto.
(WebKit::WebPage::selectWithGesture): Ditto.
(WebKit::WebPage::autocorrectionContext): Ditto.
(WebKit::focusedElementPositionInformation): Ditto.
(WebKit::WebPage::requestDocumentEditingContext): Ditto.
Source/WebKitLegacy/ios:
* WebCoreSupport/WebFrameIOS.mm:
(-[WebFrame closestCaretRectInMarkedTextRangeForPoint:]):
Updated since compositionRange is no longer a live range.
Source/WebKitLegacy/mac:
* DOM/DOMRange.mm:
(kit): Added an overload to convert to a live range so we don't have
to touch every call site.
* DOM/DOMRangeInternal.h: Added the above.
* WebCoreSupport/WebEditorClient.h: Updated for changes to EditorClient.
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::shouldDeleteRange): Changed types to not use live ranges.
(WebEditorClient::shouldApplyStyle): Ditto.
(WebEditorClient::shouldMoveRangeAfterDelete): Ditto.
(WebEditorClient::shouldBeginEditing): Ditto.
(WebEditorClient::shouldEndEditing): Ditto.
(WebEditorClient::shouldInsertText): Ditto.
(WebEditorClient::shouldChangeSelectedRange): Ditto.
(WebEditorClient::willWriteSelectionToPasteboard): Ditto.
(WebEditorClient::getClientPasteboardData): Ditto.
(WebEditorClient::shouldInsertNode): Ditto.
(WebEditorClient::performTwoStepDrop): Ditto.
* WebView/WebFrame.mm:
(-[WebFrame _firstRectForDOMRange:]): Update to not use live range.
(-[WebFrame _scrollDOMRangeToVisible:]): Ditto.
(-[WebFrame _rangeByAlteringCurrentSelection:direction:granularity:]): Ditto.
(-[WebFrame _markDOMRange]): Ditto.
(-[WebFrame _selectionRangeForFirstPoint:secondPoint:]): Ditto.
(-[WebFrame _selectionRangeForPoint:]): Ditto.
(-[WebFrame selectedDOMRange]): Ditto.
(-[WebFrame elementRangeContainingCaretSelection]): Ditto.
(-[WebFrame wordRangeContainingCaretSelection]): Ditto.
(-[WebFrame rangeByMovingCurrentSelection:]): Ditto.
(-[WebFrame rangeByExtendingCurrentSelection:]): Ditto.
(-[WebFrame markedTextDOMRange]): Ditto.
* WebView/WebHTMLView.mm:
(-[WebHTMLView _selectedRange]): Update to not use live range.
(-[WebHTMLView firstRectForCharacterRange:]): Use NSZeroRect.
(-[WebHTMLView countMatchesForText:inDOMRange:options:limit:markMatches:]):
Update to not use live range.
* WebView/WebTextCompletionController.mm:
(-[WebTextCompletionController doCompletion]): Ditto.
* WebView/WebTextIterator.mm:
(-[WebTextIterator currentRange]): Ditto.
* WebView/WebView.mm:
(-[WebView textIteratorForRect:]): Ditto.
(-[WebView editableDOMRangeForPoint:]): Ditto.
(-[WebView selectedDOMRange]): Ditto.
Source/WebKitLegacy/win:
* DOMCoreClasses.cpp:
(DOMWindow::DOMWindow): Added ref for underlying WebCore::DOMWindow.
(DOMWindow::~DOMWindow): Added deref for underlying WebCore::DOMWindow.
(DOMRange::DOMRange): Added ref for underlying live range.
(DOMRange::~DOMRange): Added deref for underlying live range.
(DOMRange::createInstance): Added overload for creating a DOMRange from
a SimpleRange that creates the live range.
(DOMNamedNodeMap::DOMNamedNodeMap): Added ref for underlying live range.
(DOMNamedNodeMap::~DOMNamedNodeMap): Added deref for underlying live range.
* DOMCoreClasses.h: Added createInstance overload as described above.
* WebCoreSupport/WebEditorClient.cpp:
(WebEditorClient::shouldBeginEditing): Updated for changes to not use
live ranges. Also removed unnecessary notImplemented calls.
(WebEditorClient::shouldEndEditing): Ditto.
(WebEditorClient::discardedComposition): Ditto.
(WebEditorClient::canceledComposition): Ditto.
(WebEditorClient::didWriteSelectionToPasteboard): Ditto.
(WebEditorClient::willWriteSelectionToPasteboard): Ditto.
(WebEditorClient::getClientPasteboardData): Ditto.
(WebEditorClient::shouldDeleteRange): Ditto.
(WebEditorClient::shouldInsertNode): Ditto.
(WebEditorClient::shouldInsertText): Ditto.
(WebEditorClient::shouldChangeSelectedRange): Ditto.
(WebEditorClient::shouldApplyStyle): Ditto.
(WebEditorClient::didApplyStyle): Ditto.
(WebEditorClient::shouldMoveRangeAfterDelete): Ditto.
* WebCoreSupport/WebEditorClient.h: Updated for changes to
EditorClient.
* WebView.cpp:
(WebView::prepareCandidateWindow): Updated to not use live ranges.
(WebView::onIMERequestCharPosition): Ditto.
(WebView::compositionRangeForTesting): Ditto.
(WebView::firstRectForCharacterRangeForTesting): Ditto.
(WebView::selectedRangeForTesting): Ditto.
Tools:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Removed duplicate install of Ahem.ttf that was leading new versions
of Xcode to fail when trying to build this.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@264692 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/editing/DeleteSelectionCommand.cpp b/Source/WebCore/editing/DeleteSelectionCommand.cpp
index 112f97b..870c4db 100644
--- a/Source/WebCore/editing/DeleteSelectionCommand.cpp
+++ b/Source/WebCore/editing/DeleteSelectionCommand.cpp
@@ -749,9 +749,9 @@
auto range = Range::create(document(), startOfParagraphToMove.deepEquivalent().parentAnchoredEquivalent(), endOfParagraphToMove.deepEquivalent().parentAnchoredEquivalent());
auto rangeToBeReplaced = Range::create(document(), mergeDestination.deepEquivalent().parentAnchoredEquivalent(), mergeDestination.deepEquivalent().parentAnchoredEquivalent());
- if (!document().editor().client()->shouldMoveRangeAfterDelete(range.ptr(), rangeToBeReplaced.ptr()))
+ if (!document().editor().client()->shouldMoveRangeAfterDelete(range, rangeToBeReplaced))
return;
-
+
// moveParagraphs will insert placeholders if it removes blocks that would require their use, don't let block
// removals that it does cause the insertion of *another* placeholder.
bool needPlaceholder = m_needPlaceholder;