Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: third_party/WebKit/Source/web/WebFrame.cpp

Issue 2507023002: Support script modify iframe scrolling, marginWidth and marginHeight attr (Closed)
Patch Set: bokan@ comment addressed Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
25 #include "wtf/Optional.h"
bokan 2016/11/21 16:11:36 Remove
24 #include <algorithm> 26 #include <algorithm>
25 27
26 namespace blink { 28 namespace blink {
27 29
30 using namespace HTMLNames;
31
28 bool WebFrame::swap(WebFrame* frame) { 32 bool WebFrame::swap(WebFrame* frame) {
29 using std::swap; 33 using std::swap;
30 Frame* oldFrame = toImplBase()->frame(); 34 Frame* oldFrame = toImplBase()->frame();
31 if (oldFrame->isDetaching()) 35 if (oldFrame->isDetaching())
32 return false; 36 return false;
33 37
34 // Unload the current Document in this frame: this calls unload handlers, 38 // Unload the current Document in this frame: this calls unload handlers,
35 // detaches child frames, etc. Since this runs script, make sure this frame 39 // detaches child frames, etc. Since this runs script, make sure this frame
36 // wasn't detached before continuing with the swap. 40 // wasn't detached before continuing with the swap.
37 // FIXME: There is no unit test for this condition, so one needs to be 41 // FIXME: There is no unit test for this condition, so one needs to be
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // for frames with a remote owner. 129 // for frames with a remote owner.
126 FrameOwner* owner = toImplBase()->frame()->owner(); 130 FrameOwner* owner = toImplBase()->frame()->owner();
127 DCHECK(owner); 131 DCHECK(owner);
128 toRemoteFrameOwner(owner)->setSandboxFlags(static_cast<SandboxFlags>(flags)); 132 toRemoteFrameOwner(owner)->setSandboxFlags(static_cast<SandboxFlags>(flags));
129 } 133 }
130 134
131 WebInsecureRequestPolicy WebFrame::getInsecureRequestPolicy() const { 135 WebInsecureRequestPolicy WebFrame::getInsecureRequestPolicy() const {
132 return toImplBase()->frame()->securityContext()->getInsecureRequestPolicy(); 136 return toImplBase()->frame()->securityContext()->getInsecureRequestPolicy();
133 } 137 }
134 138
139 ScrollbarMode toScrollbarMode(
140 WebFrameOwnerProperties::ScrollingMode scrollingMode) {
141 return static_cast<ScrollbarMode>(scrollingMode);
bokan 2016/11/21 16:11:36 just do this cast inline.
142 }
143
135 void WebFrame::setFrameOwnerProperties( 144 void WebFrame::setFrameOwnerProperties(
136 const WebFrameOwnerProperties& properties) { 145 const WebFrameOwnerProperties& properties) {
137 // At the moment, this is only used to replicate frame owner properties 146 // At the moment, this is only used to replicate frame owner properties
138 // for frames with a remote owner. 147 // for frames with a remote owner.
139 RemoteFrameOwner* owner = toRemoteFrameOwner(toImplBase()->frame()->owner()); 148 RemoteFrameOwner* owner = toRemoteFrameOwner(toImplBase()->frame()->owner());
140 DCHECK(owner); 149 DCHECK(owner);
150
151 Frame* frame = toImplBase()->frame();
152 DCHECK(frame);
153
154 if (frame->isLocalFrame()) {
155 LocalFrame* localFrame = toLocalFrame(frame);
156 if (localFrame->document()) {
157 localFrame->document()->didChangeFrameOwnerProperties(
158 properties.marginWidth, properties.marginHeight,
159 toScrollbarMode(properties.scrollingMode));
160 }
161 }
162
141 owner->setScrollingMode(properties.scrollingMode); 163 owner->setScrollingMode(properties.scrollingMode);
142 owner->setMarginWidth(properties.marginWidth); 164 owner->setMarginWidth(properties.marginWidth);
143 owner->setMarginHeight(properties.marginHeight); 165 owner->setMarginHeight(properties.marginHeight);
144 owner->setAllowFullscreen(properties.allowFullscreen); 166 owner->setAllowFullscreen(properties.allowFullscreen);
145 owner->setCsp(properties.requiredCsp); 167 owner->setCsp(properties.requiredCsp);
146 owner->setDelegatedpermissions(properties.delegatedPermissions); 168 owner->setDelegatedpermissions(properties.delegatedPermissions);
147 } 169 }
148 170
149 WebFrame* WebFrame::opener() const { 171 WebFrame* WebFrame::opener() const {
150 return m_opener; 172 return m_opener;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { \ 347 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { \
326 clearWeakFramesImpl(visitor); \ 348 clearWeakFramesImpl(visitor); \
327 } 349 }
328 350
329 DEFINE_VISITOR_METHOD(Visitor*) 351 DEFINE_VISITOR_METHOD(Visitor*)
330 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) 352 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor)
331 353
332 #undef DEFINE_VISITOR_METHOD 354 #undef DEFINE_VISITOR_METHOD
333 355
334 } // namespace blink 356 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698