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 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 return WebString(frame()->layerTreeAsText(showDebugInfo ? LayerTreeIncludesD
ebugInfo : LayerTreeNormal)); | 1358 return WebString(frame()->layerTreeAsText(showDebugInfo ? LayerTreeIncludesD
ebugInfo : LayerTreeNormal)); |
1359 } | 1359 } |
1360 | 1360 |
1361 // WebLocalFrameImpl public ----------------------------------------------------
----- | 1361 // WebLocalFrameImpl public ----------------------------------------------------
----- |
1362 | 1362 |
1363 WebLocalFrame* WebLocalFrame::create(WebTreeScopeType scope, WebFrameClient* cli
ent, WebFrame* opener) | 1363 WebLocalFrame* WebLocalFrame::create(WebTreeScopeType scope, WebFrameClient* cli
ent, WebFrame* opener) |
1364 { | 1364 { |
1365 return WebLocalFrameImpl::create(scope, client, opener); | 1365 return WebLocalFrameImpl::create(scope, client, opener); |
1366 } | 1366 } |
1367 | 1367 |
1368 WebLocalFrame* WebLocalFrame::createProvisional(WebFrameClient* client, WebRemot
eFrame* oldWebFrame, WebSandboxFlags flags, const WebFrameOwnerProperties& frame
OwnerProperties) | 1368 WebLocalFrame* WebLocalFrame::createProvisional(WebFrameClient* client, WebRemot
eFrame* oldWebFrame, WebSandboxFlags flags) |
1369 { | 1369 { |
1370 return WebLocalFrameImpl::createProvisional(client, oldWebFrame, flags, fram
eOwnerProperties); | 1370 return WebLocalFrameImpl::createProvisional(client, oldWebFrame, flags); |
1371 } | 1371 } |
1372 | 1372 |
1373 WebLocalFrameImpl* WebLocalFrameImpl::create(WebTreeScopeType scope, WebFrameCli
ent* client, WebFrame* opener) | 1373 WebLocalFrameImpl* WebLocalFrameImpl::create(WebTreeScopeType scope, WebFrameCli
ent* client, WebFrame* opener) |
1374 { | 1374 { |
1375 WebLocalFrameImpl* frame = new WebLocalFrameImpl(scope, client); | 1375 WebLocalFrameImpl* frame = new WebLocalFrameImpl(scope, client); |
1376 frame->setOpener(opener); | 1376 frame->setOpener(opener); |
1377 return frame; | 1377 return frame; |
1378 } | 1378 } |
1379 | 1379 |
1380 WebLocalFrameImpl* WebLocalFrameImpl::createProvisional(WebFrameClient* client,
WebRemoteFrame* oldWebFrame, WebSandboxFlags flags, const WebFrameOwnerPropertie
s& frameOwnerProperties) | 1380 WebLocalFrameImpl* WebLocalFrameImpl::createProvisional(WebFrameClient* client,
WebRemoteFrame* oldWebFrame, WebSandboxFlags flags) |
1381 { | 1381 { |
1382 WebLocalFrameImpl* webFrame = new WebLocalFrameImpl(oldWebFrame, client); | 1382 WebLocalFrameImpl* webFrame = new WebLocalFrameImpl(oldWebFrame, client); |
1383 Frame* oldFrame = oldWebFrame->toImplBase()->frame(); | 1383 Frame* oldFrame = oldWebFrame->toImplBase()->frame(); |
1384 webFrame->setParent(oldWebFrame->parent()); | 1384 webFrame->setParent(oldWebFrame->parent()); |
1385 webFrame->setOpener(oldWebFrame->opener()); | 1385 webFrame->setOpener(oldWebFrame->opener()); |
1386 // Note: this *always* temporarily sets a frame owner, even for main frames! | 1386 // Note: this *always* temporarily sets a frame owner, even for main frames! |
1387 // When a core Frame is created with no owner, it attempts to set itself as | 1387 // When a core Frame is created with no owner, it attempts to set itself as |
1388 // the main frame of the Page. However, this is a provisional frame, and may | 1388 // the main frame of the Page. However, this is a provisional frame, and may |
1389 // disappear, so Page::m_mainFrame can't be updated just yet. | 1389 // disappear, so Page::m_mainFrame can't be updated just yet. |
1390 FrameOwner* tempOwner = DummyFrameOwner::create(); | 1390 FrameOwner* tempOwner = DummyFrameOwner::create(); |
1391 // TODO(dcheng): This block is very similar to initializeCoreFrame. Try to r
euse it here. | 1391 // TODO(dcheng): This block is very similar to initializeCoreFrame. Try to r
euse it here. |
1392 LocalFrame* frame = LocalFrame::create(webFrame->m_frameLoaderClientImpl.get
(), oldFrame->host(), tempOwner, client ? client->serviceRegistry() : nullptr); | 1392 LocalFrame* frame = LocalFrame::create(webFrame->m_frameLoaderClientImpl.get
(), oldFrame->host(), tempOwner, client ? client->serviceRegistry() : nullptr); |
1393 // Set the name and unique name directly, bypassing any of the normal logic | 1393 // Set the name and unique name directly, bypassing any of the normal logic |
1394 // to calculate unique name. | 1394 // to calculate unique name. |
1395 frame->tree().setPrecalculatedName(toWebRemoteFrameImpl(oldWebFrame)->frame(
)->tree().name(), toWebRemoteFrameImpl(oldWebFrame)->frame()->tree().uniqueName(
)); | 1395 frame->tree().setPrecalculatedName(toWebRemoteFrameImpl(oldWebFrame)->frame(
)->tree().name(), toWebRemoteFrameImpl(oldWebFrame)->frame()->tree().uniqueName(
)); |
1396 webFrame->setCoreFrame(frame); | 1396 webFrame->setCoreFrame(frame); |
1397 | 1397 |
1398 frame->setOwner(oldFrame->owner()); | 1398 frame->setOwner(oldFrame->owner()); |
1399 | 1399 |
1400 if (frame->owner() && frame->owner()->isRemote()) { | 1400 if (frame->owner() && frame->owner()->isRemote()) |
1401 toRemoteFrameOwner(frame->owner())->setSandboxFlags(static_cast<SandboxF
lags>(flags)); | 1401 toRemoteFrameOwner(frame->owner())->setSandboxFlags(static_cast<SandboxF
lags>(flags)); |
1402 // Since a remote frame doesn't get the notifications about frame owner | |
1403 // property modifications, we need to sync up those properties here. | |
1404 webFrame->setFrameOwnerProperties(frameOwnerProperties); | |
1405 } | |
1406 | 1402 |
1407 // We must call init() after m_frame is assigned because it is referenced | 1403 // We must call init() after m_frame is assigned because it is referenced |
1408 // during init(). Note that this may dispatch JS events; the frame may be | 1404 // during init(). Note that this may dispatch JS events; the frame may be |
1409 // detached after init() returns. | 1405 // detached after init() returns. |
1410 frame->init(); | 1406 frame->init(); |
1411 return webFrame; | 1407 return webFrame; |
1412 } | 1408 } |
1413 | 1409 |
1414 WebLocalFrameImpl::WebLocalFrameImpl(WebTreeScopeType scope, WebFrameClient* cli
ent) | 1410 WebLocalFrameImpl::WebLocalFrameImpl(WebTreeScopeType scope, WebFrameClient* cli
ent) |
1415 : WebLocalFrame(scope) | 1411 : WebLocalFrame(scope) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 } | 1500 } |
1505 | 1501 |
1506 LocalFrame* WebLocalFrameImpl::createChildFrame(const FrameLoadRequest& request, | 1502 LocalFrame* WebLocalFrameImpl::createChildFrame(const FrameLoadRequest& request, |
1507 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) | 1503 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) |
1508 { | 1504 { |
1509 DCHECK(m_client); | 1505 DCHECK(m_client); |
1510 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); | 1506 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); |
1511 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() | 1507 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() |
1512 ? WebTreeScopeType::Document | 1508 ? WebTreeScopeType::Document |
1513 : WebTreeScopeType::Shadow; | 1509 : WebTreeScopeType::Shadow; |
1514 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner
Element->marginWidth(), ownerElement->marginHeight()); | 1510 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner
Element->marginWidth(), ownerElement->marginHeight(), ownerElement->allowFullscr
een()); |
1515 // FIXME: Using subResourceAttributeName as fallback is not a perfect | 1511 // FIXME: Using subResourceAttributeName as fallback is not a perfect |
1516 // solution. subResourceAttributeName returns just one attribute name. The | 1512 // solution. subResourceAttributeName returns just one attribute name. The |
1517 // element might not have the attribute, and there might be other attributes | 1513 // element might not have the attribute, and there might be other attributes |
1518 // which can identify the element. | 1514 // which can identify the element. |
1519 AtomicString uniqueName = frame()->tree().calculateUniqueNameForNewChildFram
e( | 1515 AtomicString uniqueName = frame()->tree().calculateUniqueNameForNewChildFram
e( |
1520 name, ownerElement->getAttribute(ownerElement->subResourceAttributeName(
))); | 1516 name, ownerElement->getAttribute(ownerElement->subResourceAttributeName(
))); |
1521 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild
Frame(this, scope, name, uniqueName, static_cast<WebSandboxFlags>(ownerElement->
getSandboxFlags()), ownerProperties)); | 1517 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild
Frame(this, scope, name, uniqueName, static_cast<WebSandboxFlags>(ownerElement->
getSandboxFlags()), ownerProperties)); |
1522 if (!webframeChild) | 1518 if (!webframeChild) |
1523 return nullptr; | 1519 return nullptr; |
1524 | 1520 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1791 { | 1787 { |
1792 DCHECK(devToolsClient); | 1788 DCHECK(devToolsClient); |
1793 m_devToolsAgent = WebDevToolsAgentImpl::create(this, devToolsClient); | 1789 m_devToolsAgent = WebDevToolsAgentImpl::create(this, devToolsClient); |
1794 } | 1790 } |
1795 | 1791 |
1796 WebDevToolsAgent* WebLocalFrameImpl::devToolsAgent() | 1792 WebDevToolsAgent* WebLocalFrameImpl::devToolsAgent() |
1797 { | 1793 { |
1798 return m_devToolsAgent.get(); | 1794 return m_devToolsAgent.get(); |
1799 } | 1795 } |
1800 | 1796 |
1801 void WebLocalFrameImpl::setFrameOwnerProperties(const WebFrameOwnerProperties& f
rameOwnerProperties) | |
1802 { | |
1803 // At the moment, this is only used to replicate frame owner properties | |
1804 // for frames with a remote owner. | |
1805 FrameOwner* owner = frame()->owner(); | |
1806 DCHECK(owner); | |
1807 toRemoteFrameOwner(owner)->setScrollingMode(frameOwnerProperties.scrollingMo
de); | |
1808 toRemoteFrameOwner(owner)->setMarginWidth(frameOwnerProperties.marginWidth); | |
1809 toRemoteFrameOwner(owner)->setMarginHeight(frameOwnerProperties.marginHeight
); | |
1810 } | |
1811 | |
1812 WebLocalFrameImpl* WebLocalFrameImpl::localRoot() | 1797 WebLocalFrameImpl* WebLocalFrameImpl::localRoot() |
1813 { | 1798 { |
1814 // This can't use the LocalFrame::localFrameRoot, since it may be called | 1799 // This can't use the LocalFrame::localFrameRoot, since it may be called |
1815 // when the WebLocalFrame exists but the core LocalFrame does not. | 1800 // when the WebLocalFrame exists but the core LocalFrame does not. |
1816 // TODO(alexmos, dcheng): Clean this up to only calculate this in one place. | 1801 // TODO(alexmos, dcheng): Clean this up to only calculate this in one place. |
1817 WebLocalFrameImpl* localRoot = this; | 1802 WebLocalFrameImpl* localRoot = this; |
1818 while (!localRoot->frameWidget()) | 1803 while (!localRoot->frameWidget()) |
1819 localRoot = toWebLocalFrameImpl(localRoot->parent()); | 1804 localRoot = toWebLocalFrameImpl(localRoot->parent()); |
1820 return localRoot; | 1805 return localRoot; |
1821 } | 1806 } |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 return WebSandboxFlags::None; | 2096 return WebSandboxFlags::None; |
2112 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2097 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
2113 } | 2098 } |
2114 | 2099 |
2115 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) | 2100 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) |
2116 { | 2101 { |
2117 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); | 2102 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); |
2118 } | 2103 } |
2119 | 2104 |
2120 } // namespace blink | 2105 } // namespace blink |
OLD | NEW |