Skip to content

Commit

Permalink
Deploy smart pointers in WebEditorClientMac.mm
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=260334

Reviewed by Wenson Hsieh.

* Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
(WebKit::WebEditorClient::uppercaseWord):
(WebKit::WebEditorClient::lowercaseWord):
(WebKit::WebEditorClient::capitalizeWord):
(WebKit::WebEditorClient::substitutionsPanelIsShowing):
(WebKit::WebEditorClient::toggleSmartInsertDelete):
(WebKit::WebEditorClient::isAutomaticQuoteSubstitutionEnabled):
(WebKit::WebEditorClient::toggleAutomaticQuoteSubstitution):
(WebKit::WebEditorClient::toggleAutomaticLinkDetection):
(WebKit::WebEditorClient::toggleAutomaticDashSubstitution):
(WebKit::WebEditorClient::toggleAutomaticTextReplacement):

Canonical link: https://commits.webkit.org/267006@main
  • Loading branch information
rniwa committed Aug 17, 2023
1 parent 1eac3c9 commit a321633
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,21 @@ static void changeWordCase(WebPage* page, NSString *(*changeCase)(NSString *))

void WebEditorClient::uppercaseWord()
{
changeWordCase(m_page.get(), [] (NSString *string) {
changeWordCase(RefPtr { m_page.get() }.get(), [] (NSString *string) {
return [string uppercaseString];
});
}

void WebEditorClient::lowercaseWord()
{
changeWordCase(m_page.get(), [] (NSString *string) {
changeWordCase(RefPtr { m_page.get() }.get(), [] (NSString *string) {
return [string lowercaseString];
});
}

void WebEditorClient::capitalizeWord()
{
changeWordCase(m_page.get(), [] (NSString *string) {
changeWordCase(RefPtr { m_page.get() }.get(), [] (NSString *string) {
return [string capitalizedString];
});
}
Expand All @@ -107,27 +107,27 @@ static void changeWordCase(WebPage* page, NSString *(*changeCase)(NSString *))

bool WebEditorClient::substitutionsPanelIsShowing()
{
auto sendResult = m_page->sendSync(Messages::WebPageProxy::SubstitutionsPanelIsShowing());
auto sendResult = Ref { *m_page }->sendSync(Messages::WebPageProxy::SubstitutionsPanelIsShowing());
auto [isShowing] = sendResult.takeReplyOr(false);
return isShowing;
}

void WebEditorClient::toggleSmartInsertDelete()
{
m_page->send(Messages::WebPageProxy::toggleSmartInsertDelete());
Ref { *m_page }->send(Messages::WebPageProxy::toggleSmartInsertDelete());
}

bool WebEditorClient::isAutomaticQuoteSubstitutionEnabled()
{
if (m_page->isControlledByAutomation())
if (Ref { *m_page }->isControlledByAutomation())
return false;

return WebProcess::singleton().textCheckerState().isAutomaticQuoteSubstitutionEnabled;
}

void WebEditorClient::toggleAutomaticQuoteSubstitution()
{
m_page->send(Messages::WebPageProxy::toggleAutomaticQuoteSubstitution());
Ref { *m_page }->send(Messages::WebPageProxy::toggleAutomaticQuoteSubstitution());
}

bool WebEditorClient::isAutomaticLinkDetectionEnabled()
Expand All @@ -137,7 +137,7 @@ static void changeWordCase(WebPage* page, NSString *(*changeCase)(NSString *))

void WebEditorClient::toggleAutomaticLinkDetection()
{
m_page->send(Messages::WebPageProxy::toggleAutomaticLinkDetection());
Ref { *m_page }->send(Messages::WebPageProxy::toggleAutomaticLinkDetection());
}

bool WebEditorClient::isAutomaticDashSubstitutionEnabled()
Expand All @@ -150,7 +150,7 @@ static void changeWordCase(WebPage* page, NSString *(*changeCase)(NSString *))

void WebEditorClient::toggleAutomaticDashSubstitution()
{
m_page->send(Messages::WebPageProxy::toggleAutomaticDashSubstitution());
Ref { *m_page }->send(Messages::WebPageProxy::toggleAutomaticDashSubstitution());
}

bool WebEditorClient::isAutomaticTextReplacementEnabled()
Expand All @@ -163,7 +163,7 @@ static void changeWordCase(WebPage* page, NSString *(*changeCase)(NSString *))

void WebEditorClient::toggleAutomaticTextReplacement()
{
m_page->send(Messages::WebPageProxy::toggleAutomaticTextReplacement());
Ref { *m_page }->send(Messages::WebPageProxy::toggleAutomaticTextReplacement());
}

bool WebEditorClient::isAutomaticSpellingCorrectionEnabled()
Expand Down

0 comments on commit a321633

Please sign in to comment.