OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test/layer_tree_json_parser.h" | 5 #include "cc/test/layer_tree_json_parser.h" |
6 | 6 |
7 #include "base/test/values_test_util.h" | 7 #include "base/test/values_test_util.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "cc/layers/content_layer.h" | 9 #include "cc/layers/content_layer.h" |
10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 double opacity; | 95 double opacity; |
96 if (dict->GetDouble("Opacity", &opacity)) | 96 if (dict->GetDouble("Opacity", &opacity)) |
97 new_layer->SetOpacity(opacity); | 97 new_layer->SetOpacity(opacity); |
98 | 98 |
99 bool contents_opaque; | 99 bool contents_opaque; |
100 if (dict->GetBoolean("ContentsOpaque", &contents_opaque)) | 100 if (dict->GetBoolean("ContentsOpaque", &contents_opaque)) |
101 new_layer->SetContentsOpaque(contents_opaque); | 101 new_layer->SetContentsOpaque(contents_opaque); |
102 | 102 |
103 bool scrollable; | 103 bool scrollable; |
| 104 // TODO(wjmaclean) Fix the JSON layer parsing format. |
104 if (dict->GetBoolean("Scrollable", &scrollable)) | 105 if (dict->GetBoolean("Scrollable", &scrollable)) |
105 new_layer->SetScrollable(scrollable); | 106 new_layer->SetScrollable(scrollable ? new_layer.get() : NULL); |
106 | 107 |
107 success &= dict->GetList("DrawTransform", &list); | 108 success &= dict->GetList("DrawTransform", &list); |
108 double transform[16]; | 109 double transform[16]; |
109 for (int i = 0; i < 16; ++i) | 110 for (int i = 0; i < 16; ++i) |
110 success &= list->GetDouble(i, &transform[i]); | 111 success &= list->GetDouble(i, &transform[i]); |
111 | 112 |
112 gfx::Transform layer_transform; | 113 gfx::Transform layer_transform; |
113 layer_transform.matrix().setColMajord(transform); | 114 layer_transform.matrix().setColMajord(transform); |
114 new_layer->SetTransform(layer_transform); | 115 new_layer->SetTransform(layer_transform); |
115 | 116 |
(...skipping 11 matching lines...) Expand all Loading... |
127 | 128 |
128 } // namespace | 129 } // namespace |
129 | 130 |
130 scoped_refptr<Layer> ParseTreeFromJson(std::string json, | 131 scoped_refptr<Layer> ParseTreeFromJson(std::string json, |
131 ContentLayerClient* content_client) { | 132 ContentLayerClient* content_client) { |
132 scoped_ptr<base::Value> val = base::test::ParseJson(json); | 133 scoped_ptr<base::Value> val = base::test::ParseJson(json); |
133 return ParseTreeFromValue(val.get(), content_client); | 134 return ParseTreeFromValue(val.get(), content_client); |
134 } | 135 } |
135 | 136 |
136 } // namespace cc | 137 } // namespace cc |
OLD | NEW |