Changeset 238454 in webkit
- Timestamp:
- Nov 22, 2018 7:10:34 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r238452 r238454 1 2018-11-22 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Address post-review feedback after r238438 4 https://bugs.webkit.org/show_bug.cgi?id=191913 5 6 Reviewed by Ryosuke Niwa. 7 8 Replace `bool` arguments to `FrameSelection::setSelectedRange`, `Editor::replaceSelectionWithText`, and 9 `Editor::replaceSelectionWithFragment` with `enum class`es instead. In particular, introduce the following: 10 11 FrameSelection::ShouldCloseTyping { No, Yes } 12 Editor::SelectReplacement { No, Yes } 13 Editor::SmartReplace { No, Yes } 14 Editor::MatchStyle { No, Yes } 15 16 * accessibility/AccessibilityObject.cpp: 17 (WebCore::AccessibilityObject::selectText): 18 * editing/Editor.cpp: 19 (WebCore::Editor::handleTextEvent): 20 (WebCore::Editor::replaceSelectionWithFragment): 21 (WebCore::Editor::replaceSelectionWithText): 22 (WebCore::Editor::setComposition): 23 (WebCore::Editor::markMisspellingsAfterTypingToWord): 24 (WebCore::Editor::changeBackToReplacedString): 25 (WebCore::Editor::transpose): 26 (WebCore::Editor::insertAttachment): 27 28 At various call sites, replace boolean arguments with named enums. 29 30 * editing/Editor.h: 31 * editing/EditorCommand.cpp: 32 (WebCore::expandSelectionToGranularity): 33 (WebCore::executeDeleteToMark): 34 (WebCore::executeSelectToMark): 35 * editing/FrameSelection.cpp: 36 (WebCore::FrameSelection::setSelectedRange): 37 * editing/FrameSelection.h: 38 * page/Page.cpp: 39 (WebCore::replaceRanges): 40 41 Avoid a bit of ref-count churn, and adjust a few functions to take `const Vector&`s instead of `Vector&&`s. 42 43 (WebCore::Page::replaceRangesWithText): 44 (WebCore::Page::replaceSelectionWithText): 45 * page/Page.h: 46 1 47 2018-11-21 Ryosuke Niwa <rniwa@webkit.org> 2 48 -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r237266 r238454 839 839 String closestString = closestStringRange->text(); 840 840 bool replaceSelection = false; 841 if (frame->selection().setSelectedRange(closestStringRange.get(), DOWNSTREAM, true)) {841 if (frame->selection().setSelectedRange(closestStringRange.get(), DOWNSTREAM, FrameSelection::ShouldCloseTyping::Yes)) { 842 842 switch (activity) { 843 843 case AccessibilitySelectTextActivity::FindAndCapitalize: … … 872 872 // return the replacement string when replacing, but the selected string if not. 873 873 if (replaceSelection) { 874 frame->editor().replaceSelectionWithText(replacementString, true, true);874 frame->editor().replaceSelectionWithText(replacementString, Editor::SelectReplacement::Yes, Editor::SmartReplace::Yes); 875 875 return replacementString; 876 876 } -
trunk/Source/WebCore/editing/Editor.cpp
r238440 r238454 311 311 return true; 312 312 #endif 313 replaceSelectionWithFragment(*event.pastingFragment(), false, event.shouldSmartReplace(), event.shouldMatchStyle(), EditAction::Paste, event.mailBlockquoteHandling());313 replaceSelectionWithFragment(*event.pastingFragment(), SelectReplacement::No, event.shouldSmartReplace() ? SmartReplace::Yes : SmartReplace::No, event.shouldMatchStyle() ? MatchStyle::Yes : MatchStyle::No, EditAction::Paste, event.mailBlockquoteHandling()); 314 314 } else 315 replaceSelectionWithText(event.data(), false, event.shouldSmartReplace(), EditAction::Paste);315 replaceSelectionWithText(event.data(), SelectReplacement::No, event.shouldSmartReplace() ? SmartReplace::Yes : SmartReplace::No, EditAction::Paste); 316 316 return true; 317 317 } … … 640 640 } 641 641 642 void Editor::replaceSelectionWithFragment(DocumentFragment& fragment, bool selectReplacement, bool smartReplace, boolmatchStyle, EditAction editingAction, MailBlockquoteHandling mailBlockquoteHandling)642 void Editor::replaceSelectionWithFragment(DocumentFragment& fragment, SelectReplacement selectReplacement, SmartReplace smartReplace, MatchStyle matchStyle, EditAction editingAction, MailBlockquoteHandling mailBlockquoteHandling) 643 643 { 644 644 VisibleSelection selection = m_frame.selection().selection(); … … 651 651 652 652 OptionSet<ReplaceSelectionCommand::CommandOption> options { ReplaceSelectionCommand::PreventNesting, ReplaceSelectionCommand::SanitizeFragment }; 653 if (selectReplacement )653 if (selectReplacement == SelectReplacement::Yes) 654 654 options.add(ReplaceSelectionCommand::SelectReplacement); 655 if (smartReplace )655 if (smartReplace == SmartReplace::Yes) 656 656 options.add(ReplaceSelectionCommand::SmartReplace); 657 if (matchStyle )657 if (matchStyle == MatchStyle::Yes) 658 658 options.add(ReplaceSelectionCommand::MatchStyle); 659 659 if (mailBlockquoteHandling == MailBlockquoteHandling::IgnoreBlockquote) … … 686 686 } 687 687 688 void Editor::replaceSelectionWithText(const String& text, bool selectReplacement, boolsmartReplace, EditAction editingAction)688 void Editor::replaceSelectionWithText(const String& text, SelectReplacement selectReplacement, SmartReplace smartReplace, EditAction editingAction) 689 689 { 690 690 RefPtr<Range> range = selectedRange(); … … 692 692 return; 693 693 694 replaceSelectionWithFragment(createFragmentFromText(*range, text), selectReplacement, smartReplace, true, editingAction);694 replaceSelectionWithFragment(createFragmentFromText(*range, text), selectReplacement, smartReplace, MatchStyle::Yes, editingAction); 695 695 } 696 696 … … 2024 2024 unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOffset); 2025 2025 RefPtr<Range> selectedRange = Range::create(baseNode->document(), baseNode, start, baseNode, end); 2026 m_frame.selection().setSelectedRange(selectedRange.get(), DOWNSTREAM, false);2026 m_frame.selection().setSelectedRange(selectedRange.get(), DOWNSTREAM, FrameSelection::ShouldCloseTyping::No); 2027 2027 } 2028 2028 } … … 2518 2518 if (!m_frame.editor().shouldInsertText(autocorrectedString, misspellingRange.get(), EditorInsertAction::Typed)) 2519 2519 return; 2520 m_frame.editor().replaceSelectionWithText(autocorrectedString, false, false, EditAction::Insert);2520 m_frame.editor().replaceSelectionWithText(autocorrectedString, SelectReplacement::No, SmartReplace::No, EditAction::Insert); 2521 2521 2522 2522 // Reset the charet one character further. … … 2876 2876 m_alternativeTextController->recordAutocorrectionResponse(AutocorrectionResponse::Reverted, replacedString, selection.get()); 2877 2877 TextCheckingParagraph paragraph(*selection); 2878 replaceSelectionWithText(replacedString, false, false, EditAction::Insert);2878 replaceSelectionWithText(replacedString, SelectReplacement::No, SmartReplace::No, EditAction::Insert); 2879 2879 auto changedRange = paragraph.subrange(paragraph.checkingStart(), replacedString.length()); 2880 2880 changedRange->startContainer().document().markers().addMarker(changedRange.ptr(), DocumentMarker::Replacement, String()); … … 3122 3122 if (!shouldInsertText(transposed, range.get(), EditorInsertAction::Typed)) 3123 3123 return; 3124 replaceSelectionWithText(transposed, false, false, EditAction::Insert);3124 replaceSelectionWithText(transposed, SelectReplacement::No, SmartReplace::No, EditAction::Insert); 3125 3125 } 3126 3126 … … 4099 4099 fragmentToInsert->appendChild(attachment.get()); 4100 4100 4101 replaceSelectionWithFragment(fragmentToInsert.get(), false, false, true);4101 replaceSelectionWithFragment(fragmentToInsert.get(), SelectReplacement::No, SmartReplace::No, MatchStyle::Yes); 4102 4102 } 4103 4103 -
trunk/Source/WebCore/editing/Editor.h
r238440 r238454 439 439 WEBCORE_EXPORT WritingDirection baseWritingDirectionForSelectionStart() const; 440 440 441 WEBCORE_EXPORT void replaceSelectionWithFragment(DocumentFragment&, bool selectReplacement, bool smartReplace, bool matchStyle, EditAction = EditAction::Insert, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote); 442 WEBCORE_EXPORT void replaceSelectionWithText(const String&, bool selectReplacement, bool smartReplace, EditAction = EditAction::Insert); 441 enum class SelectReplacement : bool { No, Yes }; 442 enum class SmartReplace : bool { No, Yes }; 443 enum class MatchStyle : bool { No, Yes }; 444 WEBCORE_EXPORT void replaceSelectionWithFragment(DocumentFragment&, SelectReplacement, SmartReplace, MatchStyle, EditAction = EditAction::Insert, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote); 445 WEBCORE_EXPORT void replaceSelectionWithText(const String&, SelectReplacement, SmartReplace, EditAction = EditAction::Insert); 443 446 WEBCORE_EXPORT bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, int from, int length) const; 444 447 void updateMarkersForWordsAffectedByEditing(bool onlyHandleWordsContainingSelection); -
trunk/Source/WebCore/editing/EditorCommand.cpp
r237976 r238454 186 186 if (!frame.editor().client()->shouldChangeSelectedRange(oldRange.get(), newRange.get(), affinity, false)) 187 187 return false; 188 frame.selection().setSelectedRange(newRange.get(), affinity, true);188 frame.selection().setSelectedRange(newRange.get(), affinity, FrameSelection::ShouldCloseTyping::Yes); 189 189 return true; 190 190 } … … 356 356 FrameSelection& selection = frame.selection(); 357 357 if (mark && frame.editor().selectedRange()) { 358 bool selected = selection.setSelectedRange(unionDOMRanges(*mark, *frame.editor().selectedRange()).get(), DOWNSTREAM, true);358 bool selected = selection.setSelectedRange(unionDOMRanges(*mark, *frame.editor().selectedRange()).get(), DOWNSTREAM, FrameSelection::ShouldCloseTyping::Yes); 359 359 ASSERT(selected); 360 360 if (!selected) … … 1031 1031 return false; 1032 1032 } 1033 frame.selection().setSelectedRange(unionDOMRanges(*mark, *selection).get(), DOWNSTREAM, true);1033 frame.selection().setSelectedRange(unionDOMRanges(*mark, *selection).get(), DOWNSTREAM, FrameSelection::ShouldCloseTyping::Yes); 1034 1034 return true; 1035 1035 } -
trunk/Source/WebCore/editing/FrameSelection.cpp
r238359 r238454 1980 1980 } 1981 1981 1982 bool FrameSelection::setSelectedRange(Range* range, EAffinity affinity, boolcloseTyping, EUserTriggered userTriggered)1982 bool FrameSelection::setSelectedRange(Range* range, EAffinity affinity, ShouldCloseTyping closeTyping, EUserTriggered userTriggered) 1983 1983 { 1984 1984 if (!range) … … 1995 1995 1996 1996 OptionSet<SetSelectionOption> selectionOptions { ClearTypingStyle }; 1997 if (closeTyping )1997 if (closeTyping == ShouldCloseTyping::Yes) 1998 1998 selectionOptions.add(CloseTyping); 1999 1999 -
trunk/Source/WebCore/editing/FrameSelection.h
r237266 r238454 151 151 const VisibleSelection& selection() const { return m_selection; } 152 152 WEBCORE_EXPORT void setSelection(const VisibleSelection&, OptionSet<SetSelectionOption> = defaultSetSelectionOptions(), AXTextStateChangeIntent = AXTextStateChangeIntent(), CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGranularity = CharacterGranularity); 153 WEBCORE_EXPORT bool setSelectedRange(Range*, EAffinity, bool closeTyping, EUserTriggered = NotUserTriggered); 153 154 enum class ShouldCloseTyping : bool { No, Yes }; 155 WEBCORE_EXPORT bool setSelectedRange(Range*, EAffinity, ShouldCloseTyping, EUserTriggered = NotUserTriggered); 154 156 WEBCORE_EXPORT void selectAll(); 155 157 WEBCORE_EXPORT void clear(); -
trunk/Source/WebCore/page/Page.cpp
r238438 r238454 773 773 }; 774 774 775 static void replaceRanges(Page& page, Vector<FindReplacementRange>&& ranges, const String& replacementText)775 static void replaceRanges(Page& page, const Vector<FindReplacementRange>& ranges, const String& replacementText) 776 776 { 777 777 HashMap<RefPtr<ContainerNode>, Vector<FindReplacementRange>> rangesByContainerNode; … … 820 820 }); 821 821 822 for (auto container : containerNodesInOrderOfReplacement) {822 for (auto& container : containerNodesInOrderOfReplacement) { 823 823 auto frame = makeRefPtr(container->document().frame()); 824 824 if (!frame) … … 832 832 continue; 833 833 834 frame->selection().setSelectedRange(range.get(), DOWNSTREAM, true);835 frame->editor().replaceSelectionWithText(replacementText, true, false, EditAction::InsertReplacement);834 frame->selection().setSelectedRange(range.get(), DOWNSTREAM, FrameSelection::ShouldCloseTyping::Yes); 835 frame->editor().replaceSelectionWithText(replacementText, Editor::SelectReplacement::Yes, Editor::SmartReplace::No, EditAction::InsertReplacement); 836 836 } 837 837 } 838 838 } 839 839 840 uint32_t Page::replaceRangesWithText( Vector<Ref<Range>>&& rangesToReplace, const String& replacementText, bool selectionOnly)840 uint32_t Page::replaceRangesWithText(const Vector<Ref<Range>>& rangesToReplace, const String& replacementText, bool selectionOnly) 841 841 { 842 842 // FIXME: In the future, we should respect the `selectionOnly` flag by checking whether each range being replaced is … … 867 867 } 868 868 869 replaceRanges(*this, WTFMove(replacementRanges), replacementText);869 replaceRanges(*this, replacementRanges, replacementText); 870 870 return rangesToReplace.size(); 871 871 } … … 879 879 880 880 auto editAction = selection.isRange() ? EditAction::InsertReplacement : EditAction::Insert; 881 frame->editor().replaceSelectionWithText(replacementText, true, false, editAction);881 frame->editor().replaceSelectionWithText(replacementText, Editor::SelectReplacement::Yes, Editor::SmartReplace::No, editAction); 882 882 return 1; 883 883 } -
trunk/Source/WebCore/page/Page.h
r238438 r238454 279 279 280 280 WEBCORE_EXPORT bool findString(const String&, FindOptions, DidWrap* = nullptr); 281 WEBCORE_EXPORT uint32_t replaceRangesWithText( Vector<Ref<Range>>&& rangesToReplace, const String& replacementText, bool selectionOnly);281 WEBCORE_EXPORT uint32_t replaceRangesWithText(const Vector<Ref<Range>>& rangesToReplace, const String& replacementText, bool selectionOnly); 282 282 WEBCORE_EXPORT uint32_t replaceSelectionWithText(const String& replacementText); 283 283 -
trunk/Source/WebKit/ChangeLog
r238446 r238454 1 2018-11-22 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Address post-review feedback after r238438 4 https://bugs.webkit.org/show_bug.cgi?id=191913 5 6 Reviewed by Ryosuke Niwa. 7 8 Replace boolean arguments to setSelectedRange, replaceSelectionWithText and replaceSelectionWithFragment with 9 enum flags, and tweak a couple of functions to take `const Vector&` instead of `Vector&&`. 10 11 * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: 12 (WKBundlePageReplaceStringMatches): 13 * WebProcess/WebPage/FindController.cpp: 14 (WebKit::FindController::replaceMatches): 15 * WebProcess/WebPage/FindController.h: 16 * WebProcess/WebPage/WebPage.cpp: 17 (WebKit::WebPage::replaceStringMatchesFromInjectedBundle): 18 (WebKit::WebPage::replaceMatches): 19 (WebKit::WebPage::replaceSelectionWithText): 20 * WebProcess/WebPage/WebPage.h: 21 * WebProcess/WebPage/ios/WebPageIOS.mm: 22 (WebKit::WebPage::selectWithGesture): 23 (WebKit::WebPage::updateSelectionWithTouches): 24 (WebKit::WebPage::selectWithTwoTouches): 25 (WebKit::WebPage::extendSelection): 26 (WebKit::WebPage::selectWordBackward): 27 (WebKit::WebPage::moveSelectionByOffset): 28 (WebKit::WebPage::selectPositionAtPoint): 29 (WebKit::WebPage::selectPositionAtBoundaryWithDirection): 30 (WebKit::WebPage::moveSelectionAtBoundaryWithDirection): 31 (WebKit::WebPage::selectTextWithGranularityAtPoint): 32 (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary): 33 (WebKit::WebPage::updateSelectionWithExtentPoint): 34 (WebKit::WebPage::replaceSelectedText): 35 (WebKit::WebPage::replaceDictatedText): 36 (WebKit::WebPage::syncApplyAutocorrection): 37 1 38 2018-11-22 Mark Lam <mark.lam@apple.com> 2 39 -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
r238438 r238454 462 462 indices.reserveInitialCapacity(matchIndices->size()); 463 463 464 for (size_t arrayIndex = 0; arrayIndex < matchIndices->size(); ++arrayIndex) { 465 if (auto* indexAsObject = matchIndices->at<API::UInt64>(arrayIndex)) 464 auto numberOfMatchIndices = matchIndices->size(); 465 for (size_t i = 0; i < numberOfMatchIndices; ++i) { 466 if (auto* indexAsObject = matchIndices->at<API::UInt64>(i)) 466 467 indices.uncheckedAppend(indexAsObject->value()); 467 468 } 468 toImpl(pageRef)->replaceStringMatchesFromInjectedBundle( WTFMove(indices), toWTFString(replacementText), selectionOnly);469 toImpl(pageRef)->replaceStringMatchesFromInjectedBundle(indices, toWTFString(replacementText), selectionOnly); 469 470 } 470 471 -
trunk/Source/WebKit/WebProcess/WebPage/FindController.cpp
r238438 r238454 100 100 } 101 101 102 uint32_t FindController::replaceMatches( Vector<uint32_t>&& matchIndices, const String& replacementText, bool selectionOnly)102 uint32_t FindController::replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly) 103 103 { 104 104 if (matchIndices.isEmpty()) … … 118 118 break; 119 119 } 120 return m_webPage->corePage()->replaceRangesWithText( WTFMove(rangesToReplace), replacementText, selectionOnly);120 return m_webPage->corePage()->replaceRangesWithText(rangesToReplace, replacementText, selectionOnly); 121 121 } 122 122 -
trunk/Source/WebKit/WebProcess/WebPage/FindController.h
r238438 r238454 62 62 void hideFindUI(); 63 63 void countStringMatches(const String&, FindOptions, unsigned maxMatchCount); 64 uint32_t replaceMatches( Vector<uint32_t>&& matchIndices, const String& replacementText, bool selectionOnly);64 uint32_t replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly); 65 65 66 66 void hideFindIndicator(); -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r238438 r238454 3797 3797 } 3798 3798 3799 void WebPage::replaceStringMatchesFromInjectedBundle( Vector<uint32_t>&& matchIndices, const String& replacementText, bool selectionOnly)3800 { 3801 findController().replaceMatches( WTFMove(matchIndices), replacementText, selectionOnly);3799 void WebPage::replaceStringMatchesFromInjectedBundle(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly) 3800 { 3801 findController().replaceMatches(matchIndices, replacementText, selectionOnly); 3802 3802 } 3803 3803 … … 3832 3832 } 3833 3833 3834 void WebPage::replaceMatches( Vector<uint32_t>&& matchIndices, const String& replacementText, bool selectionOnly, CallbackID callbackID)3835 { 3836 auto numberOfReplacements = findController().replaceMatches( WTFMove(matchIndices), replacementText, selectionOnly);3834 void WebPage::replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CallbackID callbackID) 3835 { 3836 auto numberOfReplacements = findController().replaceMatches(matchIndices, replacementText, selectionOnly); 3837 3837 send(Messages::WebPageProxy::UnsignedCallback(numberOfReplacements, callbackID)); 3838 3838 } … … 4037 4037 void WebPage::replaceSelectionWithText(Frame* frame, const String& text) 4038 4038 { 4039 bool selectReplacement = true; 4040 bool smartReplace = false; 4041 return frame->editor().replaceSelectionWithText(text, selectReplacement, smartReplace); 4039 return frame->editor().replaceSelectionWithText(text, WebCore::Editor::SelectReplacement::Yes, WebCore::Editor::SmartReplace::No); 4042 4040 } 4043 4041 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r238438 r238454 410 410 bool findStringFromInjectedBundle(const String&, FindOptions); 411 411 void findStringMatchesFromInjectedBundle(const String&, FindOptions); 412 void replaceStringMatchesFromInjectedBundle( Vector<uint32_t>&& matchIndices, const String& replacementText, bool selectionOnly);412 void replaceStringMatchesFromInjectedBundle(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly); 413 413 414 414 WebFrame* mainWebFrame() const { return m_mainFrame.get(); } … … 1307 1307 void hideFindUI(); 1308 1308 void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount); 1309 void replaceMatches( Vector<uint32_t>&& matchIndices, const String& replacementText, bool selectionOnly, CallbackID);1309 void replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CallbackID); 1310 1310 1311 1311 #if USE(COORDINATED_GRAPHICS) -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r238146 r238454 1215 1215 } 1216 1216 if (range) 1217 frame.selection().setSelectedRange(range.get(), position.affinity(), true, UserTriggered);1217 frame.selection().setSelectedRange(range.get(), position.affinity(), WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 1218 1218 1219 1219 send(Messages::WebPageProxy::GestureCallback(point, gestureType, gestureState, static_cast<uint32_t>(flags), callbackID)); … … 1365 1365 } 1366 1366 if (range) 1367 frame.selection().setSelectedRange(range.get(), position.affinity(), true, UserTriggered);1367 frame.selection().setSelectedRange(range.get(), position.affinity(), WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 1368 1368 1369 1369 send(Messages::WebPageProxy::TouchesCallback(point, touches, flags, callbackID)); … … 1381 1381 else 1382 1382 range = Range::create(*frame.document(), toPosition, fromPosition); 1383 frame.selection().setSelectedRange(range.get(), fromPosition.affinity(), true, UserTriggered);1383 frame.selection().setSelectedRange(range.get(), fromPosition.affinity(), WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 1384 1384 } 1385 1385 … … 1396 1396 1397 1397 VisiblePosition position = frame.selection().selection().start(); 1398 frame.selection().setSelectedRange(wordRangeFromPosition(position).get(), position.affinity(), true, UserTriggered);1398 frame.selection().setSelectedRange(wordRangeFromPosition(position).get(), position.affinity(), WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 1399 1399 } 1400 1400 … … 1408 1408 VisiblePosition startPosition = positionOfNextBoundaryOfGranularity(position, WordGranularity, DirectionBackward); 1409 1409 if (startPosition.isNotNull() && startPosition != position) 1410 frame.selection().setSelectedRange(Range::create(*frame.document(), startPosition, position).ptr(), position.affinity(), true, UserTriggered);1410 frame.selection().setSelectedRange(Range::create(*frame.document(), startPosition, position).ptr(), position.affinity(), WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 1411 1411 } 1412 1412 … … 1426 1426 } 1427 1427 if (position.isNotNull() && startPosition != position) 1428 frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), position.affinity(), true, UserTriggered);1428 frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), position.affinity(), WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 1429 1429 send(Messages::WebPageProxy::VoidCallback(callbackID)); 1430 1430 } … … 1546 1546 1547 1547 if (position.isNotNull()) 1548 frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), position.affinity(), true, UserTriggered);1548 frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), position.affinity(), WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 1549 1549 send(Messages::WebPageProxy::VoidCallback(callbackID)); 1550 1550 } … … 1558 1558 position = positionOfNextBoundaryOfGranularity(position, static_cast<WebCore::TextGranularity>(granularity), static_cast<SelectionDirection>(direction)); 1559 1559 if (position.isNotNull()) 1560 frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), UPSTREAM, true, UserTriggered);1560 frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), UPSTREAM, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 1561 1561 } 1562 1562 send(Messages::WebPageProxy::VoidCallback(callbackID)); … … 1572 1572 position = positionOfNextBoundaryOfGranularity(position, static_cast<WebCore::TextGranularity>(granularity), static_cast<SelectionDirection>(direction)); 1573 1573 if (position.isNotNull()) 1574 frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), isForward? UPSTREAM : DOWNSTREAM, true, UserTriggered);1574 frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), isForward? UPSTREAM : DOWNSTREAM, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 1575 1575 } 1576 1576 send(Messages::WebPageProxy::VoidCallback(callbackID)); … … 1629 1629 1630 1630 if (range) 1631 frame.selection().setSelectedRange(range.get(), UPSTREAM, true, UserTriggered);1631 frame.selection().setSelectedRange(range.get(), UPSTREAM, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 1632 1632 m_initialSelection = range; 1633 1633 send(Messages::WebPageProxy::VoidCallback(callbackID)); … … 1664 1664 1665 1665 if (range) 1666 frame.selection().setSelectedRange(range.get(), UPSTREAM, true, UserTriggered);1666 frame.selection().setSelectedRange(range.get(), UPSTREAM, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 1667 1667 1668 1668 send(Messages::WebPageProxy::UnsignedCallback(selectionStart == m_initialSelection->startPosition(), callbackID)); … … 1707 1707 1708 1708 if (range) 1709 frame.selection().setSelectedRange(range.get(), UPSTREAM, true, UserTriggered);1709 frame.selection().setSelectedRange(range.get(), UPSTREAM, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 1710 1710 1711 1711 send(Messages::WebPageProxy::UnsignedCallback(m_selectionAnchor == Start, callbackID)); … … 1770 1770 1771 1771 frame.editor().setIgnoreSelectionChanges(true); 1772 frame.selection().setSelectedRange(wordRange.get(), UPSTREAM, true);1772 frame.selection().setSelectedRange(wordRange.get(), UPSTREAM, WebCore::FrameSelection::ShouldCloseTyping::Yes); 1773 1773 frame.editor().insertText(newText, 0); 1774 1774 frame.editor().setIgnoreSelectionChanges(false); … … 1797 1797 // We don't want to notify the client that the selection has changed until we are done inserting the new text. 1798 1798 frame.editor().setIgnoreSelectionChanges(true); 1799 frame.selection().setSelectedRange(range.get(), UPSTREAM, true);1799 frame.selection().setSelectedRange(range.get(), UPSTREAM, WebCore::FrameSelection::ShouldCloseTyping::Yes); 1800 1800 frame.editor().insertText(newText, 0); 1801 1801 frame.editor().setIgnoreSelectionChanges(false); … … 1931 1931 affinity = VisiblePosition(range->startPosition(), UPSTREAM).affinity(); 1932 1932 1933 frame.selection().setSelectedRange(range.get(), affinity, true);1933 frame.selection().setSelectedRange(range.get(), affinity, WebCore::FrameSelection::ShouldCloseTyping::Yes); 1934 1934 if (correction.length()) 1935 1935 frame.editor().insertText(correction, 0, originalText.isEmpty() ? TextEventInputKeyboard : TextEventInputAutocompletion); -
trunk/Source/WebKitLegacy/mac/ChangeLog
r238378 r238454 1 2018-11-22 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Address post-review feedback after r238438 4 https://bugs.webkit.org/show_bug.cgi?id=191913 5 6 Reviewed by Ryosuke Niwa. 7 8 * WebView/WebFrame.mm: 9 (-[WebFrame setSelectedDOMRange:affinity:closeTyping:]): 10 (-[WebFrame _replaceSelectionWithFragment:selectReplacement:smartReplace:matchStyle:]): 11 * WebView/WebView.mm: 12 (-[WebView setSelectedDOMRange:affinity:]): 13 1 14 2018-11-19 Joseph Pecoraro <pecoraro@apple.com> 2 15 -
trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm
r237266 r238454 1483 1483 } 1484 1484 1485 frame->selection().setSelectedRange(core(range), (EAffinity)affinity, closeTyping );1485 frame->selection().setSelectedRange(core(range), (EAffinity)affinity, closeTyping ? FrameSelection::ShouldCloseTyping::Yes : FrameSelection::ShouldCloseTyping::No); 1486 1486 if (!closeTyping) 1487 1487 frame->editor().ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping(); … … 1953 1953 if (_private->coreFrame->selection().isNone() || !fragment) 1954 1954 return; 1955 _private->coreFrame->editor().replaceSelectionWithFragment(*core(fragment), selectReplacement , smartReplace, matchStyle);1955 _private->coreFrame->editor().replaceSelectionWithFragment(*core(fragment), selectReplacement ? Editor::SelectReplacement::Yes : Editor::SelectReplacement::No, smartReplace ? Editor::SmartReplace::Yes : Editor::SmartReplace::No, matchStyle ? Editor::MatchStyle::Yes : Editor::MatchStyle::No); 1956 1956 } 1957 1957 -
trunk/Source/WebKitLegacy/mac/WebView/WebView.mm
r238262 r238454 8352 8352 return; 8353 8353 8354 coreFrame->selection().setSelectedRange(core(range), core(selectionAffinity), true);8354 coreFrame->selection().setSelectedRange(core(range), core(selectionAffinity), WebCore::FrameSelection::ShouldCloseTyping::Yes); 8355 8355 } 8356 8356 } -
trunk/Source/WebKitLegacy/win/AccessibleTextImpl.cpp
r213355 r238454 657 657 addSelection(startOffset, endOffset); 658 658 659 frame->editor().replaceSelectionWithText(*text, true, false);659 frame->editor().replaceSelectionWithText(*text, Editor::SelectReplacement::Yes, Editor::SmartReplace::No); 660 660 return S_OK; 661 661 } -
trunk/Source/WebKitLegacy/win/ChangeLog
r238378 r238454 1 2018-11-22 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Address post-review feedback after r238438 4 https://bugs.webkit.org/show_bug.cgi?id=191913 5 6 Reviewed by Ryosuke Niwa. 7 8 * AccessibleTextImpl.cpp: 9 (AccessibleText::replaceText): 10 1 11 2018-11-19 Joseph Pecoraro <pecoraro@apple.com> 2 12
Note: See TracChangeset
for help on using the changeset viewer.