OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/child_frame_compositing_helper.h" | 5 #include "content/renderer/child_frame_compositing_helper.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "cc/blink/web_layer_impl.h" | 9 #include "cc/blink/web_layer_impl.h" |
10 #include "cc/layers/picture_image_layer.h" | 10 #include "cc/layers/picture_image_layer.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 crashed_layer->AddChild(sad_layer); | 202 crashed_layer->AddChild(sad_layer); |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
206 std::unique_ptr<blink::WebLayer> layer( | 206 std::unique_ptr<blink::WebLayer> layer( |
207 new cc_blink::WebLayerImpl(crashed_layer)); | 207 new cc_blink::WebLayerImpl(crashed_layer)); |
208 UpdateWebLayer(std::move(layer)); | 208 UpdateWebLayer(std::move(layer)); |
209 } | 209 } |
210 | 210 |
211 void ChildFrameCompositingHelper::OnSetSurface( | 211 void ChildFrameCompositingHelper::OnSetSurface( |
212 const cc::SurfaceId& surface_id, | 212 const cc::SurfaceInfo& surface_info, |
213 const gfx::Size& frame_size, | |
214 float scale_factor, | |
215 const cc::SurfaceSequence& sequence) { | 213 const cc::SurfaceSequence& sequence) { |
216 surface_id_ = surface_id; | 214 float scale_factor = surface_info.device_scale_factor(); |
| 215 surface_id_ = surface_info.id(); |
217 scoped_refptr<cc::SurfaceLayer> surface_layer = | 216 scoped_refptr<cc::SurfaceLayer> surface_layer = |
218 cc::SurfaceLayer::Create(surface_reference_factory_); | 217 cc::SurfaceLayer::Create(surface_reference_factory_); |
219 // TODO(oshima): This is a stopgap fix so that the compositor does not | 218 // TODO(oshima): This is a stopgap fix so that the compositor does not |
220 // scaledown the content when 2x frame data is added to 1x parent frame data. | 219 // scaledown the content when 2x frame data is added to 1x parent frame data. |
221 // Fix this in cc/. | 220 // Fix this in cc/. |
222 if (IsUseZoomForDSFEnabled()) | 221 if (IsUseZoomForDSFEnabled()) |
223 scale_factor = 1.0f; | 222 scale_factor = 1.0f; |
224 cc::SurfaceInfo info(surface_id, scale_factor, frame_size); | 223 |
225 surface_layer->SetSurfaceInfo(info, | 224 surface_layer->SetSurfaceInfo(cc::SurfaceInfo(surface_info.id(), scale_factor, |
| 225 surface_info.size_in_pixels()), |
226 false /* stretch_content_to_fill_bounds */); | 226 false /* stretch_content_to_fill_bounds */); |
227 surface_layer->SetMasksToBounds(true); | 227 surface_layer->SetMasksToBounds(true); |
228 std::unique_ptr<cc_blink::WebLayerImpl> layer( | 228 std::unique_ptr<cc_blink::WebLayerImpl> layer( |
229 new cc_blink::WebLayerImpl(surface_layer)); | 229 new cc_blink::WebLayerImpl(surface_layer)); |
230 // TODO(lfg): Investigate if it's possible to propagate the information about | 230 // TODO(lfg): Investigate if it's possible to propagate the information about |
231 // the child surface's opacity. https://crbug.com/629851. | 231 // the child surface's opacity. https://crbug.com/629851. |
232 layer->setOpaque(false); | 232 layer->setOpaque(false); |
233 layer->SetContentsOpaqueIsFixed(true); | 233 layer->SetContentsOpaqueIsFixed(true); |
234 UpdateWebLayer(std::move(layer)); | 234 UpdateWebLayer(std::move(layer)); |
235 | 235 |
236 UpdateVisibility(true); | 236 UpdateVisibility(true); |
237 | 237 |
238 // The RWHV creates a destruction dependency on the surface that needs to be | 238 // The RWHV creates a destruction dependency on the surface that needs to be |
239 // satisfied. Note: render_frame_proxy_ is null in the case our client is a | 239 // satisfied. Note: render_frame_proxy_ is null in the case our client is a |
240 // BrowserPlugin; in this case the BrowserPlugin sends its own SatisfySequence | 240 // BrowserPlugin; in this case the BrowserPlugin sends its own SatisfySequence |
241 // message. | 241 // message. |
242 if (render_frame_proxy_) { | 242 if (render_frame_proxy_) { |
243 render_frame_proxy_->Send( | 243 render_frame_proxy_->Send( |
244 new FrameHostMsg_SatisfySequence(host_routing_id_, sequence)); | 244 new FrameHostMsg_SatisfySequence(host_routing_id_, sequence)); |
245 } else if (browser_plugin_.get()) { | 245 } else if (browser_plugin_.get()) { |
246 browser_plugin_->SendSatisfySequence(sequence); | 246 browser_plugin_->SendSatisfySequence(sequence); |
247 } | 247 } |
248 | 248 |
249 CheckSizeAndAdjustLayerProperties( | 249 CheckSizeAndAdjustLayerProperties( |
250 frame_size, scale_factor, | 250 surface_info.size_in_pixels(), surface_info.device_scale_factor(), |
251 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer()); | 251 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer()); |
252 } | 252 } |
253 | 253 |
254 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { | 254 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { |
255 if (web_layer_) | 255 if (web_layer_) |
256 web_layer_->setDrawsContent(visible); | 256 web_layer_->setDrawsContent(visible); |
257 } | 257 } |
258 | 258 |
259 } // namespace content | 259 } // namespace content |
OLD | NEW |