Skip to content

Commit

Permalink
Revert 245663 "Revert 245645 "Define WebScrollOffsetAnimationCur..."
Browse files Browse the repository at this point in the history
> Revert 245645 "Define WebScrollOffsetAnimationCurveImpl"
> 
> Broke compositor_unittests on Linux Aura Tests with error:

I'm a dirty liar.

> 
>   LayerWithRealCompositorTest.DrawPixels (run chromium#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 chromium#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 chromium#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 chromium#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
  • Loading branch information
dbeam@chromium.org committed Jan 18, 2014
1 parent 3f52559 commit 429b588
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cc/animation/animation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ static const char* const s_targetPropertyNames[] = {
"Transform",
"Opacity",
"Filter",
"BackgroundColor",
"ScrollOffset"
"ScrollOffset",
"BackgroundColor"
};

COMPILE_ASSERT(static_cast<int>(cc::Animation::TargetPropertyEnumSize) ==
Expand Down
2 changes: 1 addition & 1 deletion cc/animation/animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class CC_EXPORT Animation {
Transform = 0,
Opacity,
Filter,
BackgroundColor,
ScrollOffset,
BackgroundColor,
// This sentinel must be last.
TargetPropertyEnumSize
};
Expand Down
2 changes: 2 additions & 0 deletions webkit/renderer/compositor_bindings/compositor_bindings.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
13 changes: 13 additions & 0 deletions webkit/renderer/compositor_bindings/web_animation_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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
13 changes: 13 additions & 0 deletions webkit/renderer/compositor_bindings/web_compositor_support_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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_

0 comments on commit 429b588

Please sign in to comment.