diff options
32 files changed, 538 insertions, 52 deletions
diff --git a/cc/animation/scrollbar_animation_controller.h b/cc/animation/scrollbar_animation_controller.h index 94c953e..d3667f1 100644 --- a/cc/animation/scrollbar_animation_controller.h +++ b/cc/animation/scrollbar_animation_controller.h @@ -24,7 +24,9 @@ class CC_EXPORT ScrollbarAnimationController { virtual bool Animate(base::TimeTicks now) = 0; virtual void DidScrollGestureBegin() = 0; virtual void DidScrollGestureEnd(base::TimeTicks now) = 0; - virtual void DidScrollUpdate(base::TimeTicks now) = 0; + + // Returns true if we should start an animation. + virtual bool DidScrollUpdate(base::TimeTicks now) = 0; }; } // namespace cc diff --git a/cc/animation/scrollbar_animation_controller_linear_fade.cc b/cc/animation/scrollbar_animation_controller_linear_fade.cc index 9f23802..962b26a 100644 --- a/cc/animation/scrollbar_animation_controller_linear_fade.cc +++ b/cc/animation/scrollbar_animation_controller_linear_fade.cc @@ -6,6 +6,7 @@ #include "base/time/time.h" #include "cc/layers/layer_impl.h" +#include "cc/layers/scrollbar_layer_impl_base.h" namespace cc { @@ -44,7 +45,7 @@ base::TimeDelta ScrollbarAnimationControllerLinearFade::DelayBeforeStart( bool ScrollbarAnimationControllerLinearFade::Animate(base::TimeTicks now) { float opacity = OpacityAtTime(now); - scroll_layer_->SetScrollbarOpacity(opacity); + ApplyOpacityToScrollbars(opacity); if (!opacity) last_awaken_time_ = base::TimeTicks(); return IsAnimating() && DelayBeforeStart(now) == base::TimeDelta(); @@ -64,17 +65,19 @@ void ScrollbarAnimationControllerLinearFade::DidScrollGestureEnd( scroll_gesture_in_progress_ = false; } -void ScrollbarAnimationControllerLinearFade::DidScrollUpdate( +bool ScrollbarAnimationControllerLinearFade::DidScrollUpdate( base::TimeTicks now) { - scroll_layer_->SetScrollbarOpacity(1.0f); + ApplyOpacityToScrollbars(1.0f); // The animation should only be activated if the scroll updated occurred // programatically, outside the scope of a scroll gesture. if (scroll_gesture_in_progress_) { last_awaken_time_ = base::TimeTicks(); scroll_gesture_has_scrolled_ = true; - } else { - last_awaken_time_ = now; + return true; } + + last_awaken_time_ = now; + return false; } float ScrollbarAnimationControllerLinearFade::OpacityAtTime( @@ -96,4 +99,17 @@ float ScrollbarAnimationControllerLinearFade::OpacityAtTime( return 0.0f; } +void ScrollbarAnimationControllerLinearFade::ApplyOpacityToScrollbars( + float opacity) { + ScrollbarLayerImplBase* horizontal_scrollbar = + scroll_layer_->horizontal_scrollbar_layer(); + if (horizontal_scrollbar) + horizontal_scrollbar->SetOpacity(opacity); + + ScrollbarLayerImplBase* vertical_scrollbar = + scroll_layer_->vertical_scrollbar_layer(); + if (vertical_scrollbar) + vertical_scrollbar->SetOpacity(opacity); +} + } // namespace cc diff --git a/cc/animation/scrollbar_animation_controller_linear_fade.h b/cc/animation/scrollbar_animation_controller_linear_fade.h index 74c411f..eca4c4f 100644 --- a/cc/animation/scrollbar_animation_controller_linear_fade.h +++ b/cc/animation/scrollbar_animation_controller_linear_fade.h @@ -29,7 +29,7 @@ class CC_EXPORT ScrollbarAnimationControllerLinearFade virtual bool Animate(base::TimeTicks now) OVERRIDE; virtual void DidScrollGestureBegin() OVERRIDE; virtual void DidScrollGestureEnd(base::TimeTicks now) OVERRIDE; - virtual void DidScrollUpdate(base::TimeTicks now) OVERRIDE; + virtual bool DidScrollUpdate(base::TimeTicks now) OVERRIDE; protected: ScrollbarAnimationControllerLinearFade(LayerImpl* scroll_layer, @@ -38,6 +38,7 @@ class CC_EXPORT ScrollbarAnimationControllerLinearFade private: float OpacityAtTime(base::TimeTicks now); + void ApplyOpacityToScrollbars(float opacity); LayerImpl* scroll_layer_; diff --git a/cc/animation/scrollbar_animation_controller_thinning.cc b/cc/animation/scrollbar_animation_controller_thinning.cc new file mode 100644 index 0000000..fcacfaa --- /dev/null +++ b/cc/animation/scrollbar_animation_controller_thinning.cc @@ -0,0 +1,132 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "cc/animation/scrollbar_animation_controller_thinning.h" + +#include <algorithm> + +#include "base/time/time.h" +#include "cc/layers/layer_impl.h" +#include "cc/layers/scrollbar_layer_impl_base.h" + +namespace cc { + +scoped_ptr<ScrollbarAnimationControllerThinning> +ScrollbarAnimationControllerThinning::Create(LayerImpl* scroll_layer) { + return make_scoped_ptr(new ScrollbarAnimationControllerThinning( + scroll_layer, + base::TimeDelta::FromMilliseconds(500), + base::TimeDelta::FromMilliseconds(300))); +} + +scoped_ptr<ScrollbarAnimationControllerThinning> +ScrollbarAnimationControllerThinning::CreateForTest(LayerImpl* scroll_layer, + base::TimeDelta animation_delay, base::TimeDelta animation_duration) { + return make_scoped_ptr(new ScrollbarAnimationControllerThinning( + scroll_layer, animation_delay, animation_duration)); +} + +ScrollbarAnimationControllerThinning::ScrollbarAnimationControllerThinning( + LayerImpl* scroll_layer, + base::TimeDelta animation_delay, + base::TimeDelta animation_duration) + : ScrollbarAnimationController(), + scroll_layer_(scroll_layer), + scroll_gesture_in_progress_(false), + animation_delay_(animation_delay), + animation_duration_(animation_duration) {} + +ScrollbarAnimationControllerThinning::~ScrollbarAnimationControllerThinning() { +} + +bool ScrollbarAnimationControllerThinning::IsAnimating() const { + return !last_awaken_time_.is_null(); +} + +base::TimeDelta ScrollbarAnimationControllerThinning::DelayBeforeStart( + base::TimeTicks now) const { + if (now > last_awaken_time_ + animation_delay_) + return base::TimeDelta(); + return animation_delay_ - (now - last_awaken_time_); +} + +bool ScrollbarAnimationControllerThinning::Animate(base::TimeTicks now) { + float progress = AnimationProgressAtTime(now); + float opacity = OpacityAtAnimationProgress(progress); + float thumb_thickness_scale = ThumbThicknessScaleAtAnimationProgress( + progress); + ApplyOpacityAndThumbThicknessScale(opacity, thumb_thickness_scale); + if (progress == 1.f) + last_awaken_time_ = base::TimeTicks(); + return IsAnimating() && DelayBeforeStart(now) == base::TimeDelta(); +} + +void ScrollbarAnimationControllerThinning::DidScrollGestureBegin() { + ApplyOpacityAndThumbThicknessScale(1, 1); + last_awaken_time_ = base::TimeTicks(); + scroll_gesture_in_progress_ = true; +} + +void ScrollbarAnimationControllerThinning::DidScrollGestureEnd( + base::TimeTicks now) { + last_awaken_time_ = now; + scroll_gesture_in_progress_ = false; +} + +bool ScrollbarAnimationControllerThinning::DidScrollUpdate( + base::TimeTicks now) { + ApplyOpacityAndThumbThicknessScale(1, 1); + + last_awaken_time_ = now; + return true; +} + +float ScrollbarAnimationControllerThinning::AnimationProgressAtTime( + base::TimeTicks now) { + if (scroll_gesture_in_progress_) + return 0; + + if (last_awaken_time_.is_null()) + return 1; + + base::TimeDelta delta = now - last_awaken_time_; + float progress = (delta - animation_delay_).InSecondsF() / + animation_duration_.InSecondsF(); + return std::max(std::min(progress, 1.f), 0.f); +} + +float ScrollbarAnimationControllerThinning::OpacityAtAnimationProgress( + float progress) { + const float kIdleOpacity = 0.7f; + + return ((1 - kIdleOpacity) * (1.f - progress)) + kIdleOpacity; +} + +float +ScrollbarAnimationControllerThinning::ThumbThicknessScaleAtAnimationProgress( + float progress) { + const float kIdleThicknessScale = 0.4f; + + return ((1 - kIdleThicknessScale) * (1.f - progress)) + kIdleThicknessScale; +} + +void ScrollbarAnimationControllerThinning::ApplyOpacityAndThumbThicknessScale( + float opacity, float thumb_thickness_scale) { + ScrollbarLayerImplBase* horizontal_scrollbar = + scroll_layer_->horizontal_scrollbar_layer(); + if (horizontal_scrollbar) { + horizontal_scrollbar->SetOpacity(opacity); + horizontal_scrollbar->set_thumb_thickness_scale_factor( + thumb_thickness_scale); + } + + ScrollbarLayerImplBase* vertical_scrollbar = + scroll_layer_->vertical_scrollbar_layer(); + if (vertical_scrollbar) { + vertical_scrollbar->SetOpacity(opacity); + vertical_scrollbar->set_thumb_thickness_scale_factor(thumb_thickness_scale); + } +} + +} // namespace cc diff --git a/cc/animation/scrollbar_animation_controller_thinning.h b/cc/animation/scrollbar_animation_controller_thinning.h new file mode 100644 index 0000000..0211479 --- /dev/null +++ b/cc/animation/scrollbar_animation_controller_thinning.h @@ -0,0 +1,65 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CC_ANIMATION_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ +#define CC_ANIMATION_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ + +#include "base/memory/scoped_ptr.h" +#include "cc/animation/scrollbar_animation_controller.h" +#include "cc/base/cc_export.h" + +namespace cc { +class LayerImpl; + +// Scrollbar animation that partially fades and thins after an idle delay. +class CC_EXPORT ScrollbarAnimationControllerThinning + : public ScrollbarAnimationController { + public: + static scoped_ptr<ScrollbarAnimationControllerThinning> Create( + LayerImpl* scroll_layer); + + static scoped_ptr<ScrollbarAnimationControllerThinning> CreateForTest( + LayerImpl* scroll_layer, + base::TimeDelta animation_delay, + base::TimeDelta animation_duration); + + virtual ~ScrollbarAnimationControllerThinning(); + + // ScrollbarAnimationController overrides. + virtual bool IsAnimating() const OVERRIDE; + virtual base::TimeDelta DelayBeforeStart(base::TimeTicks now) const OVERRIDE; + + virtual bool Animate(base::TimeTicks now) OVERRIDE; + virtual void DidScrollGestureBegin() OVERRIDE; + virtual void DidScrollGestureEnd(base::TimeTicks now) OVERRIDE; + virtual bool DidScrollUpdate(base::TimeTicks now) OVERRIDE; + + protected: + ScrollbarAnimationControllerThinning(LayerImpl* scroll_layer, + base::TimeDelta animation_delay, + base::TimeDelta animation_duration); + + private: + // Returns how far through the animation we are as a progress value from + // 0 to 1. + float AnimationProgressAtTime(base::TimeTicks now); + float OpacityAtAnimationProgress(float progress); + float ThumbThicknessScaleAtAnimationProgress(float progress); + void ApplyOpacityAndThumbThicknessScale(float opacity, + float thumb_thickness_scale); + + LayerImpl* scroll_layer_; + + base::TimeTicks last_awaken_time_; + bool scroll_gesture_in_progress_; + + base::TimeDelta animation_delay_; + base::TimeDelta animation_duration_; + + DISALLOW_COPY_AND_ASSIGN(ScrollbarAnimationControllerThinning); +}; + +} // namespace cc + +#endif // CC_ANIMATION_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ diff --git a/cc/animation/scrollbar_animation_controller_thinning_unittest.cc b/cc/animation/scrollbar_animation_controller_thinning_unittest.cc new file mode 100644 index 0000000..c83bdc8 --- /dev/null +++ b/cc/animation/scrollbar_animation_controller_thinning_unittest.cc @@ -0,0 +1,185 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "cc/animation/scrollbar_animation_controller_thinning.h" + +#include "cc/layers/solid_color_scrollbar_layer_impl.h" +#include "cc/test/fake_impl_proxy.h" +#include "cc/test/fake_layer_tree_host_impl.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace cc { +namespace { + +class ScrollbarAnimationControllerThinningTest : public testing::Test { + public: + ScrollbarAnimationControllerThinningTest() : host_impl_(&proxy_) {} + + protected: + virtual void SetUp() { + scroll_layer_ = LayerImpl::Create(host_impl_.active_tree(), 1); + const int kId = 2; + const int kThumbThickness = 10; + const bool kIsLeftSideVerticalScrollbar = false; + scrollbar_layer_ = SolidColorScrollbarLayerImpl::Create( + host_impl_.active_tree(), kId, HORIZONTAL, kThumbThickness, + kIsLeftSideVerticalScrollbar); + + scroll_layer_->SetMaxScrollOffset(gfx::Vector2d(50, 50)); + scroll_layer_->SetBounds(gfx::Size(50, 50)); + scroll_layer_->SetHorizontalScrollbarLayer(scrollbar_layer_.get()); + + scrollbar_controller_ = ScrollbarAnimationControllerThinning::CreateForTest( + scroll_layer_.get(), + base::TimeDelta::FromSeconds(2), + base::TimeDelta::FromSeconds(3)); + } + + FakeImplProxy proxy_; + FakeLayerTreeHostImpl host_impl_; + scoped_ptr<ScrollbarAnimationControllerThinning> scrollbar_controller_; + scoped_ptr<LayerImpl> scroll_layer_; + scoped_ptr<SolidColorScrollbarLayerImpl> scrollbar_layer_; +}; + +TEST_F(ScrollbarAnimationControllerThinningTest, Idle) { + scrollbar_controller_->Animate(base::TimeTicks()); + EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor()); +} + +TEST_F(ScrollbarAnimationControllerThinningTest, AwakenByScrollGesture) { + base::TimeTicks time; + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->DidScrollGestureBegin(); + EXPECT_FALSE(scrollbar_controller_->IsAnimating()); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(100); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); + scrollbar_controller_->DidScrollGestureEnd(time); + + EXPECT_TRUE(scrollbar_controller_->IsAnimating()); + EXPECT_EQ(2, scrollbar_controller_->DelayBeforeStart(time).InSeconds()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(0.6f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + + scrollbar_controller_->DidScrollGestureBegin(); + scrollbar_controller_->DidScrollGestureEnd(time); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(0.6f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor()); +} + +TEST_F(ScrollbarAnimationControllerThinningTest, AwakenByProgrammaticScroll) { + base::TimeTicks time; + time += base::TimeDelta::FromSeconds(1); + EXPECT_TRUE(scrollbar_controller_->DidScrollUpdate(time)); + EXPECT_TRUE(scrollbar_controller_->IsAnimating()); + EXPECT_EQ(2, scrollbar_controller_->DelayBeforeStart(time).InSeconds()); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); + EXPECT_TRUE(scrollbar_controller_->DidScrollUpdate(time)); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(0.6f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + EXPECT_TRUE(scrollbar_controller_->DidScrollUpdate(time)); + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(0.6f, scrollbar_layer_->thumb_thickness_scale_factor()); + + time += base::TimeDelta::FromSeconds(1); + scrollbar_controller_->Animate(time); + EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity()); + EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor()); +} + +} // namespace +} // namespace cc @@ -44,6 +44,8 @@ 'animation/scrollbar_animation_controller.h', 'animation/scrollbar_animation_controller_linear_fade.cc', 'animation/scrollbar_animation_controller_linear_fade.h', + 'animation/scrollbar_animation_controller_thinning.cc', + 'animation/scrollbar_animation_controller_thinning.h', 'animation/timing_function.cc', 'animation/timing_function.h', 'animation/transform_operation.cc', diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp index 581e609..4ecb8e7 100644 --- a/cc/cc_tests.gyp +++ b/cc/cc_tests.gyp @@ -10,6 +10,7 @@ 'animation/keyframed_animation_curve_unittest.cc', 'animation/layer_animation_controller_unittest.cc', 'animation/scrollbar_animation_controller_linear_fade_unittest.cc', + 'animation/scrollbar_animation_controller_thinning_unittest.cc', 'animation/timing_function_unittest.cc', 'animation/transform_operations_unittest.cc', 'base/float_quad_unittest.cc', diff --git a/cc/input/scrollbar.h b/cc/input/scrollbar.h index 4c7e338..bfefd43 100644 --- a/cc/input/scrollbar.h +++ b/cc/input/scrollbar.h @@ -24,6 +24,7 @@ class Scrollbar { virtual ~Scrollbar() {} virtual ScrollbarOrientation Orientation() const = 0; + virtual bool IsLeftSideVerticalScrollbar() const = 0; virtual gfx::Point Location() const = 0; virtual bool IsOverlay() const = 0; virtual bool HasThumb() const = 0; diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index 615fcf2..1531570 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc @@ -9,6 +9,7 @@ #include "cc/animation/animation_registrar.h" #include "cc/animation/scrollbar_animation_controller.h" #include "cc/animation/scrollbar_animation_controller_linear_fade.h" +#include "cc/animation/scrollbar_animation_controller_thinning.h" #include "cc/base/math_util.h" #include "cc/debug/debug_colors.h" #include "cc/debug/layer_tree_debug_state.h" @@ -976,8 +977,10 @@ void LayerImpl::UpdateScrollbarPositions() { last_scroll_offset_ = current_offset; if (scrollbar_animation_controller_) { - scrollbar_animation_controller_->DidScrollUpdate( + bool should_animate = scrollbar_animation_controller_->DidScrollUpdate( layer_tree_impl_->CurrentPhysicalTimeTicks()); + if (should_animate) + layer_tree_impl_->StartScrollbarAnimation(); } // Get the current_offset_.y() value for a sanity-check on scrolling @@ -1089,13 +1092,6 @@ void LayerImpl::SetMaxScrollOffset(gfx::Vector2d max_scroll_offset) { UpdateScrollbarPositions(); } -void LayerImpl::SetScrollbarOpacity(float opacity) { - if (horizontal_scrollbar_layer_) - horizontal_scrollbar_layer_->SetOpacity(opacity); - if (vertical_scrollbar_layer_) - vertical_scrollbar_layer_->SetOpacity(opacity); -} - void LayerImpl::DidBecomeActive() { if (layer_tree_impl_->settings().scrollbar_animator == LayerTreeSettings::NoAnimator) { @@ -1125,6 +1121,12 @@ void LayerImpl::DidBecomeActive() { .PassAs<ScrollbarAnimationController>(); break; } + case LayerTreeSettings::Thinning: { + scrollbar_animation_controller_ = + ScrollbarAnimationControllerThinning::Create(this) + .PassAs<ScrollbarAnimationController>(); + break; + } case LayerTreeSettings::NoAnimator: NOTREACHED(); break; diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h index 484de95..ba0ff7b 100644 --- a/cc/layers/layer_impl.h +++ b/cc/layers/layer_impl.h @@ -452,8 +452,6 @@ class CC_EXPORT LayerImpl : LayerAnimationValueObserver { return scrollbar_animation_controller_.get(); } - void SetScrollbarOpacity(float opacity); - void SetHorizontalScrollbarLayer(ScrollbarLayerImplBase* scrollbar_layer); ScrollbarLayerImplBase* horizontal_scrollbar_layer() { return horizontal_scrollbar_layer_; diff --git a/cc/layers/painted_scrollbar_layer_impl.cc b/cc/layers/painted_scrollbar_layer_impl.cc index 83685c3..e38a1a6 100644 --- a/cc/layers/painted_scrollbar_layer_impl.cc +++ b/cc/layers/painted_scrollbar_layer_impl.cc @@ -29,7 +29,7 @@ PaintedScrollbarLayerImpl::PaintedScrollbarLayerImpl( LayerTreeImpl* tree_impl, int id, ScrollbarOrientation orientation) - : ScrollbarLayerImplBase(tree_impl, id, orientation), + : ScrollbarLayerImplBase(tree_impl, id, orientation, false), track_ui_resource_id_(0), thumb_ui_resource_id_(0), thumb_thickness_(0), diff --git a/cc/layers/painted_scrollbar_layer_impl.h b/cc/layers/painted_scrollbar_layer_impl.h index 57a7330..c9d1f3d 100644 --- a/cc/layers/painted_scrollbar_layer_impl.h +++ b/cc/layers/painted_scrollbar_layer_impl.h @@ -36,7 +36,6 @@ class CC_EXPORT PaintedScrollbarLayerImpl : public ScrollbarLayerImplBase { virtual void DidLoseOutputSurface() OVERRIDE; void SetThumbThickness(int thumb_thickness); - int thumb_thickness() const { return thumb_thickness_; } void SetThumbLength(int thumb_length); void SetTrackStart(int track_start); void SetTrackLength(int track_length); diff --git a/cc/layers/scrollbar_layer_impl_base.cc b/cc/layers/scrollbar_layer_impl_base.cc index 9fa32b7..c1e7126 100644 --- a/cc/layers/scrollbar_layer_impl_base.cc +++ b/cc/layers/scrollbar_layer_impl_base.cc @@ -10,15 +10,19 @@ namespace cc { -ScrollbarLayerImplBase::ScrollbarLayerImplBase(LayerTreeImpl* tree_impl, - int id, - ScrollbarOrientation orientation) +ScrollbarLayerImplBase::ScrollbarLayerImplBase( + LayerTreeImpl* tree_impl, + int id, + ScrollbarOrientation orientation, + bool is_left_side_vertical_scrollbar) : LayerImpl(tree_impl, id), scroll_layer_id_(Layer::INVALID_ID), is_overlay_scrollbar_(false), + thumb_thickness_scale_factor_(1.f), current_pos_(0.f), maximum_(0), orientation_(orientation), + is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar), vertical_adjust_(0.f), visible_to_total_length_ratio_(1.f) {} @@ -141,13 +145,23 @@ gfx::Rect ScrollbarLayerImplBase::ComputeThumbQuadRect() const { float max_offset = track_length - thumb_length; int thumb_offset = static_cast<int>(ratio * max_offset) + TrackStart(); + float thumb_thickness_adjustment = + thumb_thickness * (1.f - thumb_thickness_scale_factor_); + gfx::RectF thumb_rect; - if (orientation() == HORIZONTAL) { - thumb_rect = gfx::RectF(thumb_offset, vertical_adjust_, - thumb_length, thumb_thickness); + if (orientation_ == HORIZONTAL) { + thumb_rect = gfx::RectF(thumb_offset, + vertical_adjust_ + thumb_thickness_adjustment, + thumb_length, + thumb_thickness - thumb_thickness_adjustment); } else { - thumb_rect = gfx::RectF(0.f, thumb_offset, - thumb_thickness, thumb_length); + thumb_rect = gfx::RectF( + is_left_side_vertical_scrollbar_ + ? bounds().width() - thumb_thickness + : thumb_thickness_adjustment, + thumb_offset, + thumb_thickness - thumb_thickness_adjustment, + thumb_length); } return ScrollbarLayerRectToContentRect(thumb_rect); diff --git a/cc/layers/scrollbar_layer_impl_base.h b/cc/layers/scrollbar_layer_impl_base.h index 47783d7..55ade6a 100644 --- a/cc/layers/scrollbar_layer_impl_base.h +++ b/cc/layers/scrollbar_layer_impl_base.h @@ -31,6 +31,9 @@ class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl { } ScrollbarOrientation orientation() const { return orientation_; } + bool is_left_side_vertical_scrollbar() { + return is_left_side_vertical_scrollbar_; + } virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; virtual ScrollbarLayerImplBase* ToScrollbarLayer() OVERRIDE; @@ -38,10 +41,18 @@ class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl { void SetVisibleToTotalLengthRatio(float ratio); virtual gfx::Rect ComputeThumbQuadRect() const; + float thumb_thickness_scale_factor() { + return thumb_thickness_scale_factor_; + } + void set_thumb_thickness_scale_factor(float thumb_thickness_scale_factor) { + thumb_thickness_scale_factor_ = thumb_thickness_scale_factor; + } + protected: ScrollbarLayerImplBase(LayerTreeImpl* tree_impl, int id, - ScrollbarOrientation orientation); + ScrollbarOrientation orientation, + bool is_left_side_vertical_scrollbar); virtual ~ScrollbarLayerImplBase() {} gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const; @@ -60,9 +71,11 @@ class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl { int scroll_layer_id_; bool is_overlay_scrollbar_; + float thumb_thickness_scale_factor_; float current_pos_; int maximum_; ScrollbarOrientation orientation_; + bool is_left_side_vertical_scrollbar_; // Difference between the clip layer's height and the visible viewport // height (which may differ in the presence of top-controls hiding). diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc index 21b4bb7..1e9442d5 100644 --- a/cc/layers/scrollbar_layer_unittest.cc +++ b/cc/layers/scrollbar_layer_unittest.cc @@ -42,8 +42,10 @@ LayerImpl* LayerImplForScrollAreaAndScrollbar( scoped_refptr<Layer> child1 = Layer::Create(); scoped_refptr<Layer> child2; if (use_solid_color_scrollbar) { + const bool kIsLeftSideVerticalScrollbar = false; child2 = SolidColorScrollbarLayer::Create( - scrollbar->Orientation(), thumb_thickness, child1->id()); + scrollbar->Orientation(), thumb_thickness, + kIsLeftSideVerticalScrollbar, child1->id()); } else { child2 = PaintedScrollbarLayer::Create(scrollbar.Pass(), child1->id()); } @@ -264,7 +266,7 @@ TEST(ScrollbarLayerTest, SolidColorDrawQuads) { const int kTrackLength = 100; LayerTreeSettings layer_tree_settings; - layer_tree_settings.solid_color_scrollbar_thickness_dip = 3; + layer_tree_settings.solid_color_scrollbar_thickness_dip = kThumbThickness; scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(layer_tree_settings); @@ -368,11 +370,14 @@ class ScrollbarLayerSolidColorThumbTest : public testing::Test { host_impl_.reset(new FakeLayerTreeHostImpl(layer_tree_settings, &proxy_)); const int kThumbThickness = 3; + const bool kIsLeftSideVerticalScrollbar = false; horizontal_scrollbar_layer_ = SolidColorScrollbarLayerImpl::Create( - host_impl_->active_tree(), 1, HORIZONTAL, kThumbThickness); + host_impl_->active_tree(), 1, HORIZONTAL, kThumbThickness, + kIsLeftSideVerticalScrollbar); vertical_scrollbar_layer_ = SolidColorScrollbarLayerImpl::Create( - host_impl_->active_tree(), 2, VERTICAL, kThumbThickness); + host_impl_->active_tree(), 2, VERTICAL, kThumbThickness, + kIsLeftSideVerticalScrollbar); } protected: @@ -576,9 +581,11 @@ class ScrollbarLayerTestResourceCreation : public testing::Test { scoped_refptr<Layer> scrollbar_layer; if (use_solid_color_scrollbar) { const int kThumbThickness = 3; + const bool kIsLeftSideVerticalScrollbar = false; scrollbar_layer = SolidColorScrollbarLayer::Create(scrollbar->Orientation(), kThumbThickness, + kIsLeftSideVerticalScrollbar, layer_tree_root->id()); } else { scrollbar_layer = PaintedScrollbarLayer::Create(scrollbar.Pass(), diff --git a/cc/layers/solid_color_scrollbar_layer.cc b/cc/layers/solid_color_scrollbar_layer.cc index 6c71bba..d9ed922 100644 --- a/cc/layers/solid_color_scrollbar_layer.cc +++ b/cc/layers/solid_color_scrollbar_layer.cc @@ -13,25 +13,31 @@ namespace cc { scoped_ptr<LayerImpl> SolidColorScrollbarLayer::CreateLayerImpl( LayerTreeImpl* tree_impl) { return SolidColorScrollbarLayerImpl::Create( - tree_impl, id(), orientation(), thumb_thickness_).PassAs<LayerImpl>(); + tree_impl, id(), orientation(), thumb_thickness_, + is_left_side_vertical_scrollbar_).PassAs<LayerImpl>(); } scoped_refptr<SolidColorScrollbarLayer> SolidColorScrollbarLayer::Create( ScrollbarOrientation orientation, int thumb_thickness, + bool is_left_side_vertical_scrollbar, int scroll_layer_id) { - return make_scoped_refptr(new SolidColorScrollbarLayer(orientation, - thumb_thickness, - scroll_layer_id)); + return make_scoped_refptr(new SolidColorScrollbarLayer( + orientation, + thumb_thickness, + is_left_side_vertical_scrollbar, + scroll_layer_id)); } SolidColorScrollbarLayer::SolidColorScrollbarLayer( ScrollbarOrientation orientation, int thumb_thickness, + bool is_left_side_vertical_scrollbar, int scroll_layer_id) : scroll_layer_id_(scroll_layer_id), orientation_(orientation), - thumb_thickness_(thumb_thickness) {} + thumb_thickness_(thumb_thickness), + is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar) {} SolidColorScrollbarLayer::~SolidColorScrollbarLayer() {} diff --git a/cc/layers/solid_color_scrollbar_layer.h b/cc/layers/solid_color_scrollbar_layer.h index 5c43655..9c0dc1e 100644 --- a/cc/layers/solid_color_scrollbar_layer.h +++ b/cc/layers/solid_color_scrollbar_layer.h @@ -20,6 +20,7 @@ class CC_EXPORT SolidColorScrollbarLayer : public ScrollbarLayerInterface, static scoped_refptr<SolidColorScrollbarLayer> Create( ScrollbarOrientation orientation, int thumb_thickness, + bool is_left_side_vertical_scrollbar, int scroll_layer_id); // Layer overrides. @@ -35,6 +36,7 @@ class CC_EXPORT SolidColorScrollbarLayer : public ScrollbarLayerInterface, protected: SolidColorScrollbarLayer(ScrollbarOrientation orientation, int thumb_thickness, + bool is_left_side_vertical_scrollbar, int scroll_layer_id); virtual ~SolidColorScrollbarLayer(); @@ -42,6 +44,7 @@ class CC_EXPORT SolidColorScrollbarLayer : public ScrollbarLayerInterface, int scroll_layer_id_; ScrollbarOrientation orientation_; int thumb_thickness_; + bool is_left_side_vertical_scrollbar_; DISALLOW_COPY_AND_ASSIGN(SolidColorScrollbarLayer); }; diff --git a/cc/layers/solid_color_scrollbar_layer_impl.cc b/cc/layers/solid_color_scrollbar_layer_impl.cc index 68812ee..806a236 100644 --- a/cc/layers/solid_color_scrollbar_layer_impl.cc +++ b/cc/layers/solid_color_scrollbar_layer_impl.cc @@ -14,9 +14,11 @@ scoped_ptr<SolidColorScrollbarLayerImpl> SolidColorScrollbarLayerImpl::Create( LayerTreeImpl* tree_impl, int id, ScrollbarOrientation orientation, - int thumb_thickness) { + int thumb_thickness, + bool is_left_side_vertical_scrollbar) { return make_scoped_ptr(new SolidColorScrollbarLayerImpl( - tree_impl, id, orientation, thumb_thickness)); + tree_impl, id, orientation, thumb_thickness, + is_left_side_vertical_scrollbar)); } SolidColorScrollbarLayerImpl::~SolidColorScrollbarLayerImpl() {} @@ -24,15 +26,18 @@ SolidColorScrollbarLayerImpl::~SolidColorScrollbarLayerImpl() {} scoped_ptr<LayerImpl> SolidColorScrollbarLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { return SolidColorScrollbarLayerImpl::Create( - tree_impl, id(), orientation(), thumb_thickness_).PassAs<LayerImpl>(); + tree_impl, id(), orientation(), thumb_thickness_, + is_left_side_vertical_scrollbar()).PassAs<LayerImpl>(); } SolidColorScrollbarLayerImpl::SolidColorScrollbarLayerImpl( LayerTreeImpl* tree_impl, int id, ScrollbarOrientation orientation, - int thumb_thickness) - : ScrollbarLayerImplBase(tree_impl, id, orientation), + int thumb_thickness, + bool is_left_side_vertical_scrollbar) + : ScrollbarLayerImplBase(tree_impl, id, orientation, + is_left_side_vertical_scrollbar), thumb_thickness_(thumb_thickness), color_(tree_impl->settings().solid_color_scrollbar_color) {} diff --git a/cc/layers/solid_color_scrollbar_layer_impl.h b/cc/layers/solid_color_scrollbar_layer_impl.h index c952fc2..56cbacd 100644 --- a/cc/layers/solid_color_scrollbar_layer_impl.h +++ b/cc/layers/solid_color_scrollbar_layer_impl.h @@ -16,7 +16,8 @@ class CC_EXPORT SolidColorScrollbarLayerImpl : public ScrollbarLayerImplBase { LayerTreeImpl* tree_impl, int id, ScrollbarOrientation orientation, - int thumb_thickness); + int thumb_thickness, + bool is_left_side_vertical_scrollbar); virtual ~SolidColorScrollbarLayerImpl(); // LayerImpl overrides. @@ -32,7 +33,8 @@ class CC_EXPORT SolidColorScrollbarLayerImpl : public ScrollbarLayerImplBase { SolidColorScrollbarLayerImpl(LayerTreeImpl* tree_impl, int id, ScrollbarOrientation orientation, - int thumb_thickness); + int thumb_thickness, + bool is_left_side_vertical_scrollbar); // ScrollbarLayerImplBase implementation. virtual int ThumbThickness() const OVERRIDE; diff --git a/cc/test/fake_scrollbar.cc b/cc/test/fake_scrollbar.cc index 67166f6..b1566fb 100644 --- a/cc/test/fake_scrollbar.cc +++ b/cc/test/fake_scrollbar.cc @@ -32,6 +32,10 @@ ScrollbarOrientation FakeScrollbar::Orientation() const { return HORIZONTAL; } +bool FakeScrollbar::IsLeftSideVerticalScrollbar() const { + return false; +} + gfx::Point FakeScrollbar::Location() const { return location_; } bool FakeScrollbar::IsOverlay() const { return is_overlay_; } diff --git a/cc/test/fake_scrollbar.h b/cc/test/fake_scrollbar.h index 0f068b0..e1ac147 100644 --- a/cc/test/fake_scrollbar.h +++ b/cc/test/fake_scrollbar.h @@ -19,6 +19,7 @@ class FakeScrollbar : public Scrollbar { // Scrollbar implementation. virtual ScrollbarOrientation Orientation() const OVERRIDE; + virtual bool IsLeftSideVerticalScrollbar() const OVERRIDE; virtual gfx::Point Location() const OVERRIDE; virtual bool IsOverlay() const OVERRIDE; virtual bool HasThumb() const OVERRIDE; diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 4c6b6b1..faff70e 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc @@ -513,6 +513,10 @@ gfx::Size LayerTreeImpl::DrawViewportSize() const { return layer_tree_host_impl_->DrawViewportSize(); } +void LayerTreeImpl::StartScrollbarAnimation() { + layer_tree_host_impl_->StartScrollbarAnimation(); +} + void LayerTreeImpl::SetNeedsRedraw() { layer_tree_host_impl_->SetNeedsRedraw(); } diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h index 3b18693..969cba2 100644 --- a/cc/trees/layer_tree_impl.h +++ b/cc/trees/layer_tree_impl.h @@ -79,6 +79,7 @@ class CC_EXPORT LayerTreeImpl { base::TimeTicks CurrentPhysicalTimeTicks() const; void SetNeedsCommit(); gfx::Size DrawViewportSize() const; + void StartScrollbarAnimation(); // Tree specific methods exposed to layer-impl tree. // --------------------------------------------------------------------------- diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h index 5d16165..25b98d4 100644 --- a/cc/trees/layer_tree_settings.h +++ b/cc/trees/layer_tree_settings.h @@ -37,6 +37,7 @@ class CC_EXPORT LayerTreeSettings { enum ScrollbarAnimator { NoAnimator, LinearFade, + Thinning, }; ScrollbarAnimator scrollbar_animator; int scrollbar_linear_fade_delay_ms; diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc index cb7df84..ec047de 100644 --- a/content/renderer/gpu/render_widget_compositor.cc +++ b/content/renderer/gpu/render_widget_compositor.cc @@ -279,7 +279,7 @@ scoped_ptr<RenderWidgetCompositor> RenderWidgetCompositor::Create( widget->UsingSynchronousRendererCompositor(); #elif !defined(OS_MACOSX) if (cmd->HasSwitch(switches::kEnableOverlayScrollbars)) { - settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; + settings.scrollbar_animator = cc::LayerTreeSettings::Thinning; settings.solid_color_scrollbars = true; } if (cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport) || diff --git a/webkit/renderer/compositor_bindings/scrollbar_impl.cc b/webkit/renderer/compositor_bindings/scrollbar_impl.cc index 4f1c4bf..332cf7e 100644 --- a/webkit/renderer/compositor_bindings/scrollbar_impl.cc +++ b/webkit/renderer/compositor_bindings/scrollbar_impl.cc @@ -28,6 +28,10 @@ cc::ScrollbarOrientation ScrollbarImpl::Orientation() const { return cc::VERTICAL; } +bool ScrollbarImpl::IsLeftSideVerticalScrollbar() const { + return scrollbar_->isLeftSideVerticalScrollbar(); +} + bool ScrollbarImpl::HasThumb() const { return geometry_->hasThumb(scrollbar_.get()); } diff --git a/webkit/renderer/compositor_bindings/scrollbar_impl.h b/webkit/renderer/compositor_bindings/scrollbar_impl.h index 0b6671d..284be63 100644 --- a/webkit/renderer/compositor_bindings/scrollbar_impl.h +++ b/webkit/renderer/compositor_bindings/scrollbar_impl.h @@ -26,6 +26,7 @@ class ScrollbarImpl : public cc::Scrollbar { // cc::Scrollbar implementation. virtual cc::ScrollbarOrientation Orientation() const OVERRIDE; + virtual bool IsLeftSideVerticalScrollbar() const OVERRIDE; virtual bool HasThumb() const OVERRIDE; virtual bool IsOverlay() const OVERRIDE; virtual gfx::Point Location() const OVERRIDE; diff --git a/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc b/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc index f80c28b..4805dc6 100644 --- a/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc +++ b/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc @@ -82,8 +82,17 @@ WebScrollbarLayer* WebCompositorSupportImpl::createScrollbarLayer( } WebScrollbarLayer* WebCompositorSupportImpl::createSolidColorScrollbarLayer( - WebKit::WebScrollbar::Orientation orientation, int thumb_thickness) { - return new WebScrollbarLayerImpl(orientation, thumb_thickness); + WebScrollbar::Orientation orientation, int thumb_thickness) { + // TODO(tony): Remove this after the caller in blink is migrated to + // the version which includes |should_place_vertical_scrollbar_on_left|. + return new WebScrollbarLayerImpl(orientation, thumb_thickness, false); +} + +WebScrollbarLayer* WebCompositorSupportImpl::createSolidColorScrollbarLayer( + WebScrollbar::Orientation orientation, int thumb_thickness, + bool is_left_side_vertical_scrollbar) { + return new WebScrollbarLayerImpl(orientation, thumb_thickness, + is_left_side_vertical_scrollbar); } WebAnimation* WebCompositorSupportImpl::createAnimation( diff --git a/webkit/renderer/compositor_bindings/web_compositor_support_impl.h b/webkit/renderer/compositor_bindings/web_compositor_support_impl.h index a5c42c8..f2c2505 100644 --- a/webkit/renderer/compositor_bindings/web_compositor_support_impl.h +++ b/webkit/renderer/compositor_bindings/web_compositor_support_impl.h @@ -36,6 +36,9 @@ class WebCompositorSupportImpl : public WebKit::WebCompositorSupport { WebKit::WebScrollbarThemeGeometry*); virtual WebKit::WebScrollbarLayer* createSolidColorScrollbarLayer( WebKit::WebScrollbar::Orientation orientation, int thumb_thickness); + virtual WebKit::WebScrollbarLayer* createSolidColorScrollbarLayer( + WebKit::WebScrollbar::Orientation orientation, int thumb_thickness, + bool is_left_side_vertical_scrollbar); virtual WebKit::WebAnimation* createAnimation( const WebKit::WebAnimationCurve& curve, WebKit::WebAnimation::TargetProperty target, diff --git a/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.cc b/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.cc index a214c44..68a35d3 100644 --- a/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.cc +++ b/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.cc @@ -37,11 +37,14 @@ WebScrollbarLayerImpl::WebScrollbarLayerImpl( WebScrollbarLayerImpl::WebScrollbarLayerImpl( WebKit::WebScrollbar::Orientation orientation, - int thumb_thickness) + int thumb_thickness, + bool is_left_side_vertical_scrollbar) : layer_(new WebLayerImpl( - SolidColorScrollbarLayer::Create(ConvertOrientation(orientation), - thumb_thickness, - 0))) {} + SolidColorScrollbarLayer::Create( + ConvertOrientation(orientation), + thumb_thickness, + is_left_side_vertical_scrollbar, + 0))) {} WebScrollbarLayerImpl::~WebScrollbarLayerImpl() {} diff --git a/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.h b/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.h index d0ffaa25..a96ca98 100644 --- a/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.h +++ b/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.h @@ -27,7 +27,8 @@ class WebScrollbarLayerImpl : public WebKit::WebScrollbarLayer { WebKit::WebScrollbarThemeGeometry* geometry); WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebScrollbarLayerImpl( WebKit::WebScrollbar::Orientation orientation, - int thumb_thickness); + int thumb_thickness, + bool is_left_side_vertical_scrollbar); virtual ~WebScrollbarLayerImpl(); // WebKit::WebScrollbarLayer implementation. |