| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 float scale_factor = surface_info.device_scale_factor(); | 216 float scale_factor = surface_info.device_scale_factor(); |
| 217 surface_id_ = surface_info.id(); | 217 surface_id_ = surface_info.id(); |
| 218 scoped_refptr<cc::SurfaceLayer> surface_layer = | 218 scoped_refptr<cc::SurfaceLayer> surface_layer = |
| 219 cc::SurfaceLayer::Create(surface_reference_factory_); | 219 cc::SurfaceLayer::Create(surface_reference_factory_); |
| 220 // TODO(oshima): This is a stopgap fix so that the compositor does not | 220 // TODO(oshima): This is a stopgap fix so that the compositor does not |
| 221 // scaledown the content when 2x frame data is added to 1x parent frame data. | 221 // scaledown the content when 2x frame data is added to 1x parent frame data. |
| 222 // Fix this in cc/. | 222 // Fix this in cc/. |
| 223 if (IsUseZoomForDSFEnabled()) | 223 if (IsUseZoomForDSFEnabled()) |
| 224 scale_factor = 1.0f; | 224 scale_factor = 1.0f; |
| 225 | 225 |
| 226 surface_layer->SetPrimarySurfaceInfo(cc::SurfaceInfo( | 226 cc::SurfaceInfo modified_surface_info(surface_info.id(), scale_factor, |
| 227 surface_info.id(), scale_factor, surface_info.size_in_pixels())); | 227 surface_info.size_in_pixels()); |
| 228 surface_layer->SetPrimarySurfaceInfo(modified_surface_info); |
| 229 surface_layer->SetFallbackSurfaceInfo(modified_surface_info); |
| 228 surface_layer->SetMasksToBounds(true); | 230 surface_layer->SetMasksToBounds(true); |
| 229 std::unique_ptr<cc_blink::WebLayerImpl> layer( | 231 std::unique_ptr<cc_blink::WebLayerImpl> layer( |
| 230 new cc_blink::WebLayerImpl(surface_layer)); | 232 new cc_blink::WebLayerImpl(surface_layer)); |
| 231 // TODO(lfg): Investigate if it's possible to propagate the information about | 233 // TODO(lfg): Investigate if it's possible to propagate the information about |
| 232 // the child surface's opacity. https://crbug.com/629851. | 234 // the child surface's opacity. https://crbug.com/629851. |
| 233 layer->SetOpaque(false); | 235 layer->SetOpaque(false); |
| 234 layer->SetContentsOpaqueIsFixed(true); | 236 layer->SetContentsOpaqueIsFixed(true); |
| 235 UpdateWebLayer(std::move(layer)); | 237 UpdateWebLayer(std::move(layer)); |
| 236 | 238 |
| 237 UpdateVisibility(true); | 239 UpdateVisibility(true); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 251 surface_info.size_in_pixels(), surface_info.device_scale_factor(), | 253 surface_info.size_in_pixels(), surface_info.device_scale_factor(), |
| 252 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer()); | 254 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer()); |
| 253 } | 255 } |
| 254 | 256 |
| 255 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { | 257 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { |
| 256 if (web_layer_) | 258 if (web_layer_) |
| 257 web_layer_->SetDrawsContent(visible); | 259 web_layer_->SetDrawsContent(visible); |
| 258 } | 260 } |
| 259 | 261 |
| 260 } // namespace content | 262 } // namespace content |
| OLD | NEW |