| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 #ifndef CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| 6 #define CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "cc/trees/layer_tree_impl.h" | 21 #include "cc/trees/layer_tree_impl.h" |
| 22 #include "cc/trees/property_tree.h" | 22 #include "cc/trees/property_tree.h" |
| 23 #include "ui/gfx/geometry/rect.h" | 23 #include "ui/gfx/geometry/rect.h" |
| 24 #include "ui/gfx/geometry/vector2d.h" | 24 #include "ui/gfx/geometry/vector2d.h" |
| 25 #include "ui/gfx/transform.h" | 25 #include "ui/gfx/transform.h" |
| 26 | 26 |
| 27 namespace cc { | 27 namespace cc { |
| 28 | 28 |
| 29 namespace proto { | 29 namespace proto { |
| 30 class ScrollUpdateInfo; | 30 class ScrollUpdateInfo; |
| 31 class ScrollbarsUpdateInfo; |
| 31 class ScrollAndScaleSet; | 32 class ScrollAndScaleSet; |
| 32 } | 33 } |
| 33 | 34 |
| 34 class LayerImpl; | 35 class LayerImpl; |
| 35 class Layer; | 36 class Layer; |
| 36 class SwapPromise; | 37 class SwapPromise; |
| 37 class PropertyTrees; | 38 class PropertyTrees; |
| 38 | 39 |
| 39 class CC_EXPORT LayerTreeHostCommon { | 40 class CC_EXPORT LayerTreeHostCommon { |
| 40 public: | 41 public: |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 static void CallFunctionForEveryLayer(LayerTree* layer, | 136 static void CallFunctionForEveryLayer(LayerTree* layer, |
| 136 const Function& function); | 137 const Function& function); |
| 137 | 138 |
| 138 template <typename Function> | 139 template <typename Function> |
| 139 static void CallFunctionForEveryLayer(LayerTreeImpl* layer, | 140 static void CallFunctionForEveryLayer(LayerTreeImpl* layer, |
| 140 const Function& function); | 141 const Function& function); |
| 141 | 142 |
| 142 struct CC_EXPORT ScrollUpdateInfo { | 143 struct CC_EXPORT ScrollUpdateInfo { |
| 143 int layer_id; | 144 int layer_id; |
| 144 // TODO(miletus): Use ScrollOffset once LayerTreeHost/Blink fully supports | 145 // TODO(miletus): Use ScrollOffset once LayerTreeHost/Blink fully supports |
| 145 // franctional scroll offset. | 146 // fractional scroll offset. |
| 146 gfx::Vector2d scroll_delta; | 147 gfx::Vector2d scroll_delta; |
| 147 | 148 |
| 148 ScrollUpdateInfo(); | 149 ScrollUpdateInfo(); |
| 149 | 150 |
| 150 bool operator==(const ScrollUpdateInfo& other) const; | 151 bool operator==(const ScrollUpdateInfo& other) const; |
| 151 | 152 |
| 152 void ToProtobuf(proto::ScrollUpdateInfo* proto) const; | 153 void ToProtobuf(proto::ScrollUpdateInfo* proto) const; |
| 153 void FromProtobuf(const proto::ScrollUpdateInfo& proto); | 154 void FromProtobuf(const proto::ScrollUpdateInfo& proto); |
| 154 }; | 155 }; |
| 156 |
| 157 // Used to communicate scrollbar visibility from Impl thread to Blink. |
| 158 // Scrollbar input is handled by Blink but the compositor thread animates |
| 159 // opacity on scrollbars to fade them out when they're overlay. Blink needs |
| 160 // to be told when they're faded out so it can stop handling input for |
| 161 // invisible scrollbars. |
| 162 struct CC_EXPORT ScrollbarsUpdateInfo { |
| 163 int layer_id; |
| 164 bool hidden; |
| 165 |
| 166 ScrollbarsUpdateInfo(); |
| 167 ScrollbarsUpdateInfo(int layer_id, bool hidden); |
| 168 |
| 169 bool operator==(const ScrollbarsUpdateInfo& other) const; |
| 170 |
| 171 void ToProtobuf(proto::ScrollbarsUpdateInfo* proto) const; |
| 172 void FromProtobuf(const proto::ScrollbarsUpdateInfo& proto); |
| 173 }; |
| 155 }; | 174 }; |
| 156 | 175 |
| 157 struct CC_EXPORT ScrollAndScaleSet { | 176 struct CC_EXPORT ScrollAndScaleSet { |
| 158 ScrollAndScaleSet(); | 177 ScrollAndScaleSet(); |
| 159 ~ScrollAndScaleSet(); | 178 ~ScrollAndScaleSet(); |
| 160 | 179 |
| 161 // The inner viewport scroll delta is kept separate since it's special. | 180 // The inner viewport scroll delta is kept separate since it's special. |
| 162 // Because the inner (visual) viewport's maximum offset depends on the | 181 // Because the inner (visual) viewport's maximum offset depends on the |
| 163 // current page scale, the two must be committed at the same time to prevent | 182 // current page scale, the two must be committed at the same time to prevent |
| 164 // clamping. | 183 // clamping. |
| 165 LayerTreeHostCommon::ScrollUpdateInfo inner_viewport_scroll; | 184 LayerTreeHostCommon::ScrollUpdateInfo inner_viewport_scroll; |
| 166 | 185 |
| 167 std::vector<LayerTreeHostCommon::ScrollUpdateInfo> scrolls; | 186 std::vector<LayerTreeHostCommon::ScrollUpdateInfo> scrolls; |
| 168 float page_scale_delta; | 187 float page_scale_delta; |
| 169 gfx::Vector2dF elastic_overscroll_delta; | 188 gfx::Vector2dF elastic_overscroll_delta; |
| 170 float top_controls_delta; | 189 float top_controls_delta; |
| 190 std::vector<LayerTreeHostCommon::ScrollbarsUpdateInfo> scrollbars; |
| 171 std::vector<std::unique_ptr<SwapPromise>> swap_promises; | 191 std::vector<std::unique_ptr<SwapPromise>> swap_promises; |
| 172 | 192 |
| 173 bool EqualsForTesting(const ScrollAndScaleSet& other) const; | 193 bool EqualsForTesting(const ScrollAndScaleSet& other) const; |
| 174 void ToProtobuf(proto::ScrollAndScaleSet* proto) const; | 194 void ToProtobuf(proto::ScrollAndScaleSet* proto) const; |
| 175 void FromProtobuf(const proto::ScrollAndScaleSet& proto); | 195 void FromProtobuf(const proto::ScrollAndScaleSet& proto); |
| 176 | 196 |
| 177 private: | 197 private: |
| 178 DISALLOW_COPY_AND_ASSIGN(ScrollAndScaleSet); | 198 DISALLOW_COPY_AND_ASSIGN(ScrollAndScaleSet); |
| 179 }; | 199 }; |
| 180 | 200 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 198 function(tree_impl->LayerById(id)); | 218 function(tree_impl->LayerById(id)); |
| 199 } | 219 } |
| 200 } | 220 } |
| 201 | 221 |
| 202 CC_EXPORT PropertyTrees* GetPropertyTrees(Layer* layer); | 222 CC_EXPORT PropertyTrees* GetPropertyTrees(Layer* layer); |
| 203 CC_EXPORT PropertyTrees* GetPropertyTrees(LayerImpl* layer); | 223 CC_EXPORT PropertyTrees* GetPropertyTrees(LayerImpl* layer); |
| 204 | 224 |
| 205 } // namespace cc | 225 } // namespace cc |
| 206 | 226 |
| 207 #endif // CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 227 #endif // CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| OLD | NEW |