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

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

Issue 1307013004: Propagate scrolling/marginwidth/marginheight property values to child frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from Daniel Created 5 years, 2 months 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 /* 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 #include "public/platform/WebSuspendableTask.h" 194 #include "public/platform/WebSuspendableTask.h"
195 #include "public/platform/WebURLError.h" 195 #include "public/platform/WebURLError.h"
196 #include "public/platform/WebVector.h" 196 #include "public/platform/WebVector.h"
197 #include "public/web/WebAutofillClient.h" 197 #include "public/web/WebAutofillClient.h"
198 #include "public/web/WebConsoleMessage.h" 198 #include "public/web/WebConsoleMessage.h"
199 #include "public/web/WebDOMEvent.h" 199 #include "public/web/WebDOMEvent.h"
200 #include "public/web/WebDocument.h" 200 #include "public/web/WebDocument.h"
201 #include "public/web/WebFindOptions.h" 201 #include "public/web/WebFindOptions.h"
202 #include "public/web/WebFormElement.h" 202 #include "public/web/WebFormElement.h"
203 #include "public/web/WebFrameClient.h" 203 #include "public/web/WebFrameClient.h"
204 #include "public/web/WebFrameOwnerProperties.h"
204 #include "public/web/WebHistoryItem.h" 205 #include "public/web/WebHistoryItem.h"
205 #include "public/web/WebIconURL.h" 206 #include "public/web/WebIconURL.h"
206 #include "public/web/WebInputElement.h" 207 #include "public/web/WebInputElement.h"
207 #include "public/web/WebKit.h" 208 #include "public/web/WebKit.h"
208 #include "public/web/WebNode.h" 209 #include "public/web/WebNode.h"
209 #include "public/web/WebPerformance.h" 210 #include "public/web/WebPerformance.h"
210 #include "public/web/WebPlugin.h" 211 #include "public/web/WebPlugin.h"
211 #include "public/web/WebPrintParams.h" 212 #include "public/web/WebPrintParams.h"
212 #include "public/web/WebPrintPresetOptions.h" 213 #include "public/web/WebPrintPresetOptions.h"
213 #include "public/web/WebRange.h" 214 #include "public/web/WebRange.h"
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 return frame; 1749 return frame;
1749 } 1750 }
1750 1751
1751 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request, 1752 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request,
1752 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) 1753 const AtomicString& name, HTMLFrameOwnerElement* ownerElement)
1753 { 1754 {
1754 ASSERT(m_client); 1755 ASSERT(m_client);
1755 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() 1756 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope()
1756 ? WebTreeScopeType::Document 1757 ? WebTreeScopeType::Document
1757 : WebTreeScopeType::Shadow; 1758 : WebTreeScopeType::Shadow;
1758 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild Frame(this, scope, name, static_cast<WebSandboxFlags>(ownerElement->sandboxFlags ()))); 1759 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner Element->marginWidth(), ownerElement->marginHeight());
1760 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild Frame(this, scope, name, static_cast<WebSandboxFlags>(ownerElement->sandboxFlags ()), ownerProperties));
1759 if (!webframeChild) 1761 if (!webframeChild)
1760 return nullptr; 1762 return nullptr;
1761 1763
1762 // FIXME: Using subResourceAttributeName as fallback is not a perfect 1764 // FIXME: Using subResourceAttributeName as fallback is not a perfect
1763 // solution. subResourceAttributeName returns just one attribute name. The 1765 // solution. subResourceAttributeName returns just one attribute name. The
1764 // element might not have the attribute, and there might be other attributes 1766 // element might not have the attribute, and there might be other attributes
1765 // which can identify the element. 1767 // which can identify the element.
1766 RefPtrWillBeRawPtr<LocalFrame> child = webframeChild->initializeCoreFrame(fr ame()->host(), ownerElement, name, ownerElement->getAttribute(ownerElement->subR esourceAttributeName())); 1768 RefPtrWillBeRawPtr<LocalFrame> child = webframeChild->initializeCoreFrame(fr ame()->host(), ownerElement, name, ownerElement->getAttribute(ownerElement->subR esourceAttributeName()));
1767 // Initializing the core frame may cause the new child to be detached, since 1769 // Initializing the core frame may cause the new child to be detached, since
1768 // it may dispatch a load event in the parent. 1770 // it may dispatch a load event in the parent.
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1988 static void ensureFrameLoaderHasCommitted(FrameLoader& frameLoader) 1990 static void ensureFrameLoaderHasCommitted(FrameLoader& frameLoader)
1989 { 1991 {
1990 // Internally, Blink uses CommittedMultipleRealLoads to track whether the 1992 // Internally, Blink uses CommittedMultipleRealLoads to track whether the
1991 // next commit should create a new history item or not. Ensure we have 1993 // next commit should create a new history item or not. Ensure we have
1992 // reached that state. 1994 // reached that state.
1993 if (frameLoader.stateMachine()->committedMultipleRealLoads()) 1995 if (frameLoader.stateMachine()->committedMultipleRealLoads())
1994 return; 1996 return;
1995 frameLoader.stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedMult ipleRealLoads); 1997 frameLoader.stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedMult ipleRealLoads);
1996 } 1998 }
1997 1999
1998 void WebLocalFrameImpl::initializeToReplaceRemoteFrame(WebRemoteFrame* oldWebFra me, const WebString& name, WebSandboxFlags flags) 2000 void WebLocalFrameImpl::initializeToReplaceRemoteFrame(WebRemoteFrame* oldWebFra me, const WebString& name, WebSandboxFlags flags, const WebFrameOwnerProperties& frameOwnerProperties)
1999 { 2001 {
2000 Frame* oldFrame = toCoreFrame(oldWebFrame); 2002 Frame* oldFrame = toCoreFrame(oldWebFrame);
2001 // Note: this *always* temporarily sets a frame owner, even for main frames! 2003 // Note: this *always* temporarily sets a frame owner, even for main frames!
2002 // When a core Frame is created with no owner, it attempts to set itself as 2004 // When a core Frame is created with no owner, it attempts to set itself as
2003 // the main frame of the Page. However, this is a provisional frame, and may 2005 // the main frame of the Page. However, this is a provisional frame, and may
2004 // disappear, so Page::m_mainFrame can't be updated just yet. 2006 // disappear, so Page::m_mainFrame can't be updated just yet.
2005 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = RemoteBridgeFrameOwner::create(nu llptr, SandboxNone); 2007 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = RemoteBridgeFrameOwner::create(nu llptr, SandboxNone, WebFrameOwnerProperties());
2006 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(m_frameLoaderClien tImpl.get(), oldFrame->host(), tempOwner.get()); 2008 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(m_frameLoaderClien tImpl.get(), oldFrame->host(), tempOwner.get());
2007 frame->setOwner(oldFrame->owner()); 2009 frame->setOwner(oldFrame->owner());
2008 if (frame->owner() && !frame->owner()->isLocal()) 2010 if (frame->owner() && !frame->owner()->isLocal()) {
2009 toRemoteBridgeFrameOwner(frame->owner())->setSandboxFlags(static_cast<Sa ndboxFlags>(flags)); 2011 RemoteBridgeFrameOwner* remoteOwner = toRemoteBridgeFrameOwner(frame->ow ner());
dcheng 2015/10/14 07:20:43 Maybe this should just call WebFrame::setReplicate
dcheng 2015/10/14 07:57:08 Also, can we add a comment as to why this is neces
lazyboy 2015/10/14 20:05:29 Yes. in A-embed B-embed C scenario, if we navigate
lazyboy 2015/10/14 20:05:29 WebFrame::setFrameOwnerProperties needs core Frame
dcheng 2015/10/15 06:06:53 We prepare a local frame when we have a provisiona
lazyboy 2015/10/15 16:56:38 OK. If I understand correctly, if these properties
alexmos 2015/10/16 17:17:01 I think this should be ok. This needs to happens
2012 remoteOwner->setSandboxFlags(static_cast<SandboxFlags>(flags));
2013 remoteOwner->setScrollingMode(frameOwnerProperties.scrollingMode);
2014 remoteOwner->setMarginWidth(frameOwnerProperties.marginWidth);
2015 remoteOwner->setMarginHeight(frameOwnerProperties.marginHeight);
2016 }
2017
2010 frame->tree().setName(name); 2018 frame->tree().setName(name);
2011 setParent(oldWebFrame->parent()); 2019 setParent(oldWebFrame->parent());
2012 setOpener(oldWebFrame->opener()); 2020 setOpener(oldWebFrame->opener());
2013 setCoreFrame(frame); 2021 setCoreFrame(frame);
2014 // We must call init() after m_frame is assigned because it is referenced 2022 // We must call init() after m_frame is assigned because it is referenced
2015 // during init(). Note that this may dispatch JS events; the frame may be 2023 // during init(). Note that this may dispatch JS events; the frame may be
2016 // detached after init() returns. 2024 // detached after init() returns.
2017 frame->init(); 2025 frame->init();
2018 } 2026 }
2019 2027
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2198 } 2206 }
2199 2207
2200 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const 2208 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const
2201 { 2209 {
2202 if (!frame()) 2210 if (!frame())
2203 return WebSandboxFlags::None; 2211 return WebSandboxFlags::None;
2204 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); 2212 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( ));
2205 } 2213 }
2206 2214
2207 } // namespace blink 2215 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698