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

Side by Side Diff: components/html_viewer/html_frame.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 for tests + merge blink/cr changes. 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/html_viewer/html_frame.h" 5 #include "components/html_viewer/html_frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 182 }
183 } else if (!params->is_local_create_child && params->view && 183 } else if (!params->is_local_create_child && params->view &&
184 id_ == params->view->id()) { 184 id_ == params->view->id()) {
185 // Frame represents the local frame, and it isn't the root of the tree. 185 // Frame represents the local frame, and it isn't the root of the tree.
186 HTMLFrame* previous_sibling = GetPreviousSibling(this); 186 HTMLFrame* previous_sibling = GetPreviousSibling(this);
187 blink::WebFrame* previous_web_frame = 187 blink::WebFrame* previous_web_frame =
188 previous_sibling ? previous_sibling->web_frame() : nullptr; 188 previous_sibling ? previous_sibling->web_frame() : nullptr;
189 CHECK(!parent_->IsLocal()); 189 CHECK(!parent_->IsLocal());
190 web_frame_ = parent_->web_frame()->toWebRemoteFrame()->createLocalChild( 190 web_frame_ = parent_->web_frame()->toWebRemoteFrame()->createLocalChild(
191 state_.tree_scope, state_.name, state_.sandbox_flags, this, 191 state_.tree_scope, state_.name, state_.sandbox_flags, this,
192 previous_web_frame); 192 previous_web_frame, state_.owner_properties);
193 CreateLocalRootWebWidget(web_frame_->toWebLocalFrame()); 193 CreateLocalRootWebWidget(web_frame_->toWebLocalFrame());
194 } else if (!parent_->IsLocal()) { 194 } else if (!parent_->IsLocal()) {
195 web_frame_ = parent_->web_frame()->toWebRemoteFrame()->createRemoteChild( 195 web_frame_ = parent_->web_frame()->toWebRemoteFrame()->createRemoteChild(
196 state_.tree_scope, state_.name, state_.sandbox_flags, this); 196 state_.tree_scope, state_.name, state_.sandbox_flags, this);
197 } else { 197 } else {
198 CHECK(params->is_local_create_child); 198 CHECK(params->is_local_create_child);
199 199
200 blink::WebLocalFrame* child_web_frame = 200 blink::WebLocalFrame* child_web_frame =
201 blink::WebLocalFrame::create(state_.tree_scope, this); 201 blink::WebLocalFrame::create(state_.tree_scope, this);
202 web_frame_ = child_web_frame; 202 web_frame_ = child_web_frame;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, 310 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
311 blink::WebContentDecryptionModule* initial_cdm) { 311 blink::WebContentDecryptionModule* initial_cdm) {
312 return global_state()->media_factory()->CreateMediaPlayer( 312 return global_state()->media_factory()->CreateMediaPlayer(
313 frame, url, client, encrypted_client, initial_cdm, GetApp()->shell()); 313 frame, url, client, encrypted_client, initial_cdm, GetApp()->shell());
314 } 314 }
315 315
316 blink::WebFrame* HTMLFrame::createChildFrame( 316 blink::WebFrame* HTMLFrame::createChildFrame(
317 blink::WebLocalFrame* parent, 317 blink::WebLocalFrame* parent,
318 blink::WebTreeScopeType scope, 318 blink::WebTreeScopeType scope,
319 const blink::WebString& frame_name, 319 const blink::WebString& frame_name,
320 blink::WebSandboxFlags sandbox_flags) { 320 blink::WebSandboxFlags sandbox_flags,
321 const blink::WebFrameOwnerProperties& frame_owner_properties) {
321 DCHECK(IsLocal()); // Can't create children of remote frames. 322 DCHECK(IsLocal()); // Can't create children of remote frames.
322 DCHECK_EQ(parent, web_frame_); 323 DCHECK_EQ(parent, web_frame_);
323 DCHECK(view_); // If we're local we have to have a view. 324 DCHECK(view_); // If we're local we have to have a view.
324 // Create the view that will house the frame now. We embed once we know the 325 // Create the view that will house the frame now. We embed once we know the
325 // url (see decidePolicyForNavigation()). 326 // url (see decidePolicyForNavigation()).
326 mus::View* child_view = view_->connection()->CreateView(); 327 mus::View* child_view = view_->connection()->CreateView();
327 ReplicatedFrameState child_state; 328 ReplicatedFrameState child_state;
328 child_state.name = frame_name; 329 child_state.name = frame_name;
329 child_state.tree_scope = scope; 330 child_state.tree_scope = scope;
330 child_state.sandbox_flags = sandbox_flags; 331 child_state.sandbox_flags = sandbox_flags;
332 child_state.owner_properties = frame_owner_properties;
331 mojo::Map<mojo::String, mojo::Array<uint8_t>> client_properties; 333 mojo::Map<mojo::String, mojo::Array<uint8_t>> client_properties;
332 client_properties.mark_non_null(); 334 client_properties.mark_non_null();
333 ClientPropertiesFromReplicatedFrameState(child_state, &client_properties); 335 ClientPropertiesFromReplicatedFrameState(child_state, &client_properties);
334 336
335 child_view->SetVisible(true); 337 child_view->SetVisible(true);
336 view_->AddChild(child_view); 338 view_->AddChild(child_view);
337 339
338 HTMLFrame::CreateParams params(frame_tree_manager_, this, child_view->id(), 340 HTMLFrame::CreateParams params(frame_tree_manager_, this, child_view->id(),
339 child_view, client_properties, nullptr); 341 child_view, client_properties, nullptr);
340 params.is_local_create_child = true; 342 params.is_local_create_child = true;
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 DVLOG(2) << "HTMLFrame::SwapToLocal this=" << this << " id=" << id_; 643 DVLOG(2) << "HTMLFrame::SwapToLocal this=" << this << " id=" << id_;
642 CHECK(!IsLocal()); 644 CHECK(!IsLocal());
643 // It doesn't make sense for the root to swap to local. 645 // It doesn't make sense for the root to swap to local.
644 CHECK(parent_); 646 CHECK(parent_);
645 delegate_ = delegate; 647 delegate_ = delegate;
646 SetView(view); 648 SetView(view);
647 SetReplicatedFrameStateFromClientProperties(properties, &state_); 649 SetReplicatedFrameStateFromClientProperties(properties, &state_);
648 blink::WebLocalFrame* local_web_frame = 650 blink::WebLocalFrame* local_web_frame =
649 blink::WebLocalFrame::create(state_.tree_scope, this); 651 blink::WebLocalFrame::create(state_.tree_scope, this);
650 local_web_frame->initializeToReplaceRemoteFrame( 652 local_web_frame->initializeToReplaceRemoteFrame(
651 web_frame_->toWebRemoteFrame(), state_.name, state_.sandbox_flags); 653 web_frame_->toWebRemoteFrame(), state_.name, state_.sandbox_flags,
654 state_.owner_properties);
652 // The swap() ends up calling to frameDetached() and deleting the old. 655 // The swap() ends up calling to frameDetached() and deleting the old.
653 web_frame_->swap(local_web_frame); 656 web_frame_->swap(local_web_frame);
654 web_frame_ = local_web_frame; 657 web_frame_ = local_web_frame;
655 658
656 web_layer_.reset(); 659 web_layer_.reset();
657 } 660 }
658 661
659 void HTMLFrame::SwapDelegate(HTMLFrameDelegate* delegate) { 662 void HTMLFrame::SwapDelegate(HTMLFrameDelegate* delegate) {
660 DCHECK(IsLocal()); 663 DCHECK(IsLocal());
661 HTMLFrameDelegate* old_delegate = delegate_; 664 HTMLFrameDelegate* old_delegate = delegate_;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 if (!surface_layer_) 921 if (!surface_layer_)
919 return; 922 return;
920 923
921 surface_layer_->SetSurfaceId( 924 surface_layer_->SetSurfaceId(
922 cc::SurfaceId(owned_view_->view()->id()), 925 cc::SurfaceId(owned_view_->view()->id()),
923 global_state()->device_pixel_ratio(), 926 global_state()->device_pixel_ratio(),
924 owned_view_->view()->bounds().To<gfx::Rect>().size()); 927 owned_view_->view()->bounds().To<gfx::Rect>().size());
925 } 928 }
926 929
927 } // namespace mojo 930 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698