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) At some time in the future we may wish to test that a | |
aelias_OOO_until_Jul13
2014/01/16 03:44:04
I think this problem goes away if you follow my su
wjmaclean
2014/01/16 15:07:32
This comment will be addressed based on the outcom
| |
105 // reconstructed layer tree contains the correct linkage for the scroll | |
106 // clip layer. This is complicated by the fact that the json output doesn't | |
107 // (currently) re-construct the tree with the same layer IDs as the original. | |
108 // But, since a clip layer is always an ancestor of the scrollable layer, we | |
109 // can just count the number of upwards hops to the clip layer and write that | |
110 // into the json file (with 0 hops implying no clip layer, i.e. not | |
111 // scrollable). Reconstructing the tree can then be accomplished by passing | |
112 // the parent pointer to this function and traversing the same number of | |
113 // ancestors to determine the pointer to the clip layer. The LayerTreesMatch() | |
114 // function should then check that both original and reconstructed layers | |
115 // have the same positioning with respect to their clip layers. | |
116 // | |
117 // For now, we can safely indicate a layer is scrollable by giving it a | |
118 // pointer to itself, something not normally allowed in a working tree. | |
119 // | |
120 // https://code.google.com/p/chromium/issues/detail?id=330622 | |
121 // | |
104 if (dict->GetBoolean("Scrollable", &scrollable)) | 122 if (dict->GetBoolean("Scrollable", &scrollable)) |
105 new_layer->SetScrollable(scrollable); | 123 new_layer->SetScrollClipLayer(scrollable ? new_layer.get() : NULL); |
106 | 124 |
107 bool wheel_handler; | 125 bool wheel_handler; |
108 if (dict->GetBoolean("WheelHandler", &wheel_handler)) | 126 if (dict->GetBoolean("WheelHandler", &wheel_handler)) |
109 new_layer->SetHaveWheelEventHandlers(wheel_handler); | 127 new_layer->SetHaveWheelEventHandlers(wheel_handler); |
110 | 128 |
111 if (dict->HasKey("TouchRegion")) { | 129 if (dict->HasKey("TouchRegion")) { |
112 success &= dict->GetList("TouchRegion", &list); | 130 success &= dict->GetList("TouchRegion", &list); |
113 Region touch_region; | 131 Region touch_region; |
114 for (size_t i = 0; i < list->GetSize(); ) { | 132 for (size_t i = 0; i < list->GetSize(); ) { |
115 int rect_x, rect_y, rect_width, rect_height; | 133 int rect_x, rect_y, rect_width, rect_height; |
(...skipping 29 matching lines...) Expand all Loading... | |
145 | 163 |
146 } // namespace | 164 } // namespace |
147 | 165 |
148 scoped_refptr<Layer> ParseTreeFromJson(std::string json, | 166 scoped_refptr<Layer> ParseTreeFromJson(std::string json, |
149 ContentLayerClient* content_client) { | 167 ContentLayerClient* content_client) { |
150 scoped_ptr<base::Value> val = base::test::ParseJson(json); | 168 scoped_ptr<base::Value> val = base::test::ParseJson(json); |
151 return ParseTreeFromValue(val.get(), content_client); | 169 return ParseTreeFromValue(val.get(), content_client); |
152 } | 170 } |
153 | 171 |
154 } // namespace cc | 172 } // namespace cc |
OLD | NEW |