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

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: content_unittests compile fix Created 5 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 /* 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 #include "public/platform/WebSuspendableTask.h" 195 #include "public/platform/WebSuspendableTask.h"
196 #include "public/platform/WebURLError.h" 196 #include "public/platform/WebURLError.h"
197 #include "public/platform/WebVector.h" 197 #include "public/platform/WebVector.h"
198 #include "public/web/WebAutofillClient.h" 198 #include "public/web/WebAutofillClient.h"
199 #include "public/web/WebConsoleMessage.h" 199 #include "public/web/WebConsoleMessage.h"
200 #include "public/web/WebDOMEvent.h" 200 #include "public/web/WebDOMEvent.h"
201 #include "public/web/WebDocument.h" 201 #include "public/web/WebDocument.h"
202 #include "public/web/WebFindOptions.h" 202 #include "public/web/WebFindOptions.h"
203 #include "public/web/WebFormElement.h" 203 #include "public/web/WebFormElement.h"
204 #include "public/web/WebFrameClient.h" 204 #include "public/web/WebFrameClient.h"
205 #include "public/web/WebFrameOwnerProperties.h"
205 #include "public/web/WebHistoryItem.h" 206 #include "public/web/WebHistoryItem.h"
206 #include "public/web/WebIconURL.h" 207 #include "public/web/WebIconURL.h"
207 #include "public/web/WebInputElement.h" 208 #include "public/web/WebInputElement.h"
208 #include "public/web/WebKit.h" 209 #include "public/web/WebKit.h"
209 #include "public/web/WebNode.h" 210 #include "public/web/WebNode.h"
210 #include "public/web/WebPerformance.h" 211 #include "public/web/WebPerformance.h"
211 #include "public/web/WebPlugin.h" 212 #include "public/web/WebPlugin.h"
212 #include "public/web/WebPrintParams.h" 213 #include "public/web/WebPrintParams.h"
213 #include "public/web/WebPrintPresetOptions.h" 214 #include "public/web/WebPrintPresetOptions.h"
214 #include "public/web/WebRange.h" 215 #include "public/web/WebRange.h"
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 } 1741 }
1741 1742
1742 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request, 1743 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request,
1743 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) 1744 const AtomicString& name, HTMLFrameOwnerElement* ownerElement)
1744 { 1745 {
1745 ASSERT(m_client); 1746 ASSERT(m_client);
1746 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); 1747 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe");
1747 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() 1748 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope()
1748 ? WebTreeScopeType::Document 1749 ? WebTreeScopeType::Document
1749 : WebTreeScopeType::Shadow; 1750 : WebTreeScopeType::Shadow;
1750 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild Frame(this, scope, name, static_cast<WebSandboxFlags>(ownerElement->sandboxFlags ()))); 1751 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner Element->marginWidth(), ownerElement->marginHeight());
1752 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild Frame(this, scope, name, static_cast<WebSandboxFlags>(ownerElement->sandboxFlags ()), ownerProperties));
1751 if (!webframeChild) 1753 if (!webframeChild)
1752 return nullptr; 1754 return nullptr;
1753 1755
1754 // FIXME: Using subResourceAttributeName as fallback is not a perfect 1756 // FIXME: Using subResourceAttributeName as fallback is not a perfect
1755 // solution. subResourceAttributeName returns just one attribute name. The 1757 // solution. subResourceAttributeName returns just one attribute name. The
1756 // element might not have the attribute, and there might be other attributes 1758 // element might not have the attribute, and there might be other attributes
1757 // which can identify the element. 1759 // which can identify the element.
1758 RefPtrWillBeRawPtr<LocalFrame> child = webframeChild->initializeCoreFrame(fr ame()->host(), ownerElement, name, ownerElement->getAttribute(ownerElement->subR esourceAttributeName())); 1760 RefPtrWillBeRawPtr<LocalFrame> child = webframeChild->initializeCoreFrame(fr ame()->host(), ownerElement, name, ownerElement->getAttribute(ownerElement->subR esourceAttributeName()));
1759 // Initializing the core frame may cause the new child to be detached, since 1761 // Initializing the core frame may cause the new child to be detached, since
1760 // it may dispatch a load event in the parent. 1762 // it may dispatch a load event in the parent.
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 static void ensureFrameLoaderHasCommitted(FrameLoader& frameLoader) 1982 static void ensureFrameLoaderHasCommitted(FrameLoader& frameLoader)
1981 { 1983 {
1982 // Internally, Blink uses CommittedMultipleRealLoads to track whether the 1984 // Internally, Blink uses CommittedMultipleRealLoads to track whether the
1983 // next commit should create a new history item or not. Ensure we have 1985 // next commit should create a new history item or not. Ensure we have
1984 // reached that state. 1986 // reached that state.
1985 if (frameLoader.stateMachine()->committedMultipleRealLoads()) 1987 if (frameLoader.stateMachine()->committedMultipleRealLoads())
1986 return; 1988 return;
1987 frameLoader.stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedMult ipleRealLoads); 1989 frameLoader.stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedMult ipleRealLoads);
1988 } 1990 }
1989 1991
1990 void WebLocalFrameImpl::initializeToReplaceRemoteFrame(WebRemoteFrame* oldWebFra me, const WebString& name, WebSandboxFlags flags) 1992 void WebLocalFrameImpl::initializeToReplaceRemoteFrame(WebRemoteFrame* oldWebFra me, const WebString& name, WebSandboxFlags flags, const WebFrameOwnerProperties& frameOwnerProperties)
1991 { 1993 {
1992 Frame* oldFrame = toCoreFrame(oldWebFrame); 1994 Frame* oldFrame = toCoreFrame(oldWebFrame);
1993 // Note: this *always* temporarily sets a frame owner, even for main frames! 1995 // Note: this *always* temporarily sets a frame owner, even for main frames!
1994 // When a core Frame is created with no owner, it attempts to set itself as 1996 // When a core Frame is created with no owner, it attempts to set itself as
1995 // the main frame of the Page. However, this is a provisional frame, and may 1997 // the main frame of the Page. However, this is a provisional frame, and may
1996 // disappear, so Page::m_mainFrame can't be updated just yet. 1998 // disappear, so Page::m_mainFrame can't be updated just yet.
1997 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = RemoteBridgeFrameOwner::create(nu llptr, SandboxNone); 1999 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = RemoteBridgeFrameOwner::create(nu llptr, SandboxNone, WebFrameOwnerProperties());
1998 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(m_frameLoaderClien tImpl.get(), oldFrame->host(), tempOwner.get()); 2000 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(m_frameLoaderClien tImpl.get(), oldFrame->host(), tempOwner.get());
1999 frame->setOwner(oldFrame->owner()); 2001 frame->setOwner(oldFrame->owner());
2000 if (frame->owner() && !frame->owner()->isLocal())
2001 toRemoteBridgeFrameOwner(frame->owner())->setSandboxFlags(static_cast<Sa ndboxFlags>(flags));
2002 frame->tree().setName(name); 2002 frame->tree().setName(name);
2003 setParent(oldWebFrame->parent()); 2003 setParent(oldWebFrame->parent());
2004 setOpener(oldWebFrame->opener()); 2004 setOpener(oldWebFrame->opener());
2005 setCoreFrame(frame); 2005 setCoreFrame(frame);
2006
2007 if (frame->owner() && !frame->owner()->isLocal()) {
2008 toRemoteBridgeFrameOwner(frame->owner())->setSandboxFlags(static_cast<Sa ndboxFlags>(flags));
2009 // Since a remote frame doesn't get the notifications about frame owner
2010 // property modifications, we need to sync up those properties here.
2011 WebLocalFrameImpl::fromFrame(frame.get())->setFrameOwnerProperties(frame OwnerProperties);
2012 }
2013
2006 // We must call init() after m_frame is assigned because it is referenced 2014 // We must call init() after m_frame is assigned because it is referenced
2007 // during init(). Note that this may dispatch JS events; the frame may be 2015 // during init(). Note that this may dispatch JS events; the frame may be
2008 // detached after init() returns. 2016 // detached after init() returns.
2009 frame->init(); 2017 frame->init();
2010 } 2018 }
2011 2019
2012 void WebLocalFrameImpl::setAutofillClient(WebAutofillClient* autofillClient) 2020 void WebLocalFrameImpl::setAutofillClient(WebAutofillClient* autofillClient)
2013 { 2021 {
2014 m_autofillClient = autofillClient; 2022 m_autofillClient = autofillClient;
2015 } 2023 }
(...skipping 12 matching lines...) Expand all
2028 m_devToolsAgent->dispose(); 2036 m_devToolsAgent->dispose();
2029 m_devToolsAgent.clear(); 2037 m_devToolsAgent.clear();
2030 } 2038 }
2031 } 2039 }
2032 2040
2033 WebDevToolsAgent* WebLocalFrameImpl::devToolsAgent() 2041 WebDevToolsAgent* WebLocalFrameImpl::devToolsAgent()
2034 { 2042 {
2035 return m_devToolsAgent.get(); 2043 return m_devToolsAgent.get();
2036 } 2044 }
2037 2045
2046 void WebLocalFrameImpl::setFrameOwnerProperties(const WebFrameOwnerProperties& f rameOwnerProperties)
2047 {
2048 // At the moment, this is only used to replicate frame owner properties
2049 // for frames with a remote owner.
2050 FrameOwner* owner = toCoreFrame(this)->owner();
2051 ASSERT(owner);
2052 toRemoteBridgeFrameOwner(owner)->setScrollingMode(frameOwnerProperties.scrol lingMode);
2053 toRemoteBridgeFrameOwner(owner)->setMarginWidth(frameOwnerProperties.marginW idth);
2054 toRemoteBridgeFrameOwner(owner)->setMarginHeight(frameOwnerProperties.margin Height);
2055 }
2056
2038 void WebLocalFrameImpl::sendPings(const WebNode& contextNode, const WebURL& dest inationURL) 2057 void WebLocalFrameImpl::sendPings(const WebNode& contextNode, const WebURL& dest inationURL)
2039 { 2058 {
2040 ASSERT(frame()); 2059 ASSERT(frame());
2041 Element* anchor = contextNode.constUnwrap<Node>()->enclosingLinkEventParentO rSelf(); 2060 Element* anchor = contextNode.constUnwrap<Node>()->enclosingLinkEventParentO rSelf();
2042 if (isHTMLAnchorElement(anchor)) 2061 if (isHTMLAnchorElement(anchor))
2043 toHTMLAnchorElement(anchor)->sendPings(destinationURL); 2062 toHTMLAnchorElement(anchor)->sendPings(destinationURL);
2044 } 2063 }
2045 2064
2046 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it em, 2065 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it em,
2047 WebURLRequest::CachePolicy cachePolicy) const 2066 WebURLRequest::CachePolicy cachePolicy) const
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 } 2219 }
2201 2220
2202 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const 2221 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const
2203 { 2222 {
2204 if (!frame()) 2223 if (!frame())
2205 return WebSandboxFlags::None; 2224 return WebSandboxFlags::None;
2206 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); 2225 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( ));
2207 } 2226 }
2208 2227
2209 } // namespace blink 2228 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698