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 "cc/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "cc/animation/animation_registrar.h" | 9 #include "cc/animation/animation_registrar.h" |
10 #include "cc/animation/scrollbar_animation_controller.h" | 10 #include "cc/animation/scrollbar_animation_controller.h" |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 DCHECK(layer_tree_impl()->IsActiveTree()); | 334 DCHECK(layer_tree_impl()->IsActiveTree()); |
335 | 335 |
336 if (sent_scroll_delta_ == sent_scroll_delta) | 336 if (sent_scroll_delta_ == sent_scroll_delta) |
337 return; | 337 return; |
338 | 338 |
339 sent_scroll_delta_ = sent_scroll_delta; | 339 sent_scroll_delta_ = sent_scroll_delta; |
340 } | 340 } |
341 | 341 |
342 gfx::Vector2dF LayerImpl::ScrollBy(gfx::Vector2dF scroll) { | 342 gfx::Vector2dF LayerImpl::ScrollBy(gfx::Vector2dF scroll) { |
343 DCHECK(scrollable()); | 343 DCHECK(scrollable()); |
344 if (!horizontal_scrollbar_layer_) | |
345 scroll.set_x(0.f); | |
danakj
2013/10/21 15:14:42
This would eat the whole scroll but not perform it
sadrul
2013/10/21 16:19:14
That wasn't intentional. Fixed. Thanks!
| |
346 if (!vertical_scrollbar_layer_) | |
347 scroll.set_y(0.f); | |
344 | 348 |
345 gfx::Vector2dF min_delta = -scroll_offset_; | 349 gfx::Vector2dF min_delta = -scroll_offset_; |
346 gfx::Vector2dF max_delta = max_scroll_offset_ - scroll_offset_; | 350 gfx::Vector2dF max_delta = max_scroll_offset_ - scroll_offset_; |
347 // Clamp new_delta so that position + delta stays within scroll bounds. | 351 // Clamp new_delta so that position + delta stays within scroll bounds. |
348 gfx::Vector2dF new_delta = (ScrollDelta() + scroll); | 352 gfx::Vector2dF new_delta = (ScrollDelta() + scroll); |
349 new_delta.SetToMax(min_delta); | 353 new_delta.SetToMax(min_delta); |
350 new_delta.SetToMin(max_delta); | 354 new_delta.SetToMin(max_delta); |
351 gfx::Vector2dF unscrolled = ScrollDelta() + scroll - new_delta; | 355 gfx::Vector2dF unscrolled = ScrollDelta() + scroll - new_delta; |
352 SetScrollDelta(new_delta); | 356 SetScrollDelta(new_delta); |
353 return unscrolled; | 357 return unscrolled; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
442 return InputHandler::ScrollIgnored; | 446 return InputHandler::ScrollIgnored; |
443 } | 447 } |
444 | 448 |
445 if (max_scroll_offset_.x() <= 0 && max_scroll_offset_.y() <= 0) { | 449 if (max_scroll_offset_.x() <= 0 && max_scroll_offset_.y() <= 0) { |
446 TRACE_EVENT0("cc", | 450 TRACE_EVENT0("cc", |
447 "LayerImpl::tryScroll: Ignored. Technically scrollable," | 451 "LayerImpl::tryScroll: Ignored. Technically scrollable," |
448 " but has no affordance in either direction."); | 452 " but has no affordance in either direction."); |
449 return InputHandler::ScrollIgnored; | 453 return InputHandler::ScrollIgnored; |
450 } | 454 } |
451 | 455 |
456 if (!horizontal_scrollbar_layer_ && !vertical_scrollbar_layer_) | |
457 return InputHandler::ScrollIgnored; | |
458 | |
452 return InputHandler::ScrollStarted; | 459 return InputHandler::ScrollStarted; |
453 } | 460 } |
454 | 461 |
455 bool LayerImpl::DrawCheckerboardForMissingTiles() const { | 462 bool LayerImpl::DrawCheckerboardForMissingTiles() const { |
456 return draw_checkerboard_for_missing_tiles_ && | 463 return draw_checkerboard_for_missing_tiles_ && |
457 !layer_tree_impl()->settings().background_color_instead_of_checkerboard; | 464 !layer_tree_impl()->settings().background_color_instead_of_checkerboard; |
458 } | 465 } |
459 | 466 |
460 gfx::Rect LayerImpl::LayerRectToContentRect( | 467 gfx::Rect LayerImpl::LayerRectToContentRect( |
461 const gfx::RectF& layer_rect) const { | 468 const gfx::RectF& layer_rect) const { |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1305 | 1312 |
1306 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1313 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
1307 | 1314 |
1308 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1315 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
1309 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1316 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1310 AsValueInto(state.get()); | 1317 AsValueInto(state.get()); |
1311 return state.PassAs<base::Value>(); | 1318 return state.PassAs<base::Value>(); |
1312 } | 1319 } |
1313 | 1320 |
1314 } // namespace cc | 1321 } // namespace cc |
OLD | NEW |