| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 provideUserMediaTo(*m_frame, &m_userMediaClientImpl); | 1544 provideUserMediaTo(*m_frame, &m_userMediaClientImpl); |
| 1545 provideGeolocationTo(*m_frame, m_geolocationClientProxy.get()); | 1545 provideGeolocationTo(*m_frame, m_geolocationClientProxy.get()); |
| 1546 m_geolocationClientProxy->setController(GeolocationController::from(m_fr
ame.get())); | 1546 m_geolocationClientProxy->setController(GeolocationController::from(m_fr
ame.get())); |
| 1547 provideMIDITo(*m_frame, MIDIClientProxy::create(m_client ? m_client->web
MIDIClient() : 0)); | 1547 provideMIDITo(*m_frame, MIDIClientProxy::create(m_client ? m_client->web
MIDIClient() : 0)); |
| 1548 if (RuntimeEnabledFeatures::screenOrientationEnabled()) | 1548 if (RuntimeEnabledFeatures::screenOrientationEnabled()) |
| 1549 ScreenOrientationController::provideTo(*m_frame, m_client ? m_client
->webScreenOrientationClient() : 0); | 1549 ScreenOrientationController::provideTo(*m_frame, m_client ? m_client
->webScreenOrientationClient() : 0); |
| 1550 provideLocalFileSystemTo(*m_frame, LocalFileSystemClient::create()); | 1550 provideLocalFileSystemTo(*m_frame, LocalFileSystemClient::create()); |
| 1551 } | 1551 } |
| 1552 } | 1552 } |
| 1553 | 1553 |
| 1554 void WebLocalFrameImpl::initializeAsMainFrame(WebCore::Page* page) | 1554 PassRefPtr<LocalFrame> WebLocalFrameImpl::initializeWebCoreFrame(FrameHost* host
, FrameOwner* owner, const AtomicString& name, const AtomicString& fallbackName) |
| 1555 { | 1555 { |
| 1556 setWebCoreFrame(LocalFrame::create(&m_frameLoaderClientImpl, &page->frameHos
t(), 0)); | 1556 RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host
, owner); |
| 1557 | 1557 setWebCoreFrame(frame); |
| 1558 frame->tree().setName(name, fallbackName); |
| 1558 // We must call init() after m_frame is assigned because it is referenced | 1559 // We must call init() after m_frame is assigned because it is referenced |
| 1559 // during init(). | 1560 // during init(). Note that this may dispatch JS events; the frame may be |
| 1560 m_frame->init(); | 1561 // detached after init() returns. |
| 1562 frame->init(); |
| 1563 return frame; |
| 1561 } | 1564 } |
| 1562 | 1565 |
| 1563 PassRefPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const FrameLoadReques
t& request, HTMLFrameOwnerElement* ownerElement) | 1566 PassRefPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const FrameLoadReques
t& request, HTMLFrameOwnerElement* ownerElement) |
| 1564 { | 1567 { |
| 1565 ASSERT(m_client); | 1568 ASSERT(m_client); |
| 1566 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild
Frame(this, request.frameName())); | 1569 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild
Frame(this, request.frameName())); |
| 1567 if (!webframeChild) | 1570 if (!webframeChild) |
| 1568 return nullptr; | 1571 return nullptr; |
| 1569 | 1572 |
| 1570 // FIXME: Using subResourceAttributeName as fallback is not a perfect | 1573 // FIXME: Using subResourceAttributeName as fallback is not a perfect |
| 1571 // solution. subResourceAttributeName returns just one attribute name. The | 1574 // solution. subResourceAttributeName returns just one attribute name. The |
| 1572 // element might not have the attribute, and there might be other attributes | 1575 // element might not have the attribute, and there might be other attributes |
| 1573 // which can identify the element. | 1576 // which can identify the element. |
| 1574 RefPtr<LocalFrame> child = webframeChild->initializeAsChildFrame(frame()->ho
st(), ownerElement, request.frameName(), ownerElement->getAttribute(ownerElement
->subResourceAttributeName())); | 1577 RefPtr<LocalFrame> child = webframeChild->initializeWebCoreFrame(frame()->ho
st(), ownerElement, request.frameName(), ownerElement->getAttribute(ownerElement
->subResourceAttributeName())); |
| 1575 // Initializing the WebCore frame may cause the new child to be detached, si
nce it may dispatch a load event in the parent. | 1578 // Initializing the WebCore frame may cause the new child to be detached, si
nce it may dispatch a load event in the parent. |
| 1576 if (!child->tree().parent()) | 1579 if (!child->tree().parent()) |
| 1577 return nullptr; | 1580 return nullptr; |
| 1578 | 1581 |
| 1579 // If we're moving in the back/forward list, we might want to replace the co
ntent | 1582 // If we're moving in the back/forward list, we might want to replace the co
ntent |
| 1580 // of this child frame with whatever was there at that point. | 1583 // of this child frame with whatever was there at that point. |
| 1581 RefPtr<HistoryItem> childItem; | 1584 RefPtr<HistoryItem> childItem; |
| 1582 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen
t()->loadEventFinished()) | 1585 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen
t()->loadEventFinished()) |
| 1583 childItem = PassRefPtr<HistoryItem>(webframeChild->client()->historyItem
ForNewChildFrame(webframeChild)); | 1586 childItem = PassRefPtr<HistoryItem>(webframeChild->client()->historyItem
ForNewChildFrame(webframeChild)); |
| 1584 | 1587 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1847 } | 1850 } |
| 1848 | 1851 |
| 1849 void WebLocalFrameImpl::invalidateAll() const | 1852 void WebLocalFrameImpl::invalidateAll() const |
| 1850 { | 1853 { |
| 1851 ASSERT(frame() && frame()->view()); | 1854 ASSERT(frame() && frame()->view()); |
| 1852 FrameView* view = frame()->view(); | 1855 FrameView* view = frame()->view(); |
| 1853 view->invalidateRect(view->frameRect()); | 1856 view->invalidateRect(view->frameRect()); |
| 1854 invalidateScrollbar(); | 1857 invalidateScrollbar(); |
| 1855 } | 1858 } |
| 1856 | 1859 |
| 1857 PassRefPtr<LocalFrame> WebLocalFrameImpl::initializeAsChildFrame(FrameHost* host
, FrameOwner* owner, const AtomicString& name, const AtomicString& fallbackName) | |
| 1858 { | |
| 1859 RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host
, owner); | |
| 1860 setWebCoreFrame(frame); | |
| 1861 frame->tree().setName(name, fallbackName); | |
| 1862 // May dispatch JS events; frame may be detached after this. | |
| 1863 frame->init(); | |
| 1864 return frame; | |
| 1865 } | |
| 1866 | |
| 1867 } // namespace blink | 1860 } // namespace blink |
| OLD | NEW |