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

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

Issue 1319863006: (blink) Propagate scrolling/marginwidth/marginheight property values to child frame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address nits Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 return frame; 1742 return frame;
1742 } 1743 }
1743 1744
1744 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request, 1745 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request,
1745 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) 1746 const AtomicString& name, HTMLFrameOwnerElement* ownerElement)
1746 { 1747 {
1747 ASSERT(m_client); 1748 ASSERT(m_client);
1748 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() 1749 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope()
1749 ? WebTreeScopeType::Document 1750 ? WebTreeScopeType::Document
1750 : WebTreeScopeType::Shadow; 1751 : WebTreeScopeType::Shadow;
1751 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild Frame(this, scope, name, static_cast<WebSandboxFlags>(ownerElement->sandboxFlags ()))); 1752 WebFrameOwnerProperties ownerProperties(static_cast<WebFrameOwnerProperties: :ScrollingMode>(ownerElement->scrollingMode()), ownerElement->marginWidth(), own erElement->marginHeight());
1753 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild Frame(this, scope, name, static_cast<WebSandboxFlags>(ownerElement->sandboxFlags ()), ownerProperties));
1752 if (!webframeChild) 1754 if (!webframeChild)
1753 return nullptr; 1755 return nullptr;
1754 1756
1755 // FIXME: Using subResourceAttributeName as fallback is not a perfect 1757 // FIXME: Using subResourceAttributeName as fallback is not a perfect
1756 // solution. subResourceAttributeName returns just one attribute name. The 1758 // solution. subResourceAttributeName returns just one attribute name. The
1757 // element might not have the attribute, and there might be other attributes 1759 // element might not have the attribute, and there might be other attributes
1758 // which can identify the element. 1760 // which can identify the element.
1759 RefPtrWillBeRawPtr<LocalFrame> child = webframeChild->initializeCoreFrame(fr ame()->host(), ownerElement, name, ownerElement->getAttribute(ownerElement->subR esourceAttributeName())); 1761 RefPtrWillBeRawPtr<LocalFrame> child = webframeChild->initializeCoreFrame(fr ame()->host(), ownerElement, name, ownerElement->getAttribute(ownerElement->subR esourceAttributeName()));
1760 // Initializing the core frame may cause the new child to be detached, since 1762 // Initializing the core frame may cause the new child to be detached, since
1761 // it may dispatch a load event in the parent. 1763 // it may dispatch a load event in the parent.
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 static void ensureFrameLoaderHasCommitted(FrameLoader& frameLoader) 1983 static void ensureFrameLoaderHasCommitted(FrameLoader& frameLoader)
1982 { 1984 {
1983 // Internally, Blink uses CommittedMultipleRealLoads to track whether the 1985 // Internally, Blink uses CommittedMultipleRealLoads to track whether the
1984 // next commit should create a new history item or not. Ensure we have 1986 // next commit should create a new history item or not. Ensure we have
1985 // reached that state. 1987 // reached that state.
1986 if (frameLoader.stateMachine()->committedMultipleRealLoads()) 1988 if (frameLoader.stateMachine()->committedMultipleRealLoads())
1987 return; 1989 return;
1988 frameLoader.stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedMult ipleRealLoads); 1990 frameLoader.stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedMult ipleRealLoads);
1989 } 1991 }
1990 1992
1991 void WebLocalFrameImpl::initializeToReplaceRemoteFrame(WebRemoteFrame* oldWebFra me, const WebString& name, WebSandboxFlags flags) 1993 void WebLocalFrameImpl::initializeToReplaceRemoteFrame(WebRemoteFrame* oldWebFra me, const WebString& name, WebSandboxFlags flags, const WebFrameOwnerProperties& frameOwnerProperties)
1992 { 1994 {
1993 Frame* oldFrame = toCoreFrame(oldWebFrame); 1995 Frame* oldFrame = toCoreFrame(oldWebFrame);
1994 // Note: this *always* temporarily sets a frame owner, even for main frames! 1996 // Note: this *always* temporarily sets a frame owner, even for main frames!
1995 // When a core Frame is created with no owner, it attempts to set itself as 1997 // When a core Frame is created with no owner, it attempts to set itself as
1996 // the main frame of the Page. However, this is a provisional frame, and may 1998 // the main frame of the Page. However, this is a provisional frame, and may
1997 // disappear, so Page::m_mainFrame can't be updated just yet. 1999 // disappear, so Page::m_mainFrame can't be updated just yet.
1998 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = RemoteBridgeFrameOwner::create(nu llptr, SandboxNone); 2000 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = RemoteBridgeFrameOwner::create(nu llptr, SandboxNone, WebFrameOwnerProperties());
1999 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(m_frameLoaderClien tImpl.get(), oldFrame->host(), tempOwner.get()); 2001 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(m_frameLoaderClien tImpl.get(), oldFrame->host(), tempOwner.get());
2000 frame->setOwner(oldFrame->owner()); 2002 frame->setOwner(oldFrame->owner());
2001 if (frame->owner() && !frame->owner()->isLocal()) 2003 if (frame->owner() && !frame->owner()->isLocal()) {
2002 toRemoteBridgeFrameOwner(frame->owner())->setSandboxFlags(static_cast<Sa ndboxFlags>(flags)); 2004 RemoteBridgeFrameOwner* remoteOwner = toRemoteBridgeFrameOwner(frame->ow ner());
2005 remoteOwner->setSandboxFlags(static_cast<SandboxFlags>(flags));
2006 remoteOwner->setScrollingMode(static_cast<ScrollbarMode>(frameOwnerPrope rties.scrollingMode));
2007 remoteOwner->setMarginWidth(frameOwnerProperties.marginWidth);
2008 remoteOwner->setMarginHeight(frameOwnerProperties.marginHeight);
2009 }
2010
2003 frame->tree().setName(name); 2011 frame->tree().setName(name);
2004 setParent(oldWebFrame->parent()); 2012 setParent(oldWebFrame->parent());
2005 setOpener(oldWebFrame->opener()); 2013 setOpener(oldWebFrame->opener());
2006 setCoreFrame(frame); 2014 setCoreFrame(frame);
2007 // We must call init() after m_frame is assigned because it is referenced 2015 // We must call init() after m_frame is assigned because it is referenced
2008 // during init(). Note that this may dispatch JS events; the frame may be 2016 // during init(). Note that this may dispatch JS events; the frame may be
2009 // detached after init() returns. 2017 // detached after init() returns.
2010 frame->init(); 2018 frame->init();
2011 } 2019 }
2012 2020
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 } 2199 }
2192 2200
2193 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const 2201 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const
2194 { 2202 {
2195 if (!frame()) 2203 if (!frame())
2196 return WebSandboxFlags::None; 2204 return WebSandboxFlags::None;
2197 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); 2205 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( ));
2198 } 2206 }
2199 2207
2200 } // namespace blink 2208 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698