Skip to content
Permalink
Browse files
Purge PassRefPtr from Frame.
<https://webkit.org/b/139731>

Reviewed by Anders Carlsson.

Source/WebCore:

Remove all use of PassRefPtr from the Frame class, instead using
Ref or RefPtr as appropriate.

* WebCore.exp.in:
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::begin):
* page/Frame.cpp:
(WebCore::Frame::create):
(WebCore::Frame::setView):
(WebCore::Frame::setDocument):
(WebCore::Frame::rangeForPoint):
(WebCore::Frame::createView):
* page/Frame.h:
* xml/XSLTProcessor.cpp:
(WebCore::XSLTProcessor::createDocumentFromSource):

Source/WebKit/mac:

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::transitionToCommittedForNewPage):
* WebView/WebFrame.mm:
(+[WebFrame _createFrameWithPage:frameName:frameView:ownerElement:]):
(+[WebFrame _createSubframeWithOwnerElement:frameName:frameView:]):
* WebView/WebFrameInternal.h:

Source/WebKit2:

* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::createSubframe):


Canonical link: https://commits.webkit.org/157642@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@177450 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Andreas Kling committed Dec 17, 2014
1 parent 3797b69 commit c445aa60d6453c732b9138a62e97d8328a71481c
@@ -1,3 +1,26 @@
2014-12-17 Andreas Kling <akling@apple.com>

Purge PassRefPtr from Frame.
<https://webkit.org/b/139731>

Reviewed by Anders Carlsson.

Remove all use of PassRefPtr from the Frame class, instead using
Ref or RefPtr as appropriate.

* WebCore.exp.in:
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::begin):
* page/Frame.cpp:
(WebCore::Frame::create):
(WebCore::Frame::setView):
(WebCore::Frame::setDocument):
(WebCore::Frame::rangeForPoint):
(WebCore::Frame::createView):
* page/Frame.h:
* xml/XSLTProcessor.cpp:
(WebCore::XSLTProcessor::createDocumentFromSource):

2014-12-17 Myles C. Maxfield <mmaxfield@apple.com>

Test fix after r177444.
@@ -1216,7 +1216,7 @@ __ZN7WebCore5Frame24searchForLabelsAboveCellERKN3JSC4Yarr17RegularExpressionEPNS
__ZN7WebCore5Frame25setPageAndTextZoomFactorsEff
__ZN7WebCore5Frame27resizePageRectsKeepingRatioERKNS_9FloatSizeES3_
__ZN7WebCore5Frame6createEPNS_4PageEPNS_21HTMLFrameOwnerElementEPNS_17FrameLoaderClientE
__ZN7WebCore5Frame7setViewEN3WTF10PassRefPtrINS_9FrameViewEEE
__ZN7WebCore5Frame7setViewEON3WTF6RefPtrINS_9FrameViewEEE
__ZN7WebCore5FrameD1Ev
__ZN7WebCore5Image12supportsTypeERKN3WTF6StringE
__ZN7WebCore5Image20loadPlatformResourceEPKc
@@ -144,7 +144,7 @@ void DocumentWriter::begin(const URL& urlReference, bool dispatch, Document* own
m_frame->script().updatePlatformScriptObjects();

m_frame->loader().setOutgoingReferrer(url);
m_frame->setDocument(document);
m_frame->setDocument(document.copyRef());

if (m_decoder)
document->setDecoder(m_decoder.get());
@@ -204,11 +204,11 @@ Frame::Frame(Page& page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient&
#endif
}

PassRefPtr<Frame> Frame::create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* client)
Ref<Frame> Frame::create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* client)
{
ASSERT(page);
ASSERT(client);
return adoptRef(new Frame(*page, ownerElement, *client));
return adoptRef(*new Frame(*page, ownerElement, *client));
}

Frame::~Frame()
@@ -241,7 +241,7 @@ void Frame::removeDestructionObserver(FrameDestructionObserver* observer)
m_destructionObservers.remove(observer);
}

void Frame::setView(PassRefPtr<FrameView> view)
void Frame::setView(RefPtr<FrameView>&& view)
{
// We the custom scroll bars as early as possible to prevent m_doc->detach()
// from messing with the view such that its scroll bars won't be torn down.
@@ -260,22 +260,22 @@ void Frame::setView(PassRefPtr<FrameView> view)

eventHandler().clear();

m_view = view;
m_view = WTF::move(view);

// Only one form submission is allowed per view of a part.
// Since this part may be getting reused as a result of being
// pulled from the back/forward cache, reset this flag.
loader().resetMultipleFormSubmissionProtection();
}

void Frame::setDocument(PassRefPtr<Document> newDocument)
void Frame::setDocument(RefPtr<Document>&& newDocument)
{
ASSERT(!newDocument || newDocument->frame() == this);

if (m_doc && !m_doc->inPageCache())
m_doc->prepareForDestruction();

m_doc = newDocument.get();
m_doc = newDocument.copyRef();
ASSERT(!m_doc || m_doc->domWindow());
ASSERT(!m_doc || m_doc->domWindow()->frame() == this);

@@ -854,28 +854,28 @@ Document* Frame::documentAtPoint(const IntPoint& point)
return result.innerNode() ? &result.innerNode()->document() : 0;
}

PassRefPtr<Range> Frame::rangeForPoint(const IntPoint& framePoint)
RefPtr<Range> Frame::rangeForPoint(const IntPoint& framePoint)
{
VisiblePosition position = visiblePositionForPoint(framePoint);
if (position.isNull())
return 0;
return nullptr;

VisiblePosition previous = position.previous();
if (previous.isNotNull()) {
RefPtr<Range> previousCharacterRange = makeRange(previous, position);
LayoutRect rect = editor().firstRectForRange(previousCharacterRange.get());
if (rect.contains(framePoint))
return previousCharacterRange.release();
return previousCharacterRange;
}

VisiblePosition next = position.next();
if (RefPtr<Range> nextCharacterRange = makeRange(position, next)) {
LayoutRect rect = editor().firstRectForRange(nextCharacterRange.get());
if (rect.contains(framePoint))
return nextCharacterRange.release();
return nextCharacterRange;
}

return 0;
return nullptr;
}

void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor, bool transparent,
@@ -908,7 +908,7 @@ void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor

frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode, horizontalLock, verticalLock);

setView(frameView);
setView(frameView.copyRef());

if (backgroundColor.isValid())
frameView->updateBackgroundRecursively(backgroundColor, transparent);
@@ -115,14 +115,14 @@ namespace WebCore {

class Frame : public RefCounted<Frame> {
public:
WEBCORE_EXPORT static PassRefPtr<Frame> create(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*);
WEBCORE_EXPORT static Ref<Frame> create(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*);

void init();
#if PLATFORM(IOS)
// Creates <html><body style="..."></body></html> doing minimal amount of work.
WEBCORE_EXPORT void initWithSimpleHTMLDocument(const String& style, const URL&);
#endif
WEBCORE_EXPORT void setView(PassRefPtr<FrameView>);
WEBCORE_EXPORT void setView(RefPtr<FrameView>&&);
WEBCORE_EXPORT void createView(const IntSize&, const Color&, bool,
const IntSize& fixedLayoutSize = IntSize(), const IntRect& fixedVisibleContentRect = IntRect(),
bool useFixedLayout = false, ScrollbarMode = ScrollbarAuto, bool horizontalLock = false,
@@ -173,7 +173,7 @@ namespace WebCore {
bool shouldUsePrintingLayout() const;
WEBCORE_EXPORT FloatSize resizePageRectsKeepingRatio(const FloatSize& originalSize, const FloatSize& expectedSize);

void setDocument(PassRefPtr<Document>);
void setDocument(RefPtr<Document>&&);

WEBCORE_EXPORT void setPageZoomFactor(float);
float pageZoomFactor() const { return m_pageZoomFactor; }
@@ -225,7 +225,7 @@ namespace WebCore {

WEBCORE_EXPORT VisiblePosition visiblePositionForPoint(const IntPoint& framePoint);
Document* documentAtPoint(const IntPoint& windowPoint);
WEBCORE_EXPORT PassRefPtr<Range> rangeForPoint(const IntPoint& framePoint);
WEBCORE_EXPORT RefPtr<Range> rangeForPoint(const IntPoint& framePoint);

WEBCORE_EXPORT String searchForLabelsAboveCell(const JSC::Yarr::RegularExpression&, HTMLTableCellElement*, size_t* resultDistanceFromStartOfCell);
String searchForLabelsBeforeElement(const Vector<String>& labels, Element*, size_t* resultDistance, bool* resultIsInCellAbove);
@@ -96,7 +96,7 @@ PassRefPtr<Document> XSLTProcessor::createDocumentFromSource(const String& sourc
result->contentSecurityPolicy()->copyStateFrom(oldDocument->contentSecurityPolicy());
}

frame->setDocument(result);
frame->setDocument(result.copyRef());
}

RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(sourceMIMEType);
@@ -1,3 +1,17 @@
2014-12-17 Andreas Kling <akling@apple.com>

Purge PassRefPtr from Frame.
<https://webkit.org/b/139731>

Reviewed by Anders Carlsson.

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::transitionToCommittedForNewPage):
* WebView/WebFrame.mm:
(+[WebFrame _createFrameWithPage:frameName:frameView:ownerElement:]):
(+[WebFrame _createSubframeWithOwnerElement:frameName:frameView:]):
* WebView/WebFrameInternal.h:

2014-12-16 Timothy Horton <timothy_horton@apple.com>

Implement and adopt two new TextIndicator presentation animations
@@ -1429,9 +1429,9 @@ - (void)invalidate;
bool isMainFrame = coreFrame->isMainFrame();
if (isMainFrame && coreFrame->view())
coreFrame->view()->setParentVisible(false);
coreFrame->setView(0);
coreFrame->setView(nullptr);
RefPtr<FrameView> coreView = FrameView::create(*coreFrame);
coreFrame->setView(coreView);
coreFrame->setView(coreView.copyRef());

[m_webFrame.get() _updateBackgroundAndUpdatesWhileOffscreen];
[m_webFrame->_private->webFrameView _install];
@@ -316,26 +316,26 @@ @implementation WebFrame (WebInternal)
return kit(coreFrame->page());
}

+ (PassRefPtr<Frame>)_createFrameWithPage:(Page*)page frameName:(const String&)name frameView:(WebFrameView *)frameView ownerElement:(HTMLFrameOwnerElement*)ownerElement
+ (Ref<WebCore::Frame>)_createFrameWithPage:(Page*)page frameName:(const String&)name frameView:(WebFrameView *)frameView ownerElement:(HTMLFrameOwnerElement*)ownerElement
{
WebView *webView = kit(page);

WebFrame *frame = [[self alloc] _initWithWebFrameView:frameView webView:webView];
RefPtr<Frame> coreFrame = Frame::create(page, ownerElement, new WebFrameLoaderClient(frame));
Ref<WebCore::Frame> coreFrame = Frame::create(page, ownerElement, new WebFrameLoaderClient(frame));
[frame release];
frame->_private->coreFrame = coreFrame.get();
frame->_private->coreFrame = coreFrame.ptr();

coreFrame->tree().setName(name);
coreFrame.get().tree().setName(name);
if (ownerElement) {
ASSERT(ownerElement->document().frame());
ownerElement->document().frame()->tree().appendChild(coreFrame.get());
ownerElement->document().frame()->tree().appendChild(coreFrame.ptr());
}

coreFrame->init();
coreFrame.get().init();

[webView _setZoomMultiplier:[webView _realZoomMultiplier] isTextOnly:[webView _realZoomMultiplierIsTextOnly]];

return coreFrame.release();
return coreFrame;
}

+ (void)_createMainFrameWithPage:(Page*)page frameName:(const String&)name frameView:(WebFrameView *)frameView
@@ -353,7 +353,7 @@ + (void)_createMainFrameWithPage:(Page*)page frameName:(const String&)name frame
[webView _setZoomMultiplier:[webView _realZoomMultiplier] isTextOnly:[webView _realZoomMultiplierIsTextOnly]];
}

+ (PassRefPtr<WebCore::Frame>)_createSubframeWithOwnerElement:(HTMLFrameOwnerElement*)ownerElement frameName:(const String&)name frameView:(WebFrameView *)frameView
+ (Ref<WebCore::Frame>)_createSubframeWithOwnerElement:(HTMLFrameOwnerElement*)ownerElement frameName:(const String&)name frameView:(WebFrameView *)frameView
{
return [self _createFrameWithPage:ownerElement->document().frame()->page() frameName:name frameView:frameView ownerElement:ownerElement];
}
@@ -103,7 +103,7 @@ WebView *getWebView(WebFrame *webFrame);
@interface WebFrame (WebInternal)

+ (void)_createMainFrameWithPage:(WebCore::Page*)page frameName:(const WTF::String&)name frameView:(WebFrameView *)frameView;
+ (PassRefPtr<WebCore::Frame>)_createSubframeWithOwnerElement:(WebCore::HTMLFrameOwnerElement*)ownerElement frameName:(const WTF::String&)name frameView:(WebFrameView *)frameView;
+ (Ref<WebCore::Frame>)_createSubframeWithOwnerElement:(WebCore::HTMLFrameOwnerElement*)ownerElement frameName:(const WTF::String&)name frameView:(WebFrameView *)frameView;
- (id)_initWithWebFrameView:(WebFrameView *)webFrameView webView:(WebView *)webView;

- (void)_clearCoreFrame;
@@ -1,3 +1,13 @@
2014-12-17 Andreas Kling <akling@apple.com>

Purge PassRefPtr from Frame.
<https://webkit.org/b/139731>

Reviewed by Anders Carlsson.

* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::createSubframe):

2014-12-17 Dan Bernstein <mitz@apple.com>

iOS build fix
@@ -123,12 +123,12 @@ PassRefPtr<WebFrame> WebFrame::createSubframe(WebPage* page, const String& frame
RefPtr<WebFrame> frame = create(std::make_unique<WebFrameLoaderClient>());
page->send(Messages::WebPageProxy::DidCreateSubframe(frame->frameID()), page->pageID(), IPC::DispatchMessageEvenWhenWaitingForSyncReply);

RefPtr<Frame> coreFrame = Frame::create(page->corePage(), ownerElement, frame->m_frameLoaderClient.get());
frame->m_coreFrame = coreFrame.get();
Ref<WebCore::Frame> coreFrame = Frame::create(page->corePage(), ownerElement, frame->m_frameLoaderClient.get());
frame->m_coreFrame = coreFrame.ptr();
frame->m_coreFrame->tree().setName(frameName);
if (ownerElement) {
ASSERT(ownerElement->document().frame());
ownerElement->document().frame()->tree().appendChild(coreFrame.release());
ownerElement->document().frame()->tree().appendChild(WTF::move(coreFrame));
}
frame->m_coreFrame->init();
return frame.release();

0 comments on commit c445aa6

Please sign in to comment.