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 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | 5 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event_impl.h" | 8 #include "base/debug/trace_event_impl.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 | 251 |
252 blink::WebPoint WebLayerImpl::scrollPosition() const { | 252 blink::WebPoint WebLayerImpl::scrollPosition() const { |
253 return gfx::PointAtOffsetFromOrigin(layer_->scroll_offset()); | 253 return gfx::PointAtOffsetFromOrigin(layer_->scroll_offset()); |
254 } | 254 } |
255 | 255 |
256 WebSize WebLayerImpl::maxScrollPosition() const { | 256 WebSize WebLayerImpl::maxScrollPosition() const { |
257 return layer_->MaxScrollOffset(); | 257 return layer_->MaxScrollOffset(); |
258 } | 258 } |
259 | 259 |
260 void WebLayerImpl::setScrollClipLayer(WebLayer* clip_layer) { | 260 void WebLayerImpl::setScrollClipLayer(WebLayer* clip_layer) { |
261 cc::Layer* cc_clip_layer = | 261 if (!clip_layer) { |
262 clip_layer ? static_cast<WebLayerImpl*>(clip_layer)->layer() : 0; | 262 layer_->SetScrollClipLayerId(Layer::INVALID_ID); |
263 return; | |
264 } | |
265 cc::Layer* cc_clip_layer = static_cast<WebLayerImpl*>(clip_layer)->layer(); | |
enne (OOO)
2014/03/18 23:39:05
Can you just ask for clip_layer->id() directly, no
qinmin
2014/03/18 23:57:40
Done.
On 2014/03/18 23:39:05, enne wrote:
| |
263 layer_->SetScrollClipLayerId(cc_clip_layer->id()); | 266 layer_->SetScrollClipLayerId(cc_clip_layer->id()); |
264 } | 267 } |
265 | 268 |
266 bool WebLayerImpl::scrollable() const { return layer_->scrollable(); } | 269 bool WebLayerImpl::scrollable() const { return layer_->scrollable(); } |
267 | 270 |
268 void WebLayerImpl::setUserScrollable(bool horizontal, bool vertical) { | 271 void WebLayerImpl::setUserScrollable(bool horizontal, bool vertical) { |
269 layer_->SetUserScrollable(horizontal, vertical); | 272 layer_->SetUserScrollable(horizontal, vertical); |
270 } | 273 } |
271 | 274 |
272 bool WebLayerImpl::userScrollableHorizontal() const { | 275 bool WebLayerImpl::userScrollableHorizontal() const { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 void WebLayerImpl::setClipParent(blink::WebLayer* parent) { | 439 void WebLayerImpl::setClipParent(blink::WebLayer* parent) { |
437 cc::Layer* clip_parent = NULL; | 440 cc::Layer* clip_parent = NULL; |
438 if (parent) | 441 if (parent) |
439 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 442 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
440 layer_->SetClipParent(clip_parent); | 443 layer_->SetClipParent(clip_parent); |
441 } | 444 } |
442 | 445 |
443 Layer* WebLayerImpl::layer() const { return layer_.get(); } | 446 Layer* WebLayerImpl::layer() const { return layer_.get(); } |
444 | 447 |
445 } // namespace webkit | 448 } // namespace webkit |
OLD | NEW |