Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: cc/layers/layer_impl.cc

Issue 13079003: Fix solid color scrollbars for sublayers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/layers/scrollbar_layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/animation/animation_registrar.h" 10 #include "cc/animation/animation_registrar.h"
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 // Base LayerImpl has all of its content scales and content bounds pushed 793 // Base LayerImpl has all of its content scales and content bounds pushed
794 // from its Layer during commit and just reuses those values as-is. 794 // from its Layer during commit and just reuses those values as-is.
795 *contents_scale_x = this->contents_scale_x(); 795 *contents_scale_x = this->contents_scale_x();
796 *contents_scale_y = this->contents_scale_y(); 796 *contents_scale_y = this->contents_scale_y();
797 *content_bounds = this->content_bounds(); 797 *content_bounds = this->content_bounds();
798 } 798 }
799 799
800 void LayerImpl::UpdateScrollbarPositions() { 800 void LayerImpl::UpdateScrollbarPositions() {
801 gfx::Vector2dF current_offset = scroll_offset_ + scroll_delta_; 801 gfx::Vector2dF current_offset = scroll_offset_ + scroll_delta_;
802 802
803 gfx::RectF viewport(PointAtOffsetFromOrigin(current_offset), bounds_);
804 gfx::SizeF scrollable_size(max_scroll_offset_.x() + bounds_.width(),
805 max_scroll_offset_.y() + bounds_.height());
803 if (horizontal_scrollbar_layer_) { 806 if (horizontal_scrollbar_layer_) {
804 horizontal_scrollbar_layer_->SetCurrentPos(current_offset.x()); 807 horizontal_scrollbar_layer_->SetCurrentPos(current_offset.x());
805 horizontal_scrollbar_layer_->SetTotalSize(bounds_.width()); 808 horizontal_scrollbar_layer_->SetTotalSize(bounds_.width());
806 horizontal_scrollbar_layer_->SetMaximum(max_scroll_offset_.x()); 809 horizontal_scrollbar_layer_->SetMaximum(max_scroll_offset_.x());
810 horizontal_scrollbar_layer_->SetViewportWithinScrollableArea(
811 viewport, scrollable_size);
807 } 812 }
808 if (vertical_scrollbar_layer_) { 813 if (vertical_scrollbar_layer_) {
809 vertical_scrollbar_layer_->SetCurrentPos(current_offset.y()); 814 vertical_scrollbar_layer_->SetCurrentPos(current_offset.y());
810 vertical_scrollbar_layer_->SetTotalSize(bounds_.height()); 815 vertical_scrollbar_layer_->SetTotalSize(bounds_.height());
811 vertical_scrollbar_layer_->SetMaximum(max_scroll_offset_.y()); 816 vertical_scrollbar_layer_->SetMaximum(max_scroll_offset_.y());
817 vertical_scrollbar_layer_->SetViewportWithinScrollableArea(
818 viewport, scrollable_size);
812 } 819 }
813 820
814 if (current_offset == last_scroll_offset_) 821 if (current_offset == last_scroll_offset_)
815 return; 822 return;
816 last_scroll_offset_ = current_offset; 823 last_scroll_offset_ = current_offset;
817 824
818 if (scrollbar_animation_controller_ && 825 if (scrollbar_animation_controller_ &&
819 !scrollbar_animation_controller_->IsScrollGestureInProgress()) { 826 !scrollbar_animation_controller_->IsScrollGestureInProgress()) {
820 scrollbar_animation_controller_->DidProgrammaticallyUpdateScroll( 827 scrollbar_animation_controller_->DidProgrammaticallyUpdateScroll(
821 base::TimeTicks::Now()); 828 base::TimeTicks::Now());
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 964
958 } 965 }
959 966
960 scoped_ptr<base::Value> LayerImpl::AsValue() const { 967 scoped_ptr<base::Value> LayerImpl::AsValue() const {
961 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 968 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
962 AsValueInto(state.get()); 969 AsValueInto(state.get());
963 return state.PassAs<base::Value>(); 970 return state.PassAs<base::Value>();
964 } 971 }
965 972
966 } // namespace cc 973 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/scrollbar_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698