Skip to content

Commit

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

Reviewed by Wenson Hsieh.

Deployed more smart pointers.

* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::getContentsAsAttributedString):
(WebKit::WebPage::updateMockAccessibilityElementAfterCommittingLoad):
(WebKit::WebPage::pdfSnapshotAtSize):
(WebKit::WebPage::getPlatformEditorStateCommon const):
(WebKit::WebPage::getPDFFirstPageSize):
(WebKit::WebPage::readSelectionFromPasteboard):
(WebKit::WebPage::applyLinkDecorationFiltering):

Canonical link: https://commits.webkit.org/266972@main
  • Loading branch information
rniwa committed Aug 17, 2023
1 parent 3991fe0 commit 5575558
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@

void WebPage::getContentsAsAttributedString(CompletionHandler<void(const WebCore::AttributedString&)>&& completionHandler)
{
completionHandler(is<LocalFrame>(m_page->mainFrame()) ? attributedString(makeRangeSelectingNodeContents(*downcast<LocalFrame>(m_page->mainFrame()).document())) : AttributedString());
completionHandler(is<LocalFrame>(m_page->mainFrame()) ? attributedString(makeRangeSelectingNodeContents(Ref { *downcast<LocalFrame>(m_page->mainFrame()).document() })) : AttributedString());
}

void WebPage::setRemoteObjectRegistry(WebRemoteObjectRegistry* registry)
Expand All @@ -386,18 +386,18 @@

void WebPage::updateMockAccessibilityElementAfterCommittingLoad()
{
auto* mainFrame = dynamicDowncast<WebCore::LocalFrame>(this->mainFrame());
auto* document = mainFrame ? mainFrame->document() : nullptr;
RefPtr mainFrame = dynamicDowncast<WebCore::LocalFrame>(this->mainFrame());
RefPtr document = mainFrame ? mainFrame->document() : nullptr;
[m_mockAccessibilityElement setHasMainFramePlugin:document ? document->isPluginDocument() : false];
}

RetainPtr<CFDataRef> WebPage::pdfSnapshotAtSize(IntRect rect, IntSize bitmapSize, SnapshotOptions options)
{
auto* coreFrame = m_mainFrame->coreLocalFrame();
RefPtr coreFrame = m_mainFrame->coreLocalFrame();
if (!coreFrame)
return nullptr;

auto* frameView = coreFrame->view();
RefPtr frameView = coreFrame->view();
if (!frameView)
return nullptr;

Expand Down Expand Up @@ -523,7 +523,7 @@
}
}

if (auto* enclosingListElement = enclosingList(selection.start().containerNode())) {
if (RefPtr enclosingListElement = enclosingList(selection.start().containerNode())) {
if (is<HTMLUListElement>(*enclosingListElement))
postLayoutData.enclosingListType = ListType::UnorderedList;
else if (is<HTMLOListElement>(*enclosingListElement))
Expand All @@ -549,7 +549,7 @@
#if !ENABLE(PDFKIT_PLUGIN)
return completionHandler({ });
#else
auto* webFrame = WebProcess::singleton().webFrame(frameID);
RefPtr webFrame = WebProcess::singleton().webFrame(frameID);
if (!webFrame)
return completionHandler({ });

Expand Down Expand Up @@ -674,10 +674,10 @@

void WebPage::readSelectionFromPasteboard(const String& pasteboardName, CompletionHandler<void(bool&&)>&& completionHandler)
{
auto& frame = m_page->focusController().focusedOrMainFrame();
if (frame.selection().isNone())
Ref frame = m_page->focusController().focusedOrMainFrame();
if (frame->selection().isNone())
return completionHandler(false);
frame.editor().readSelectionFromPasteboard(pasteboardName);
frame->editor().readSelectionFromPasteboard(pasteboardName);
completionHandler(true);
}

Expand All @@ -701,13 +701,13 @@
};

bool shouldApplyLinkDecorationFiltering = [&] {
if (isLinkDecorationFilteringEnabled(mainFrame->loader().documentLoader()))
if (isLinkDecorationFilteringEnabled(RefPtr { mainFrame->loader().documentLoader() }.get()))
return true;

if (isLinkDecorationFilteringEnabled(mainFrame->loader().provisionalDocumentLoader()))
if (isLinkDecorationFilteringEnabled(RefPtr { mainFrame->loader().provisionalDocumentLoader() }.get()))
return true;

return isLinkDecorationFilteringEnabled(mainFrame->loader().policyDocumentLoader());
return isLinkDecorationFilteringEnabled(RefPtr { mainFrame->loader().policyDocumentLoader() }.get());
}();

if (!shouldApplyLinkDecorationFiltering)
Expand Down

0 comments on commit 5575558

Please sign in to comment.