diff options
author | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-18 00:28:22 +0000 |
---|---|---|
committer | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-18 00:28:22 +0000 |
commit | 429b58813bde651b4c674ddde14d2b6a575ebe6e (patch) | |
tree | 88dbe2d20b04ee2353b534f8a5314237cff7c1dd /webkit/renderer | |
parent | 3f52559fdacbf3ce374b03550f3a5c63280e70a9 (diff) | |
download | chromium_src-429b58813bde651b4c674ddde14d2b6a575ebe6e.zip chromium_src-429b58813bde651b4c674ddde14d2b6a575ebe6e.tar.gz chromium_src-429b58813bde651b4c674ddde14d2b6a575ebe6e.tar.bz2 |
Revert 245663 "Revert 245645 "Define WebScrollOffsetAnimationCur..."
> Revert 245645 "Define WebScrollOffsetAnimationCurveImpl"
>
> Broke compositor_unittests on Linux Aura Tests with error:
I'm a dirty liar.
>
> LayerWithRealCompositorTest.DrawPixels (run #1):
> [ RUN ] LayerWithRealCompositorTest.DrawPixels
> ../../ui/compositor/layer_unittest.cc:832: Failure
> Value of: ReadPixels(&bitmap, gfx::Rect(viewport_size))
> Actual: false
> Expected: true
> [ FAILED ] LayerWithRealCompositorTest.DrawPixels (246 ms)
>
> LayerWithRealCompositorTest.DrawPixels (run #2):
> [ RUN ] LayerWithRealCompositorTest.DrawPixels
> ../../ui/compositor/layer_unittest.cc:832: Failure
> Value of: ReadPixels(&bitmap, gfx::Rect(viewport_size))
> Actual: false
> Expected: true
> [ FAILED ] LayerWithRealCompositorTest.DrawPixels (272 ms)
>
> LayerWithRealCompositorTest.DrawPixels (run #3):
> [ RUN ] LayerWithRealCompositorTest.DrawPixels
> ../../ui/compositor/layer_unittest.cc:832: Failure
> Value of: ReadPixels(&bitmap, gfx::Rect(viewport_size))
> Actual: false
> Expected: true
> [ FAILED ] LayerWithRealCompositorTest.DrawPixels (259 ms)
>
> LayerWithRealCompositorTest.DrawPixels (run #4):
> [ RUN ] LayerWithRealCompositorTest.DrawPixels
> ../../ui/compositor/layer_unittest.cc:832: Failure
> Value of: ReadPixels(&bitmap, gfx::Rect(viewport_size))
> Actual: false
> Expected: true
> [ FAILED ] LayerWithRealCompositorTest.DrawPixels (229 ms)
>
> > Define WebScrollOffsetAnimationCurveImpl
> >
> > This defines WebScrollOffsetAnimationCurveImpl, which wraps a
> > cc::ScrollOffsetAnimationCurve. This is needed for
> > implementing the CSSOM Smooth Scroll API.
> >
> > BUG=243871
> >
> > Review URL: https://codereview.chromium.org/112933005
>
> TBR=ajuma@chromium.org
>
> Review URL: https://codereview.chromium.org/141753007
TBR=dbeam@chromium.org
Review URL: https://codereview.chromium.org/141953013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245674 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/renderer')
6 files changed, 138 insertions, 0 deletions
diff --git a/webkit/renderer/compositor_bindings/compositor_bindings.gyp b/webkit/renderer/compositor_bindings/compositor_bindings.gyp index 6acc57c..09f4b51 100644 --- a/webkit/renderer/compositor_bindings/compositor_bindings.gyp +++ b/webkit/renderer/compositor_bindings/compositor_bindings.gyp @@ -69,6 +69,8 @@ 'web_layer_impl_fixed_bounds.h', 'web_nine_patch_layer_impl.cc', 'web_nine_patch_layer_impl.h', + 'web_scroll_offset_animation_curve_impl.cc', + 'web_scroll_offset_animation_curve_impl.h', 'web_scrollbar_layer_impl.cc', 'web_scrollbar_layer_impl.h', 'web_solid_color_layer_impl.cc', diff --git a/webkit/renderer/compositor_bindings/web_animation_impl.cc b/webkit/renderer/compositor_bindings/web_animation_impl.cc index dbcc184..c401d5c 100644 --- a/webkit/renderer/compositor_bindings/web_animation_impl.cc +++ b/webkit/renderer/compositor_bindings/web_animation_impl.cc @@ -11,6 +11,7 @@ #include "third_party/WebKit/public/platform/WebAnimationCurve.h" #include "webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.h" #include "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h" +#include "webkit/renderer/compositor_bindings/web_scroll_offset_animation_curve_impl.h" #include "webkit/renderer/compositor_bindings/web_transform_animation_curve_impl.h" using cc::Animation; @@ -51,6 +52,14 @@ WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& web_curve, curve = filter_curve_impl->CloneToAnimationCurve(); break; } +#if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED + case WebAnimationCurve::AnimationCurveTypeScrollOffset: { + const WebScrollOffsetAnimationCurveImpl* scroll_curve_impl = + static_cast<const WebScrollOffsetAnimationCurveImpl*>(&web_curve); + curve = scroll_curve_impl->CloneToAnimationCurve(); + break; + } +#endif } animation_ = Animation::Create( curve.Pass(), @@ -109,5 +118,9 @@ COMPILE_ASSERT_MATCHING_ENUMS( WebAnimation::TargetPropertyOpacity, Animation::Opacity); COMPILE_ASSERT_MATCHING_ENUMS( WebAnimation::TargetPropertyFilter, Animation::Filter); +#if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED +COMPILE_ASSERT_MATCHING_ENUMS( + WebAnimation::TargetPropertyScrollOffset, Animation::ScrollOffset); +#endif } // namespace webkit diff --git a/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc b/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc index a49de09..51bb621 100644 --- a/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc +++ b/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc @@ -19,6 +19,7 @@ #include "webkit/renderer/compositor_bindings/web_image_layer_impl.h" #include "webkit/renderer/compositor_bindings/web_layer_impl.h" #include "webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.h" +#include "webkit/renderer/compositor_bindings/web_scroll_offset_animation_curve_impl.h" #include "webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.h" #include "webkit/renderer/compositor_bindings/web_solid_color_layer_impl.h" #include "webkit/renderer/compositor_bindings/web_transform_animation_curve_impl.h" @@ -40,6 +41,9 @@ using blink::WebScrollbar; using blink::WebScrollbarLayer; using blink::WebScrollbarThemeGeometry; using blink::WebScrollbarThemePainter; +#if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED +using blink::WebScrollOffsetAnimationCurve; +#endif using blink::WebSolidColorLayer; using blink::WebTransformAnimationCurve; using blink::WebTransformOperations; @@ -106,6 +110,15 @@ WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() { return new WebFloatAnimationCurveImpl(); } +#if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED +WebScrollOffsetAnimationCurve* +WebCompositorSupportImpl::createScrollOffsetAnimationCurve( + blink::WebFloatPoint target_value, + blink::WebAnimationCurve::TimingFunctionType timing_function) { + return new WebScrollOffsetAnimationCurveImpl(target_value, timing_function); +} +#endif + WebTransformAnimationCurve* WebCompositorSupportImpl::createTransformAnimationCurve() { return new WebTransformAnimationCurveImpl(); diff --git a/webkit/renderer/compositor_bindings/web_compositor_support_impl.h b/webkit/renderer/compositor_bindings/web_compositor_support_impl.h index 276a5906..e89a0cb 100644 --- a/webkit/renderer/compositor_bindings/web_compositor_support_impl.h +++ b/webkit/renderer/compositor_bindings/web_compositor_support_impl.h @@ -7,6 +7,7 @@ #include "base/memory/ref_counted.h" #include "base/message_loop/message_loop_proxy.h" +#include "third_party/WebKit/public/platform/WebAnimationCurve.h" #include "third_party/WebKit/public/platform/WebCompositorSupport.h" #include "third_party/WebKit/public/platform/WebLayer.h" #include "third_party/WebKit/public/platform/WebTransformOperations.h" @@ -43,6 +44,12 @@ class WebCompositorSupportImpl : public blink::WebCompositorSupport { int animation_id); virtual blink::WebFilterAnimationCurve* createFilterAnimationCurve(); virtual blink::WebFloatAnimationCurve* createFloatAnimationCurve(); +#if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED + virtual blink::WebScrollOffsetAnimationCurve* + createScrollOffsetAnimationCurve( + blink::WebFloatPoint target_value, + blink::WebAnimationCurve::TimingFunctionType timing_function); +#endif virtual blink::WebTransformAnimationCurve* createTransformAnimationCurve(); virtual blink::WebTransformOperations* createTransformOperations(); virtual blink::WebFilterOperations* createFilterOperations(); diff --git a/webkit/renderer/compositor_bindings/web_scroll_offset_animation_curve_impl.cc b/webkit/renderer/compositor_bindings/web_scroll_offset_animation_curve_impl.cc new file mode 100644 index 0000000..fc6c76a --- /dev/null +++ b/webkit/renderer/compositor_bindings/web_scroll_offset_animation_curve_impl.cc @@ -0,0 +1,52 @@ +// Copyright 2014 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 "webkit/renderer/compositor_bindings/web_scroll_offset_animation_curve_impl.h" + +#if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED + +#include "cc/animation/scroll_offset_animation_curve.h" +#include "cc/animation/timing_function.h" +#include "webkit/renderer/compositor_bindings/web_animation_curve_common.h" + +using blink::WebFloatPoint; + +namespace webkit { + +WebScrollOffsetAnimationCurveImpl::WebScrollOffsetAnimationCurveImpl( + WebFloatPoint target_value, + TimingFunctionType timing_function) + : curve_(cc::ScrollOffsetAnimationCurve::Create( + gfx::Vector2dF(target_value.x, target_value.y), + CreateTimingFunction(timing_function))) {} + +WebScrollOffsetAnimationCurveImpl::~WebScrollOffsetAnimationCurveImpl() {} + +blink::WebAnimationCurve::AnimationCurveType +WebScrollOffsetAnimationCurveImpl::type() const { + return WebAnimationCurve::AnimationCurveTypeScrollOffset; +} + +void WebScrollOffsetAnimationCurveImpl::setInitialValue( + WebFloatPoint initial_value) { + curve_->SetInitialValue(gfx::Vector2dF(initial_value.x, initial_value.y)); +} + +WebFloatPoint WebScrollOffsetAnimationCurveImpl::getValue(double time) const { + gfx::Vector2dF value = curve_->GetValue(time); + return WebFloatPoint(value.x(), value.y()); +} + +double WebScrollOffsetAnimationCurveImpl::duration() const { + return curve_->Duration(); +} + +scoped_ptr<cc::AnimationCurve> +WebScrollOffsetAnimationCurveImpl::CloneToAnimationCurve() const { + return curve_->Clone(); +} + +} // namespace webkit + +#endif // WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED diff --git a/webkit/renderer/compositor_bindings/web_scroll_offset_animation_curve_impl.h b/webkit/renderer/compositor_bindings/web_scroll_offset_animation_curve_impl.h new file mode 100644 index 0000000..ae1c8b0 --- /dev/null +++ b/webkit/renderer/compositor_bindings/web_scroll_offset_animation_curve_impl.h @@ -0,0 +1,51 @@ +// Copyright 2014 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 WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_SCROLL_OFFSET_ANIMATION_CURVE_IMPL_H_ +#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_SCROLL_OFFSET_ANIMATION_CURVE_IMPL_H_ + +#include "third_party/WebKit/public/platform/WebAnimationCurve.h" + +#if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED + +#include "base/memory/scoped_ptr.h" +#include "third_party/WebKit/public/platform/WebScrollOffsetAnimationCurve.h" +#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" + +namespace cc { +class AnimationCurve; +class ScrollOffsetAnimationCurve; +} + +namespace webkit { + +class WebScrollOffsetAnimationCurveImpl + : public blink::WebScrollOffsetAnimationCurve { + public: + WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebScrollOffsetAnimationCurveImpl( + blink::WebFloatPoint target_value, + TimingFunctionType timing_function); + virtual ~WebScrollOffsetAnimationCurveImpl(); + + // blink::WebAnimationCurve implementation. + virtual AnimationCurveType type() const; + + // blink::WebScrollOffsetAnimationCurve implementation. + virtual void setInitialValue(blink::WebFloatPoint initial_value); + virtual blink::WebFloatPoint getValue(double time) const; + virtual double duration() const; + + scoped_ptr<cc::AnimationCurve> CloneToAnimationCurve() const; + + private: + scoped_ptr<cc::ScrollOffsetAnimationCurve> curve_; + + DISALLOW_COPY_AND_ASSIGN(WebScrollOffsetAnimationCurveImpl); +}; + +} // namespace webkit + +#endif // WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED + +#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_SCROLL_OFFSET_ANIMATION_CURVE_IMPL_H_ |