Address post-review feedback after r238438
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Nov 2018 03:10:34 +0000 (03:10 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Nov 2018 03:10:34 +0000 (03:10 +0000)
commitbdeb4f3a929bb42ba9bc7afbb6e82f3d06704396
treeb3df1e44d3d1082ff3c65bb5a8b6c21ef93aa878
parent88c9c42fc586714fc8187853f59c1e41226b0e6f
Address post-review feedback after r238438
https://bugs.webkit.org/show_bug.cgi?id=191913

Reviewed by Ryosuke Niwa.

Source/WebCore:

Replace `bool` arguments to `FrameSelection::setSelectedRange`, `Editor::replaceSelectionWithText`, and
`Editor::replaceSelectionWithFragment` with `enum class`es instead. In particular, introduce the following:

FrameSelection::ShouldCloseTyping { No, Yes }
Editor::SelectReplacement { No, Yes }
Editor::SmartReplace { No, Yes }
Editor::MatchStyle { No, Yes }

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::selectText):
* editing/Editor.cpp:
(WebCore::Editor::handleTextEvent):
(WebCore::Editor::replaceSelectionWithFragment):
(WebCore::Editor::replaceSelectionWithText):
(WebCore::Editor::setComposition):
(WebCore::Editor::markMisspellingsAfterTypingToWord):
(WebCore::Editor::changeBackToReplacedString):
(WebCore::Editor::transpose):
(WebCore::Editor::insertAttachment):

At various call sites, replace boolean arguments with named enums.

* editing/Editor.h:
* editing/EditorCommand.cpp:
(WebCore::expandSelectionToGranularity):
(WebCore::executeDeleteToMark):
(WebCore::executeSelectToMark):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setSelectedRange):
* editing/FrameSelection.h:
* page/Page.cpp:
(WebCore::replaceRanges):

Avoid a bit of ref-count churn, and adjust a few functions to take `const Vector&`s instead of `Vector&&`s.

(WebCore::Page::replaceRangesWithText):
(WebCore::Page::replaceSelectionWithText):
* page/Page.h:

Source/WebKit:

Replace boolean arguments to setSelectedRange, replaceSelectionWithText and replaceSelectionWithFragment with
enum flags, and tweak a couple of functions to take `const Vector&` instead of `Vector&&`.

* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageReplaceStringMatches):
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::replaceMatches):
* WebProcess/WebPage/FindController.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::replaceStringMatchesFromInjectedBundle):
(WebKit::WebPage::replaceMatches):
(WebKit::WebPage::replaceSelectionWithText):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::selectWithGesture):
(WebKit::WebPage::updateSelectionWithTouches):
(WebKit::WebPage::selectWithTwoTouches):
(WebKit::WebPage::extendSelection):
(WebKit::WebPage::selectWordBackward):
(WebKit::WebPage::moveSelectionByOffset):
(WebKit::WebPage::selectPositionAtPoint):
(WebKit::WebPage::selectPositionAtBoundaryWithDirection):
(WebKit::WebPage::moveSelectionAtBoundaryWithDirection):
(WebKit::WebPage::selectTextWithGranularityAtPoint):
(WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
(WebKit::WebPage::updateSelectionWithExtentPoint):
(WebKit::WebPage::replaceSelectedText):
(WebKit::WebPage::replaceDictatedText):
(WebKit::WebPage::syncApplyAutocorrection):

Source/WebKitLegacy/mac:

* WebView/WebFrame.mm:
(-[WebFrame setSelectedDOMRange:affinity:closeTyping:]):
(-[WebFrame _replaceSelectionWithFragment:selectReplacement:smartReplace:matchStyle:]):
* WebView/WebView.mm:
(-[WebView setSelectedDOMRange:affinity:]):

Source/WebKitLegacy/win:

* AccessibleTextImpl.cpp:
(AccessibleText::replaceText):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238454 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/Editor.h
Source/WebCore/editing/EditorCommand.cpp
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/editing/FrameSelection.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
Source/WebKit/WebProcess/WebPage/FindController.cpp
Source/WebKit/WebProcess/WebPage/FindController.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebFrame.mm
Source/WebKitLegacy/mac/WebView/WebView.mm
Source/WebKitLegacy/win/AccessibleTextImpl.cpp
Source/WebKitLegacy/win/ChangeLog