| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 : Layer::INVALID_ID); | 123 : Layer::INVALID_ID); |
| 124 | 124 |
| 125 bool wheel_handler; | 125 bool wheel_handler; |
| 126 if (dict->GetBoolean("WheelHandler", &wheel_handler)) | 126 if (dict->GetBoolean("WheelHandler", &wheel_handler)) |
| 127 new_layer->SetHaveWheelEventHandlers(wheel_handler); | 127 new_layer->SetHaveWheelEventHandlers(wheel_handler); |
| 128 | 128 |
| 129 bool scroll_handler; | 129 bool scroll_handler; |
| 130 if (dict->GetBoolean("ScrollHandler", &scroll_handler)) | 130 if (dict->GetBoolean("ScrollHandler", &scroll_handler)) |
| 131 new_layer->SetHaveScrollEventHandlers(scroll_handler); | 131 new_layer->SetHaveScrollEventHandlers(scroll_handler); |
| 132 | 132 |
| 133 bool is_3d_sorted; |
| 134 if (dict->GetBoolean("Is3DSorted", &is_3d_sorted)) |
| 135 new_layer->SetIs3dSorted(is_3d_sorted); |
| 136 |
| 133 if (dict->HasKey("TouchRegion")) { | 137 if (dict->HasKey("TouchRegion")) { |
| 134 success &= dict->GetList("TouchRegion", &list); | 138 success &= dict->GetList("TouchRegion", &list); |
| 135 Region touch_region; | 139 Region touch_region; |
| 136 for (size_t i = 0; i < list->GetSize(); ) { | 140 for (size_t i = 0; i < list->GetSize(); ) { |
| 137 int rect_x, rect_y, rect_width, rect_height; | 141 int rect_x, rect_y, rect_width, rect_height; |
| 138 success &= list->GetInteger(i++, &rect_x); | 142 success &= list->GetInteger(i++, &rect_x); |
| 139 success &= list->GetInteger(i++, &rect_y); | 143 success &= list->GetInteger(i++, &rect_y); |
| 140 success &= list->GetInteger(i++, &rect_width); | 144 success &= list->GetInteger(i++, &rect_width); |
| 141 success &= list->GetInteger(i++, &rect_height); | 145 success &= list->GetInteger(i++, &rect_height); |
| 142 touch_region.Union(gfx::Rect(rect_x, rect_y, rect_width, rect_height)); | 146 touch_region.Union(gfx::Rect(rect_x, rect_y, rect_width, rect_height)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 167 | 171 |
| 168 } // namespace | 172 } // namespace |
| 169 | 173 |
| 170 scoped_refptr<Layer> ParseTreeFromJson(std::string json, | 174 scoped_refptr<Layer> ParseTreeFromJson(std::string json, |
| 171 ContentLayerClient* content_client) { | 175 ContentLayerClient* content_client) { |
| 172 scoped_ptr<base::Value> val = base::test::ParseJson(json); | 176 scoped_ptr<base::Value> val = base::test::ParseJson(json); |
| 173 return ParseTreeFromValue(val.get(), content_client); | 177 return ParseTreeFromValue(val.get(), content_client); |
| 174 } | 178 } |
| 175 | 179 |
| 176 } // namespace cc | 180 } // namespace cc |
| OLD | NEW |