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