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

Side by Side Diff: content/renderer/render_frame_impl.cc

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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 601
602 // static 602 // static
603 void RenderFrameImpl::CreateFrame( 603 void RenderFrameImpl::CreateFrame(
604 int routing_id, 604 int routing_id,
605 int proxy_routing_id, 605 int proxy_routing_id,
606 int opener_routing_id, 606 int opener_routing_id,
607 int parent_routing_id, 607 int parent_routing_id,
608 int previous_sibling_routing_id, 608 int previous_sibling_routing_id,
609 const FrameReplicationState& replicated_state, 609 const FrameReplicationState& replicated_state,
610 CompositorDependencies* compositor_deps, 610 CompositorDependencies* compositor_deps,
611 const FrameMsg_NewFrame_WidgetParams& widget_params) { 611 const FrameMsg_NewFrame_WidgetParams& widget_params,
612 const blink::WebFrameOwnerProperties& frame_owner_properties) {
612 blink::WebLocalFrame* web_frame; 613 blink::WebLocalFrame* web_frame;
613 RenderFrameImpl* render_frame; 614 RenderFrameImpl* render_frame;
614 if (proxy_routing_id == MSG_ROUTING_NONE) { 615 if (proxy_routing_id == MSG_ROUTING_NONE) {
615 RenderFrameProxy* parent_proxy = 616 RenderFrameProxy* parent_proxy =
616 RenderFrameProxy::FromRoutingID(parent_routing_id); 617 RenderFrameProxy::FromRoutingID(parent_routing_id);
617 // If the browser is sending a valid parent routing id, it should already 618 // If the browser is sending a valid parent routing id, it should already
618 // be created and registered. 619 // be created and registered.
619 CHECK(parent_proxy); 620 CHECK(parent_proxy);
620 blink::WebRemoteFrame* parent_web_frame = parent_proxy->web_frame(); 621 blink::WebRemoteFrame* parent_web_frame = parent_proxy->web_frame();
621 622
622 blink::WebFrame* previous_sibling_web_frame = nullptr; 623 blink::WebFrame* previous_sibling_web_frame = nullptr;
623 RenderFrameProxy* previous_sibling_proxy = 624 RenderFrameProxy* previous_sibling_proxy =
624 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id); 625 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id);
625 if (previous_sibling_proxy) 626 if (previous_sibling_proxy)
626 previous_sibling_web_frame = previous_sibling_proxy->web_frame(); 627 previous_sibling_web_frame = previous_sibling_proxy->web_frame();
627 628
628 // Create the RenderFrame and WebLocalFrame, linking the two. 629 // Create the RenderFrame and WebLocalFrame, linking the two.
629 render_frame = 630 render_frame =
630 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); 631 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id);
631 web_frame = parent_web_frame->createLocalChild( 632 web_frame = parent_web_frame->createLocalChild(
632 replicated_state.scope, WebString::fromUTF8(replicated_state.name), 633 replicated_state.scope, WebString::fromUTF8(replicated_state.name),
633 replicated_state.sandbox_flags, render_frame, 634 replicated_state.sandbox_flags, render_frame,
634 previous_sibling_web_frame); 635 previous_sibling_web_frame, frame_owner_properties);
635 } else { 636 } else {
636 RenderFrameProxy* proxy = 637 RenderFrameProxy* proxy =
637 RenderFrameProxy::FromRoutingID(proxy_routing_id); 638 RenderFrameProxy::FromRoutingID(proxy_routing_id);
638 CHECK(proxy); 639 CHECK(proxy);
639 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id); 640 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id);
640 web_frame = 641 web_frame =
641 blink::WebLocalFrame::create(replicated_state.scope, render_frame); 642 blink::WebLocalFrame::create(replicated_state.scope, render_frame);
642 render_frame->proxy_routing_id_ = proxy_routing_id; 643 render_frame->proxy_routing_id_ = proxy_routing_id;
643 web_frame->initializeToReplaceRemoteFrame( 644 web_frame->initializeToReplaceRemoteFrame(
644 proxy->web_frame(), WebString::fromUTF8(replicated_state.name), 645 proxy->web_frame(), WebString::fromUTF8(replicated_state.name),
645 replicated_state.sandbox_flags); 646 replicated_state.sandbox_flags, frame_owner_properties);
646 } 647 }
647 render_frame->SetWebFrame(web_frame); 648 render_frame->SetWebFrame(web_frame);
648 CHECK(parent_routing_id != MSG_ROUTING_NONE || !web_frame->parent()); 649 CHECK(parent_routing_id != MSG_ROUTING_NONE || !web_frame->parent());
649 650
650 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr); 651 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr);
651 web_frame->setOpener(opener); 652 web_frame->setOpener(opener);
652 653
653 if (widget_params.routing_id != MSG_ROUTING_NONE) { 654 if (widget_params.routing_id != MSG_ROUTING_NONE) {
654 CHECK(!web_frame->parent() || 655 CHECK(!web_frame->parent() ||
655 SiteIsolationPolicy::AreCrossProcessFramesPossible()); 656 SiteIsolationPolicy::AreCrossProcessFramesPossible());
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) 1159 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload)
1159 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, 1160 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest,
1160 OnTextSurroundingSelectionRequest) 1161 OnTextSurroundingSelectionRequest)
1161 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, 1162 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode,
1162 OnSetAccessibilityMode) 1163 OnSetAccessibilityMode)
1163 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree, 1164 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree,
1164 OnSnapshotAccessibilityTree) 1165 OnSnapshotAccessibilityTree)
1165 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) 1166 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener)
1166 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) 1167 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation)
1167 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) 1168 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags)
1169 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties,
1170 OnSetFrameOwnerProperties)
1168 IPC_MESSAGE_HANDLER(FrameMsg_ClearFocus, OnClearFocus) 1171 IPC_MESSAGE_HANDLER(FrameMsg_ClearFocus, OnClearFocus)
1169 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, 1172 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings,
1170 OnTextTrackSettingsChanged) 1173 OnTextTrackSettingsChanged)
1171 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) 1174 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent)
1172 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) 1175 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation)
1173 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, 1176 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks,
1174 OnGetSavableResourceLinks) 1177 OnGetSavableResourceLinks)
1175 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, 1178 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks,
1176 OnGetSerializedHtmlWithLocalLinks) 1179 OnGetSerializedHtmlWithLocalLinks)
1177 #if defined(OS_ANDROID) 1180 #if defined(OS_ANDROID)
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 1717
1715 void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) { 1718 void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) {
1716 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr); 1719 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr);
1717 frame_->setOpener(opener); 1720 frame_->setOpener(opener);
1718 } 1721 }
1719 1722
1720 void RenderFrameImpl::OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags) { 1723 void RenderFrameImpl::OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags) {
1721 frame_->setFrameOwnerSandboxFlags(flags); 1724 frame_->setFrameOwnerSandboxFlags(flags);
1722 } 1725 }
1723 1726
1727 void RenderFrameImpl::OnSetFrameOwnerProperties(
1728 const blink::WebFrameOwnerProperties& frame_owner_properties) {
1729 DCHECK(frame_);
1730 frame_->setFrameOwnerProperties(frame_owner_properties);
1731 }
1732
1724 void RenderFrameImpl::OnClearFocus() { 1733 void RenderFrameImpl::OnClearFocus() {
1725 frame_->clearFocus(); 1734 frame_->clearFocus();
1726 } 1735 }
1727 1736
1728 void RenderFrameImpl::OnTextTrackSettingsChanged( 1737 void RenderFrameImpl::OnTextTrackSettingsChanged(
1729 const FrameMsg_TextTrackSettings_Params& params) { 1738 const FrameMsg_TextTrackSettings_Params& params) {
1730 DCHECK(!frame_->parent()); 1739 DCHECK(!frame_->parent());
1731 if (!render_view_->webview()) 1740 if (!render_view_->webview())
1732 return; 1741 return;
1733 1742
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
2289 if (!navigation_state->request_committed()) { 2298 if (!navigation_state->request_committed()) {
2290 Send(new FrameHostMsg_DidAccessInitialDocument(routing_id_)); 2299 Send(new FrameHostMsg_DidAccessInitialDocument(routing_id_));
2291 } 2300 }
2292 } 2301 }
2293 } 2302 }
2294 2303
2295 blink::WebFrame* RenderFrameImpl::createChildFrame( 2304 blink::WebFrame* RenderFrameImpl::createChildFrame(
2296 blink::WebLocalFrame* parent, 2305 blink::WebLocalFrame* parent,
2297 blink::WebTreeScopeType scope, 2306 blink::WebTreeScopeType scope,
2298 const blink::WebString& name, 2307 const blink::WebString& name,
2299 blink::WebSandboxFlags sandbox_flags) { 2308 blink::WebSandboxFlags sandbox_flags,
2309 const blink::WebFrameOwnerProperties& frameOwnerProperties) {
2300 // Synchronously notify the browser of a child frame creation to get the 2310 // Synchronously notify the browser of a child frame creation to get the
2301 // routing_id for the RenderFrame. 2311 // routing_id for the RenderFrame.
2302 int child_routing_id = MSG_ROUTING_NONE; 2312 int child_routing_id = MSG_ROUTING_NONE;
2303 Send(new FrameHostMsg_CreateChildFrame( 2313 Send(new FrameHostMsg_CreateChildFrame(
2304 routing_id_, scope, 2314 routing_id_, scope, base::UTF16ToUTF8(base::StringPiece16(name)),
2305 base::UTF16ToUTF8(base::StringPiece16(name)), sandbox_flags, 2315 sandbox_flags, frameOwnerProperties, &child_routing_id));
2306 &child_routing_id));
2307 2316
2308 // Allocation of routing id failed, so we can't create a child frame. This can 2317 // Allocation of routing id failed, so we can't create a child frame. This can
2309 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped 2318 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped
2310 // out state or synchronous IPC message above has failed. 2319 // out state or synchronous IPC message above has failed.
2311 if (child_routing_id == MSG_ROUTING_NONE) { 2320 if (child_routing_id == MSG_ROUTING_NONE) {
2312 NOTREACHED() << "Failed to allocate routing id for child frame."; 2321 NOTREACHED() << "Failed to allocate routing id for child frame.";
2313 return nullptr; 2322 return nullptr;
2314 } 2323 }
2315 2324
2316 // This method is always called by local frames, never remote frames. 2325 // This method is always called by local frames, never remote frames.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2431 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name)))); 2440 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name))));
2432 } 2441 }
2433 } 2442 }
2434 2443
2435 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame, 2444 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame,
2436 blink::WebSandboxFlags flags) { 2445 blink::WebSandboxFlags flags) {
2437 Send(new FrameHostMsg_DidChangeSandboxFlags( 2446 Send(new FrameHostMsg_DidChangeSandboxFlags(
2438 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), flags)); 2447 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), flags));
2439 } 2448 }
2440 2449
2450 void RenderFrameImpl::didChangeFrameOwnerProperties(
2451 blink::WebFrame* child_frame,
2452 const blink::WebFrameOwnerProperties& frame_owner_properties) {
2453 Send(new FrameHostMsg_DidChangeFrameOwnerProperties(
2454 routing_id_, GetRoutingIdForFrameOrProxy(child_frame),
2455 frame_owner_properties));
2456 }
2457
2441 void RenderFrameImpl::didMatchCSS( 2458 void RenderFrameImpl::didMatchCSS(
2442 blink::WebLocalFrame* frame, 2459 blink::WebLocalFrame* frame,
2443 const blink::WebVector<blink::WebString>& newly_matching_selectors, 2460 const blink::WebVector<blink::WebString>& newly_matching_selectors,
2444 const blink::WebVector<blink::WebString>& stopped_matching_selectors) { 2461 const blink::WebVector<blink::WebString>& stopped_matching_selectors) {
2445 DCHECK(!frame_ || frame_ == frame); 2462 DCHECK(!frame_ || frame_ == frame);
2446 2463
2447 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, 2464 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
2448 DidMatchCSS(newly_matching_selectors, 2465 DidMatchCSS(newly_matching_selectors,
2449 stopped_matching_selectors)); 2466 stopped_matching_selectors));
2450 } 2467 }
(...skipping 2836 matching lines...) Expand 10 before | Expand all | Expand 10 after
5287 mojo::ServiceProviderPtr service_provider; 5304 mojo::ServiceProviderPtr service_provider;
5288 mojo::URLRequestPtr request(mojo::URLRequest::New()); 5305 mojo::URLRequestPtr request(mojo::URLRequest::New());
5289 request->url = mojo::String::From(url); 5306 request->url = mojo::String::From(url);
5290 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), 5307 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider),
5291 nullptr, nullptr, 5308 nullptr, nullptr,
5292 base::Bind(&OnGotContentHandlerID)); 5309 base::Bind(&OnGotContentHandlerID));
5293 return service_provider.Pass(); 5310 return service_provider.Pass();
5294 } 5311 }
5295 5312
5296 } // namespace content 5313 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698