haikuwebkit/Source/WebCore/editing/win
Darin Adler 5bc9273a05 Remove some member functions of Range and many calls to createLiveRange
https://bugs.webkit.org/show_bug.cgi?id=215070

Reviewed by Sam Weinig.

Source/WebCore:

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::nextBoundary): Remove createLiveRange.
(WebCore::AXObjectCache::previousBoundary): Ditto.

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _convertToNSRange:]): Take SimpleRange.
(-[WebAccessibilityObjectWrapper positionForTextMarker:]): Remove createLiveRange.
(-[WebAccessibilityObjectWrapper textRectsFromMarkers:withText:]): Ditto.

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper _convertToNSRange:]): Take SimpleRange.
(-[WebAccessibilityObjectWrapper _indexForTextMarker:]): Remove createLiveRange.
(-[WebAccessibilityObjectWrapper _textMarkerForIndex:]): Ditto.

* dom/DocumentMarkerController.cpp:
(WebCore::updateRenderedRectsForMarker): Renamed range to makeSimpleRange.
(WebCore::makeSimpleRange): Ditto.
* dom/DocumentMarkerController.h: Update for the above.

* dom/Range.cpp:
(WebCore::Range::text const): Use makeSimpleRange.
(WebCore::Range::shadowRoot const): Deleted.
(WebCore::intervalsSufficientlyOverlap): Deleted.
(WebCore::adjustLineHeightOfSelectionRects): Deleted.
(WebCore::coalesceSelectionRects): Deleted.
(WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines const): Deleted.
(WebCore::Range::collectSelectionRects const): Deleted.
* dom/Range.h: Update for the above. Also make pastLastNode private since it is
only used inside the Range class's implementation.

* dom/SimpleRange.cpp:
(WebCore::SimpleRange::SimpleRange): Removed overload that takes a Range.
* dom/SimpleRange.h: Update for the above. Removed both constructor overloads
that take a Range.

* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::timerFired): Remove createLiveRange.
(WebCore::AlternativeTextController::respondToMarkerAtEndOfWord): Use
makeSimpleRange.
(WebCore::AlternativeTextController::applyAlternativeTextToRange):
Remove createLiveRange.

* editing/EditingStyle.cpp:
(WebCore::EditingStyle::styleAtSelectionStart): Remove createLiveRange.
* editing/Editor.cpp:
(WebCore::Editor::performCutOrCopy): Ditto.
(WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Ditto.
(WebCore::Editor::replaceRangeForSpellChecking): Ditto.
(WebCore::correctSpellcheckingPreservingTextCheckingParagraph): Ditto.
(WebCore::Editor::changeBackToReplacedString): Ditto.
(WebCore::Editor::countMatchesForText): Ditto.
* editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::doApply): Ditto.
(WebCore::InsertListCommand::doApplyForSingleParagraph): Change out
argument type to SimpleRange.
* editing/InsertListCommand.h: Update for above.

* editing/SpellChecker.cpp:
(WebCore::SpellChecker::isCheckable const): Rewrite questionable logic
to use intersectingNodes instead of firstNode.

* editing/TextCheckingHelper.cpp:
(WebCore::TextCheckingHelper::findUngrammaticalPhrases const): Remove createLiveRange.
* editing/TypingCommand.cpp:
(WebCore::TypingCommand::deleteKeyPressed): Ditto.
(WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto.
* editing/markup.cpp:
(WebCore::createFragmentFromText): Ditto.

* editing/ios/EditorIOS.mm:
(WebCore::Editor::setTextAsChildOfElement): Use makeRangeSelectingNodeContents.

* editing/win/EditorWin.cpp:
(WebCore::Editor::pasteWithPasteboard): Remove createLiveRange.

* page/DOMSelection.cpp:
(WebCore::DOMSelection::addRange): Use makeSimpleRange.
(WebCore::DOMSelection::deleteFromDocument): Remove createLiveRange.

* page/DragController.cpp:
(WebCore::documentFragmentFromDragData): Take SimpleRange.
(WebCore::DragController::concludeEditDrag): Remove createLiveRange.
(WebCore::DragController::startDrag): Ditto.

* page/TextIndicator.cpp:
(WebCore::selectionRects): Deleted.
(WebCore::initializeIndicator): Call collectSelectionRects directly here,
avoiding createLiveRange and using map to convert from Vector<SelectionRect>
to Vector<FloatRect>.

* page/ios/FrameIOS.mm:
(WebCore::Frame::interpretationsForCurrentRoot const): Use makeSimpleRange.

* platform/DragImage.cpp:
(WebCore::createDragImageForRange): Take SimpleRange.
* platform/DragImage.h: Update createDragImageForRange to take SimpleRange.

* platform/Pasteboard.h: Updated Windows-only layering-violating functions
to take SimpleRange.

* platform/ios/DragImageIOS.mm:
(WebCore::createDragImageForRange): Take SimpleRange.

* platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::writeRangeToDataObject): Take SimpleRange.
(WebCore::Pasteboard::writeSelection): Ditto.
(WebCore::Pasteboard::documentFragment): Ditto.

* rendering/RenderObject.cpp:
(WebCore::intervalsSufficientlyOverlap): Added. Moved from Range. Mostly unchanged
but uses SimpleRange now instead of a live range, and intersectingNodes instead of
a loop using firstNode and pastLastNode.
(WebCore::adjustLineHeightOfSelectionRects): Ditto.
(WebCore::coalesceSelectionRects): Ditto.
(WebCore::RenderObject::collectSelectionRectsWithoutUnionInteriorLines): Ditto.
(WebCore::RenderObject::collectSelectionRectsInternal): Ditto.
(WebCore::RenderObject::collectSelectionRects): Ditto.
* rendering/RenderObject.h: Update for above.

* testing/Internals.cpp:
(WebCore::Internals::markerRangeForNode): Use makeSimplRange.
(WebCore::Internals::locationFromRange): Ditto.
(WebCore::Internals::lengthFromRange): Ditto.
(WebCore::Internals::rangeAsTextUsingBackwardsTextIterator): Ditto.
(WebCore::Internals::subrange): Ditto.
(WebCore::Internals::rangeOfStringNearLocation): Ditto.
(WebCore::Internals::textIndicatorForRange): Ditto.

Source/WebKit:

* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm:
(-[WKWebProcessPlugInRangeHandle detectDataWithTypes:context:]): Use makeSimpleRange.
* WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
(API::PageOverlayClientImpl::actionContextForResultAtPoint): Ditto.
* WebProcess/InjectedBundle/API/mac/WKDOMRange.mm:
(-[WKDOMRange textRects]): Ditto.
* WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm:
(-[WKDOMTextIterator initWithRange:]): Ditto.
* WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
(WebKit::InjectedBundleRangeHandle::renderedImage): Ditto.

* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::performDictionaryLookupAtLocation): Remove createLiveRange.
(WebKit::WebPage::performDictionaryLookupForSelection): Ditto.
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::updateFindUIAfterPageScroll): Ditto.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPlatformEditorState const): Ditto.
(WebKit::WebPage::computeAndSendEditDragSnapshot): Ditto.
(WebKit::WebPage::getRectsForGranularityWithSelectionOffset): Ditto.
(WebKit::WebPage::getRectsAtSelectionOffsetWithText): Ditto.
(WebKit::WebPage::requestAutocorrectionData): Ditto.

Source/WebKitLegacy/ios:

* WebCoreSupport/WebFrameIOS.mm:
(-[WebFrame selectionRectsForCoreRange:]): Remove createLiveRange.
(-[WebFrame selectionRectsForRange:]): Use makeSimpleRange.
* WebCoreSupport/WebVisiblePosition.mm:
(-[WebVisiblePosition enclosingRangeWithDictationPhraseAlternatives:]): Ditto.
(-[WebVisiblePosition enclosingRangeWithCorrectionIndicator]): Ditto.
(+[DOMRange rangeForFirstPosition:second:]): Rename firstVP/secondVP
to firstPosition/secondPosition.

Source/WebKitLegacy/mac:

* DOM/DOM.mm:
(-[DOMRange renderedImageForcingBlackText:renderedImageForcingBlackText:]):
Use makeSimpleRange.
(-[DOMRange textRects]): Ditto.

* DOM/DOMDocument.mm: Update includes.
* DOM/DOMRange.mm: Ditto.
* DOM/DOMRangeInternal.h: Ditto.
* DOM/DOMUIKitExtensions.mm: Ditto.
* DOM/DOMUtility.mm: Ditto.

* DOM/WebDOMOperations.mm:
(-[DOMRange webArchive]): Use makeSimpleRange.
(-[DOMRange markupString]): Ditto.

* WebView/WebFrame.mm:
(-[WebFrame _stringForRange:]): Use makeSimpleRange.
(-[WebFrame _convertToDOMRange:]): Return a SimpleRange.
(-[WebFrame _convertToDOMRange:rangeIsRelativeTo:]): Ditto.
(-[WebFrame _convertNSRangeToDOMRange:]): Update for above.
(-[WebFrame _convertDOMRangeToNSRange:]): Use makeSimpleRange.
(-[WebFrame _selectNSRange:]): Update for above.
(-[WebFrame selectWithoutClosingTypingNSRange:]): Ditto.
(-[WebFrame getDictationResultRanges:andMetadatas:]): Use makeSimpleRange.
(-[WebFrame dictationResultMetadataForRange:]): Ditto.
* WebView/WebFrameInternal.h: Update for above.

* WebView/WebHTMLView.mm:
(-[WebHTMLView _documentFragmentFromPasteboard:forType:inContext:subresources:]):
Use makeSimpleRange.
(-[WebHTMLView attributedSubstringFromRange:]): Use auto.
(-[WebHTMLView _attributedStringFromDOMRange:]): Deleted.
(-[WebHTMLView attributedString]): Rewrote to use SimpleRange consistently.
(-[WebHTMLView selectedAttributedString]): Ditto.

* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController _animationControllerForDataDetectedText]):
Use makeSimpleRange.
* WebView/WebTextIterator.mm:
(-[WebTextIterator initWithRange:]): Ditto.

* WebView/WebView.mm:
(-[WebView _didConcludeEditDrag]): Remove createLiveRange.


Canonical link: https://commits.webkit.org/227876@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265190 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-03 00:47:52 +00:00
..
EditorWin.cpp Remove some member functions of Range and many calls to createLiveRange 2020-08-03 00:47:52 +00:00