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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/test/values_test_util.h" | 9 #include "base/test/values_test_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 int rect_x, rect_y, rect_width, rect_height; | 146 int rect_x, rect_y, rect_width, rect_height; |
147 success &= list->GetInteger(i++, &rect_x); | 147 success &= list->GetInteger(i++, &rect_x); |
148 success &= list->GetInteger(i++, &rect_y); | 148 success &= list->GetInteger(i++, &rect_y); |
149 success &= list->GetInteger(i++, &rect_width); | 149 success &= list->GetInteger(i++, &rect_width); |
150 success &= list->GetInteger(i++, &rect_height); | 150 success &= list->GetInteger(i++, &rect_height); |
151 touch_region.Union(gfx::Rect(rect_x, rect_y, rect_width, rect_height)); | 151 touch_region.Union(gfx::Rect(rect_x, rect_y, rect_width, rect_height)); |
152 } | 152 } |
153 new_layer->SetTouchEventHandlerRegion(touch_region); | 153 new_layer->SetTouchEventHandlerRegion(touch_region); |
154 } | 154 } |
155 | 155 |
156 if (dict->HasKey("ScrollBlocksOn")) { | |
157 success &= dict->GetList("ScrollBlocksOn", &list); | |
158 ScrollBlocksOn blocks; | |
159 std::string str; | |
160 for (size_t i = 0; i < list->GetSize(); i++) { | |
161 success &= list->GetString(i, &str); | |
162 if (str == "StartTouch") | |
163 blocks |= SCROLL_BLOCKS_ON_START_TOUCH; | |
164 else if (str == "WheelEvent") | |
165 blocks |= SCROLL_BLOCKS_ON_WHEEL_EVENT; | |
166 else if (str == "ScrollEvent") | |
167 blocks |= SCROLL_BLOCKS_ON_SCROLL_EVENT; | |
168 else | |
169 success = false; | |
170 } | |
171 } | |
172 | |
173 success &= dict->GetList("DrawTransform", &list); | 156 success &= dict->GetList("DrawTransform", &list); |
174 double transform[16]; | 157 double transform[16]; |
175 for (int i = 0; i < 16; ++i) | 158 for (int i = 0; i < 16; ++i) |
176 success &= list->GetDouble(i, &transform[i]); | 159 success &= list->GetDouble(i, &transform[i]); |
177 | 160 |
178 gfx::Transform layer_transform; | 161 gfx::Transform layer_transform; |
179 layer_transform.matrix().setColMajord(transform); | 162 layer_transform.matrix().setColMajord(transform); |
180 new_layer->SetTransform(layer_transform); | 163 new_layer->SetTransform(layer_transform); |
181 | 164 |
182 success &= dict->GetList("Children", &list); | 165 success &= dict->GetList("Children", &list); |
(...skipping 10 matching lines...) Expand all Loading... |
193 | 176 |
194 } // namespace | 177 } // namespace |
195 | 178 |
196 scoped_refptr<Layer> ParseTreeFromJson(std::string json, | 179 scoped_refptr<Layer> ParseTreeFromJson(std::string json, |
197 ContentLayerClient* content_client) { | 180 ContentLayerClient* content_client) { |
198 scoped_ptr<base::Value> val = base::test::ParseJson(json); | 181 scoped_ptr<base::Value> val = base::test::ParseJson(json); |
199 return ParseTreeFromValue(val.get(), content_client); | 182 return ParseTreeFromValue(val.get(), content_client); |
200 } | 183 } |
201 | 184 |
202 } // namespace cc | 185 } // namespace cc |
OLD | NEW |