Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "public/web/WebFrame.h" | 5 #include "public/web/WebFrame.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/WindowProxyManager.h" | 7 #include "bindings/core/v8/WindowProxyManager.h" |
| 8 #include "core/HTMLNames.h" | |
| 8 #include "core/frame/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
| 9 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/LocalFrame.h" | 11 #include "core/frame/LocalFrame.h" |
| 11 #include "core/frame/RemoteFrame.h" | 12 #include "core/frame/RemoteFrame.h" |
| 12 #include "core/html/HTMLFrameElementBase.h" | 13 #include "core/html/HTMLFrameElementBase.h" |
| 13 #include "core/html/HTMLFrameOwnerElement.h" | 14 #include "core/html/HTMLFrameOwnerElement.h" |
| 14 #include "core/page/Page.h" | 15 #include "core/page/Page.h" |
| 15 #include "platform/UserGestureIndicator.h" | 16 #include "platform/UserGestureIndicator.h" |
| 16 #include "platform/heap/Handle.h" | 17 #include "platform/heap/Handle.h" |
| 17 #include "public/web/WebElement.h" | 18 #include "public/web/WebElement.h" |
| 18 #include "public/web/WebFrameOwnerProperties.h" | 19 #include "public/web/WebFrameOwnerProperties.h" |
| 19 #include "public/web/WebSandboxFlags.h" | 20 #include "public/web/WebSandboxFlags.h" |
| 20 #include "web/OpenedFrameTracker.h" | 21 #include "web/OpenedFrameTracker.h" |
| 21 #include "web/RemoteFrameOwner.h" | 22 #include "web/RemoteFrameOwner.h" |
| 22 #include "web/WebLocalFrameImpl.h" | 23 #include "web/WebLocalFrameImpl.h" |
| 23 #include "web/WebRemoteFrameImpl.h" | 24 #include "web/WebRemoteFrameImpl.h" |
| 24 #include <algorithm> | 25 #include <algorithm> |
| 25 | 26 |
| 26 namespace blink { | 27 namespace blink { |
| 27 | 28 |
| 29 using namespace HTMLNames; | |
| 30 | |
| 28 bool WebFrame::swap(WebFrame* frame) { | 31 bool WebFrame::swap(WebFrame* frame) { |
| 29 using std::swap; | 32 using std::swap; |
| 30 Frame* oldFrame = toImplBase()->frame(); | 33 Frame* oldFrame = toImplBase()->frame(); |
| 31 if (oldFrame->isDetaching()) | 34 if (oldFrame->isDetaching()) |
| 32 return false; | 35 return false; |
| 33 | 36 |
| 34 // Unload the current Document in this frame: this calls unload handlers, | 37 // Unload the current Document in this frame: this calls unload handlers, |
| 35 // detaches child frames, etc. Since this runs script, make sure this frame | 38 // detaches child frames, etc. Since this runs script, make sure this frame |
| 36 // wasn't detached before continuing with the swap. | 39 // wasn't detached before continuing with the swap. |
| 37 // FIXME: There is no unit test for this condition, so one needs to be | 40 // FIXME: There is no unit test for this condition, so one needs to be |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 // At the moment, this is only used to replicate frame owner properties | 140 // At the moment, this is only used to replicate frame owner properties |
| 138 // for frames with a remote owner. | 141 // for frames with a remote owner. |
| 139 RemoteFrameOwner* owner = toRemoteFrameOwner(toImplBase()->frame()->owner()); | 142 RemoteFrameOwner* owner = toRemoteFrameOwner(toImplBase()->frame()->owner()); |
| 140 DCHECK(owner); | 143 DCHECK(owner); |
| 141 owner->setScrollingMode(properties.scrollingMode); | 144 owner->setScrollingMode(properties.scrollingMode); |
| 142 owner->setMarginWidth(properties.marginWidth); | 145 owner->setMarginWidth(properties.marginWidth); |
| 143 owner->setMarginHeight(properties.marginHeight); | 146 owner->setMarginHeight(properties.marginHeight); |
| 144 owner->setAllowFullscreen(properties.allowFullscreen); | 147 owner->setAllowFullscreen(properties.allowFullscreen); |
| 145 owner->setCsp(properties.requiredCsp); | 148 owner->setCsp(properties.requiredCsp); |
| 146 owner->setDelegatedpermissions(properties.delegatedPermissions); | 149 owner->setDelegatedpermissions(properties.delegatedPermissions); |
| 150 | |
| 151 Frame* frame = toImplBase()->frame(); | |
| 152 DCHECK(frame); | |
| 153 | |
| 154 if (frame->isLocalFrame()) { | |
|
bokan
2016/11/18 20:56:18
This logic is currently duplicated for Remote and
| |
| 155 LocalFrame* localFrame = toLocalFrame(frame); | |
| 156 localFrame->document()->body()->setIntegralAttribute( | |
|
bokan
2016/11/18 20:56:18
We should only do each of these if the specific at
| |
| 157 marginwidthAttr, properties.marginWidth); | |
| 158 localFrame->document()->body()->setIntegralAttribute( | |
| 159 marginheightAttr, properties.marginHeight); | |
| 160 localFrame->view()->setNeedsLayout(); | |
| 161 } | |
| 147 } | 162 } |
| 148 | 163 |
| 149 WebFrame* WebFrame::opener() const { | 164 WebFrame* WebFrame::opener() const { |
| 150 return m_opener; | 165 return m_opener; |
| 151 } | 166 } |
| 152 | 167 |
| 153 void WebFrame::setOpener(WebFrame* opener) { | 168 void WebFrame::setOpener(WebFrame* opener) { |
| 154 if (m_opener) | 169 if (m_opener) |
| 155 m_opener->m_openedFrameTracker->remove(this); | 170 m_opener->m_openedFrameTracker->remove(this); |
| 156 if (opener) | 171 if (opener) |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { \ | 340 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { \ |
| 326 clearWeakFramesImpl(visitor); \ | 341 clearWeakFramesImpl(visitor); \ |
| 327 } | 342 } |
| 328 | 343 |
| 329 DEFINE_VISITOR_METHOD(Visitor*) | 344 DEFINE_VISITOR_METHOD(Visitor*) |
| 330 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) | 345 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) |
| 331 | 346 |
| 332 #undef DEFINE_VISITOR_METHOD | 347 #undef DEFINE_VISITOR_METHOD |
| 333 | 348 |
| 334 } // namespace blink | 349 } // namespace blink |
| OLD | NEW |