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

Unified 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: consolidate render->browser ipcs into one 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 13e8952694f0183f9f9dc8598c8ce78fc9bcfc30..82613f19f064270d3ae8c6b94a19c1c557b08630 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -246,6 +246,13 @@ namespace content {
namespace {
+int GetRoutingIDForFrame(blink::WebFrame* child_frame) {
+ if (child_frame->isWebRemoteFrame())
+ return RenderFrameProxy::FromWebFrame(child_frame)->routing_id();
+
+ return RenderFrameImpl::FromWebFrame(child_frame)->GetRoutingID();
+}
+
const char kDefaultAcceptHeader[] =
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/"
"*;q=0.8";
@@ -589,7 +596,8 @@ void RenderFrameImpl::CreateFrame(
int previous_sibling_routing_id,
const FrameReplicationState& replicated_state,
CompositorDependencies* compositor_deps,
- const FrameMsg_NewFrame_WidgetParams& widget_params) {
+ const FrameMsg_NewFrame_WidgetParams& widget_params,
+ const blink::WebFrameOwnerProperties& frame_owner_properties) {
blink::WebLocalFrame* web_frame;
RenderFrameImpl* render_frame;
if (proxy_routing_id == MSG_ROUTING_NONE) {
@@ -612,7 +620,7 @@ void RenderFrameImpl::CreateFrame(
web_frame = parent_web_frame->createLocalChild(
replicated_state.scope, WebString::fromUTF8(replicated_state.name),
replicated_state.sandbox_flags, render_frame,
- previous_sibling_web_frame);
+ previous_sibling_web_frame, frame_owner_properties);
} else {
RenderFrameProxy* proxy =
RenderFrameProxy::FromRoutingID(proxy_routing_id);
@@ -623,7 +631,7 @@ void RenderFrameImpl::CreateFrame(
render_frame->proxy_routing_id_ = proxy_routing_id;
web_frame->initializeToReplaceRemoteFrame(
proxy->web_frame(), WebString::fromUTF8(replicated_state.name),
- replicated_state.sandbox_flags);
+ replicated_state.sandbox_flags, frame_owner_properties);
}
render_frame->SetWebFrame(web_frame);
CHECK_IMPLIES(parent_routing_id == MSG_ROUTING_NONE, !web_frame->parent());
@@ -1127,6 +1135,8 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener)
IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation)
IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags)
+ IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties,
+ OnSetFrameOwnerProperties)
IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings,
OnTextTrackSettingsChanged)
IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent)
@@ -1678,6 +1688,12 @@ void RenderFrameImpl::OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags) {
frame_->setFrameOwnerSandboxFlags(flags);
}
+void RenderFrameImpl::OnSetFrameOwnerProperties(
+ const blink::WebFrameOwnerProperties& frame_owner_properties) {
+ DCHECK(frame_);
+ frame_->setFrameOwnerProperties(frame_owner_properties);
+}
+
void RenderFrameImpl::OnTextTrackSettingsChanged(
const FrameMsg_TextTrackSettings_Params& params) {
DCHECK(!frame_->parent());
@@ -2211,14 +2227,14 @@ blink::WebFrame* RenderFrameImpl::createChildFrame(
blink::WebLocalFrame* parent,
blink::WebTreeScopeType scope,
const blink::WebString& name,
- blink::WebSandboxFlags sandbox_flags) {
+ blink::WebSandboxFlags sandbox_flags,
+ const blink::WebFrameOwnerProperties& frameOwnerProperties) {
// Synchronously notify the browser of a child frame creation to get the
// routing_id for the RenderFrame.
int child_routing_id = MSG_ROUTING_NONE;
Send(new FrameHostMsg_CreateChildFrame(
- routing_id_, scope,
- base::UTF16ToUTF8(base::StringPiece16(name)), sandbox_flags,
- &child_routing_id));
+ routing_id_, scope, base::UTF16ToUTF8(base::StringPiece16(name)),
+ sandbox_flags, frameOwnerProperties, &child_routing_id));
// Allocation of routing id failed, so we can't create a child frame. This can
// happen if this RenderFrameImpl's IPCs are being filtered when in swapped
@@ -2341,19 +2357,33 @@ void RenderFrameImpl::didChangeName(blink::WebLocalFrame* frame,
void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame,
blink::WebSandboxFlags flags) {
- int frame_routing_id = MSG_ROUTING_NONE;
- if (child_frame->isWebRemoteFrame()) {
- frame_routing_id =
- RenderFrameProxy::FromWebFrame(child_frame)->routing_id();
- } else {
- frame_routing_id =
- RenderFrameImpl::FromWebFrame(child_frame)->GetRoutingID();
- }
-
+ int frame_routing_id = GetRoutingIDForFrame(child_frame);
Send(new FrameHostMsg_DidChangeSandboxFlags(routing_id_, frame_routing_id,
flags));
}
+void RenderFrameImpl::didChangeScrollingMode(
+ blink::WebFrame* child_frame,
+ blink::WebFrameOwnerProperties::ScrollingMode scrolling_mode) {
+ int frame_routing_id = GetRoutingIDForFrame(child_frame);
+ frame_owner_properties_.scrollingMode = scrolling_mode;
+ DidChangeFrameOwnerProperties(frame_routing_id);
+}
+
+void RenderFrameImpl::didChangeMarginWidth(blink::WebFrame* child_frame,
+ int marginWidth) {
+ int frame_routing_id = GetRoutingIDForFrame(child_frame);
+ frame_owner_properties_.marginWidth = marginWidth;
+ DidChangeFrameOwnerProperties(frame_routing_id);
+}
+
+void RenderFrameImpl::didChangeMarginHeight(blink::WebFrame* child_frame,
+ int marginHeight) {
+ int frame_routing_id = GetRoutingIDForFrame(child_frame);
+ frame_owner_properties_.marginHeight = marginHeight;
+ DidChangeFrameOwnerProperties(frame_routing_id);
+}
+
void RenderFrameImpl::didMatchCSS(
blink::WebLocalFrame* frame,
const blink::WebVector<blink::WebString>& newly_matching_selectors,
@@ -4994,6 +5024,11 @@ NavigationState* RenderFrameImpl::CreateNavigationStateFromPending() {
return NavigationStateImpl::CreateContentInitiated();
}
+void RenderFrameImpl::DidChangeFrameOwnerProperties(int frame_routing_id) {
+ Send(new FrameHostMsg_DidChangeFrameOwnerProperties(
+ routing_id_, frame_routing_id, frame_owner_properties_));
+}
+
#if defined(OS_ANDROID)
WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer(
WebMediaPlayerClient* client,

Powered by Google App Engine
This is Rietveld 408576698