OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 return gfx::Vector2dF(); | 379 return gfx::Vector2dF(); |
380 | 380 |
381 return scroll_clip_layer->bounds_delta(); | 381 return scroll_clip_layer->bounds_delta(); |
382 } | 382 } |
383 | 383 |
384 std::unique_ptr<base::DictionaryValue> LayerImpl::LayerTreeAsJson() { | 384 std::unique_ptr<base::DictionaryValue> LayerImpl::LayerTreeAsJson() { |
385 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue); | 385 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue); |
386 result->SetInteger("LayerId", id()); | 386 result->SetInteger("LayerId", id()); |
387 result->SetString("LayerType", LayerTypeAsString()); | 387 result->SetString("LayerType", LayerTypeAsString()); |
388 | 388 |
389 base::ListValue* list = new base::ListValue; | 389 auto list = base::MakeUnique<base::ListValue>(); |
390 list->AppendInteger(bounds().width()); | 390 list->AppendInteger(bounds().width()); |
391 list->AppendInteger(bounds().height()); | 391 list->AppendInteger(bounds().height()); |
392 result->Set("Bounds", list); | 392 result->Set("Bounds", std::move(list)); |
393 | 393 |
394 list = new base::ListValue; | 394 list = base::MakeUnique<base::ListValue>(); |
395 list->AppendDouble(position_.x()); | 395 list->AppendDouble(position_.x()); |
396 list->AppendDouble(position_.y()); | 396 list->AppendDouble(position_.y()); |
397 result->Set("Position", list); | 397 result->Set("Position", std::move(list)); |
398 | 398 |
399 const gfx::Transform& gfx_transform = test_properties()->transform; | 399 const gfx::Transform& gfx_transform = test_properties()->transform; |
400 double transform[16]; | 400 double transform[16]; |
401 gfx_transform.matrix().asColMajord(transform); | 401 gfx_transform.matrix().asColMajord(transform); |
402 list = new base::ListValue; | 402 list = base::MakeUnique<base::ListValue>(); |
403 for (int i = 0; i < 16; ++i) | 403 for (int i = 0; i < 16; ++i) |
404 list->AppendDouble(transform[i]); | 404 list->AppendDouble(transform[i]); |
405 result->Set("Transform", list); | 405 result->Set("Transform", std::move(list)); |
406 | 406 |
407 result->SetBoolean("DrawsContent", draws_content_); | 407 result->SetBoolean("DrawsContent", draws_content_); |
408 result->SetBoolean("Is3dSorted", Is3dSorted()); | 408 result->SetBoolean("Is3dSorted", Is3dSorted()); |
409 result->SetDouble("OPACITY", Opacity()); | 409 result->SetDouble("OPACITY", Opacity()); |
410 result->SetBoolean("ContentsOpaque", contents_opaque_); | 410 result->SetBoolean("ContentsOpaque", contents_opaque_); |
411 | 411 |
412 if (scrollable()) | 412 if (scrollable()) |
413 result->SetBoolean("Scrollable", true); | 413 result->SetBoolean("Scrollable", true); |
414 | 414 |
415 if (!touch_event_handler_region_.IsEmpty()) { | 415 if (!touch_event_handler_region_.IsEmpty()) { |
416 std::unique_ptr<base::Value> region = touch_event_handler_region_.AsValue(); | 416 std::unique_ptr<base::Value> region = touch_event_handler_region_.AsValue(); |
417 result->Set("TouchRegion", region.release()); | 417 result->Set("TouchRegion", std::move(region)); |
418 } | 418 } |
419 | 419 |
420 list = new base::ListValue; | 420 list = base::MakeUnique<base::ListValue>(); |
421 for (size_t i = 0; i < test_properties()->children.size(); ++i) | 421 for (size_t i = 0; i < test_properties()->children.size(); ++i) |
422 list->Append(test_properties()->children[i]->LayerTreeAsJson()); | 422 list->Append(test_properties()->children[i]->LayerTreeAsJson()); |
423 result->Set("Children", list); | 423 result->Set("Children", std::move(list)); |
424 | 424 |
425 return result; | 425 return result; |
426 } | 426 } |
427 | 427 |
428 bool LayerImpl::LayerPropertyChanged() const { | 428 bool LayerImpl::LayerPropertyChanged() const { |
429 if (layer_property_changed_ || GetPropertyTrees()->full_tree_damaged) | 429 if (layer_property_changed_ || GetPropertyTrees()->full_tree_damaged) |
430 return true; | 430 return true; |
431 if (transform_tree_index() == TransformTree::kInvalidNodeId) | 431 if (transform_tree_index() == TransformTree::kInvalidNodeId) |
432 return false; | 432 return false; |
433 TransformNode* transform_node = | 433 TransformNode* transform_node = |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 | 1050 |
1051 ScrollTree& LayerImpl::GetScrollTree() const { | 1051 ScrollTree& LayerImpl::GetScrollTree() const { |
1052 return GetPropertyTrees()->scroll_tree; | 1052 return GetPropertyTrees()->scroll_tree; |
1053 } | 1053 } |
1054 | 1054 |
1055 TransformTree& LayerImpl::GetTransformTree() const { | 1055 TransformTree& LayerImpl::GetTransformTree() const { |
1056 return GetPropertyTrees()->transform_tree; | 1056 return GetPropertyTrees()->transform_tree; |
1057 } | 1057 } |
1058 | 1058 |
1059 } // namespace cc | 1059 } // namespace cc |
OLD | NEW |