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

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: 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 // 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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 570
571 // static 571 // static
572 void RenderFrameImpl::CreateFrame( 572 void RenderFrameImpl::CreateFrame(
573 int routing_id, 573 int routing_id,
574 int proxy_routing_id, 574 int proxy_routing_id,
575 int opener_routing_id, 575 int opener_routing_id,
576 int parent_routing_id, 576 int parent_routing_id,
577 int previous_sibling_routing_id, 577 int previous_sibling_routing_id,
578 const FrameReplicationState& replicated_state, 578 const FrameReplicationState& replicated_state,
579 CompositorDependencies* compositor_deps, 579 CompositorDependencies* compositor_deps,
580 const FrameMsg_NewFrame_WidgetParams& widget_params) { 580 const FrameMsg_NewFrame_WidgetParams& widget_params,
581 const blink::WebFrameOwnerProperties& frame_owner_properties) {
581 blink::WebLocalFrame* web_frame; 582 blink::WebLocalFrame* web_frame;
582 RenderFrameImpl* render_frame; 583 RenderFrameImpl* render_frame;
583 if (proxy_routing_id == MSG_ROUTING_NONE) { 584 if (proxy_routing_id == MSG_ROUTING_NONE) {
584 RenderFrameProxy* parent_proxy = 585 RenderFrameProxy* parent_proxy =
585 RenderFrameProxy::FromRoutingID(parent_routing_id); 586 RenderFrameProxy::FromRoutingID(parent_routing_id);
586 // If the browser is sending a valid parent routing id, it should already 587 // If the browser is sending a valid parent routing id, it should already
587 // be created and registered. 588 // be created and registered.
588 CHECK(parent_proxy); 589 CHECK(parent_proxy);
589 blink::WebRemoteFrame* parent_web_frame = parent_proxy->web_frame(); 590 blink::WebRemoteFrame* parent_web_frame = parent_proxy->web_frame();
590 591
591 blink::WebFrame* previous_sibling_web_frame = nullptr; 592 blink::WebFrame* previous_sibling_web_frame = nullptr;
592 RenderFrameProxy* previous_sibling_proxy = 593 RenderFrameProxy* previous_sibling_proxy =
593 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id); 594 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id);
594 if (previous_sibling_proxy) 595 if (previous_sibling_proxy)
595 previous_sibling_web_frame = previous_sibling_proxy->web_frame(); 596 previous_sibling_web_frame = previous_sibling_proxy->web_frame();
596 597
597 // Create the RenderFrame and WebLocalFrame, linking the two. 598 // Create the RenderFrame and WebLocalFrame, linking the two.
598 render_frame = 599 render_frame =
599 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); 600 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id);
600 web_frame = parent_web_frame->createLocalChild( 601 web_frame = parent_web_frame->createLocalChild(
601 replicated_state.scope, WebString::fromUTF8(replicated_state.name), 602 replicated_state.scope, WebString::fromUTF8(replicated_state.name),
602 replicated_state.sandbox_flags, render_frame, 603 replicated_state.sandbox_flags, render_frame,
603 previous_sibling_web_frame); 604 previous_sibling_web_frame, frame_owner_properties);
604 } else { 605 } else {
605 RenderFrameProxy* proxy = 606 RenderFrameProxy* proxy =
606 RenderFrameProxy::FromRoutingID(proxy_routing_id); 607 RenderFrameProxy::FromRoutingID(proxy_routing_id);
607 CHECK(proxy); 608 CHECK(proxy);
608 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id); 609 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id);
609 web_frame = 610 web_frame =
610 blink::WebLocalFrame::create(replicated_state.scope, render_frame); 611 blink::WebLocalFrame::create(replicated_state.scope, render_frame);
611 render_frame->proxy_routing_id_ = proxy_routing_id; 612 render_frame->proxy_routing_id_ = proxy_routing_id;
612 web_frame->initializeToReplaceRemoteFrame( 613 web_frame->initializeToReplaceRemoteFrame(
613 proxy->web_frame(), WebString::fromUTF8(replicated_state.name), 614 proxy->web_frame(), WebString::fromUTF8(replicated_state.name),
614 replicated_state.sandbox_flags); 615 replicated_state.sandbox_flags, frame_owner_properties);
615 } 616 }
616 render_frame->SetWebFrame(web_frame); 617 render_frame->SetWebFrame(web_frame);
617 CHECK_IMPLIES(parent_routing_id == MSG_ROUTING_NONE, !web_frame->parent()); 618 CHECK_IMPLIES(parent_routing_id == MSG_ROUTING_NONE, !web_frame->parent());
618 619
619 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr); 620 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr);
620 web_frame->setOpener(opener); 621 web_frame->setOpener(opener);
621 622
622 if (widget_params.routing_id != MSG_ROUTING_NONE) { 623 if (widget_params.routing_id != MSG_ROUTING_NONE) {
623 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); 624 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible());
624 render_frame->render_widget_ = RenderWidget::CreateForFrame( 625 render_frame->render_widget_ = RenderWidget::CreateForFrame(
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) 1117 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload)
1117 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, 1118 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest,
1118 OnTextSurroundingSelectionRequest) 1119 OnTextSurroundingSelectionRequest)
1119 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, 1120 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode,
1120 OnSetAccessibilityMode) 1121 OnSetAccessibilityMode)
1121 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree, 1122 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree,
1122 OnSnapshotAccessibilityTree) 1123 OnSnapshotAccessibilityTree)
1123 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) 1124 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener)
1124 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) 1125 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation)
1125 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) 1126 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags)
1127 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties,
1128 OnSetFrameOwnerProperties)
1126 IPC_MESSAGE_HANDLER(FrameMsg_ClearFocus, OnClearFocus) 1129 IPC_MESSAGE_HANDLER(FrameMsg_ClearFocus, OnClearFocus)
1127 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, 1130 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings,
1128 OnTextTrackSettingsChanged) 1131 OnTextTrackSettingsChanged)
1129 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) 1132 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent)
1130 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) 1133 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation)
1131 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, 1134 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks,
1132 OnGetSavableResourceLinks) 1135 OnGetSavableResourceLinks)
1133 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, 1136 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks,
1134 OnGetSerializedHtmlWithLocalLinks) 1137 OnGetSerializedHtmlWithLocalLinks)
1135 #if defined(OS_ANDROID) 1138 #if defined(OS_ANDROID)
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 1676
1674 void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) { 1677 void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) {
1675 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr); 1678 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr);
1676 frame_->setOpener(opener); 1679 frame_->setOpener(opener);
1677 } 1680 }
1678 1681
1679 void RenderFrameImpl::OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags) { 1682 void RenderFrameImpl::OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags) {
1680 frame_->setFrameOwnerSandboxFlags(flags); 1683 frame_->setFrameOwnerSandboxFlags(flags);
1681 } 1684 }
1682 1685
1686 void RenderFrameImpl::OnSetFrameOwnerProperties(
1687 const blink::WebFrameOwnerProperties& frame_owner_properties) {
1688 DCHECK(frame_);
1689 frame_->setFrameOwnerProperties(frame_owner_properties);
1690 }
1691
1683 void RenderFrameImpl::OnClearFocus() { 1692 void RenderFrameImpl::OnClearFocus() {
1684 frame_->clearFocus(); 1693 frame_->clearFocus();
1685 } 1694 }
1686 1695
1687 void RenderFrameImpl::OnTextTrackSettingsChanged( 1696 void RenderFrameImpl::OnTextTrackSettingsChanged(
1688 const FrameMsg_TextTrackSettings_Params& params) { 1697 const FrameMsg_TextTrackSettings_Params& params) {
1689 DCHECK(!frame_->parent()); 1698 DCHECK(!frame_->parent());
1690 if (!render_view_->webview()) 1699 if (!render_view_->webview())
1691 return; 1700 return;
1692 1701
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
2211 if (!navigation_state->request_committed()) { 2220 if (!navigation_state->request_committed()) {
2212 Send(new FrameHostMsg_DidAccessInitialDocument(routing_id_)); 2221 Send(new FrameHostMsg_DidAccessInitialDocument(routing_id_));
2213 } 2222 }
2214 } 2223 }
2215 } 2224 }
2216 2225
2217 blink::WebFrame* RenderFrameImpl::createChildFrame( 2226 blink::WebFrame* RenderFrameImpl::createChildFrame(
2218 blink::WebLocalFrame* parent, 2227 blink::WebLocalFrame* parent,
2219 blink::WebTreeScopeType scope, 2228 blink::WebTreeScopeType scope,
2220 const blink::WebString& name, 2229 const blink::WebString& name,
2221 blink::WebSandboxFlags sandbox_flags) { 2230 blink::WebSandboxFlags sandbox_flags,
2231 const blink::WebFrameOwnerProperties& frameOwnerProperties) {
2222 // Synchronously notify the browser of a child frame creation to get the 2232 // Synchronously notify the browser of a child frame creation to get the
2223 // routing_id for the RenderFrame. 2233 // routing_id for the RenderFrame.
2224 int child_routing_id = MSG_ROUTING_NONE; 2234 int child_routing_id = MSG_ROUTING_NONE;
2225 Send(new FrameHostMsg_CreateChildFrame( 2235 Send(new FrameHostMsg_CreateChildFrame(
2226 routing_id_, scope, 2236 routing_id_, scope, base::UTF16ToUTF8(base::StringPiece16(name)),
2227 base::UTF16ToUTF8(base::StringPiece16(name)), sandbox_flags, 2237 sandbox_flags, frameOwnerProperties, &child_routing_id));
2228 &child_routing_id));
2229 2238
2230 // Allocation of routing id failed, so we can't create a child frame. This can 2239 // Allocation of routing id failed, so we can't create a child frame. This can
2231 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped 2240 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped
2232 // out state or synchronous IPC message above has failed. 2241 // out state or synchronous IPC message above has failed.
2233 if (child_routing_id == MSG_ROUTING_NONE) { 2242 if (child_routing_id == MSG_ROUTING_NONE) {
2234 NOTREACHED() << "Failed to allocate routing id for child frame."; 2243 NOTREACHED() << "Failed to allocate routing id for child frame.";
2235 return nullptr; 2244 return nullptr;
2236 } 2245 }
2237 2246
2238 // This method is always called by local frames, never remote frames. 2247 // This method is always called by local frames, never remote frames.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2353 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name)))); 2362 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name))));
2354 } 2363 }
2355 } 2364 }
2356 2365
2357 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame, 2366 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame,
2358 blink::WebSandboxFlags flags) { 2367 blink::WebSandboxFlags flags) {
2359 Send(new FrameHostMsg_DidChangeSandboxFlags( 2368 Send(new FrameHostMsg_DidChangeSandboxFlags(
2360 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), flags)); 2369 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), flags));
2361 } 2370 }
2362 2371
2372 void RenderFrameImpl::didChangeFrameOwnerProperties(
2373 blink::WebFrame* child_frame,
2374 const blink::WebFrameOwnerProperties& frame_owner_properties) {
2375 Send(new FrameHostMsg_DidChangeFrameOwnerProperties(
2376 routing_id_, GetRoutingIdForFrameOrProxy(child_frame),
2377 frame_owner_properties));
2378 }
2379
2363 void RenderFrameImpl::didMatchCSS( 2380 void RenderFrameImpl::didMatchCSS(
2364 blink::WebLocalFrame* frame, 2381 blink::WebLocalFrame* frame,
2365 const blink::WebVector<blink::WebString>& newly_matching_selectors, 2382 const blink::WebVector<blink::WebString>& newly_matching_selectors,
2366 const blink::WebVector<blink::WebString>& stopped_matching_selectors) { 2383 const blink::WebVector<blink::WebString>& stopped_matching_selectors) {
2367 DCHECK(!frame_ || frame_ == frame); 2384 DCHECK(!frame_ || frame_ == frame);
2368 2385
2369 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, 2386 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
2370 DidMatchCSS(newly_matching_selectors, 2387 DidMatchCSS(newly_matching_selectors,
2371 stopped_matching_selectors)); 2388 stopped_matching_selectors));
2372 } 2389 }
(...skipping 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after
5197 mojo::ServiceProviderPtr service_provider; 5214 mojo::ServiceProviderPtr service_provider;
5198 mojo::URLRequestPtr request(mojo::URLRequest::New()); 5215 mojo::URLRequestPtr request(mojo::URLRequest::New());
5199 request->url = mojo::String::From(url); 5216 request->url = mojo::String::From(url);
5200 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), 5217 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider),
5201 nullptr, nullptr, 5218 nullptr, nullptr,
5202 base::Bind(&OnGotContentHandlerID)); 5219 base::Bind(&OnGotContentHandlerID));
5203 return service_provider.Pass(); 5220 return service_provider.Pass();
5204 } 5221 }
5205 5222
5206 } // namespace content 5223 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698