| 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 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 provideUserMediaTo(*m_frame, &m_userMediaClientImpl); | 1580 provideUserMediaTo(*m_frame, &m_userMediaClientImpl); |
| 1581 provideGeolocationTo(*m_frame, m_geolocationClientProxy.get()); | 1581 provideGeolocationTo(*m_frame, m_geolocationClientProxy.get()); |
| 1582 m_geolocationClientProxy->setController(GeolocationController::from(m_fr
ame.get())); | 1582 m_geolocationClientProxy->setController(GeolocationController::from(m_fr
ame.get())); |
| 1583 provideMIDITo(*m_frame, MIDIClientProxy::create(m_client ? m_client->web
MIDIClient() : 0)); | 1583 provideMIDITo(*m_frame, MIDIClientProxy::create(m_client ? m_client->web
MIDIClient() : 0)); |
| 1584 if (RuntimeEnabledFeatures::screenOrientationEnabled()) | 1584 if (RuntimeEnabledFeatures::screenOrientationEnabled()) |
| 1585 ScreenOrientationController::provideTo(*m_frame, m_client ? m_client
->webScreenOrientationClient() : 0); | 1585 ScreenOrientationController::provideTo(*m_frame, m_client ? m_client
->webScreenOrientationClient() : 0); |
| 1586 provideLocalFileSystemTo(*m_frame, LocalFileSystemClient::create()); | 1586 provideLocalFileSystemTo(*m_frame, LocalFileSystemClient::create()); |
| 1587 } | 1587 } |
| 1588 } | 1588 } |
| 1589 | 1589 |
| 1590 void WebLocalFrameImpl::initializeAsMainFrame(WebCore::Page* page) | 1590 PassRefPtr<LocalFrame> WebLocalFrameImpl::initializeWebCoreFrame(FrameHost* host
, FrameOwner* owner, const AtomicString& name, const AtomicString& fallbackName) |
| 1591 { | 1591 { |
| 1592 setWebCoreFrame(LocalFrame::create(&m_frameLoaderClientImpl, &page->frameHos
t(), 0)); | 1592 RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host
, owner); |
| 1593 | 1593 setWebCoreFrame(frame); |
| 1594 frame->tree().setName(name, fallbackName); |
| 1594 // We must call init() after m_frame is assigned because it is referenced | 1595 // We must call init() after m_frame is assigned because it is referenced |
| 1595 // during init(). | 1596 // during init(). Note that this may dispatch JS events; the frame may be |
| 1596 m_frame->init(); | 1597 // detached after init() returns. |
| 1598 frame->init(); |
| 1599 return frame; |
| 1597 } | 1600 } |
| 1598 | 1601 |
| 1599 PassRefPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const FrameLoadReques
t& request, HTMLFrameOwnerElement* ownerElement) | 1602 PassRefPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const FrameLoadReques
t& request, HTMLFrameOwnerElement* ownerElement) |
| 1600 { | 1603 { |
| 1601 ASSERT(m_client); | 1604 ASSERT(m_client); |
| 1602 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild
Frame(this, request.frameName())); | 1605 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild
Frame(this, request.frameName())); |
| 1603 if (!webframeChild) | 1606 if (!webframeChild) |
| 1604 return nullptr; | 1607 return nullptr; |
| 1605 | 1608 |
| 1606 // FIXME: Using subResourceAttributeName as fallback is not a perfect | 1609 // FIXME: Using subResourceAttributeName as fallback is not a perfect |
| 1607 // solution. subResourceAttributeName returns just one attribute name. The | 1610 // solution. subResourceAttributeName returns just one attribute name. The |
| 1608 // element might not have the attribute, and there might be other attributes | 1611 // element might not have the attribute, and there might be other attributes |
| 1609 // which can identify the element. | 1612 // which can identify the element. |
| 1610 RefPtr<LocalFrame> child = webframeChild->initializeAsChildFrame(frame()->ho
st(), ownerElement, request.frameName(), ownerElement->getAttribute(ownerElement
->subResourceAttributeName())); | 1613 RefPtr<LocalFrame> child = webframeChild->initializeWebCoreFrame(frame()->ho
st(), ownerElement, request.frameName(), ownerElement->getAttribute(ownerElement
->subResourceAttributeName())); |
| 1611 // Initializing the WebCore frame may cause the new child to be detached, si
nce it may dispatch a load event in the parent. | 1614 // Initializing the WebCore frame may cause the new child to be detached, si
nce it may dispatch a load event in the parent. |
| 1612 if (!child->tree().parent()) | 1615 if (!child->tree().parent()) |
| 1613 return nullptr; | 1616 return nullptr; |
| 1614 | 1617 |
| 1615 // If we're moving in the back/forward list, we might want to replace the co
ntent | 1618 // If we're moving in the back/forward list, we might want to replace the co
ntent |
| 1616 // of this child frame with whatever was there at that point. | 1619 // of this child frame with whatever was there at that point. |
| 1617 RefPtr<HistoryItem> childItem; | 1620 RefPtr<HistoryItem> childItem; |
| 1618 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen
t()->loadEventFinished()) | 1621 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen
t()->loadEventFinished()) |
| 1619 childItem = PassRefPtr<HistoryItem>(webframeChild->client()->historyItem
ForNewChildFrame(webframeChild)); | 1622 childItem = PassRefPtr<HistoryItem>(webframeChild->client()->historyItem
ForNewChildFrame(webframeChild)); |
| 1620 | 1623 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1636 // This is only possible on the main frame. | 1639 // This is only possible on the main frame. |
| 1637 if (m_textFinder && m_textFinder->totalMatchCount() > 0) { | 1640 if (m_textFinder && m_textFinder->totalMatchCount() > 0) { |
| 1638 ASSERT(!parent()); | 1641 ASSERT(!parent()); |
| 1639 m_textFinder->increaseMarkerVersion(); | 1642 m_textFinder->increaseMarkerVersion(); |
| 1640 } | 1643 } |
| 1641 } | 1644 } |
| 1642 | 1645 |
| 1643 void WebLocalFrameImpl::createFrameView() | 1646 void WebLocalFrameImpl::createFrameView() |
| 1644 { | 1647 { |
| 1645 TRACE_EVENT0("blink", "WebLocalFrameImpl::createFrameView"); | 1648 TRACE_EVENT0("blink", "WebLocalFrameImpl::createFrameView"); |
| 1649 printf("WebLocalFrameImpl::createFrameView\n"); |
| 1646 | 1650 |
| 1647 ASSERT(frame()); // If frame() doesn't exist, we probably didn't init proper
ly. | 1651 ASSERT(frame()); // If frame() doesn't exist, we probably didn't init proper
ly. |
| 1648 | 1652 |
| 1649 WebViewImpl* webView = viewImpl(); | 1653 WebViewImpl* webView = viewImpl(); |
| 1650 bool isMainFrame = webView->mainFrameImpl()->frame() == frame(); | 1654 bool isMainFrame = frame()->isLocalRoot(); |
| 1651 if (isMainFrame) | 1655 if (isMainFrame) |
| 1652 webView->suppressInvalidations(true); | 1656 webView->suppressInvalidations(true); |
| 1653 | 1657 |
| 1654 frame()->createView(webView->size(), webView->baseBackgroundColor(), webView
->isTransparent()); | 1658 frame()->createView(webView->size(), webView->baseBackgroundColor(), webView
->isTransparent()); |
| 1655 if (webView->shouldAutoResize() && isMainFrame) | 1659 if (webView->shouldAutoResize() && isMainFrame) |
| 1656 frame()->view()->enableAutoSizeMode(true, webView->minAutoSize(), webVie
w->maxAutoSize()); | 1660 frame()->view()->enableAutoSizeMode(true, webView->minAutoSize(), webVie
w->maxAutoSize()); |
| 1657 | 1661 |
| 1658 frame()->view()->setInputEventsTransformForEmulation(m_inputEventsOffsetForE
mulation, m_inputEventsScaleFactorForEmulation); | 1662 frame()->view()->setInputEventsTransformForEmulation(m_inputEventsOffsetForE
mulation, m_inputEventsScaleFactorForEmulation); |
| 1659 | 1663 |
| 1660 if (isMainFrame) | 1664 if (isMainFrame) |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1883 } | 1887 } |
| 1884 | 1888 |
| 1885 void WebLocalFrameImpl::invalidateAll() const | 1889 void WebLocalFrameImpl::invalidateAll() const |
| 1886 { | 1890 { |
| 1887 ASSERT(frame() && frame()->view()); | 1891 ASSERT(frame() && frame()->view()); |
| 1888 FrameView* view = frame()->view(); | 1892 FrameView* view = frame()->view(); |
| 1889 view->invalidateRect(view->frameRect()); | 1893 view->invalidateRect(view->frameRect()); |
| 1890 invalidateScrollbar(); | 1894 invalidateScrollbar(); |
| 1891 } | 1895 } |
| 1892 | 1896 |
| 1893 PassRefPtr<LocalFrame> WebLocalFrameImpl::initializeAsChildFrame(FrameHost* host
, FrameOwner* owner, const AtomicString& name, const AtomicString& fallbackName) | |
| 1894 { | |
| 1895 RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host
, owner); | |
| 1896 setWebCoreFrame(frame); | |
| 1897 frame->tree().setName(name, fallbackName); | |
| 1898 // May dispatch JS events; frame may be detached after this. | |
| 1899 frame->init(); | |
| 1900 return frame; | |
| 1901 } | |
| 1902 | |
| 1903 } // namespace blink | 1897 } // namespace blink |
| OLD | NEW |