OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/blink/web_layer_impl.h" | 5 #include "cc/blink/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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 } | 261 } |
262 | 262 |
263 bool WebLayerImpl::hasActiveAnimation() { | 263 bool WebLayerImpl::hasActiveAnimation() { |
264 return layer_->HasActiveAnimation(); | 264 return layer_->HasActiveAnimation(); |
265 } | 265 } |
266 | 266 |
267 void WebLayerImpl::setForceRenderSurface(bool force_render_surface) { | 267 void WebLayerImpl::setForceRenderSurface(bool force_render_surface) { |
268 layer_->SetForceRenderSurface(force_render_surface); | 268 layer_->SetForceRenderSurface(force_render_surface); |
269 } | 269 } |
270 | 270 |
271 void WebLayerImpl::setScrollPosition(blink::WebPoint position) { | |
272 layer_->SetScrollOffset(gfx::ScrollOffset(position.x, position.y)); | |
273 } | |
274 | |
275 blink::WebPoint WebLayerImpl::scrollPosition() const { | |
276 return gfx::PointAtOffsetFromOrigin( | |
277 gfx::ScrollOffsetToFlooredVector2d(layer_->scroll_offset())); | |
278 } | |
279 | |
280 void WebLayerImpl::setScrollPositionDouble(blink::WebDoublePoint position) { | 271 void WebLayerImpl::setScrollPositionDouble(blink::WebDoublePoint position) { |
281 layer_->SetScrollOffset(gfx::ScrollOffset(position.x, position.y)); | 272 layer_->SetScrollOffset(gfx::ScrollOffset(position.x, position.y)); |
282 } | 273 } |
283 | 274 |
284 blink::WebDoublePoint WebLayerImpl::scrollPositionDouble() const { | 275 blink::WebDoublePoint WebLayerImpl::scrollPositionDouble() const { |
285 return blink::WebDoublePoint(layer_->scroll_offset().x(), | 276 return blink::WebDoublePoint(layer_->scroll_offset().x(), |
286 layer_->scroll_offset().y()); | 277 layer_->scroll_offset().y()); |
287 } | 278 } |
288 | 279 |
289 void WebLayerImpl::setScrollClipLayer(WebLayer* clip_layer) { | 280 void WebLayerImpl::setScrollClipLayer(WebLayer* clip_layer) { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 | 427 |
437 void WebLayerImpl::setWebLayerClient(blink::WebLayerClient* client) { | 428 void WebLayerImpl::setWebLayerClient(blink::WebLayerClient* client) { |
438 web_layer_client_ = client; | 429 web_layer_client_ = client; |
439 } | 430 } |
440 | 431 |
441 class TracedDebugInfo : public base::debug::ConvertableToTraceFormat { | 432 class TracedDebugInfo : public base::debug::ConvertableToTraceFormat { |
442 public: | 433 public: |
443 // This object takes ownership of the debug_info object. | 434 // This object takes ownership of the debug_info object. |
444 explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info) | 435 explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info) |
445 : debug_info_(debug_info) {} | 436 : debug_info_(debug_info) {} |
446 virtual void AppendAsTraceFormat(std::string* out) const override { | 437 void AppendAsTraceFormat(std::string* out) const override { |
danakj
2014/10/09 20:11:17
ditto?
| |
447 DCHECK(thread_checker_.CalledOnValidThread()); | 438 DCHECK(thread_checker_.CalledOnValidThread()); |
448 blink::WebString web_string; | 439 blink::WebString web_string; |
449 debug_info_->appendAsTraceFormat(&web_string); | 440 debug_info_->appendAsTraceFormat(&web_string); |
450 out->append(web_string.utf8()); | 441 out->append(web_string.utf8()); |
451 } | 442 } |
452 | 443 |
453 private: | 444 private: |
454 virtual ~TracedDebugInfo() {} | 445 virtual ~TracedDebugInfo() {} |
455 scoped_ptr<blink::WebGraphicsLayerDebugInfo> debug_info_; | 446 scoped_ptr<blink::WebGraphicsLayerDebugInfo> debug_info_; |
456 base::ThreadChecker thread_checker_; | 447 base::ThreadChecker thread_checker_; |
(...skipping 24 matching lines...) Expand all Loading... | |
481 if (parent) | 472 if (parent) |
482 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 473 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
483 layer_->SetClipParent(clip_parent); | 474 layer_->SetClipParent(clip_parent); |
484 } | 475 } |
485 | 476 |
486 Layer* WebLayerImpl::layer() const { | 477 Layer* WebLayerImpl::layer() const { |
487 return layer_.get(); | 478 return layer_.get(); |
488 } | 479 } |
489 | 480 |
490 } // namespace cc_blink | 481 } // namespace cc_blink |
OLD | NEW |