summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/animation/animation.cc83
-rw-r--r--cc/animation/animation.h70
-rw-r--r--cc/animation/animation_curve.cc22
-rw-r--r--cc/animation/animation_curve.h2
-rw-r--r--cc/animation/animation_events.h2
-rw-r--r--cc/animation/animation_unittest.cc138
-rw-r--r--cc/animation/layer_animation_controller.cc180
-rw-r--r--cc/animation/layer_animation_controller.h5
-rw-r--r--cc/animation/layer_animation_controller_unittest.cc488
-rw-r--r--cc/animation/scroll_offset_animation_curve.cc2
-rw-r--r--cc/animation/scroll_offset_animation_curve_unittest.cc4
-rw-r--r--cc/animation/transform_operation.cc32
-rw-r--r--cc/animation/transform_operation.h18
-rw-r--r--cc/animation/transform_operations.cc58
-rw-r--r--cc/blink/web_animation_impl.cc32
-rw-r--r--cc/blink/web_layer_impl.cc8
-rw-r--r--cc/input/input_handler.h26
-rw-r--r--cc/layers/heads_up_display_layer_impl.cc2
-rw-r--r--cc/layers/layer.cc10
-rw-r--r--cc/layers/layer_impl.cc50
-rw-r--r--cc/layers/layer_impl.h2
-rw-r--r--cc/layers/layer_unittest.cc17
-rw-r--r--cc/layers/picture_image_layer_impl_unittest.cc3
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc5
-rw-r--r--cc/layers/scroll_blocks_on.h13
-rw-r--r--cc/layers/scrollbar_layer_unittest.cc14
-rw-r--r--cc/layers/texture_layer_impl.cc2
-rw-r--r--cc/output/direct_renderer.cc2
-rw-r--r--cc/output/gl_renderer.cc211
-rw-r--r--cc/output/gl_renderer.h79
-rw-r--r--cc/output/gl_renderer_unittest.cc85
-rw-r--r--cc/output/program_binding.h2
-rw-r--r--cc/output/renderer_pixeltest.cc20
-rw-r--r--cc/output/shader.cc73
-rw-r--r--cc/output/shader.h56
-rw-r--r--cc/output/shader_unittest.cc40
-rw-r--r--cc/output/software_renderer.cc6
-rw-r--r--cc/output/software_renderer_unittest.cc16
-rw-r--r--cc/quads/draw_polygon.cc2
-rw-r--r--cc/resources/prioritized_resource_manager.cc7
-rw-r--r--cc/resources/resource_provider.cc239
-rw-r--r--cc/resources/resource_provider.h22
-rw-r--r--cc/resources/resource_provider_unittest.cc244
-rw-r--r--cc/resources/scoped_resource.cc5
-rw-r--r--cc/resources/scoped_resource_unittest.cc12
-rw-r--r--cc/resources/tile.cc2
-rw-r--r--cc/resources/tile.h4
-rw-r--r--cc/resources/tile_priority.h4
-rw-r--r--cc/resources/tile_task_worker_pool_perftest.cc2
-rw-r--r--cc/resources/tile_task_worker_pool_unittest.cc9
-rw-r--r--cc/resources/tiling_set_eviction_queue.cc3
-rw-r--r--cc/resources/ui_resource_request.h6
-rw-r--r--cc/resources/video_resource_updater.cc6
-rw-r--r--cc/test/animation_test_common.cc14
-rw-r--r--cc/test/layer_tree_json_parser.cc6
-rw-r--r--cc/test/render_pass_test_common.cc40
-rw-r--r--cc/test/test_web_graphics_context_3d.cc2
-rw-r--r--cc/test/test_web_graphics_context_3d.h6
-rw-r--r--cc/trees/layer_sorter.cc14
-rw-r--r--cc/trees/layer_sorter.h6
-rw-r--r--cc/trees/layer_sorter_unittest.cc18
-rw-r--r--cc/trees/layer_tree_host.cc16
-rw-r--r--cc/trees/layer_tree_host_common.cc26
-rw-r--r--cc/trees/layer_tree_host_common_unittest.cc8
-rw-r--r--cc/trees/layer_tree_host_impl.cc59
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc601
-rw-r--r--cc/trees/layer_tree_host_unittest.cc2
-rw-r--r--cc/trees/layer_tree_host_unittest_animation.cc47
-rw-r--r--cc/trees/layer_tree_host_unittest_context.cc6
-rw-r--r--cc/trees/layer_tree_host_unittest_scroll.cc30
-rw-r--r--cc/trees/layer_tree_impl.cc12
-rw-r--r--cc/trees/layer_tree_settings.cc2
-rw-r--r--cc/trees/layer_tree_settings.h6
-rw-r--r--cc/trees/property_tree_builder.cc2
-rw-r--r--content/child/assert_matching_enums.cc11
-rw-r--r--content/renderer/gpu/render_widget_compositor.cc8
-rw-r--r--content/renderer/input/input_handler_proxy.cc41
-rw-r--r--content/renderer/input/input_handler_proxy_unittest.cc96
-rw-r--r--ui/compositor/layer_animation_element.cc22
-rw-r--r--ui/compositor/layer_animation_sequence_unittest.cc27
-rw-r--r--ui/compositor/layer_animator_unittest.cc72
-rw-r--r--ui/compositor/test/layer_animator_test_controller.cc13
82 files changed, 1730 insertions, 1928 deletions
diff --git a/cc/animation/animation.cc b/cc/animation/animation.cc
index 48ebc74..96cb40a 100644
--- a/cc/animation/animation.cc
+++ b/cc/animation/animation.cc
@@ -14,32 +14,28 @@
namespace {
// This should match the RunState enum.
-static const char* const s_runStateNames[] = {
- "WaitingForTargetAvailability",
- "WaitingForDeletion",
- "Starting",
- "Running",
- "Paused",
- "Finished",
- "Aborted"
-};
-
-static_assert(static_cast<int>(cc::Animation::RunStateEnumSize) ==
- arraysize(s_runStateNames),
+static const char* const s_runStateNames[] = {"WAITING_FOR_TARGET_AVAILABILITY",
+ "WAITING_FOR_DELETION",
+ "STARTING",
+ "RUNNING",
+ "PAUSED",
+ "FINISHED",
+ "ABORTED"};
+
+static_assert(static_cast<int>(cc::Animation::LAST_RUN_STATE) + 1 ==
+ arraysize(s_runStateNames),
"RunStateEnumSize should equal the number of elements in "
"s_runStateNames");
// This should match the TargetProperty enum.
-static const char* const s_targetPropertyNames[] = {
- "Transform",
- "Opacity",
- "Filter",
- "ScrollOffset",
- "BackgroundColor"
-};
-
-static_assert(static_cast<int>(cc::Animation::TargetPropertyEnumSize) ==
- arraysize(s_targetPropertyNames),
+static const char* const s_targetPropertyNames[] = {"TRANSFORM",
+ "OPACITY",
+ "FILTER",
+ "SCROLL_OFFSET",
+ "BACKGROUND_COLOR"};
+
+static_assert(static_cast<int>(cc::Animation::LAST_TARGET_PROPERTY) + 1 ==
+ arraysize(s_targetPropertyNames),
"TargetPropertyEnumSize should equal the number of elements in "
"s_targetPropertyNames");
@@ -65,12 +61,12 @@ Animation::Animation(scoped_ptr<AnimationCurve> curve,
id_(animation_id),
group_(group_id),
target_property_(target_property),
- run_state_(WaitingForTargetAvailability),
+ run_state_(WAITING_FOR_TARGET_AVAILABILITY),
iterations_(1),
iteration_start_(0),
- direction_(Normal),
+ direction_(DIRECTION_NORMAL),
playback_rate_(1),
- fill_mode_(FillModeBoth),
+ fill_mode_(FILL_MODE_BOTH),
needs_synchronized_start_time_(false),
received_finished_event_(false),
suspended_(false),
@@ -81,8 +77,8 @@ Animation::Animation(scoped_ptr<AnimationCurve> curve,
}
Animation::~Animation() {
- if (run_state_ == Running || run_state_ == Paused)
- SetRunState(Aborted, base::TimeTicks());
+ if (run_state_ == RUNNING || run_state_ == PAUSED)
+ SetRunState(ABORTED, base::TimeTicks());
}
void Animation::SetRunState(RunState run_state,
@@ -97,10 +93,10 @@ void Animation::SetRunState(RunState run_state,
s_targetPropertyNames[target_property_],
group_);
- bool is_waiting_to_start = run_state_ == WaitingForTargetAvailability ||
- run_state_ == Starting;
+ bool is_waiting_to_start =
+ run_state_ == WAITING_FOR_TARGET_AVAILABILITY || run_state_ == STARTING;
- if (is_controlling_instance_ && is_waiting_to_start && run_state == Running) {
+ if (is_controlling_instance_ && is_waiting_to_start && run_state == RUNNING) {
TRACE_EVENT_ASYNC_BEGIN1(
"cc", "Animation", this, "Name", TRACE_STR_COPY(name_buffer));
}
@@ -109,9 +105,9 @@ void Animation::SetRunState(RunState run_state,
const char* old_run_state_name = s_runStateNames[run_state_];
- if (run_state == Running && run_state_ == Paused)
+ if (run_state == RUNNING && run_state_ == PAUSED)
total_paused_time_ += (monotonic_time - pause_time_);
- else if (run_state == Paused)
+ else if (run_state == PAUSED)
pause_time_ = monotonic_time;
run_state_ = run_state;
@@ -137,13 +133,13 @@ void Animation::SetRunState(RunState run_state,
}
void Animation::Suspend(base::TimeTicks monotonic_time) {
- SetRunState(Paused, monotonic_time);
+ SetRunState(PAUSED, monotonic_time);
suspended_ = true;
}
void Animation::Resume(base::TimeTicks monotonic_time) {
suspended_ = false;
- SetRunState(Running, monotonic_time);
+ SetRunState(RUNNING, monotonic_time);
}
bool Animation::IsFinishedAt(base::TimeTicks monotonic_time) const {
@@ -156,7 +152,7 @@ bool Animation::IsFinishedAt(base::TimeTicks monotonic_time) const {
if (playback_rate_ == 0)
return false;
- return run_state_ == Running && iterations_ >= 0 &&
+ return run_state_ == RUNNING && iterations_ >= 0 &&
TimeUtil::Scale(curve_->Duration(),
iterations_ / std::abs(playback_rate_)) <=
(monotonic_time + time_offset_ - start_time_ - total_paused_time_);
@@ -164,7 +160,7 @@ bool Animation::IsFinishedAt(base::TimeTicks monotonic_time) const {
bool Animation::InEffect(base::TimeTicks monotonic_time) const {
return ConvertToActiveTime(monotonic_time) >= base::TimeDelta() ||
- (fill_mode_ == FillModeBoth || fill_mode_ == FillModeBackwards);
+ (fill_mode_ == FILL_MODE_BOTH || fill_mode_ == FILL_MODE_BACKWARDS);
}
base::TimeDelta Animation::ConvertToActiveTime(
@@ -172,7 +168,7 @@ base::TimeDelta Animation::ConvertToActiveTime(
base::TimeTicks trimmed = monotonic_time + time_offset_;
// If we're paused, time is 'stuck' at the pause time.
- if (run_state_ == Paused)
+ if (run_state_ == PAUSED)
trimmed = pause_time_;
// Returned time should always be relative to the start time and should
@@ -181,7 +177,7 @@ base::TimeDelta Animation::ConvertToActiveTime(
// If we're just starting or we're waiting on receiving a start time,
// time is 'stuck' at the initial state.
- if ((run_state_ == Starting && !has_set_start_time()) ||
+ if ((run_state_ == STARTING && !has_set_start_time()) ||
needs_synchronized_start_time())
trimmed = base::TimeTicks() + time_offset_;
@@ -247,9 +243,10 @@ base::TimeDelta Animation::TrimTimeToCurrentIteration(
// Check if we are running the animation in reverse direction for the current
// iteration
- bool reverse = (direction_ == Reverse) ||
- (direction_ == Alternate && iteration % 2 == 1) ||
- (direction_ == AlternateReverse && iteration % 2 == 0);
+ bool reverse =
+ (direction_ == DIRECTION_REVERSE) ||
+ (direction_ == DIRECTION_ALTERNATE && iteration % 2 == 1) ||
+ (direction_ == DIRECTION_ALTERNATE_REVERSE && iteration % 2 == 0);
// If we are running the animation in reverse direction, reverse the result
if (reverse)
@@ -280,8 +277,8 @@ scoped_ptr<Animation> Animation::CloneAndInitialize(
void Animation::PushPropertiesTo(Animation* other) const {
// Currently, we only push changes due to pausing and resuming animations on
// the main thread.
- if (run_state_ == Animation::Paused ||
- other->run_state_ == Animation::Paused) {
+ if (run_state_ == Animation::PAUSED ||
+ other->run_state_ == Animation::PAUSED) {
other->run_state_ = run_state_;
other->pause_time_ = pause_time_;
other->total_paused_time_ = total_paused_time_;
diff --git a/cc/animation/animation.h b/cc/animation/animation.h
index 9342f1a..2677fde 100644
--- a/cc/animation/animation.h
+++ b/cc/animation/animation.h
@@ -19,43 +19,48 @@ class AnimationCurve;
// loop count, last pause time, and the total time spent paused.
class CC_EXPORT Animation {
public:
- // Animations begin in the 'WaitingForTargetAvailability' state. An Animation
- // waiting for target availibility will run as soon as its target property
- // is free (and all the animations animating with it are also able to run).
- // When this time arrives, the controller will move the animation into the
- // Starting state, and then into the Running state. Running animations may
- // toggle between Running and Paused, and may be stopped by moving into either
- // the Aborted or Finished states. A Finished animation was allowed to run to
- // completion, but an Aborted animation was not.
+ // Animations begin in the 'WAITING_FOR_TARGET_AVAILABILITY' state. An
+ // Animation waiting for target availibility will run as soon as its target
+ // property is free (and all the animations animating with it are also able to
+ // run). When this time arrives, the controller will move the animation into
+ // the STARTING state, and then into the RUNNING state. RUNNING animations may
+ // toggle between RUNNING and PAUSED, and may be stopped by moving into either
+ // the ABORTED or FINISHED states. A FINISHED animation was allowed to run to
+ // completion, but an ABORTED animation was not.
enum RunState {
- WaitingForTargetAvailability = 0,
- WaitingForDeletion,
- Starting,
- Running,
- Paused,
- Finished,
- Aborted,
+ WAITING_FOR_TARGET_AVAILABILITY = 0,
+ WAITING_FOR_DELETION,
+ STARTING,
+ RUNNING,
+ PAUSED,
+ FINISHED,
+ ABORTED,
// This sentinel must be last.
- RunStateEnumSize
+ LAST_RUN_STATE = ABORTED
};
enum TargetProperty {
- Transform = 0,
- Opacity,
- Filter,
- ScrollOffset,
- BackgroundColor,
+ TRANSFORM = 0,
+ OPACITY,
+ FILTER,
+ SCROLL_OFFSET,
+ BACKGROUND_COLOR,
// This sentinel must be last.
- TargetPropertyEnumSize
+ LAST_TARGET_PROPERTY = BACKGROUND_COLOR
};
- enum Direction { Normal, Reverse, Alternate, AlternateReverse };
+ enum Direction {
+ DIRECTION_NORMAL,
+ DIRECTION_REVERSE,
+ DIRECTION_ALTERNATE,
+ DIRECTION_ALTERNATE_REVERSE
+ };
enum FillMode {
- FillModeNone,
- FillModeForwards,
- FillModeBackwards,
- FillModeBoth
+ FILL_MODE_NONE,
+ FILL_MODE_FORWARDS,
+ FILL_MODE_BACKWARDS,
+ FILL_MODE_BOTH
};
static scoped_ptr<Animation> Create(scoped_ptr<AnimationCurve> curve,
@@ -111,9 +116,8 @@ class CC_EXPORT Animation {
bool IsFinishedAt(base::TimeTicks monotonic_time) const;
bool is_finished() const {
- return run_state_ == Finished ||
- run_state_ == Aborted ||
- run_state_ == WaitingForDeletion;
+ return run_state_ == FINISHED || run_state_ == ABORTED ||
+ run_state_ == WAITING_FOR_DELETION;
}
bool InEffect(base::TimeTicks monotonic_time) const;
@@ -131,7 +135,7 @@ class CC_EXPORT Animation {
needs_synchronized_start_time_ = needs_synchronized_start_time;
}
- // This is true for animations running on the main thread when the Finished
+ // This is true for animations running on the main thread when the FINISHED
// event sent by the corresponding impl animation has been received.
bool received_finished_event() const {
return received_finished_event_;
@@ -227,10 +231,10 @@ class CC_EXPORT Animation {
// When pushed from a main-thread controller to a compositor-thread
// controller, an animation will initially only affect pending observers
// (corresponding to layers in the pending tree). Animations that only
- // affect pending observers are able to reach the Starting state and tick
+ // affect pending observers are able to reach the STARTING state and tick
// pending observers, but cannot proceed any further and do not tick active
// observers. After activation, such animations affect both kinds of observers
- // and are able to proceed past the Starting state. When the removal of
+ // and are able to proceed past the STARTING state. When the removal of
// an animation is pushed from a main-thread controller to a
// compositor-thread controller, this initially only makes the animation
// stop affecting pending observers. After activation, such animations no
diff --git a/cc/animation/animation_curve.cc b/cc/animation/animation_curve.cc
index 3acff5d..9e8cae9 100644
--- a/cc/animation/animation_curve.cc
+++ b/cc/animation/animation_curve.cc
@@ -10,48 +10,50 @@
namespace cc {
const ColorAnimationCurve* AnimationCurve::ToColorAnimationCurve() const {
- DCHECK(Type() == AnimationCurve::Color);
+ DCHECK(Type() == AnimationCurve::COLOR);
return static_cast<const ColorAnimationCurve*>(this);
}
-AnimationCurve::CurveType ColorAnimationCurve::Type() const { return Color; }
+AnimationCurve::CurveType ColorAnimationCurve::Type() const {
+ return COLOR;
+}
const FloatAnimationCurve* AnimationCurve::ToFloatAnimationCurve() const {
- DCHECK(Type() == AnimationCurve::Float);
+ DCHECK(Type() == AnimationCurve::FLOAT);
return static_cast<const FloatAnimationCurve*>(this);
}
AnimationCurve::CurveType FloatAnimationCurve::Type() const {
- return Float;
+ return FLOAT;
}
const TransformAnimationCurve* AnimationCurve::ToTransformAnimationCurve()
const {
- DCHECK(Type() == AnimationCurve::Transform);
+ DCHECK(Type() == AnimationCurve::TRANSFORM);
return static_cast<const TransformAnimationCurve*>(this);
}
AnimationCurve::CurveType TransformAnimationCurve::Type() const {
- return Transform;
+ return TRANSFORM;
}
const FilterAnimationCurve* AnimationCurve::ToFilterAnimationCurve() const {
- DCHECK(Type() == AnimationCurve::Filter);
+ DCHECK(Type() == AnimationCurve::FILTER);
return static_cast<const FilterAnimationCurve*>(this);
}
AnimationCurve::CurveType FilterAnimationCurve::Type() const {
- return Filter;
+ return FILTER;
}
const ScrollOffsetAnimationCurve* AnimationCurve::ToScrollOffsetAnimationCurve()
const {
- DCHECK(Type() == AnimationCurve::ScrollOffset);
+ DCHECK(Type() == AnimationCurve::SCROLL_OFFSET);
return static_cast<const ScrollOffsetAnimationCurve*>(this);
}
ScrollOffsetAnimationCurve* AnimationCurve::ToScrollOffsetAnimationCurve() {
- DCHECK(Type() == AnimationCurve::ScrollOffset);
+ DCHECK(Type() == AnimationCurve::SCROLL_OFFSET);
return static_cast<ScrollOffsetAnimationCurve*>(this);
}
diff --git a/cc/animation/animation_curve.h b/cc/animation/animation_curve.h
index 74ce11b..1074203 100644
--- a/cc/animation/animation_curve.h
+++ b/cc/animation/animation_curve.h
@@ -27,7 +27,7 @@ class TransformOperations;
// An animation curve is a function that returns a value given a time.
class CC_EXPORT AnimationCurve {
public:
- enum CurveType { Color, Float, Transform, Filter, ScrollOffset };
+ enum CurveType { COLOR, FLOAT, TRANSFORM, FILTER, SCROLL_OFFSET };
virtual ~AnimationCurve() {}
diff --git a/cc/animation/animation_events.h b/cc/animation/animation_events.h
index e40ca3f..d268162 100644
--- a/cc/animation/animation_events.h
+++ b/cc/animation/animation_events.h
@@ -15,7 +15,7 @@
namespace cc {
struct CC_EXPORT AnimationEvent {
- enum Type { Started, Finished, Aborted, PropertyUpdate };
+ enum Type { STARTED, FINISHED, ABORTED, PROPERTY_UPDATE };
AnimationEvent(Type type,
int layer_id,
diff --git a/cc/animation/animation_unittest.cc b/cc/animation/animation_unittest.cc
index 2522f19..9345c6b 100644
--- a/cc/animation/animation_unittest.cc
+++ b/cc/animation/animation_unittest.cc
@@ -23,9 +23,7 @@ scoped_ptr<Animation> CreateAnimation(double iterations,
double playback_rate) {
scoped_ptr<Animation> to_return(
Animation::Create(make_scoped_ptr(new FakeFloatAnimationCurve(duration)),
- 0,
- 1,
- Animation::Opacity));
+ 0, 1, Animation::OPACITY));
to_return->set_iterations(iterations);
to_return->set_playback_rate(playback_rate);
return to_return.Pass();
@@ -93,7 +91,7 @@ TEST(AnimationTest, TrimTimeInfiniteIterations) {
TEST(AnimationTest, TrimTimeReverse) {
scoped_ptr<Animation> anim(CreateAnimation(-1));
- anim->set_direction(Animation::Reverse);
+ anim->set_direction(Animation::DIRECTION_REVERSE);
EXPECT_EQ(
1.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0)).InSecondsF());
EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.25))
@@ -110,7 +108,7 @@ TEST(AnimationTest, TrimTimeReverse) {
TEST(AnimationTest, TrimTimeAlternateInfiniteIterations) {
scoped_ptr<Animation> anim(CreateAnimation(-1));
- anim->set_direction(Animation::Alternate);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE);
EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
EXPECT_EQ(0.25, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.25))
@@ -127,7 +125,7 @@ TEST(AnimationTest, TrimTimeAlternateInfiniteIterations) {
TEST(AnimationTest, TrimTimeAlternateOneIteration) {
scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->set_direction(Animation::Alternate);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE);
EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
EXPECT_EQ(0.25, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.25))
@@ -144,7 +142,7 @@ TEST(AnimationTest, TrimTimeAlternateOneIteration) {
TEST(AnimationTest, TrimTimeAlternateTwoIterations) {
scoped_ptr<Animation> anim(CreateAnimation(2));
- anim->set_direction(Animation::Alternate);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE);
EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
EXPECT_EQ(0.25, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.25))
@@ -167,7 +165,7 @@ TEST(AnimationTest, TrimTimeAlternateTwoIterations) {
TEST(AnimationTest, TrimTimeAlternateTwoHalfIterations) {
scoped_ptr<Animation> anim(CreateAnimation(2.5));
- anim->set_direction(Animation::Alternate);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE);
EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
EXPECT_EQ(0.25, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.25))
@@ -194,7 +192,7 @@ TEST(AnimationTest, TrimTimeAlternateTwoHalfIterations) {
TEST(AnimationTest, TrimTimeAlternateReverseInfiniteIterations) {
scoped_ptr<Animation> anim(CreateAnimation(-1));
- anim->set_direction(Animation::AlternateReverse);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE_REVERSE);
EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.25))
@@ -211,7 +209,7 @@ TEST(AnimationTest, TrimTimeAlternateReverseInfiniteIterations) {
TEST(AnimationTest, TrimTimeAlternateReverseOneIteration) {
scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->set_direction(Animation::AlternateReverse);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE_REVERSE);
EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.25))
@@ -228,7 +226,7 @@ TEST(AnimationTest, TrimTimeAlternateReverseOneIteration) {
TEST(AnimationTest, TrimTimeAlternateReverseTwoIterations) {
scoped_ptr<Animation> anim(CreateAnimation(2));
- anim->set_direction(Animation::AlternateReverse);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE_REVERSE);
EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.25))
@@ -267,7 +265,7 @@ TEST(AnimationTest, TrimTimeStartTime) {
TEST(AnimationTest, TrimTimeStartTimeReverse) {
scoped_ptr<Animation> anim(CreateAnimation(1));
anim->set_start_time(TicksFromSecondsF(4));
- anim->set_direction(Animation::Reverse);
+ anim->set_direction(Animation::DIRECTION_REVERSE);
EXPECT_EQ(
0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0)).InSecondsF());
EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(4.0))
@@ -298,7 +296,7 @@ TEST(AnimationTest, TrimTimeTimeOffsetReverse) {
scoped_ptr<Animation> anim(CreateAnimation(1));
anim->set_time_offset(TimeDelta::FromMilliseconds(4000));
anim->set_start_time(TicksFromSecondsF(4));
- anim->set_direction(Animation::Reverse);
+ anim->set_direction(Animation::DIRECTION_REVERSE);
EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.5))
@@ -326,7 +324,7 @@ TEST(AnimationTest, TrimTimeNegativeTimeOffset) {
TEST(AnimationTest, TrimTimeNegativeTimeOffsetReverse) {
scoped_ptr<Animation> anim(CreateAnimation(1));
anim->set_time_offset(TimeDelta::FromMilliseconds(-4000));
- anim->set_direction(Animation::Reverse);
+ anim->set_direction(Animation::DIRECTION_REVERSE);
EXPECT_EQ(
0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0)).InSecondsF());
@@ -340,15 +338,15 @@ TEST(AnimationTest, TrimTimeNegativeTimeOffsetReverse) {
TEST(AnimationTest, TrimTimePauseResume) {
scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
EXPECT_EQ(
0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0)).InSecondsF());
EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.5))
.InSecondsF());
- anim->SetRunState(Animation::Paused, TicksFromSecondsF(0.5));
+ anim->SetRunState(Animation::PAUSED, TicksFromSecondsF(0.5));
EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(1024.0))
.InSecondsF());
- anim->SetRunState(Animation::Running, TicksFromSecondsF(1024.0));
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(1024.0));
EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(1024.0))
.InSecondsF());
EXPECT_EQ(1, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(1024.5))
@@ -357,16 +355,16 @@ TEST(AnimationTest, TrimTimePauseResume) {
TEST(AnimationTest, TrimTimePauseResumeReverse) {
scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->set_direction(Animation::Reverse);
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
+ anim->set_direction(Animation::DIRECTION_REVERSE);
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.5))
.InSecondsF());
- anim->SetRunState(Animation::Paused, TicksFromSecondsF(0.25));
+ anim->SetRunState(Animation::PAUSED, TicksFromSecondsF(0.25));
EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(1024.0))
.InSecondsF());
- anim->SetRunState(Animation::Running, TicksFromSecondsF(1024.0));
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(1024.0));
EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(1024.0))
.InSecondsF());
EXPECT_EQ(0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(1024.75))
@@ -375,7 +373,7 @@ TEST(AnimationTest, TrimTimePauseResumeReverse) {
TEST(AnimationTest, TrimTimeSuspendResume) {
scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
EXPECT_EQ(
0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0)).InSecondsF());
EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.5))
@@ -392,8 +390,8 @@ TEST(AnimationTest, TrimTimeSuspendResume) {
TEST(AnimationTest, TrimTimeSuspendResumeReverse) {
scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->set_direction(Animation::Reverse);
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
+ anim->set_direction(Animation::DIRECTION_REVERSE);
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.25))
@@ -410,7 +408,7 @@ TEST(AnimationTest, TrimTimeSuspendResumeReverse) {
TEST(AnimationTest, TrimTimeZeroDuration) {
scoped_ptr<Animation> anim(CreateAnimation(0, 0));
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
EXPECT_EQ(0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(-1.0))
.InSecondsF());
EXPECT_EQ(
@@ -421,7 +419,7 @@ TEST(AnimationTest, TrimTimeZeroDuration) {
TEST(AnimationTest, TrimTimeStarting) {
scoped_ptr<Animation> anim(CreateAnimation(1, 5.0));
- anim->SetRunState(Animation::Starting, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::STARTING, TicksFromSecondsF(0.0));
EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(-1.0))
.InSecondsF());
EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
@@ -448,7 +446,7 @@ TEST(AnimationTest, TrimTimeStarting) {
TEST(AnimationTest, TrimTimeNeedsSynchronizedStartTime) {
scoped_ptr<Animation> anim(CreateAnimation(1, 5.0));
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
anim->set_needs_synchronized_start_time(true);
EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(-1.0))
.InSecondsF());
@@ -475,7 +473,7 @@ TEST(AnimationTest, TrimTimeNeedsSynchronizedStartTime) {
TEST(AnimationTest, IsFinishedAtZeroIterations) {
scoped_ptr<Animation> anim(CreateAnimation(0));
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
EXPECT_FALSE(anim->IsFinishedAt(TicksFromSecondsF(-1.0)));
EXPECT_TRUE(anim->IsFinishedAt(TicksFromSecondsF(0.0)));
EXPECT_TRUE(anim->IsFinishedAt(TicksFromSecondsF(1.0)));
@@ -483,7 +481,7 @@ TEST(AnimationTest, IsFinishedAtZeroIterations) {
TEST(AnimationTest, IsFinishedAtOneIteration) {
scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
EXPECT_FALSE(anim->IsFinishedAt(TicksFromSecondsF(-1.0)));
EXPECT_FALSE(anim->IsFinishedAt(TicksFromSecondsF(0.0)));
EXPECT_TRUE(anim->IsFinishedAt(TicksFromSecondsF(1.0)));
@@ -492,7 +490,7 @@ TEST(AnimationTest, IsFinishedAtOneIteration) {
TEST(AnimationTest, IsFinishedAtInfiniteIterations) {
scoped_ptr<Animation> anim(CreateAnimation(-1));
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
EXPECT_FALSE(anim->IsFinishedAt(TicksFromSecondsF(0.0)));
EXPECT_FALSE(anim->IsFinishedAt(TicksFromSecondsF(0.5)));
EXPECT_FALSE(anim->IsFinishedAt(TicksFromSecondsF(1.0)));
@@ -502,7 +500,7 @@ TEST(AnimationTest, IsFinishedAtInfiniteIterations) {
TEST(AnimationTest, IsFinishedNegativeTimeOffset) {
scoped_ptr<Animation> anim(CreateAnimation(1));
anim->set_time_offset(TimeDelta::FromMilliseconds(-500));
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
EXPECT_FALSE(anim->IsFinishedAt(TicksFromSecondsF(-1.0)));
EXPECT_FALSE(anim->IsFinishedAt(TicksFromSecondsF(0.0)));
@@ -516,7 +514,7 @@ TEST(AnimationTest, IsFinishedNegativeTimeOffset) {
TEST(AnimationTest, IsFinishedPositiveTimeOffset) {
scoped_ptr<Animation> anim(CreateAnimation(1));
anim->set_time_offset(TimeDelta::FromMilliseconds(500));
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
EXPECT_FALSE(anim->IsFinishedAt(TicksFromSecondsF(-1.0)));
EXPECT_FALSE(anim->IsFinishedAt(TicksFromSecondsF(0.0)));
@@ -526,58 +524,58 @@ TEST(AnimationTest, IsFinishedPositiveTimeOffset) {
TEST(AnimationTest, IsFinishedAtNotRunning) {
scoped_ptr<Animation> anim(CreateAnimation(0));
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
EXPECT_TRUE(anim->IsFinishedAt(TicksFromSecondsF(0.0)));
- anim->SetRunState(Animation::Paused, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::PAUSED, TicksFromSecondsF(0.0));
EXPECT_FALSE(anim->IsFinishedAt(TicksFromSecondsF(0.0)));
- anim->SetRunState(Animation::WaitingForTargetAvailability,
+ anim->SetRunState(Animation::WAITING_FOR_TARGET_AVAILABILITY,
TicksFromSecondsF(0.0));
EXPECT_FALSE(anim->IsFinishedAt(TicksFromSecondsF(0.0)));
- anim->SetRunState(Animation::Finished, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::FINISHED, TicksFromSecondsF(0.0));
EXPECT_TRUE(anim->IsFinishedAt(TicksFromSecondsF(0.0)));
- anim->SetRunState(Animation::Aborted, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::ABORTED, TicksFromSecondsF(0.0));
EXPECT_TRUE(anim->IsFinishedAt(TicksFromSecondsF(0.0)));
}
TEST(AnimationTest, IsFinished) {
scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
EXPECT_FALSE(anim->is_finished());
- anim->SetRunState(Animation::Paused, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::PAUSED, TicksFromSecondsF(0.0));
EXPECT_FALSE(anim->is_finished());
- anim->SetRunState(Animation::WaitingForTargetAvailability,
+ anim->SetRunState(Animation::WAITING_FOR_TARGET_AVAILABILITY,
TicksFromSecondsF(0.0));
EXPECT_FALSE(anim->is_finished());
- anim->SetRunState(Animation::Finished, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::FINISHED, TicksFromSecondsF(0.0));
EXPECT_TRUE(anim->is_finished());
- anim->SetRunState(Animation::Aborted, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::ABORTED, TicksFromSecondsF(0.0));
EXPECT_TRUE(anim->is_finished());
}
TEST(AnimationTest, IsFinishedNeedsSynchronizedStartTime) {
scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->SetRunState(Animation::Running, TicksFromSecondsF(2.0));
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(2.0));
EXPECT_FALSE(anim->is_finished());
- anim->SetRunState(Animation::Paused, TicksFromSecondsF(2.0));
+ anim->SetRunState(Animation::PAUSED, TicksFromSecondsF(2.0));
EXPECT_FALSE(anim->is_finished());
- anim->SetRunState(Animation::WaitingForTargetAvailability,
+ anim->SetRunState(Animation::WAITING_FOR_TARGET_AVAILABILITY,
TicksFromSecondsF(2.0));
EXPECT_FALSE(anim->is_finished());
- anim->SetRunState(Animation::Finished, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::FINISHED, TicksFromSecondsF(0.0));
EXPECT_TRUE(anim->is_finished());
- anim->SetRunState(Animation::Aborted, TicksFromSecondsF(0.0));
+ anim->SetRunState(Animation::ABORTED, TicksFromSecondsF(0.0));
EXPECT_TRUE(anim->is_finished());
}
TEST(AnimationTest, RunStateChangesIgnoredWhileSuspended) {
scoped_ptr<Animation> anim(CreateAnimation(1));
anim->Suspend(TicksFromSecondsF(0));
- EXPECT_EQ(Animation::Paused, anim->run_state());
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
- EXPECT_EQ(Animation::Paused, anim->run_state());
+ EXPECT_EQ(Animation::PAUSED, anim->run_state());
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
+ EXPECT_EQ(Animation::PAUSED, anim->run_state());
anim->Resume(TicksFromSecondsF(0));
- anim->SetRunState(Animation::Running, TicksFromSecondsF(0.0));
- EXPECT_EQ(Animation::Running, anim->run_state());
+ anim->SetRunState(Animation::RUNNING, TicksFromSecondsF(0.0));
+ EXPECT_EQ(Animation::RUNNING, anim->run_state());
}
TEST(AnimationTest, TrimTimePlaybackNormal) {
@@ -708,7 +706,7 @@ TEST(AnimationTest, TrimTimePlaybackFastInfiniteIterations) {
TEST(AnimationTest, TrimTimePlaybackNormalDoubleReverse) {
scoped_ptr<Animation> anim(CreateAnimation(1, 1, -1));
- anim->set_direction(Animation::Reverse);
+ anim->set_direction(Animation::DIRECTION_REVERSE);
EXPECT_EQ(0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(-1.0))
.InSecondsF());
EXPECT_EQ(
@@ -723,7 +721,7 @@ TEST(AnimationTest, TrimTimePlaybackNormalDoubleReverse) {
TEST(AnimationTest, TrimTimePlaybackFastDoubleReverse) {
scoped_ptr<Animation> anim(CreateAnimation(1, 4, -2));
- anim->set_direction(Animation::Reverse);
+ anim->set_direction(Animation::DIRECTION_REVERSE);
EXPECT_EQ(0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(-1.0))
.InSecondsF());
EXPECT_EQ(
@@ -742,7 +740,7 @@ TEST(AnimationTest, TrimTimePlaybackFastDoubleReverse) {
TEST(AnimationTest, TrimTimeAlternateTwoIterationsPlaybackFast) {
scoped_ptr<Animation> anim(CreateAnimation(2, 2, 2));
- anim->set_direction(Animation::Alternate);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE);
EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.25))
@@ -767,7 +765,7 @@ TEST(AnimationTest, TrimTimeAlternateTwoIterationsPlaybackFast) {
TEST(AnimationTest, TrimTimeAlternateTwoIterationsPlaybackFastReverse) {
scoped_ptr<Animation> anim(CreateAnimation(2, 2, 2));
- anim->set_direction(Animation::AlternateReverse);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE_REVERSE);
EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(-1.0))
.InSecondsF());
EXPECT_EQ(2.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
@@ -794,7 +792,7 @@ TEST(AnimationTest, TrimTimeAlternateTwoIterationsPlaybackFastReverse) {
TEST(AnimationTest, TrimTimeAlternateTwoIterationsPlaybackFastDoubleReverse) {
scoped_ptr<Animation> anim(CreateAnimation(2, 2, -2));
- anim->set_direction(Animation::AlternateReverse);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE_REVERSE);
EXPECT_EQ(2.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
EXPECT_EQ(1.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.25))
@@ -820,7 +818,7 @@ TEST(AnimationTest, TrimTimeAlternateTwoIterationsPlaybackFastDoubleReverse) {
TEST(AnimationTest,
TrimTimeAlternateReverseThreeIterationsPlaybackFastAlternateReverse) {
scoped_ptr<Animation> anim(CreateAnimation(3, 2, -2));
- anim->set_direction(Animation::AlternateReverse);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE_REVERSE);
EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.25))
@@ -854,7 +852,7 @@ TEST(AnimationTest,
TEST(AnimationTest,
TrimTimeAlternateReverseTwoIterationsPlaybackNormalAlternate) {
scoped_ptr<Animation> anim(CreateAnimation(2, 2, -1));
- anim->set_direction(Animation::Alternate);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE);
EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.5))
@@ -898,7 +896,7 @@ TEST(AnimationTest, TrimTimeIterationStart) {
TEST(AnimationTest, TrimTimeIterationStartAlternate) {
scoped_ptr<Animation> anim(CreateAnimation(2, 1, 1));
- anim->set_direction(Animation::Alternate);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE);
anim->set_iteration_start(0.3);
EXPECT_EQ(0.3, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(-1.0))
.InSecondsF());
@@ -918,7 +916,7 @@ TEST(AnimationTest, TrimTimeIterationStartAlternate) {
TEST(AnimationTest, TrimTimeIterationStartAlternateThreeIterations) {
scoped_ptr<Animation> anim(CreateAnimation(3, 1, 1));
- anim->set_direction(Animation::Alternate);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE);
anim->set_iteration_start(1);
EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(-1.0))
.InSecondsF());
@@ -943,7 +941,7 @@ TEST(AnimationTest, TrimTimeIterationStartAlternateThreeIterations) {
TEST(AnimationTest,
TrimTimeIterationStartAlternateThreeIterationsPlaybackReverse) {
scoped_ptr<Animation> anim(CreateAnimation(3, 1, -1));
- anim->set_direction(Animation::Alternate);
+ anim->set_direction(Animation::DIRECTION_ALTERNATE);
anim->set_iteration_start(1);
EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(0.0))
.InSecondsF());
@@ -959,22 +957,22 @@ TEST(AnimationTest,
TEST(AnimationTest, InEffectFillMode) {
scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->set_fill_mode(Animation::FillModeNone);
+ anim->set_fill_mode(Animation::FILL_MODE_NONE);
EXPECT_FALSE(anim->InEffect(TicksFromSecondsF(-1.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(0.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0)));
- anim->set_fill_mode(Animation::FillModeForwards);
+ anim->set_fill_mode(Animation::FILL_MODE_FORWARDS);
EXPECT_FALSE(anim->InEffect(TicksFromSecondsF(-1.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(0.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0)));
- anim->set_fill_mode(Animation::FillModeBackwards);
+ anim->set_fill_mode(Animation::FILL_MODE_BACKWARDS);
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(-1.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(0.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0)));
- anim->set_fill_mode(Animation::FillModeBoth);
+ anim->set_fill_mode(Animation::FILL_MODE_BOTH);
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(-1.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(0.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0)));
@@ -982,22 +980,22 @@ TEST(AnimationTest, InEffectFillMode) {
TEST(AnimationTest, InEffectFillModePlayback) {
scoped_ptr<Animation> anim(CreateAnimation(1, 1, -1));
- anim->set_fill_mode(Animation::FillModeNone);
+ anim->set_fill_mode(Animation::FILL_MODE_NONE);
EXPECT_FALSE(anim->InEffect(TicksFromSecondsF(-1.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(0.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0)));
- anim->set_fill_mode(Animation::FillModeForwards);
+ anim->set_fill_mode(Animation::FILL_MODE_FORWARDS);
EXPECT_FALSE(anim->InEffect(TicksFromSecondsF(-1.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(0.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0)));
- anim->set_fill_mode(Animation::FillModeBackwards);
+ anim->set_fill_mode(Animation::FILL_MODE_BACKWARDS);
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(-1.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(0.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0)));
- anim->set_fill_mode(Animation::FillModeBoth);
+ anim->set_fill_mode(Animation::FILL_MODE_BOTH);
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(-1.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(0.0)));
EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0)));
diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc
index 1892dd4..c253dae 100644
--- a/cc/animation/layer_animation_controller.cc
+++ b/cc/animation/layer_animation_controller.cc
@@ -45,7 +45,7 @@ void LayerAnimationController::PauseAnimation(int animation_id,
base::TimeDelta time_offset) {
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->id() == animation_id) {
- animations_[i]->SetRunState(Animation::Paused,
+ animations_[i]->SetRunState(Animation::PAUSED,
time_offset + animations_[i]->start_time());
}
}
@@ -65,13 +65,13 @@ void LayerAnimationController::RemoveAnimation(int animation_id) {
auto animations_to_remove =
animations_.remove_if(HasAnimationId(animation_id));
for (auto it = animations_to_remove; it != animations_.end(); ++it) {
- if ((*it)->target_property() == Animation::ScrollOffset) {
+ if ((*it)->target_property() == Animation::SCROLL_OFFSET) {
scroll_offset_animation_was_interrupted_ = true;
break;
}
}
animations_.erase(animations_to_remove, animations_.end());
- UpdateActivation(NormalActivation);
+ UpdateActivation(NORMAL_ACTIVATION);
}
struct HasAnimationIdAndProperty {
@@ -92,12 +92,12 @@ void LayerAnimationController::RemoveAnimation(
Animation::TargetProperty target_property) {
auto animations_to_remove = animations_.remove_if(
HasAnimationIdAndProperty(animation_id, target_property));
- if (target_property == Animation::ScrollOffset &&
+ if (target_property == Animation::SCROLL_OFFSET &&
animations_to_remove != animations_.end())
scroll_offset_animation_was_interrupted_ = true;
animations_.erase(animations_to_remove, animations_.end());
- UpdateActivation(NormalActivation);
+ UpdateActivation(NORMAL_ACTIVATION);
}
void LayerAnimationController::AbortAnimations(
@@ -105,7 +105,7 @@ void LayerAnimationController::AbortAnimations(
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->target_property() == target_property &&
!animations_[i]->is_finished())
- animations_[i]->SetRunState(Animation::Aborted, last_tick_time_);
+ animations_[i]->SetRunState(Animation::ABORTED, last_tick_time_);
}
}
@@ -125,8 +125,8 @@ void LayerAnimationController::PushAnimationUpdatesTo(
RemoveAnimationsCompletedOnMainThread(controller_impl);
PushPropertiesToImplThread(controller_impl);
- controller_impl->UpdateActivation(NormalActivation);
- UpdateActivation(NormalActivation);
+ controller_impl->UpdateActivation(NORMAL_ACTIVATION);
+ UpdateActivation(NORMAL_ACTIVATION);
}
void LayerAnimationController::Animate(base::TimeTicks monotonic_time) {
@@ -157,11 +157,9 @@ void LayerAnimationController::AccumulatePropertyUpdates(
base::TimeDelta trimmed =
animation->TrimTimeToCurrentIteration(monotonic_time);
switch (animation->target_property()) {
- case Animation::Opacity: {
- AnimationEvent event(AnimationEvent::PropertyUpdate,
- id_,
- animation->group(),
- Animation::Opacity,
+ case Animation::OPACITY: {
+ AnimationEvent event(AnimationEvent::PROPERTY_UPDATE, id_,
+ animation->group(), Animation::OPACITY,
monotonic_time);
const FloatAnimationCurve* float_animation_curve =
animation->curve()->ToFloatAnimationCurve();
@@ -171,11 +169,9 @@ void LayerAnimationController::AccumulatePropertyUpdates(
break;
}
- case Animation::Transform: {
- AnimationEvent event(AnimationEvent::PropertyUpdate,
- id_,
- animation->group(),
- Animation::Transform,
+ case Animation::TRANSFORM: {
+ AnimationEvent event(AnimationEvent::PROPERTY_UPDATE, id_,
+ animation->group(), Animation::TRANSFORM,
monotonic_time);
const TransformAnimationCurve* transform_animation_curve =
animation->curve()->ToTransformAnimationCurve();
@@ -185,11 +181,9 @@ void LayerAnimationController::AccumulatePropertyUpdates(
break;
}
- case Animation::Filter: {
- AnimationEvent event(AnimationEvent::PropertyUpdate,
- id_,
- animation->group(),
- Animation::Filter,
+ case Animation::FILTER: {
+ AnimationEvent event(AnimationEvent::PROPERTY_UPDATE, id_,
+ animation->group(), Animation::FILTER,
monotonic_time);
const FilterAnimationCurve* filter_animation_curve =
animation->curve()->ToFilterAnimationCurve();
@@ -199,17 +193,16 @@ void LayerAnimationController::AccumulatePropertyUpdates(
break;
}
- case Animation::BackgroundColor: { break; }
+ case Animation::BACKGROUND_COLOR: {
+ break;
+ }
- case Animation::ScrollOffset: {
+ case Animation::SCROLL_OFFSET: {
// Impl-side changes to scroll offset are already sent back to the
- // main thread (e.g. for user-driven scrolling), so a PropertyUpdate
+ // main thread (e.g. for user-driven scrolling), so a PROPERTY_UPDATE
// isn't needed.
break;
}
-
- case Animation::TargetPropertyEnumSize:
- NOTREACHED();
}
}
}
@@ -237,7 +230,7 @@ void LayerAnimationController::UpdateState(bool start_ready_animations,
AccumulatePropertyUpdates(last_tick_time_, events);
- UpdateActivation(NormalActivation);
+ UpdateActivation(NORMAL_ACTIVATION);
}
struct AffectsNoObservers {
@@ -258,13 +251,13 @@ void LayerAnimationController::ActivateAnimations() {
AffectsNoObservers()),
animations_.end());
scroll_offset_animation_was_interrupted_ = false;
- UpdateActivation(NormalActivation);
+ UpdateActivation(NORMAL_ACTIVATION);
}
void LayerAnimationController::AddAnimation(scoped_ptr<Animation> animation) {
animations_.push_back(animation.Pass());
needs_to_start_animations_ = true;
- UpdateActivation(NormalActivation);
+ UpdateActivation(NORMAL_ACTIVATION);
}
Animation* LayerAnimationController::GetAnimation(
@@ -315,7 +308,7 @@ void LayerAnimationController::SetAnimationRegistrar(
if (registrar_)
registrar_->RegisterAnimationController(this);
- UpdateActivation(ForceActivation);
+ UpdateActivation(FORCE_ACTIVATION);
}
void LayerAnimationController::NotifyAnimationStarted(
@@ -375,7 +368,7 @@ void LayerAnimationController::NotifyAnimationAborted(
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->group() == event.group_id &&
animations_[i]->target_property() == event.target_property) {
- animations_[i]->SetRunState(Animation::Aborted, event.monotonic_time);
+ animations_[i]->SetRunState(Animation::ABORTED, event.monotonic_time);
}
}
}
@@ -385,11 +378,11 @@ void LayerAnimationController::NotifyAnimationPropertyUpdate(
bool notify_active_observers = true;
bool notify_pending_observers = true;
switch (event.target_property) {
- case Animation::Opacity:
+ case Animation::OPACITY:
NotifyObserversOpacityAnimated(
event.opacity, notify_active_observers, notify_pending_observers);
break;
- case Animation::Transform:
+ case Animation::TRANSFORM:
NotifyObserversTransformAnimated(
event.transform, notify_active_observers, notify_pending_observers);
break;
@@ -423,7 +416,7 @@ void LayerAnimationController::RemoveEventObserver(
bool LayerAnimationController::HasFilterAnimationThatInflatesBounds() const {
for (size_t i = 0; i < animations_.size(); ++i) {
if (!animations_[i]->is_finished() &&
- animations_[i]->target_property() == Animation::Filter &&
+ animations_[i]->target_property() == Animation::FILTER &&
animations_[i]
->curve()
->ToFilterAnimationCurve()
@@ -435,7 +428,7 @@ bool LayerAnimationController::HasFilterAnimationThatInflatesBounds() const {
}
bool LayerAnimationController::HasTransformAnimationThatInflatesBounds() const {
- return IsAnimatingProperty(Animation::Transform);
+ return IsAnimatingProperty(Animation::TRANSFORM);
}
bool LayerAnimationController::FilterAnimationBoundsForBox(
@@ -459,7 +452,7 @@ bool LayerAnimationController::TransformAnimationBoundsForBox(
*bounds = gfx::BoxF();
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->is_finished() ||
- animations_[i]->target_property() != Animation::Transform)
+ animations_[i]->target_property() != Animation::TRANSFORM)
continue;
const TransformAnimationCurve* transform_animation_curve =
@@ -478,7 +471,7 @@ bool LayerAnimationController::TransformAnimationBoundsForBox(
bool LayerAnimationController::HasAnimationThatAffectsScale() const {
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->is_finished() ||
- animations_[i]->target_property() != Animation::Transform)
+ animations_[i]->target_property() != Animation::TRANSFORM)
continue;
const TransformAnimationCurve* transform_animation_curve =
@@ -493,7 +486,7 @@ bool LayerAnimationController::HasAnimationThatAffectsScale() const {
bool LayerAnimationController::HasOnlyTranslationTransforms() const {
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->is_finished() ||
- animations_[i]->target_property() != Animation::Transform)
+ animations_[i]->target_property() != Animation::TRANSFORM)
continue;
const TransformAnimationCurve* transform_animation_curve =
@@ -508,7 +501,7 @@ bool LayerAnimationController::HasOnlyTranslationTransforms() const {
bool LayerAnimationController::AnimationsPreserveAxisAlignment() const {
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->is_finished() ||
- animations_[i]->target_property() != Animation::Transform)
+ animations_[i]->target_property() != Animation::TRANSFORM)
continue;
const TransformAnimationCurve* transform_animation_curve =
@@ -524,17 +517,17 @@ bool LayerAnimationController::MaximumTargetScale(float* max_scale) const {
*max_scale = 0.f;
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->is_finished() ||
- animations_[i]->target_property() != Animation::Transform)
+ animations_[i]->target_property() != Animation::TRANSFORM)
continue;
bool forward_direction = true;
switch (animations_[i]->direction()) {
- case Animation::Normal:
- case Animation::Alternate:
+ case Animation::DIRECTION_NORMAL:
+ case Animation::DIRECTION_ALTERNATE:
forward_direction = animations_[i]->playback_rate() >= 0.0;
break;
- case Animation::Reverse:
- case Animation::AlternateReverse:
+ case Animation::DIRECTION_REVERSE:
+ case Animation::DIRECTION_ALTERNATE_REVERSE:
forward_direction = animations_[i]->playback_rate() < 0.0;
break;
}
@@ -571,7 +564,7 @@ void LayerAnimationController::PushNewAnimationsToImplThread(
continue;
// Scroll animations always start at the current scroll offset.
- if (animations_[i]->target_property() == Animation::ScrollOffset) {
+ if (animations_[i]->target_property() == Animation::SCROLL_OFFSET) {
gfx::ScrollOffset current_scroll_offset;
if (controller_impl->value_provider_) {
current_scroll_offset =
@@ -587,7 +580,7 @@ void LayerAnimationController::PushNewAnimationsToImplThread(
// The new animation should be set to run as soon as possible.
Animation::RunState initial_run_state =
- Animation::WaitingForTargetAvailability;
+ Animation::WAITING_FOR_TARGET_AVAILABILITY;
scoped_ptr<Animation> to_add(
animations_[i]->CloneAndInitialize(initial_run_state));
DCHECK(!to_add->needs_synchronized_start_time());
@@ -600,14 +593,14 @@ static bool IsCompleted(
Animation* animation,
const LayerAnimationController* main_thread_controller) {
if (animation->is_impl_only()) {
- return (animation->run_state() == Animation::WaitingForDeletion);
+ return (animation->run_state() == Animation::WAITING_FOR_DELETION);
} else {
return !main_thread_controller->GetAnimationById(animation->id());
}
}
static bool AffectsActiveOnlyAndIsWaitingForDeletion(Animation* animation) {
- return animation->run_state() == Animation::WaitingForDeletion &&
+ return animation->run_state() == Animation::WAITING_FOR_DELETION &&
!animation->affects_pending_observers();
}
@@ -615,7 +608,7 @@ void LayerAnimationController::RemoveAnimationsCompletedOnMainThread(
LayerAnimationController* controller_impl) const {
// Animations removed on the main thread should no longer affect pending
// observers, and should stop affecting active observers after the next call
- // to ActivateAnimations. If already WaitingForDeletion, they can be removed
+ // to ActivateAnimations. If already WAITING_FOR_DELETION, they can be removed
// immediately.
ScopedPtrVector<Animation>& animations = controller_impl->animations_;
for (size_t i = 0; i < animations.size(); ++i) {
@@ -652,8 +645,8 @@ void LayerAnimationController::StartAnimations(base::TimeTicks monotonic_time) {
animations_waiting_for_target.reserve(animations_.size());
for (size_t i = 0; i < animations_.size(); ++i) {
- if (animations_[i]->run_state() == Animation::Starting ||
- animations_[i]->run_state() == Animation::Running) {
+ if (animations_[i]->run_state() == Animation::STARTING ||
+ animations_[i]->run_state() == Animation::RUNNING) {
if (animations_[i]->affects_active_observers()) {
blocked_properties_for_active_observers.insert(
animations_[i]->target_property());
@@ -663,7 +656,7 @@ void LayerAnimationController::StartAnimations(base::TimeTicks monotonic_time) {
animations_[i]->target_property());
}
} else if (animations_[i]->run_state() ==
- Animation::WaitingForTargetAvailability) {
+ Animation::WAITING_FOR_TARGET_AVAILABILITY) {
animations_waiting_for_target.push_back(i);
}
}
@@ -677,7 +670,7 @@ void LayerAnimationController::StartAnimations(base::TimeTicks monotonic_time) {
// for target because it might have changed the run state while handling
// previous animation in this loop (if they belong to same group).
if (animation_waiting_for_target->run_state() ==
- Animation::WaitingForTargetAvailability) {
+ Animation::WAITING_FOR_TARGET_AVAILABILITY) {
TargetProperties enqueued_properties;
bool affects_active_observers =
animation_waiting_for_target->affects_active_observers();
@@ -715,12 +708,12 @@ void LayerAnimationController::StartAnimations(base::TimeTicks monotonic_time) {
// If the intersection is null, then we are free to start the animations
// in the group.
if (null_intersection) {
- animation_waiting_for_target->SetRunState(Animation::Starting,
+ animation_waiting_for_target->SetRunState(Animation::STARTING,
monotonic_time);
for (size_t j = animation_index + 1; j < animations_.size(); ++j) {
if (animation_waiting_for_target->group() ==
animations_[j]->group()) {
- animations_[j]->SetRunState(Animation::Starting, monotonic_time);
+ animations_[j]->SetRunState(Animation::STARTING, monotonic_time);
}
}
} else {
@@ -734,18 +727,16 @@ void LayerAnimationController::PromoteStartedAnimations(
base::TimeTicks monotonic_time,
AnimationEventsVector* events) {
for (size_t i = 0; i < animations_.size(); ++i) {
- if (animations_[i]->run_state() == Animation::Starting &&
+ if (animations_[i]->run_state() == Animation::STARTING &&
animations_[i]->affects_active_observers()) {
- animations_[i]->SetRunState(Animation::Running, monotonic_time);
+ animations_[i]->SetRunState(Animation::RUNNING, monotonic_time);
if (!animations_[i]->has_set_start_time() &&
!animations_[i]->needs_synchronized_start_time())
animations_[i]->set_start_time(monotonic_time);
if (events) {
- AnimationEvent started_event(AnimationEvent::Started,
- id_,
- animations_[i]->group(),
- animations_[i]->target_property(),
- monotonic_time);
+ AnimationEvent started_event(
+ AnimationEvent::STARTED, id_, animations_[i]->group(),
+ animations_[i]->target_property(), monotonic_time);
started_event.is_impl_only = animations_[i]->is_impl_only();
if (started_event.is_impl_only)
NotifyAnimationStarted(started_event);
@@ -760,9 +751,9 @@ void LayerAnimationController::MarkFinishedAnimations(
base::TimeTicks monotonic_time) {
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->IsFinishedAt(monotonic_time) &&
- animations_[i]->run_state() != Animation::Aborted &&
- animations_[i]->run_state() != Animation::WaitingForDeletion)
- animations_[i]->SetRunState(Animation::Finished, monotonic_time);
+ animations_[i]->run_state() != Animation::ABORTED &&
+ animations_[i]->run_state() != Animation::WAITING_FOR_DELETION)
+ animations_[i]->SetRunState(Animation::FINISHED, monotonic_time);
}
}
@@ -774,21 +765,19 @@ void LayerAnimationController::MarkAnimationsForDeletion(
animations_with_same_group_id.reserve(animations_.size());
// Non-aborted animations are marked for deletion after a corresponding
- // AnimationEvent::Finished event is sent or received. This means that if
+ // AnimationEvent::FINISHED event is sent or received. This means that if
// we don't have an events vector, we must ensure that non-aborted animations
// have received a finished event before marking them for deletion.
for (size_t i = 0; i < animations_.size(); i++) {
int group_id = animations_[i]->group();
- if (animations_[i]->run_state() == Animation::Aborted) {
+ if (animations_[i]->run_state() == Animation::ABORTED) {
if (events && !animations_[i]->is_impl_only()) {
- AnimationEvent aborted_event(AnimationEvent::Aborted,
- id_,
- group_id,
+ AnimationEvent aborted_event(AnimationEvent::ABORTED, id_, group_id,
animations_[i]->target_property(),
monotonic_time);
events->push_back(aborted_event);
}
- animations_[i]->SetRunState(Animation::WaitingForDeletion,
+ animations_[i]->SetRunState(Animation::WAITING_FOR_DELETION,
monotonic_time);
marked_animations_for_deletions = true;
continue;
@@ -797,13 +786,13 @@ void LayerAnimationController::MarkAnimationsForDeletion(
bool all_anims_with_same_id_are_finished = false;
// Since deleting an animation on the main thread leads to its deletion
- // on the impl thread, we only mark a Finished main thread animation for
- // deletion once it has received a Finished event from the impl thread.
+ // on the impl thread, we only mark a FINISHED main thread animation for
+ // deletion once it has received a FINISHED event from the impl thread.
bool animation_i_will_send_or_has_received_finish_event =
events || animations_[i]->received_finished_event();
// If an animation is finished, and not already marked for deletion,
// find out if all other animations in the same group are also finished.
- if (animations_[i]->run_state() == Animation::Finished &&
+ if (animations_[i]->run_state() == Animation::FINISHED &&
animation_i_will_send_or_has_received_finish_event) {
// Clear the animations_with_same_group_id if it was added for
// the previous animation's iteration.
@@ -815,16 +804,16 @@ void LayerAnimationController::MarkAnimationsForDeletion(
events || animations_[j]->received_finished_event();
if (group_id == animations_[j]->group()) {
if (!animations_[j]->is_finished() ||
- (animations_[j]->run_state() == Animation::Finished &&
+ (animations_[j]->run_state() == Animation::FINISHED &&
!animation_j_will_send_or_has_received_finish_event)) {
all_anims_with_same_id_are_finished = false;
break;
} else if (j >= i &&
- animations_[j]->run_state() != Animation::Aborted) {
+ animations_[j]->run_state() != Animation::ABORTED) {
// Mark down the animations which belong to the same group
// and is not yet aborted. If this current iteration finds that all
// animations with same ID are finished, then the marked
- // animations below will be set to WaitingForDeletion in next
+ // animations below will be set to WAITING_FOR_DELETION in next
// iteration.
animations_with_same_group_id.push_back(j);
}
@@ -839,8 +828,7 @@ void LayerAnimationController::MarkAnimationsForDeletion(
size_t animation_index = animations_with_same_group_id[j];
if (events) {
AnimationEvent finished_event(
- AnimationEvent::Finished,
- id_,
+ AnimationEvent::FINISHED, id_,
animations_[animation_index]->group(),
animations_[animation_index]->target_property(),
monotonic_time);
@@ -852,7 +840,7 @@ void LayerAnimationController::MarkAnimationsForDeletion(
events->push_back(finished_event);
}
animations_[animation_index]->SetRunState(
- Animation::WaitingForDeletion, monotonic_time);
+ Animation::WAITING_FOR_DELETION, monotonic_time);
}
marked_animations_for_deletions = true;
}
@@ -862,7 +850,7 @@ void LayerAnimationController::MarkAnimationsForDeletion(
}
static bool IsWaitingForDeletion(Animation* animation) {
- return animation->run_state() == Animation::WaitingForDeletion;
+ return animation->run_state() == Animation::WAITING_FOR_DELETION;
}
void LayerAnimationController::PurgeAnimationsMarkedForDeletion() {
@@ -875,9 +863,9 @@ void LayerAnimationController::PurgeAnimationsMarkedForDeletion() {
void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) {
for (size_t i = 0; i < animations_.size(); ++i) {
- if (animations_[i]->run_state() == Animation::Starting ||
- animations_[i]->run_state() == Animation::Running ||
- animations_[i]->run_state() == Animation::Paused) {
+ if (animations_[i]->run_state() == Animation::STARTING ||
+ animations_[i]->run_state() == Animation::RUNNING ||
+ animations_[i]->run_state() == Animation::PAUSED) {
if (!animations_[i]->InEffect(monotonic_time))
continue;
@@ -885,7 +873,7 @@ void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) {
animations_[i]->TrimTimeToCurrentIteration(monotonic_time);
switch (animations_[i]->target_property()) {
- case Animation::Transform: {
+ case Animation::TRANSFORM: {
const TransformAnimationCurve* transform_animation_curve =
animations_[i]->curve()->ToTransformAnimationCurve();
const gfx::Transform transform =
@@ -897,7 +885,7 @@ void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) {
break;
}
- case Animation::Opacity: {
+ case Animation::OPACITY: {
const FloatAnimationCurve* float_animation_curve =
animations_[i]->curve()->ToFloatAnimationCurve();
const float opacity = std::max(
@@ -909,7 +897,7 @@ void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) {
break;
}
- case Animation::Filter: {
+ case Animation::FILTER: {
const FilterAnimationCurve* filter_animation_curve =
animations_[i]->curve()->ToFilterAnimationCurve();
const FilterOperations filter =
@@ -921,12 +909,12 @@ void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) {
break;
}
- case Animation::BackgroundColor: {
+ case Animation::BACKGROUND_COLOR: {
// Not yet implemented.
break;
}
- case Animation::ScrollOffset: {
+ case Animation::SCROLL_OFFSET: {
const ScrollOffsetAnimationCurve* scroll_offset_animation_curve =
animations_[i]->curve()->ToScrollOffsetAnimationCurve();
const gfx::ScrollOffset scroll_offset =
@@ -937,22 +925,18 @@ void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) {
animations_[i]->affects_pending_observers());
break;
}
-
- // Do nothing for sentinel value.
- case Animation::TargetPropertyEnumSize:
- NOTREACHED();
}
}
}
}
void LayerAnimationController::UpdateActivation(UpdateActivationType type) {
- bool force = type == ForceActivation;
+ bool force = type == FORCE_ACTIVATION;
if (registrar_) {
bool was_active = is_active_;
is_active_ = false;
for (size_t i = 0; i < animations_.size(); ++i) {
- if (animations_[i]->run_state() != Animation::WaitingForDeletion) {
+ if (animations_[i]->run_state() != Animation::WAITING_FOR_DELETION) {
is_active_ = true;
break;
}
diff --git a/cc/animation/layer_animation_controller.h b/cc/animation/layer_animation_controller.h
index 48c3bdc..d459515 100644
--- a/cc/animation/layer_animation_controller.h
+++ b/cc/animation/layer_animation_controller.h
@@ -179,10 +179,7 @@ class CC_EXPORT LayerAnimationController
void TickAnimations(base::TimeTicks monotonic_time);
- enum UpdateActivationType {
- NormalActivation,
- ForceActivation
- };
+ enum UpdateActivationType { NORMAL_ACTIVATION, FORCE_ACTIVATION };
void UpdateActivation(UpdateActivationType type);
void NotifyObserversOpacityAnimated(float opacity,
diff --git a/cc/animation/layer_animation_controller_unittest.cc b/cc/animation/layer_animation_controller_unittest.cc
index ba639b3..d8d0b056 100644
--- a/cc/animation/layer_animation_controller_unittest.cc
+++ b/cc/animation/layer_animation_controller_unittest.cc
@@ -49,7 +49,7 @@ TEST(LayerAnimationControllerTest, SyncNewAnimation) {
LayerAnimationController::Create(0));
controller->AddValueObserver(&dummy);
- EXPECT_FALSE(controller_impl->GetAnimation(Animation::Opacity));
+ EXPECT_FALSE(controller_impl->GetAnimation(Animation::OPACITY));
EXPECT_FALSE(controller->needs_to_start_animations_for_testing());
EXPECT_FALSE(controller_impl->needs_to_start_animations_for_testing());
@@ -63,7 +63,7 @@ TEST(LayerAnimationControllerTest, SyncNewAnimation) {
controller_impl->ActivateAnimations();
EXPECT_TRUE(controller_impl->GetAnimationById(animation_id));
- EXPECT_EQ(Animation::WaitingForTargetAvailability,
+ EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
controller_impl->GetAnimationById(animation_id)->run_state());
}
@@ -79,7 +79,7 @@ TEST(LayerAnimationControllerTest, DoNotClobberStartTimes) {
LayerAnimationController::Create(0));
controller->AddValueObserver(&dummy);
- EXPECT_FALSE(controller_impl->GetAnimation(Animation::Opacity));
+ EXPECT_FALSE(controller_impl->GetAnimation(Animation::OPACITY));
int animation_id =
AddOpacityTransitionToController(controller.get(), 1, 0, 1, false);
@@ -88,7 +88,7 @@ TEST(LayerAnimationControllerTest, DoNotClobberStartTimes) {
controller_impl->ActivateAnimations();
EXPECT_TRUE(controller_impl->GetAnimationById(animation_id));
- EXPECT_EQ(Animation::WaitingForTargetAvailability,
+ EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
controller_impl->GetAnimationById(animation_id)->run_state());
AnimationEventsVector events;
@@ -122,13 +122,13 @@ TEST(LayerAnimationControllerTest, UseSpecifiedStartTimes) {
AddOpacityTransitionToController(controller.get(), 1, 0, 1, false);
const TimeTicks start_time = TicksFromSecondsF(123);
- controller->GetAnimation(Animation::Opacity)->set_start_time(start_time);
+ controller->GetAnimation(Animation::OPACITY)->set_start_time(start_time);
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
EXPECT_TRUE(controller_impl->GetAnimationById(animation_id));
- EXPECT_EQ(Animation::WaitingForTargetAvailability,
+ EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
controller_impl->GetAnimationById(animation_id)->run_state());
AnimationEventsVector events;
@@ -202,8 +202,8 @@ TEST(LayerAnimationControllerTest, Activation) {
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
controller->UpdateState(true, nullptr);
- EXPECT_EQ(Animation::Finished,
- controller->GetAnimation(Animation::Opacity)->run_state());
+ EXPECT_EQ(Animation::FINISHED,
+ controller->GetAnimation(Animation::OPACITY)->run_state());
EXPECT_EQ(1u, registrar->active_animation_controllers().size());
events.reset(new AnimationEventsVector);
@@ -211,8 +211,8 @@ TEST(LayerAnimationControllerTest, Activation) {
TimeDelta::FromMilliseconds(1500));
controller_impl->UpdateState(true, events.get());
- EXPECT_EQ(Animation::WaitingForDeletion,
- controller_impl->GetAnimation(Animation::Opacity)->run_state());
+ EXPECT_EQ(Animation::WAITING_FOR_DELETION,
+ controller_impl->GetAnimation(Animation::OPACITY)->run_state());
// The impl thread controller should have de-activated.
EXPECT_EQ(0u, registrar_impl->active_animation_controllers().size());
@@ -221,8 +221,8 @@ TEST(LayerAnimationControllerTest, Activation) {
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1500));
controller->UpdateState(true, nullptr);
- EXPECT_EQ(Animation::WaitingForDeletion,
- controller->GetAnimation(Animation::Opacity)->run_state());
+ EXPECT_EQ(Animation::WAITING_FOR_DELETION,
+ controller->GetAnimation(Animation::OPACITY)->run_state());
// The main thread controller should have de-activated.
EXPECT_EQ(0u, registrar->active_animation_controllers().size());
@@ -247,7 +247,7 @@ TEST(LayerAnimationControllerTest, SyncPause) {
LayerAnimationController::Create(0));
controller->AddValueObserver(&dummy);
- EXPECT_FALSE(controller_impl->GetAnimation(Animation::Opacity));
+ EXPECT_FALSE(controller_impl->GetAnimation(Animation::OPACITY));
int animation_id =
AddOpacityTransitionToController(controller.get(), 1, 0, 1, false);
@@ -256,7 +256,7 @@ TEST(LayerAnimationControllerTest, SyncPause) {
controller_impl->ActivateAnimations();
EXPECT_TRUE(controller_impl->GetAnimationById(animation_id));
- EXPECT_EQ(Animation::WaitingForTargetAvailability,
+ EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
controller_impl->GetAnimationById(animation_id)->run_state());
// Start the animations on each controller.
@@ -265,22 +265,22 @@ TEST(LayerAnimationControllerTest, SyncPause) {
controller_impl->UpdateState(true, &events);
controller->Animate(kInitialTickTime);
controller->UpdateState(true, nullptr);
- EXPECT_EQ(Animation::Running,
+ EXPECT_EQ(Animation::RUNNING,
controller_impl->GetAnimationById(animation_id)->run_state());
- EXPECT_EQ(Animation::Running,
+ EXPECT_EQ(Animation::RUNNING,
controller->GetAnimationById(animation_id)->run_state());
// Pause the main-thread animation.
controller->PauseAnimation(
animation_id,
TimeDelta::FromMilliseconds(1000) + TimeDelta::FromMilliseconds(1000));
- EXPECT_EQ(Animation::Paused,
+ EXPECT_EQ(Animation::PAUSED,
controller->GetAnimationById(animation_id)->run_state());
// The pause run state change should make it to the impl thread controller.
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
- EXPECT_EQ(Animation::Paused,
+ EXPECT_EQ(Animation::PAUSED,
controller_impl->GetAnimationById(animation_id)->run_state());
}
@@ -294,7 +294,7 @@ TEST(LayerAnimationControllerTest, DoNotSyncFinishedAnimation) {
LayerAnimationController::Create(0));
controller->AddValueObserver(&dummy);
- EXPECT_FALSE(controller_impl->GetAnimation(Animation::Opacity));
+ EXPECT_FALSE(controller_impl->GetAnimation(Animation::OPACITY));
int animation_id =
AddOpacityTransitionToController(controller.get(), 1, 0, 1, false);
@@ -304,15 +304,12 @@ TEST(LayerAnimationControllerTest, DoNotSyncFinishedAnimation) {
controller_impl->ActivateAnimations();
EXPECT_TRUE(controller_impl->GetAnimationById(animation_id));
- EXPECT_EQ(Animation::WaitingForTargetAvailability,
+ EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
controller_impl->GetAnimationById(animation_id)->run_state());
// Notify main thread controller that the animation has started.
- AnimationEvent animation_started_event(AnimationEvent::Started,
- 0,
- group_id,
- Animation::Opacity,
- kInitialTickTime);
+ AnimationEvent animation_started_event(AnimationEvent::STARTED, 0, group_id,
+ Animation::OPACITY, kInitialTickTime);
controller->NotifyAnimationStarted(animation_started_event);
// Force animation to complete on impl thread.
@@ -351,9 +348,9 @@ TEST(LayerAnimationControllerTest, AnimationsAreDeleted) {
controller_impl->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
controller_impl->UpdateState(true, events.get());
- // There should be a Started event for the animation.
+ // There should be a STARTED event for the animation.
EXPECT_EQ(1u, events->size());
- EXPECT_EQ(AnimationEvent::Started, (*events)[0].type);
+ EXPECT_EQ(AnimationEvent::STARTED, (*events)[0].type);
controller->NotifyAnimationStarted((*events)[0]);
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
@@ -369,13 +366,13 @@ TEST(LayerAnimationControllerTest, AnimationsAreDeleted) {
EXPECT_TRUE(dummy_impl.animation_waiting_for_deletion());
- // There should be a Finished event for the animation.
+ // There should be a FINISHED event for the animation.
EXPECT_EQ(1u, events->size());
- EXPECT_EQ(AnimationEvent::Finished, (*events)[0].type);
+ EXPECT_EQ(AnimationEvent::FINISHED, (*events)[0].type);
// Neither controller should have deleted the animation yet.
- EXPECT_TRUE(controller->GetAnimation(Animation::Opacity));
- EXPECT_TRUE(controller_impl->GetAnimation(Animation::Opacity));
+ EXPECT_TRUE(controller->GetAnimation(Animation::OPACITY));
+ EXPECT_TRUE(controller_impl->GetAnimation(Animation::OPACITY));
controller->NotifyAnimationFinished((*events)[0]);
@@ -399,7 +396,7 @@ static const AnimationEvent* GetMostRecentPropertyUpdateEvent(
const AnimationEventsVector* events) {
const AnimationEvent* event = 0;
for (size_t i = 0; i < events->size(); ++i)
- if ((*events)[i].type == AnimationEvent::PropertyUpdate)
+ if ((*events)[i].type == AnimationEvent::PROPERTY_UPDATE)
event = &(*events)[i];
return event;
@@ -415,8 +412,7 @@ TEST(LayerAnimationControllerTest, TrivialTransition) {
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1,
- Animation::Opacity));
+ 1, Animation::OPACITY));
EXPECT_FALSE(controller->needs_to_start_animations_for_testing());
controller->AddAnimation(to_add.Pass());
@@ -447,8 +443,7 @@ TEST(LayerAnimationControllerTest, TrivialTransitionOnImpl) {
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1,
- Animation::Opacity));
+ 1, Animation::OPACITY));
to_add->set_is_impl_only(true);
controller_impl->AddAnimation(to_add.Pass());
@@ -488,7 +483,7 @@ TEST(LayerAnimationControllerTest, TrivialTransformOnImpl) {
scoped_ptr<KeyframedTransformAnimationCurve> curve(
KeyframedTransformAnimationCurve::Create());
- // Create simple Transform animation.
+ // Create simple TRANSFORM animation.
TransformOperations operations;
curve->AddKeyframe(
TransformKeyframe::Create(base::TimeDelta(), operations, nullptr));
@@ -497,7 +492,7 @@ TEST(LayerAnimationControllerTest, TrivialTransformOnImpl) {
base::TimeDelta::FromSecondsD(1.0), operations, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(curve.Pass(), 1, 0, Animation::Transform));
+ Animation::Create(curve.Pass(), 1, 0, Animation::TRANSFORM));
animation->set_is_impl_only(true);
controller_impl->AddAnimation(animation.Pass());
@@ -549,7 +544,7 @@ TEST(LayerAnimationControllerTest, FilterTransition) {
end_filters, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(curve.Pass(), 1, 0, Animation::Filter));
+ Animation::Create(curve.Pass(), 1, 0, Animation::FILTER));
controller->AddAnimation(animation.Pass());
controller->Animate(kInitialTickTime);
@@ -587,7 +582,7 @@ TEST(LayerAnimationControllerTest, FilterTransitionOnImplOnly) {
scoped_ptr<KeyframedFilterAnimationCurve> curve(
KeyframedFilterAnimationCurve::Create());
- // Create simple Filter animation.
+ // Create simple FILTER animation.
FilterOperations start_filters;
start_filters.Append(FilterOperation::CreateBrightnessFilter(1.f));
curve->AddKeyframe(
@@ -598,7 +593,7 @@ TEST(LayerAnimationControllerTest, FilterTransitionOnImplOnly) {
end_filters, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(curve.Pass(), 1, 0, Animation::Filter));
+ Animation::Create(curve.Pass(), 1, 0, Animation::FILTER));
animation->set_is_impl_only(true);
controller_impl->AddAnimation(animation.Pass());
@@ -651,20 +646,20 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransition) {
EaseInOutTimingFunction::Create().Pass()));
scoped_ptr<Animation> animation(
- Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset));
+ Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET));
animation->set_needs_synchronized_start_time(true);
controller->AddAnimation(animation.Pass());
dummy_provider_impl.set_scroll_offset(initial_value);
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
- EXPECT_TRUE(controller_impl->GetAnimation(Animation::ScrollOffset));
- TimeDelta duration = controller_impl->GetAnimation(Animation::ScrollOffset)
+ EXPECT_TRUE(controller_impl->GetAnimation(Animation::SCROLL_OFFSET));
+ TimeDelta duration = controller_impl->GetAnimation(Animation::SCROLL_OFFSET)
->curve()
->Duration();
EXPECT_EQ(
duration,
- controller->GetAnimation(Animation::ScrollOffset)->curve()->Duration());
+ controller->GetAnimation(Animation::SCROLL_OFFSET)->curve()->Duration());
controller->Animate(kInitialTickTime);
controller->UpdateState(true, nullptr);
@@ -730,20 +725,20 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransitionNoImplProvider) {
EaseInOutTimingFunction::Create().Pass()));
scoped_ptr<Animation> animation(
- Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset));
+ Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET));
animation->set_needs_synchronized_start_time(true);
controller->AddAnimation(animation.Pass());
dummy_provider.set_scroll_offset(initial_value);
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
- EXPECT_TRUE(controller_impl->GetAnimation(Animation::ScrollOffset));
- TimeDelta duration = controller_impl->GetAnimation(Animation::ScrollOffset)
+ EXPECT_TRUE(controller_impl->GetAnimation(Animation::SCROLL_OFFSET));
+ TimeDelta duration = controller_impl->GetAnimation(Animation::SCROLL_OFFSET)
->curve()
->Duration();
EXPECT_EQ(
duration,
- controller->GetAnimation(Animation::ScrollOffset)->curve()->Duration());
+ controller->GetAnimation(Animation::SCROLL_OFFSET)->curve()->Duration());
controller->Animate(kInitialTickTime);
controller->UpdateState(true, nullptr);
@@ -803,7 +798,7 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransitionOnImplOnly) {
double duration_in_seconds = curve->Duration().InSecondsF();
scoped_ptr<Animation> animation(
- Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset));
+ Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET));
animation->set_is_impl_only(true);
controller_impl->AddAnimation(animation.Pass());
@@ -857,7 +852,7 @@ TEST(LayerAnimationControllerTest, ScrollOffsetRemovalClearsScrollDelta) {
int animation_id = 1;
scoped_ptr<Animation> animation(Animation::Create(
- curve.Pass(), animation_id, 0, Animation::ScrollOffset));
+ curve.Pass(), animation_id, 0, Animation::SCROLL_OFFSET));
animation->set_needs_synchronized_start_time(true);
controller->AddAnimation(animation.Pass());
controller->PushAnimationUpdatesTo(controller_impl.get());
@@ -878,8 +873,8 @@ TEST(LayerAnimationControllerTest, ScrollOffsetRemovalClearsScrollDelta) {
// Now, test the 2-argument version of RemoveAnimation.
curve = ScrollOffsetAnimationCurve::Create(
target_value, EaseInOutTimingFunction::Create().Pass());
- animation =
- Animation::Create(curve.Pass(), animation_id, 0, Animation::ScrollOffset);
+ animation = Animation::Create(curve.Pass(), animation_id, 0,
+ Animation::SCROLL_OFFSET);
animation->set_needs_synchronized_start_time(true);
controller->AddAnimation(animation.Pass());
controller->PushAnimationUpdatesTo(controller_impl.get());
@@ -975,8 +970,7 @@ TEST(LayerAnimationControllerTest,
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1,
- Animation::Opacity));
+ 1, Animation::OPACITY));
to_add->set_is_impl_only(true);
controller_impl->AddAnimation(to_add.Pass());
@@ -1011,8 +1005,7 @@ TEST(LayerAnimationControllerTest,
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1,
- Animation::Opacity));
+ 1, Animation::OPACITY));
to_add->set_needs_synchronized_start_time(true);
// We should pause at the first keyframe indefinitely waiting for that
@@ -1033,10 +1026,7 @@ TEST(LayerAnimationControllerTest,
// Send the synchronized start time.
controller->NotifyAnimationStarted(
- AnimationEvent(AnimationEvent::Started,
- 0,
- 1,
- Animation::Opacity,
+ AnimationEvent(AnimationEvent::STARTED, 0, 1, Animation::OPACITY,
kInitialTickTime + TimeDelta::FromMilliseconds(2000)));
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(5000));
controller->UpdateState(true, events.get());
@@ -1057,13 +1047,11 @@ TEST(LayerAnimationControllerTest, TrivialQueuing) {
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1,
- Animation::Opacity));
+ 1, Animation::OPACITY));
controller->AddAnimation(CreateAnimation(
- scoped_ptr<AnimationCurve>(
- new FakeFloatTransition(1.0, 1.f, 0.5f)).Pass(),
- 2,
- Animation::Opacity));
+ scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.5f))
+ .Pass(),
+ 2, Animation::OPACITY));
EXPECT_TRUE(controller->needs_to_start_animations_for_testing());
@@ -1099,19 +1087,17 @@ TEST(LayerAnimationControllerTest, Interrupt) {
controller->AddValueObserver(&dummy);
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1,
- Animation::Opacity));
+ 1, Animation::OPACITY));
controller->Animate(kInitialTickTime);
controller->UpdateState(true, events.get());
EXPECT_TRUE(controller->HasActiveAnimation());
EXPECT_EQ(0.f, dummy.opacity());
scoped_ptr<Animation> to_add(CreateAnimation(
- scoped_ptr<AnimationCurve>(
- new FakeFloatTransition(1.0, 1.f, 0.5f)).Pass(),
- 2,
- Animation::Opacity));
- controller->AbortAnimations(Animation::Opacity);
+ scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.5f))
+ .Pass(),
+ 2, Animation::OPACITY));
+ controller->AbortAnimations(Animation::OPACITY);
controller->AddAnimation(to_add.Pass());
// Since the previous animation was aborted, the new animation should start
@@ -1137,17 +1123,14 @@ TEST(LayerAnimationControllerTest, ScheduleTogetherWhenAPropertyIsBlocked) {
controller->AddValueObserver(&dummy);
controller->AddAnimation(CreateAnimation(
- scoped_ptr<AnimationCurve>(new FakeTransformTransition(1)).Pass(),
- 1,
- Animation::Transform));
+ scoped_ptr<AnimationCurve>(new FakeTransformTransition(1)).Pass(), 1,
+ Animation::TRANSFORM));
controller->AddAnimation(CreateAnimation(
- scoped_ptr<AnimationCurve>(new FakeTransformTransition(1)).Pass(),
- 2,
- Animation::Transform));
+ scoped_ptr<AnimationCurve>(new FakeTransformTransition(1)).Pass(), 2,
+ Animation::TRANSFORM));
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 2,
- Animation::Opacity));
+ 2, Animation::OPACITY));
controller->Animate(kInitialTickTime);
controller->UpdateState(true, events.get());
@@ -1177,18 +1160,15 @@ TEST(LayerAnimationControllerTest, ScheduleTogetherWithAnAnimWaiting) {
controller->AddValueObserver(&dummy);
controller->AddAnimation(CreateAnimation(
- scoped_ptr<AnimationCurve>(new FakeTransformTransition(2)).Pass(),
- 1,
- Animation::Transform));
+ scoped_ptr<AnimationCurve>(new FakeTransformTransition(2)).Pass(), 1,
+ Animation::TRANSFORM));
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1,
- Animation::Opacity));
+ 1, Animation::OPACITY));
controller->AddAnimation(CreateAnimation(
- scoped_ptr<AnimationCurve>(
- new FakeFloatTransition(1.0, 1.f, 0.5f)).Pass(),
- 2,
- Animation::Opacity));
+ scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.5f))
+ .Pass(),
+ 2, Animation::OPACITY));
// Animations with id 1 should both start now.
controller->Animate(kInitialTickTime);
@@ -1223,8 +1203,7 @@ TEST(LayerAnimationControllerTest, TrivialLooping) {
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1,
- Animation::Opacity));
+ 1, Animation::OPACITY));
to_add->set_iterations(3);
controller->AddAnimation(to_add.Pass());
@@ -1270,7 +1249,7 @@ TEST(LayerAnimationControllerTest, InfiniteLooping) {
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1, Animation::Opacity));
+ 1, Animation::OPACITY));
to_add->set_iterations(-1);
controller->AddAnimation(to_add.Pass());
@@ -1298,9 +1277,9 @@ TEST(LayerAnimationControllerTest, InfiniteLooping) {
EXPECT_TRUE(controller->HasActiveAnimation());
EXPECT_EQ(0.75f, dummy.opacity());
- EXPECT_TRUE(controller->GetAnimation(Animation::Opacity));
- controller->GetAnimation(Animation::Opacity)
- ->SetRunState(Animation::Aborted,
+ EXPECT_TRUE(controller->GetAnimation(Animation::OPACITY));
+ controller->GetAnimation(Animation::OPACITY)
+ ->SetRunState(Animation::ABORTED,
kInitialTickTime + TimeDelta::FromMilliseconds(750));
EXPECT_FALSE(controller->HasActiveAnimation());
EXPECT_EQ(0.75f, dummy.opacity());
@@ -1317,7 +1296,7 @@ TEST(LayerAnimationControllerTest, PauseResume) {
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1, Animation::Opacity));
+ 1, Animation::OPACITY));
controller->Animate(kInitialTickTime);
controller->UpdateState(true, events.get());
@@ -1328,9 +1307,9 @@ TEST(LayerAnimationControllerTest, PauseResume) {
EXPECT_TRUE(controller->HasActiveAnimation());
EXPECT_EQ(0.5f, dummy.opacity());
- EXPECT_TRUE(controller->GetAnimation(Animation::Opacity));
- controller->GetAnimation(Animation::Opacity)
- ->SetRunState(Animation::Paused,
+ EXPECT_TRUE(controller->GetAnimation(Animation::OPACITY));
+ controller->GetAnimation(Animation::OPACITY)
+ ->SetRunState(Animation::PAUSED,
kInitialTickTime + TimeDelta::FromMilliseconds(500));
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1024000));
@@ -1338,9 +1317,9 @@ TEST(LayerAnimationControllerTest, PauseResume) {
EXPECT_TRUE(controller->HasActiveAnimation());
EXPECT_EQ(0.5f, dummy.opacity());
- EXPECT_TRUE(controller->GetAnimation(Animation::Opacity));
- controller->GetAnimation(Animation::Opacity)
- ->SetRunState(Animation::Running,
+ EXPECT_TRUE(controller->GetAnimation(Animation::OPACITY));
+ controller->GetAnimation(Animation::OPACITY)
+ ->SetRunState(Animation::RUNNING,
kInitialTickTime + TimeDelta::FromMilliseconds(1024000));
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1024250));
controller->UpdateState(true, events.get());
@@ -1364,14 +1343,14 @@ TEST(LayerAnimationControllerTest, AbortAGroupedAnimation) {
const int animation_id = 2;
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(1)).Pass(), 1, 1,
- Animation::Transform));
+ Animation::TRANSFORM));
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(2.0, 0.f, 1.f)).Pass(),
- animation_id, 1, Animation::Opacity));
+ animation_id, 1, Animation::OPACITY));
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.75f))
.Pass(),
- 3, 2, Animation::Opacity));
+ 3, 2, Animation::OPACITY));
controller->Animate(kInitialTickTime);
controller->UpdateState(true, events.get());
@@ -1384,7 +1363,7 @@ TEST(LayerAnimationControllerTest, AbortAGroupedAnimation) {
EXPECT_TRUE(controller->GetAnimationById(animation_id));
controller->GetAnimationById(animation_id)
- ->SetRunState(Animation::Aborted,
+ ->SetRunState(Animation::ABORTED,
kInitialTickTime + TimeDelta::FromMilliseconds(1000));
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
controller->UpdateState(true, events.get());
@@ -1410,24 +1389,23 @@ TEST(LayerAnimationControllerTest, PushUpdatesWhenSynchronizedStartTimeNeeded) {
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(2.0, 0.f, 1.f)).Pass(),
- 0,
- Animation::Opacity));
+ 0, Animation::OPACITY));
to_add->set_needs_synchronized_start_time(true);
controller->AddAnimation(to_add.Pass());
controller->Animate(kInitialTickTime);
controller->UpdateState(true, events.get());
EXPECT_TRUE(controller->HasActiveAnimation());
- Animation* active_animation = controller->GetAnimation(Animation::Opacity);
+ Animation* active_animation = controller->GetAnimation(Animation::OPACITY);
EXPECT_TRUE(active_animation);
EXPECT_TRUE(active_animation->needs_synchronized_start_time());
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
- active_animation = controller_impl->GetAnimation(Animation::Opacity);
+ active_animation = controller_impl->GetAnimation(Animation::OPACITY);
EXPECT_TRUE(active_animation);
- EXPECT_EQ(Animation::WaitingForTargetAvailability,
+ EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
active_animation->run_state());
}
@@ -1441,17 +1419,15 @@ TEST(LayerAnimationControllerTest, SkipUpdateState) {
controller->AddValueObserver(&dummy);
controller->AddAnimation(CreateAnimation(
- scoped_ptr<AnimationCurve>(new FakeTransformTransition(1)).Pass(),
- 1,
- Animation::Transform));
+ scoped_ptr<AnimationCurve>(new FakeTransformTransition(1)).Pass(), 1,
+ Animation::TRANSFORM));
controller->Animate(kInitialTickTime);
controller->UpdateState(true, events.get());
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 2,
- Animation::Opacity));
+ 2, Animation::OPACITY));
// Animate but don't UpdateState.
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
@@ -1460,7 +1436,7 @@ TEST(LayerAnimationControllerTest, SkipUpdateState) {
events.reset(new AnimationEventsVector);
controller->UpdateState(true, events.get());
- // Should have one Started event and one Finished event.
+ // Should have one STARTED event and one FINISHED event.
EXPECT_EQ(2u, events->size());
EXPECT_NE((*events)[0].type, (*events)[1].type);
@@ -1477,7 +1453,7 @@ TEST(LayerAnimationControllerTest, SkipUpdateState) {
}
// Tests that an animation controller with only a pending observer gets ticked
-// but doesn't progress animations past the Starting state.
+// but doesn't progress animations past the STARTING state.
TEST(LayerAnimationControllerTest, InactiveObserverGetsTicked) {
scoped_ptr<AnimationEventsVector> events(
make_scoped_ptr(new AnimationEventsVector));
@@ -1487,49 +1463,49 @@ TEST(LayerAnimationControllerTest, InactiveObserverGetsTicked) {
LayerAnimationController::Create(0));
const int id = 1;
- controller->AddAnimation(CreateAnimation(scoped_ptr<AnimationCurve>(
- new FakeFloatTransition(1.0, 0.5f, 1.f)).Pass(),
- id,
- Animation::Opacity));
+ controller->AddAnimation(CreateAnimation(
+ scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.5f, 1.f))
+ .Pass(),
+ id, Animation::OPACITY));
- // Without an observer, the animation shouldn't progress to the Starting
+ // Without an observer, the animation shouldn't progress to the STARTING
// state.
controller->Animate(kInitialTickTime);
controller->UpdateState(true, events.get());
EXPECT_EQ(0u, events->size());
- EXPECT_EQ(Animation::WaitingForTargetAvailability,
- controller->GetAnimation(Animation::Opacity)->run_state());
+ EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
+ controller->GetAnimation(Animation::OPACITY)->run_state());
controller->AddValueObserver(&pending_dummy);
// With only a pending observer, the animation should progress to the
- // Starting state and get ticked at its starting point, but should not
- // progress to Running.
+ // STARTING state and get ticked at its starting point, but should not
+ // progress to RUNNING.
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
controller->UpdateState(true, events.get());
EXPECT_EQ(0u, events->size());
- EXPECT_EQ(Animation::Starting,
- controller->GetAnimation(Animation::Opacity)->run_state());
+ EXPECT_EQ(Animation::STARTING,
+ controller->GetAnimation(Animation::OPACITY)->run_state());
EXPECT_EQ(0.5f, pending_dummy.opacity());
- // Even when already in the Starting state, the animation should stay
+ // Even when already in the STARTING state, the animation should stay
// there, and shouldn't be ticked past its starting point.
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000));
controller->UpdateState(true, events.get());
EXPECT_EQ(0u, events->size());
- EXPECT_EQ(Animation::Starting,
- controller->GetAnimation(Animation::Opacity)->run_state());
+ EXPECT_EQ(Animation::STARTING,
+ controller->GetAnimation(Animation::OPACITY)->run_state());
EXPECT_EQ(0.5f, pending_dummy.opacity());
controller->AddValueObserver(&dummy);
// Now that an active observer has been added, the animation should still
- // initially tick at its starting point, but should now progress to Running.
+ // initially tick at its starting point, but should now progress to RUNNING.
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(3000));
controller->UpdateState(true, events.get());
EXPECT_EQ(1u, events->size());
- EXPECT_EQ(Animation::Running,
- controller->GetAnimation(Animation::Opacity)->run_state());
+ EXPECT_EQ(Animation::RUNNING,
+ controller->GetAnimation(Animation::OPACITY)->run_state());
EXPECT_EQ(0.5f, pending_dummy.opacity());
EXPECT_EQ(0.5f, dummy.opacity());
@@ -1554,7 +1530,7 @@ TEST(LayerAnimationControllerTest, TransformAnimationBounds) {
base::TimeDelta::FromSecondsD(1.0), operations1, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(curve1.Pass(), 1, 1, Animation::Transform));
+ Animation::Create(curve1.Pass(), 1, 1, Animation::TRANSFORM));
controller_impl->AddAnimation(animation.Pass());
scoped_ptr<KeyframedTransformAnimationCurve> curve2(
@@ -1567,7 +1543,7 @@ TEST(LayerAnimationControllerTest, TransformAnimationBounds) {
curve2->AddKeyframe(TransformKeyframe::Create(
base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
- animation = Animation::Create(curve2.Pass(), 2, 2, Animation::Transform);
+ animation = Animation::Create(curve2.Pass(), 2, 2, Animation::TRANSFORM);
controller_impl->AddAnimation(animation.Pass());
gfx::BoxF box(1.f, 2.f, -1.f, 3.f, 4.f, 5.f);
@@ -1578,7 +1554,7 @@ TEST(LayerAnimationControllerTest, TransformAnimationBounds) {
bounds.ToString());
controller_impl->GetAnimationById(1)
- ->SetRunState(Animation::Finished, TicksFromSecondsF(0.0));
+ ->SetRunState(Animation::FINISHED, TicksFromSecondsF(0.0));
// Only the unfinished animation should affect the animated bounds.
EXPECT_TRUE(controller_impl->TransformAnimationBoundsForBox(box, &bounds));
@@ -1586,7 +1562,7 @@ TEST(LayerAnimationControllerTest, TransformAnimationBounds) {
bounds.ToString());
controller_impl->GetAnimationById(2)
- ->SetRunState(Animation::Finished, TicksFromSecondsF(0.0));
+ ->SetRunState(Animation::FINISHED, TicksFromSecondsF(0.0));
// There are no longer any running animations.
EXPECT_FALSE(controller_impl->HasTransformAnimationThatInflatesBounds());
@@ -1602,7 +1578,7 @@ TEST(LayerAnimationControllerTest, TransformAnimationBounds) {
operations3.AppendMatrix(transform3);
curve3->AddKeyframe(TransformKeyframe::Create(
base::TimeDelta::FromSecondsD(1.0), operations3, nullptr));
- animation = Animation::Create(curve3.Pass(), 3, 3, Animation::Transform);
+ animation = Animation::Create(curve3.Pass(), 3, 3, Animation::TRANSFORM);
controller_impl->AddAnimation(animation.Pass());
EXPECT_FALSE(controller_impl->TransformAnimationBoundsForBox(box, &bounds));
}
@@ -1619,40 +1595,40 @@ TEST(LayerAnimationControllerTest, AbortAnimations) {
// state.
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)).Pass(), 1, 1,
- Animation::Transform));
+ Animation::TRANSFORM));
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 2, 2, Animation::Opacity));
+ 2, 2, Animation::OPACITY));
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)).Pass(), 3, 3,
- Animation::Transform));
+ Animation::TRANSFORM));
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(2.0)).Pass(), 4, 4,
- Animation::Transform));
+ Animation::TRANSFORM));
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 5, 5, Animation::Opacity));
+ 5, 5, Animation::OPACITY));
controller->Animate(kInitialTickTime);
controller->UpdateState(true, nullptr);
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
controller->UpdateState(true, nullptr);
- EXPECT_EQ(Animation::Finished, controller->GetAnimationById(1)->run_state());
- EXPECT_EQ(Animation::Finished, controller->GetAnimationById(2)->run_state());
- EXPECT_EQ(Animation::Running, controller->GetAnimationById(3)->run_state());
- EXPECT_EQ(Animation::WaitingForTargetAvailability,
+ EXPECT_EQ(Animation::FINISHED, controller->GetAnimationById(1)->run_state());
+ EXPECT_EQ(Animation::FINISHED, controller->GetAnimationById(2)->run_state());
+ EXPECT_EQ(Animation::RUNNING, controller->GetAnimationById(3)->run_state());
+ EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
controller->GetAnimationById(4)->run_state());
- EXPECT_EQ(Animation::Running, controller->GetAnimationById(5)->run_state());
+ EXPECT_EQ(Animation::RUNNING, controller->GetAnimationById(5)->run_state());
- controller->AbortAnimations(Animation::Transform);
+ controller->AbortAnimations(Animation::TRANSFORM);
- // Only un-finished Transform animations should have been aborted.
- EXPECT_EQ(Animation::Finished, controller->GetAnimationById(1)->run_state());
- EXPECT_EQ(Animation::Finished, controller->GetAnimationById(2)->run_state());
- EXPECT_EQ(Animation::Aborted, controller->GetAnimationById(3)->run_state());
- EXPECT_EQ(Animation::Aborted, controller->GetAnimationById(4)->run_state());
- EXPECT_EQ(Animation::Running, controller->GetAnimationById(5)->run_state());
+ // Only un-finished TRANSFORM animations should have been aborted.
+ EXPECT_EQ(Animation::FINISHED, controller->GetAnimationById(1)->run_state());
+ EXPECT_EQ(Animation::FINISHED, controller->GetAnimationById(2)->run_state());
+ EXPECT_EQ(Animation::ABORTED, controller->GetAnimationById(3)->run_state());
+ EXPECT_EQ(Animation::ABORTED, controller->GetAnimationById(4)->run_state());
+ EXPECT_EQ(Animation::RUNNING, controller->GetAnimationById(5)->run_state());
}
// An animation aborted on the main thread should get deleted on both threads.
@@ -1673,17 +1649,17 @@ TEST(LayerAnimationControllerTest, MainThreadAbortedAnimationGetsDeleted) {
controller_impl->ActivateAnimations();
EXPECT_TRUE(controller_impl->GetAnimationById(animation_id));
- controller->AbortAnimations(Animation::Opacity);
- EXPECT_EQ(Animation::Aborted,
- controller->GetAnimation(Animation::Opacity)->run_state());
+ controller->AbortAnimations(Animation::OPACITY);
+ EXPECT_EQ(Animation::ABORTED,
+ controller->GetAnimation(Animation::OPACITY)->run_state());
EXPECT_FALSE(dummy.animation_waiting_for_deletion());
EXPECT_FALSE(dummy_impl.animation_waiting_for_deletion());
controller->Animate(kInitialTickTime);
controller->UpdateState(true, nullptr);
EXPECT_TRUE(dummy.animation_waiting_for_deletion());
- EXPECT_EQ(Animation::WaitingForDeletion,
- controller->GetAnimation(Animation::Opacity)->run_state());
+ EXPECT_EQ(Animation::WAITING_FOR_DELETION,
+ controller->GetAnimation(Animation::OPACITY)->run_state());
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
@@ -1709,9 +1685,9 @@ TEST(LayerAnimationControllerTest, ImplThreadAbortedAnimationGetsDeleted) {
controller_impl->ActivateAnimations();
EXPECT_TRUE(controller_impl->GetAnimationById(animation_id));
- controller_impl->AbortAnimations(Animation::Opacity);
- EXPECT_EQ(Animation::Aborted,
- controller_impl->GetAnimation(Animation::Opacity)->run_state());
+ controller_impl->AbortAnimations(Animation::OPACITY);
+ EXPECT_EQ(Animation::ABORTED,
+ controller_impl->GetAnimation(Animation::OPACITY)->run_state());
EXPECT_FALSE(dummy.animation_waiting_for_deletion());
EXPECT_FALSE(dummy_impl.animation_waiting_for_deletion());
@@ -1720,19 +1696,19 @@ TEST(LayerAnimationControllerTest, ImplThreadAbortedAnimationGetsDeleted) {
controller_impl->UpdateState(true, &events);
EXPECT_TRUE(dummy_impl.animation_waiting_for_deletion());
EXPECT_EQ(1u, events.size());
- EXPECT_EQ(AnimationEvent::Aborted, events[0].type);
- EXPECT_EQ(Animation::WaitingForDeletion,
- controller_impl->GetAnimation(Animation::Opacity)->run_state());
+ EXPECT_EQ(AnimationEvent::ABORTED, events[0].type);
+ EXPECT_EQ(Animation::WAITING_FOR_DELETION,
+ controller_impl->GetAnimation(Animation::OPACITY)->run_state());
controller->NotifyAnimationAborted(events[0]);
- EXPECT_EQ(Animation::Aborted,
- controller->GetAnimation(Animation::Opacity)->run_state());
+ EXPECT_EQ(Animation::ABORTED,
+ controller->GetAnimation(Animation::OPACITY)->run_state());
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
controller->UpdateState(true, nullptr);
EXPECT_TRUE(dummy.animation_waiting_for_deletion());
- EXPECT_EQ(Animation::WaitingForDeletion,
- controller->GetAnimation(Animation::Opacity)->run_state());
+ EXPECT_EQ(Animation::WAITING_FOR_DELETION,
+ controller->GetAnimation(Animation::OPACITY)->run_state());
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
@@ -1740,7 +1716,7 @@ TEST(LayerAnimationControllerTest, ImplThreadAbortedAnimationGetsDeleted) {
EXPECT_FALSE(controller_impl->GetAnimationById(animation_id));
}
-// Ensure that we only generate Finished events for animations in a group
+// Ensure that we only generate FINISHED events for animations in a group
// once all animations in that group are finished.
TEST(LayerAnimationControllerTest, FinishedEventsForGroup) {
scoped_ptr<AnimationEventsVector> events(
@@ -1755,18 +1731,18 @@ TEST(LayerAnimationControllerTest, FinishedEventsForGroup) {
// Add two animations with the same group id but different durations.
controller_impl->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(2.0)).Pass(), 1,
- group_id, Animation::Transform));
+ group_id, Animation::TRANSFORM));
controller_impl->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 2, group_id, Animation::Opacity));
+ 2, group_id, Animation::OPACITY));
controller_impl->Animate(kInitialTickTime);
controller_impl->UpdateState(true, events.get());
// Both animations should have started.
EXPECT_EQ(2u, events->size());
- EXPECT_EQ(AnimationEvent::Started, (*events)[0].type);
- EXPECT_EQ(AnimationEvent::Started, (*events)[1].type);
+ EXPECT_EQ(AnimationEvent::STARTED, (*events)[0].type);
+ EXPECT_EQ(AnimationEvent::STARTED, (*events)[1].type);
events.reset(new AnimationEventsVector);
controller_impl->Animate(kInitialTickTime +
@@ -1774,25 +1750,25 @@ TEST(LayerAnimationControllerTest, FinishedEventsForGroup) {
controller_impl->UpdateState(true, events.get());
// The opacity animation should be finished, but should not have generated
- // a Finished event yet.
+ // a FINISHED event yet.
EXPECT_EQ(0u, events->size());
- EXPECT_EQ(Animation::Finished,
+ EXPECT_EQ(Animation::FINISHED,
controller_impl->GetAnimationById(2)->run_state());
- EXPECT_EQ(Animation::Running,
+ EXPECT_EQ(Animation::RUNNING,
controller_impl->GetAnimationById(1)->run_state());
controller_impl->Animate(kInitialTickTime +
TimeDelta::FromMilliseconds(2000));
controller_impl->UpdateState(true, events.get());
- // Both animations should have generated Finished events.
+ // Both animations should have generated FINISHED events.
EXPECT_EQ(2u, events->size());
- EXPECT_EQ(AnimationEvent::Finished, (*events)[0].type);
- EXPECT_EQ(AnimationEvent::Finished, (*events)[1].type);
+ EXPECT_EQ(AnimationEvent::FINISHED, (*events)[0].type);
+ EXPECT_EQ(AnimationEvent::FINISHED, (*events)[1].type);
}
// Ensure that when a group has a mix of aborted and finished animations,
-// we generate a Finished event for the finished animation and an Aborted
+// we generate a FINISHED event for the finished animation and an ABORTED
// event for the aborted animation.
TEST(LayerAnimationControllerTest, FinishedAndAbortedEventsForGroup) {
scoped_ptr<AnimationEventsVector> events(
@@ -1804,36 +1780,34 @@ TEST(LayerAnimationControllerTest, FinishedAndAbortedEventsForGroup) {
// Add two animations with the same group id.
controller_impl->AddAnimation(CreateAnimation(
- scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)).Pass(),
- 1,
- Animation::Transform));
+ scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)).Pass(), 1,
+ Animation::TRANSFORM));
controller_impl->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1,
- Animation::Opacity));
+ 1, Animation::OPACITY));
controller_impl->Animate(kInitialTickTime);
controller_impl->UpdateState(true, events.get());
// Both animations should have started.
EXPECT_EQ(2u, events->size());
- EXPECT_EQ(AnimationEvent::Started, (*events)[0].type);
- EXPECT_EQ(AnimationEvent::Started, (*events)[1].type);
+ EXPECT_EQ(AnimationEvent::STARTED, (*events)[0].type);
+ EXPECT_EQ(AnimationEvent::STARTED, (*events)[1].type);
- controller_impl->AbortAnimations(Animation::Opacity);
+ controller_impl->AbortAnimations(Animation::OPACITY);
events.reset(new AnimationEventsVector);
controller_impl->Animate(kInitialTickTime +
TimeDelta::FromMilliseconds(1000));
controller_impl->UpdateState(true, events.get());
- // We should have exactly 2 events: a Finished event for the tranform
- // animation, and an Aborted event for the opacity animation.
+ // We should have exactly 2 events: a FINISHED event for the tranform
+ // animation, and an ABORTED event for the opacity animation.
EXPECT_EQ(2u, events->size());
- EXPECT_EQ(AnimationEvent::Finished, (*events)[0].type);
- EXPECT_EQ(Animation::Transform, (*events)[0].target_property);
- EXPECT_EQ(AnimationEvent::Aborted, (*events)[1].type);
- EXPECT_EQ(Animation::Opacity, (*events)[1].target_property);
+ EXPECT_EQ(AnimationEvent::FINISHED, (*events)[0].type);
+ EXPECT_EQ(Animation::TRANSFORM, (*events)[0].target_property);
+ EXPECT_EQ(AnimationEvent::ABORTED, (*events)[1].type);
+ EXPECT_EQ(Animation::OPACITY, (*events)[1].target_property);
}
TEST(LayerAnimationControllerTest, HasAnimationThatAffectsScale) {
@@ -1844,8 +1818,7 @@ TEST(LayerAnimationControllerTest, HasAnimationThatAffectsScale) {
controller_impl->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1,
- Animation::Opacity));
+ 1, Animation::OPACITY));
// Opacity animations don't affect scale.
EXPECT_FALSE(controller_impl->HasAnimationThatAffectsScale());
@@ -1861,7 +1834,7 @@ TEST(LayerAnimationControllerTest, HasAnimationThatAffectsScale) {
base::TimeDelta::FromSecondsD(1.0), operations1, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(curve1.Pass(), 2, 2, Animation::Transform));
+ Animation::Create(curve1.Pass(), 2, 2, Animation::TRANSFORM));
controller_impl->AddAnimation(animation.Pass());
// Translations don't affect scale.
@@ -1877,13 +1850,13 @@ TEST(LayerAnimationControllerTest, HasAnimationThatAffectsScale) {
curve2->AddKeyframe(TransformKeyframe::Create(
base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
- animation = Animation::Create(curve2.Pass(), 3, 3, Animation::Transform);
+ animation = Animation::Create(curve2.Pass(), 3, 3, Animation::TRANSFORM);
controller_impl->AddAnimation(animation.Pass());
EXPECT_TRUE(controller_impl->HasAnimationThatAffectsScale());
controller_impl->GetAnimationById(3)
- ->SetRunState(Animation::Finished, TicksFromSecondsF(0.0));
+ ->SetRunState(Animation::FINISHED, TicksFromSecondsF(0.0));
// Only unfinished animations should be considered by
// HasAnimationThatAffectsScale.
@@ -1898,8 +1871,7 @@ TEST(LayerAnimationControllerTest, HasOnlyTranslationTransforms) {
controller_impl->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1,
- Animation::Opacity));
+ 1, Animation::OPACITY));
// Opacity animations aren't non-translation transforms.
EXPECT_TRUE(controller_impl->HasOnlyTranslationTransforms());
@@ -1915,7 +1887,7 @@ TEST(LayerAnimationControllerTest, HasOnlyTranslationTransforms) {
base::TimeDelta::FromSecondsD(1.0), operations1, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(curve1.Pass(), 2, 2, Animation::Transform));
+ Animation::Create(curve1.Pass(), 2, 2, Animation::TRANSFORM));
controller_impl->AddAnimation(animation.Pass());
// The only transform animation we've added is a translation.
@@ -1931,14 +1903,14 @@ TEST(LayerAnimationControllerTest, HasOnlyTranslationTransforms) {
curve2->AddKeyframe(TransformKeyframe::Create(
base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
- animation = Animation::Create(curve2.Pass(), 3, 3, Animation::Transform);
+ animation = Animation::Create(curve2.Pass(), 3, 3, Animation::TRANSFORM);
controller_impl->AddAnimation(animation.Pass());
// A scale animation is not a translation.
EXPECT_FALSE(controller_impl->HasOnlyTranslationTransforms());
controller_impl->GetAnimationById(3)
- ->SetRunState(Animation::Finished, TicksFromSecondsF(0.0));
+ ->SetRunState(Animation::FINISHED, TicksFromSecondsF(0.0));
// Only unfinished animations should be considered by
// HasOnlyTranslationTransforms.
@@ -1964,7 +1936,7 @@ TEST(LayerAnimationControllerTest, MaximumTargetScale) {
base::TimeDelta::FromSecondsD(1.0), operations1, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(curve1.Pass(), 1, 1, Animation::Transform));
+ Animation::Create(curve1.Pass(), 1, 1, Animation::TRANSFORM));
controller_impl->AddAnimation(animation.Pass());
EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
@@ -1980,7 +1952,7 @@ TEST(LayerAnimationControllerTest, MaximumTargetScale) {
curve2->AddKeyframe(TransformKeyframe::Create(
base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
- animation = Animation::Create(curve2.Pass(), 2, 2, Animation::Transform);
+ animation = Animation::Create(curve2.Pass(), 2, 2, Animation::TRANSFORM);
controller_impl->AddAnimation(animation.Pass());
EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
@@ -1996,15 +1968,15 @@ TEST(LayerAnimationControllerTest, MaximumTargetScale) {
curve3->AddKeyframe(TransformKeyframe::Create(
base::TimeDelta::FromSecondsD(1.0), operations3, nullptr));
- animation = Animation::Create(curve3.Pass(), 3, 3, Animation::Transform);
+ animation = Animation::Create(curve3.Pass(), 3, 3, Animation::TRANSFORM);
controller_impl->AddAnimation(animation.Pass());
EXPECT_FALSE(controller_impl->MaximumTargetScale(&max_scale));
controller_impl->GetAnimationById(3)
- ->SetRunState(Animation::Finished, TicksFromSecondsF(0.0));
+ ->SetRunState(Animation::FINISHED, TicksFromSecondsF(0.0));
controller_impl->GetAnimationById(2)
- ->SetRunState(Animation::Finished, TicksFromSecondsF(0.0));
+ ->SetRunState(Animation::FINISHED, TicksFromSecondsF(0.0));
// Only unfinished animations should be considered by
// MaximumTargetScale.
@@ -2028,7 +2000,7 @@ TEST(LayerAnimationControllerTest, MaximumTargetScaleWithDirection) {
base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
scoped_ptr<Animation> animation_owned(
- Animation::Create(curve1.Pass(), 1, 1, Animation::Transform));
+ Animation::Create(curve1.Pass(), 1, 1, Animation::TRANSFORM));
Animation* animation = animation_owned.get();
controller_impl->AddAnimation(animation_owned.Pass());
@@ -2036,45 +2008,45 @@ TEST(LayerAnimationControllerTest, MaximumTargetScaleWithDirection) {
EXPECT_GT(animation->playback_rate(), 0.0);
- // Normal direction with positive playback rate.
- animation->set_direction(Animation::Normal);
+ // NORMAL direction with positive playback rate.
+ animation->set_direction(Animation::DIRECTION_NORMAL);
EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
EXPECT_EQ(6.f, max_scale);
- // Alternate direction with positive playback rate.
- animation->set_direction(Animation::Alternate);
+ // ALTERNATE direction with positive playback rate.
+ animation->set_direction(Animation::DIRECTION_ALTERNATE);
EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
EXPECT_EQ(6.f, max_scale);
- // Reverse direction with positive playback rate.
- animation->set_direction(Animation::Reverse);
+ // REVERSE direction with positive playback rate.
+ animation->set_direction(Animation::DIRECTION_REVERSE);
EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
EXPECT_EQ(3.f, max_scale);
- // Alternate reverse direction.
- animation->set_direction(Animation::Reverse);
+ // ALTERNATE reverse direction.
+ animation->set_direction(Animation::DIRECTION_REVERSE);
EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
EXPECT_EQ(3.f, max_scale);
animation->set_playback_rate(-1.0);
- // Normal direction with negative playback rate.
- animation->set_direction(Animation::Normal);
+ // NORMAL direction with negative playback rate.
+ animation->set_direction(Animation::DIRECTION_NORMAL);
EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
EXPECT_EQ(3.f, max_scale);
- // Alternate direction with negative playback rate.
- animation->set_direction(Animation::Alternate);
+ // ALTERNATE direction with negative playback rate.
+ animation->set_direction(Animation::DIRECTION_ALTERNATE);
EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
EXPECT_EQ(3.f, max_scale);
- // Reverse direction with negative playback rate.
- animation->set_direction(Animation::Reverse);
+ // REVERSE direction with negative playback rate.
+ animation->set_direction(Animation::DIRECTION_REVERSE);
EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
EXPECT_EQ(6.f, max_scale);
- // Alternate reverse direction with negative playback rate.
- animation->set_direction(Animation::Reverse);
+ // ALTERNATE reverse direction with negative playback rate.
+ animation->set_direction(Animation::DIRECTION_REVERSE);
EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
EXPECT_EQ(6.f, max_scale);
}
@@ -2103,7 +2075,7 @@ TEST(LayerAnimationControllerTest, NewlyPushedAnimationWaitsForActivation) {
EXPECT_TRUE(controller_impl->needs_to_start_animations_for_testing());
EXPECT_TRUE(controller_impl->GetAnimationById(animation_id));
- EXPECT_EQ(Animation::WaitingForTargetAvailability,
+ EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
controller_impl->GetAnimationById(animation_id)->run_state());
EXPECT_TRUE(controller_impl->GetAnimationById(animation_id)
->affects_pending_observers());
@@ -2114,9 +2086,9 @@ TEST(LayerAnimationControllerTest, NewlyPushedAnimationWaitsForActivation) {
EXPECT_FALSE(controller_impl->needs_to_start_animations_for_testing());
controller_impl->UpdateState(true, events.get());
- // Since the animation hasn't been activated, it should still be Starting
- // rather than Running.
- EXPECT_EQ(Animation::Starting,
+ // Since the animation hasn't been activated, it should still be STARTING
+ // rather than RUNNING.
+ EXPECT_EQ(Animation::STARTING,
controller_impl->GetAnimationById(animation_id)->run_state());
// Since the animation hasn't been activated, only the pending observer
@@ -2135,8 +2107,8 @@ TEST(LayerAnimationControllerTest, NewlyPushedAnimationWaitsForActivation) {
controller_impl->UpdateState(true, events.get());
// Since the animation has been activated, it should have reached the
- // Running state and the active observer should start to get ticked.
- EXPECT_EQ(Animation::Running,
+ // RUNNING state and the active observer should start to get ticked.
+ EXPECT_EQ(Animation::RUNNING,
controller_impl->GetAnimationById(animation_id)->run_state());
EXPECT_EQ(0.5f, pending_dummy_impl.opacity());
EXPECT_EQ(0.5f, dummy_impl.opacity());
@@ -2162,7 +2134,7 @@ TEST(LayerAnimationControllerTest, ActivationBetweenAnimateAndUpdateState) {
controller->PushAnimationUpdatesTo(controller_impl.get());
EXPECT_TRUE(controller_impl->GetAnimationById(animation_id));
- EXPECT_EQ(Animation::WaitingForTargetAvailability,
+ EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
controller_impl->GetAnimationById(animation_id)->run_state());
EXPECT_TRUE(controller_impl->GetAnimationById(animation_id)
->affects_pending_observers());
@@ -2185,8 +2157,8 @@ TEST(LayerAnimationControllerTest, ActivationBetweenAnimateAndUpdateState) {
controller_impl->UpdateState(true, events.get());
// Since the animation has been activated, it should have reached the
- // Running state.
- EXPECT_EQ(Animation::Running,
+ // RUNNING state.
+ EXPECT_EQ(Animation::RUNNING,
controller_impl->GetAnimationById(animation_id)->run_state());
controller_impl->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
@@ -2249,7 +2221,7 @@ TEST(LayerAnimationControllerTest, PushedDeletedAnimationWaitsForActivation) {
controller_impl->ActivateAnimations();
controller_impl->Animate(kInitialTickTime);
controller_impl->UpdateState(true, events.get());
- EXPECT_EQ(Animation::Running,
+ EXPECT_EQ(Animation::RUNNING,
controller_impl->GetAnimationById(animation_id)->run_state());
EXPECT_EQ(0.5f, pending_dummy_impl.opacity());
EXPECT_EQ(0.5f, dummy_impl.opacity());
@@ -2261,7 +2233,7 @@ TEST(LayerAnimationControllerTest, PushedDeletedAnimationWaitsForActivation) {
// Delete the animation on the main-thread controller.
controller->RemoveAnimation(
- controller->GetAnimation(Animation::Opacity)->id());
+ controller->GetAnimation(Animation::OPACITY)->id());
controller->PushAnimationUpdatesTo(controller_impl.get());
// The animation should no longer affect pending observers.
@@ -2310,7 +2282,7 @@ TEST(LayerAnimationControllerTest, StartAnimationsAffectingDifferentObservers) {
// Remove the first animation from the main-thread controller, and add a
// new animation affecting the same property.
controller->RemoveAnimation(
- controller->GetAnimation(Animation::Opacity)->id());
+ controller->GetAnimation(Animation::OPACITY)->id());
int second_animation_id =
AddOpacityTransitionToController(controller.get(), 1, 1.f, 0.5f, true);
controller->PushAnimationUpdatesTo(controller_impl.get());
@@ -2331,10 +2303,10 @@ TEST(LayerAnimationControllerTest, StartAnimationsAffectingDifferentObservers) {
// The original animation should still be running, and the new animation
// should be starting.
- EXPECT_EQ(Animation::Running,
+ EXPECT_EQ(Animation::RUNNING,
controller_impl->GetAnimationById(first_animation_id)->run_state());
EXPECT_EQ(
- Animation::Starting,
+ Animation::STARTING,
controller_impl->GetAnimationById(second_animation_id)->run_state());
// The active observer should have been ticked by the original animation,
@@ -2359,7 +2331,7 @@ TEST(LayerAnimationControllerTest, StartAnimationsAffectingDifferentObservers) {
// The new animation should be running, and the active observer should have
// been ticked at the new animation's starting point.
EXPECT_EQ(
- Animation::Running,
+ Animation::RUNNING,
controller_impl->GetAnimationById(second_animation_id)->run_state());
EXPECT_EQ(1.f, pending_dummy_impl.opacity());
EXPECT_EQ(1.f, dummy_impl.opacity());
@@ -2373,15 +2345,14 @@ TEST(LayerAnimationControllerTest, TestIsAnimatingProperty) {
scoped_ptr<Animation> animation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1,
- Animation::Opacity));
+ 1, Animation::OPACITY));
controller->AddAnimation(animation.Pass());
controller->Animate(kInitialTickTime);
- EXPECT_TRUE(controller->IsAnimatingProperty(Animation::Opacity));
+ EXPECT_TRUE(controller->IsAnimatingProperty(Animation::OPACITY));
controller->UpdateState(true, nullptr);
EXPECT_TRUE(controller->HasActiveAnimation());
- EXPECT_TRUE(controller->IsAnimatingProperty(Animation::Opacity));
- EXPECT_FALSE(controller->IsAnimatingProperty(Animation::Filter));
+ EXPECT_TRUE(controller->IsAnimatingProperty(Animation::OPACITY));
+ EXPECT_FALSE(controller->IsAnimatingProperty(Animation::FILTER));
EXPECT_EQ(0.f, dummy.opacity());
}
@@ -2393,22 +2364,21 @@ TEST(LayerAnimationControllerTest, TestIsAnimatingPropertyTimeOffsetFillMode) {
scoped_ptr<Animation> animation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
- 1,
- Animation::Opacity));
- animation->set_fill_mode(Animation::FillModeNone);
+ 1, Animation::OPACITY));
+ animation->set_fill_mode(Animation::FILL_MODE_NONE);
animation->set_time_offset(TimeDelta::FromMilliseconds(-2000));
controller->AddAnimation(animation.Pass());
controller->Animate(kInitialTickTime);
controller->UpdateState(true, nullptr);
- EXPECT_FALSE(controller->IsAnimatingProperty(Animation::Opacity));
+ EXPECT_FALSE(controller->IsAnimatingProperty(Animation::OPACITY));
EXPECT_TRUE(controller->HasActiveAnimation());
- EXPECT_FALSE(controller->IsAnimatingProperty(Animation::Opacity));
- EXPECT_FALSE(controller->IsAnimatingProperty(Animation::Filter));
+ EXPECT_FALSE(controller->IsAnimatingProperty(Animation::OPACITY));
+ EXPECT_FALSE(controller->IsAnimatingProperty(Animation::FILTER));
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000));
controller->UpdateState(true, nullptr);
- EXPECT_TRUE(controller->IsAnimatingProperty(Animation::Opacity));
+ EXPECT_TRUE(controller->IsAnimatingProperty(Animation::OPACITY));
}
} // namespace
diff --git a/cc/animation/scroll_offset_animation_curve.cc b/cc/animation/scroll_offset_animation_curve.cc
index 9567263..87a29c1 100644
--- a/cc/animation/scroll_offset_animation_curve.cc
+++ b/cc/animation/scroll_offset_animation_curve.cc
@@ -90,7 +90,7 @@ base::TimeDelta ScrollOffsetAnimationCurve::Duration() const {
}
AnimationCurve::CurveType ScrollOffsetAnimationCurve::Type() const {
- return ScrollOffset;
+ return SCROLL_OFFSET;
}
scoped_ptr<AnimationCurve> ScrollOffsetAnimationCurve::Clone() const {
diff --git a/cc/animation/scroll_offset_animation_curve_unittest.cc b/cc/animation/scroll_offset_animation_curve_unittest.cc
index cb3e914..8aea905 100644
--- a/cc/animation/scroll_offset_animation_curve_unittest.cc
+++ b/cc/animation/scroll_offset_animation_curve_unittest.cc
@@ -68,7 +68,7 @@ TEST(ScrollOffsetAnimationCurveTest, GetValue) {
EXPECT_GT(curve->Duration().InSecondsF(), 0);
EXPECT_LT(curve->Duration().InSecondsF(), 0.1);
- EXPECT_EQ(AnimationCurve::ScrollOffset, curve->Type());
+ EXPECT_EQ(AnimationCurve::SCROLL_OFFSET, curve->Type());
EXPECT_EQ(duration, curve->Duration());
EXPECT_VECTOR2DF_EQ(initial_value,
@@ -101,7 +101,7 @@ TEST(ScrollOffsetAnimationCurveTest, Clone) {
scoped_ptr<AnimationCurve> clone(curve->Clone().Pass());
- EXPECT_EQ(AnimationCurve::ScrollOffset, clone->Type());
+ EXPECT_EQ(AnimationCurve::SCROLL_OFFSET, clone->Type());
EXPECT_EQ(duration, clone->Duration());
EXPECT_VECTOR2DF_EQ(initial_value,
diff --git a/cc/animation/transform_operation.cc b/cc/animation/transform_operation.cc
index e9ae86d..7421924 100644
--- a/cc/animation/transform_operation.cc
+++ b/cc/animation/transform_operation.cc
@@ -99,14 +99,14 @@ bool TransformOperation::BlendTransformOperations(
return true;
TransformOperation::Type interpolation_type =
- TransformOperation::TransformOperationIdentity;
+ TransformOperation::TRANSFORM_OPERATION_IDENTITY;
if (IsOperationIdentity(to))
interpolation_type = from->type;
else
interpolation_type = to->type;
switch (interpolation_type) {
- case TransformOperation::TransformOperationTranslate: {
+ case TransformOperation::TRANSFORM_OPERATION_TRANSLATE: {
SkMScalar from_x = IsOperationIdentity(from) ? 0 : from->translate.x;
SkMScalar from_y = IsOperationIdentity(from) ? 0 : from->translate.y;
SkMScalar from_z = IsOperationIdentity(from) ? 0 : from->translate.z;
@@ -118,7 +118,7 @@ bool TransformOperation::BlendTransformOperations(
BlendSkMScalars(from_z, to_z, progress));
break;
}
- case TransformOperation::TransformOperationRotate: {
+ case TransformOperation::TRANSFORM_OPERATION_ROTATE: {
SkMScalar axis_x = 0;
SkMScalar axis_y = 0;
SkMScalar axis_z = 1;
@@ -140,7 +140,7 @@ bool TransformOperation::BlendTransformOperations(
}
break;
}
- case TransformOperation::TransformOperationScale: {
+ case TransformOperation::TRANSFORM_OPERATION_SCALE: {
SkMScalar from_x = IsOperationIdentity(from) ? 1 : from->scale.x;
SkMScalar from_y = IsOperationIdentity(from) ? 1 : from->scale.y;
SkMScalar from_z = IsOperationIdentity(from) ? 1 : from->scale.z;
@@ -152,7 +152,7 @@ bool TransformOperation::BlendTransformOperations(
BlendSkMScalars(from_z, to_z, progress));
break;
}
- case TransformOperation::TransformOperationSkew: {
+ case TransformOperation::TRANSFORM_OPERATION_SKEW: {
SkMScalar from_x = IsOperationIdentity(from) ? 0 : from->skew.x;
SkMScalar from_y = IsOperationIdentity(from) ? 0 : from->skew.y;
SkMScalar to_x = IsOperationIdentity(to) ? 0 : to->skew.x;
@@ -161,7 +161,7 @@ bool TransformOperation::BlendTransformOperations(
result->SkewY(BlendSkMScalars(from_y, to_y, progress));
break;
}
- case TransformOperation::TransformOperationPerspective: {
+ case TransformOperation::TRANSFORM_OPERATION_PERSPECTIVE: {
SkMScalar from_perspective_depth =
IsOperationIdentity(from) ? std::numeric_limits<SkMScalar>::max()
: from->perspective_depth;
@@ -180,7 +180,7 @@ bool TransformOperation::BlendTransformOperations(
result->ApplyPerspectiveDepth(1.f / blended_perspective_depth);
break;
}
- case TransformOperation::TransformOperationMatrix: {
+ case TransformOperation::TRANSFORM_OPERATION_MATRIX: {
gfx::Transform to_matrix;
if (!IsOperationIdentity(to))
to_matrix = to->matrix;
@@ -192,7 +192,7 @@ bool TransformOperation::BlendTransformOperations(
return false;
break;
}
- case TransformOperation::TransformOperationIdentity:
+ case TransformOperation::TRANSFORM_OPERATION_IDENTITY:
// Do nothing.
break;
}
@@ -375,20 +375,20 @@ bool TransformOperation::BlendedBoundsForBox(const gfx::BoxF& box,
}
TransformOperation::Type interpolation_type =
- TransformOperation::TransformOperationIdentity;
+ TransformOperation::TRANSFORM_OPERATION_IDENTITY;
if (is_identity_to)
interpolation_type = from->type;
else
interpolation_type = to->type;
switch (interpolation_type) {
- case TransformOperation::TransformOperationIdentity:
+ case TransformOperation::TRANSFORM_OPERATION_IDENTITY:
*bounds = box;
return true;
- case TransformOperation::TransformOperationTranslate:
- case TransformOperation::TransformOperationSkew:
- case TransformOperation::TransformOperationPerspective:
- case TransformOperation::TransformOperationScale: {
+ case TransformOperation::TRANSFORM_OPERATION_TRANSLATE:
+ case TransformOperation::TRANSFORM_OPERATION_SKEW:
+ case TransformOperation::TRANSFORM_OPERATION_PERSPECTIVE:
+ case TransformOperation::TRANSFORM_OPERATION_SCALE: {
gfx::Transform from_transform;
gfx::Transform to_transform;
if (!BlendTransformOperations(from, to, min_progress, &from_transform) ||
@@ -404,7 +404,7 @@ bool TransformOperation::BlendedBoundsForBox(const gfx::BoxF& box,
return true;
}
- case TransformOperation::TransformOperationRotate: {
+ case TransformOperation::TRANSFORM_OPERATION_ROTATE: {
SkMScalar axis_x = 0;
SkMScalar axis_y = 0;
SkMScalar axis_z = 1;
@@ -429,7 +429,7 @@ bool TransformOperation::BlendedBoundsForBox(const gfx::BoxF& box,
}
return true;
}
- case TransformOperation::TransformOperationMatrix:
+ case TransformOperation::TRANSFORM_OPERATION_MATRIX:
return false;
}
NOTREACHED();
diff --git a/cc/animation/transform_operation.h b/cc/animation/transform_operation.h
index 345ff295e..3ea5fc2 100644
--- a/cc/animation/transform_operation.h
+++ b/cc/animation/transform_operation.h
@@ -15,18 +15,16 @@ namespace cc {
struct TransformOperation {
enum Type {
- TransformOperationTranslate,
- TransformOperationRotate,
- TransformOperationScale,
- TransformOperationSkew,
- TransformOperationPerspective,
- TransformOperationMatrix,
- TransformOperationIdentity
+ TRANSFORM_OPERATION_TRANSLATE,
+ TRANSFORM_OPERATION_ROTATE,
+ TRANSFORM_OPERATION_SCALE,
+ TRANSFORM_OPERATION_SKEW,
+ TRANSFORM_OPERATION_PERSPECTIVE,
+ TRANSFORM_OPERATION_MATRIX,
+ TRANSFORM_OPERATION_IDENTITY
};
- TransformOperation()
- : type(TransformOperationIdentity) {
- }
+ TransformOperation() : type(TRANSFORM_OPERATION_IDENTITY) {}
Type type;
gfx::Transform matrix;
diff --git a/cc/animation/transform_operations.cc b/cc/animation/transform_operations.cc
index d9d58f2..20e8c6a 100644
--- a/cc/animation/transform_operations.cc
+++ b/cc/animation/transform_operations.cc
@@ -85,9 +85,9 @@ bool TransformOperations::BlendedBoundsForBox(const gfx::BoxF& box,
bool TransformOperations::AffectsScale() const {
for (size_t i = 0; i < operations_.size(); ++i) {
- if (operations_[i].type == TransformOperation::TransformOperationScale)
+ if (operations_[i].type == TransformOperation::TRANSFORM_OPERATION_SCALE)
return true;
- if (operations_[i].type == TransformOperation::TransformOperationMatrix &&
+ if (operations_[i].type == TransformOperation::TRANSFORM_OPERATION_MATRIX &&
!operations_[i].matrix.IsIdentityOrTranslation())
return true;
}
@@ -97,18 +97,18 @@ bool TransformOperations::AffectsScale() const {
bool TransformOperations::PreservesAxisAlignment() const {
for (size_t i = 0; i < operations_.size(); ++i) {
switch (operations_[i].type) {
- case TransformOperation::TransformOperationIdentity:
- case TransformOperation::TransformOperationTranslate:
- case TransformOperation::TransformOperationScale:
+ case TransformOperation::TRANSFORM_OPERATION_IDENTITY:
+ case TransformOperation::TRANSFORM_OPERATION_TRANSLATE:
+ case TransformOperation::TRANSFORM_OPERATION_SCALE:
continue;
- case TransformOperation::TransformOperationMatrix:
+ case TransformOperation::TRANSFORM_OPERATION_MATRIX:
if (!operations_[i].matrix.IsIdentity() &&
!operations_[i].matrix.IsScaleOrTranslation())
return false;
continue;
- case TransformOperation::TransformOperationRotate:
- case TransformOperation::TransformOperationSkew:
- case TransformOperation::TransformOperationPerspective:
+ case TransformOperation::TRANSFORM_OPERATION_ROTATE:
+ case TransformOperation::TRANSFORM_OPERATION_SKEW:
+ case TransformOperation::TRANSFORM_OPERATION_PERSPECTIVE:
return false;
}
}
@@ -118,17 +118,17 @@ bool TransformOperations::PreservesAxisAlignment() const {
bool TransformOperations::IsTranslation() const {
for (size_t i = 0; i < operations_.size(); ++i) {
switch (operations_[i].type) {
- case TransformOperation::TransformOperationIdentity:
- case TransformOperation::TransformOperationTranslate:
+ case TransformOperation::TRANSFORM_OPERATION_IDENTITY:
+ case TransformOperation::TRANSFORM_OPERATION_TRANSLATE:
continue;
- case TransformOperation::TransformOperationMatrix:
+ case TransformOperation::TRANSFORM_OPERATION_MATRIX:
if (!operations_[i].matrix.IsIdentityOrTranslation())
return false;
continue;
- case TransformOperation::TransformOperationRotate:
- case TransformOperation::TransformOperationScale:
- case TransformOperation::TransformOperationSkew:
- case TransformOperation::TransformOperationPerspective:
+ case TransformOperation::TRANSFORM_OPERATION_ROTATE:
+ case TransformOperation::TRANSFORM_OPERATION_SCALE:
+ case TransformOperation::TRANSFORM_OPERATION_SKEW:
+ case TransformOperation::TRANSFORM_OPERATION_PERSPECTIVE:
return false;
}
}
@@ -140,18 +140,18 @@ bool TransformOperations::ScaleComponent(gfx::Vector3dF* scale) const {
bool has_scale_component = false;
for (size_t i = 0; i < operations_.size(); ++i) {
switch (operations_[i].type) {
- case TransformOperation::TransformOperationIdentity:
- case TransformOperation::TransformOperationTranslate:
+ case TransformOperation::TRANSFORM_OPERATION_IDENTITY:
+ case TransformOperation::TRANSFORM_OPERATION_TRANSLATE:
continue;
- case TransformOperation::TransformOperationMatrix:
+ case TransformOperation::TRANSFORM_OPERATION_MATRIX:
if (!operations_[i].matrix.IsIdentityOrTranslation())
return false;
continue;
- case TransformOperation::TransformOperationRotate:
- case TransformOperation::TransformOperationSkew:
- case TransformOperation::TransformOperationPerspective:
+ case TransformOperation::TRANSFORM_OPERATION_ROTATE:
+ case TransformOperation::TRANSFORM_OPERATION_SKEW:
+ case TransformOperation::TRANSFORM_OPERATION_PERSPECTIVE:
return false;
- case TransformOperation::TransformOperationScale:
+ case TransformOperation::TRANSFORM_OPERATION_SCALE:
if (has_scale_component)
return false;
has_scale_component = true;
@@ -191,7 +191,7 @@ void TransformOperations::AppendTranslate(SkMScalar x,
SkMScalar z) {
TransformOperation to_add;
to_add.matrix.Translate3d(x, y, z);
- to_add.type = TransformOperation::TransformOperationTranslate;
+ to_add.type = TransformOperation::TRANSFORM_OPERATION_TRANSLATE;
to_add.translate.x = x;
to_add.translate.y = y;
to_add.translate.z = z;
@@ -205,7 +205,7 @@ void TransformOperations::AppendRotate(SkMScalar x,
SkMScalar degrees) {
TransformOperation to_add;
to_add.matrix.RotateAbout(gfx::Vector3dF(x, y, z), degrees);
- to_add.type = TransformOperation::TransformOperationRotate;
+ to_add.type = TransformOperation::TRANSFORM_OPERATION_ROTATE;
to_add.rotate.axis.x = x;
to_add.rotate.axis.y = y;
to_add.rotate.axis.z = z;
@@ -217,7 +217,7 @@ void TransformOperations::AppendRotate(SkMScalar x,
void TransformOperations::AppendScale(SkMScalar x, SkMScalar y, SkMScalar z) {
TransformOperation to_add;
to_add.matrix.Scale3d(x, y, z);
- to_add.type = TransformOperation::TransformOperationScale;
+ to_add.type = TransformOperation::TRANSFORM_OPERATION_SCALE;
to_add.scale.x = x;
to_add.scale.y = y;
to_add.scale.z = z;
@@ -229,7 +229,7 @@ void TransformOperations::AppendSkew(SkMScalar x, SkMScalar y) {
TransformOperation to_add;
to_add.matrix.SkewX(x);
to_add.matrix.SkewY(y);
- to_add.type = TransformOperation::TransformOperationSkew;
+ to_add.type = TransformOperation::TRANSFORM_OPERATION_SKEW;
to_add.skew.x = x;
to_add.skew.y = y;
operations_.push_back(to_add);
@@ -239,7 +239,7 @@ void TransformOperations::AppendSkew(SkMScalar x, SkMScalar y) {
void TransformOperations::AppendPerspective(SkMScalar depth) {
TransformOperation to_add;
to_add.matrix.ApplyPerspectiveDepth(depth);
- to_add.type = TransformOperation::TransformOperationPerspective;
+ to_add.type = TransformOperation::TRANSFORM_OPERATION_PERSPECTIVE;
to_add.perspective_depth = depth;
operations_.push_back(to_add);
decomposed_transform_dirty_ = true;
@@ -248,7 +248,7 @@ void TransformOperations::AppendPerspective(SkMScalar depth) {
void TransformOperations::AppendMatrix(const gfx::Transform& matrix) {
TransformOperation to_add;
to_add.matrix = matrix;
- to_add.type = TransformOperation::TransformOperationMatrix;
+ to_add.type = TransformOperation::TRANSFORM_OPERATION_MATRIX;
operations_.push_back(to_add);
decomposed_transform_dirty_ = true;
}
diff --git a/cc/blink/web_animation_impl.cc b/cc/blink/web_animation_impl.cc
index 24fa4ec..705c33a 100644
--- a/cc/blink/web_animation_impl.cc
+++ b/cc/blink/web_animation_impl.cc
@@ -119,13 +119,13 @@ void WebCompositorAnimationImpl::setTimeOffset(double monotonic_time) {
blink::WebCompositorAnimation::Direction WebCompositorAnimationImpl::direction()
const {
switch (animation_->direction()) {
- case cc::Animation::Normal:
+ case cc::Animation::DIRECTION_NORMAL:
return DirectionNormal;
- case cc::Animation::Reverse:
+ case cc::Animation::DIRECTION_REVERSE:
return DirectionReverse;
- case cc::Animation::Alternate:
+ case cc::Animation::DIRECTION_ALTERNATE:
return DirectionAlternate;
- case cc::Animation::AlternateReverse:
+ case cc::Animation::DIRECTION_ALTERNATE_REVERSE:
return DirectionAlternateReverse;
default:
NOTREACHED();
@@ -136,16 +136,16 @@ blink::WebCompositorAnimation::Direction WebCompositorAnimationImpl::direction()
void WebCompositorAnimationImpl::setDirection(Direction direction) {
switch (direction) {
case DirectionNormal:
- animation_->set_direction(cc::Animation::Normal);
+ animation_->set_direction(cc::Animation::DIRECTION_NORMAL);
break;
case DirectionReverse:
- animation_->set_direction(cc::Animation::Reverse);
+ animation_->set_direction(cc::Animation::DIRECTION_REVERSE);
break;
case DirectionAlternate:
- animation_->set_direction(cc::Animation::Alternate);
+ animation_->set_direction(cc::Animation::DIRECTION_ALTERNATE);
break;
case DirectionAlternateReverse:
- animation_->set_direction(cc::Animation::AlternateReverse);
+ animation_->set_direction(cc::Animation::DIRECTION_ALTERNATE_REVERSE);
break;
}
}
@@ -161,13 +161,13 @@ void WebCompositorAnimationImpl::setPlaybackRate(double playback_rate) {
blink::WebCompositorAnimation::FillMode WebCompositorAnimationImpl::fillMode()
const {
switch (animation_->fill_mode()) {
- case cc::Animation::FillModeNone:
+ case cc::Animation::FILL_MODE_NONE:
return FillModeNone;
- case cc::Animation::FillModeForwards:
+ case cc::Animation::FILL_MODE_FORWARDS:
return FillModeForwards;
- case cc::Animation::FillModeBackwards:
+ case cc::Animation::FILL_MODE_BACKWARDS:
return FillModeBackwards;
- case cc::Animation::FillModeBoth:
+ case cc::Animation::FILL_MODE_BOTH:
return FillModeBoth;
default:
NOTREACHED();
@@ -178,16 +178,16 @@ blink::WebCompositorAnimation::FillMode WebCompositorAnimationImpl::fillMode()
void WebCompositorAnimationImpl::setFillMode(FillMode fill_mode) {
switch (fill_mode) {
case FillModeNone:
- animation_->set_fill_mode(cc::Animation::FillModeNone);
+ animation_->set_fill_mode(cc::Animation::FILL_MODE_NONE);
break;
case FillModeForwards:
- animation_->set_fill_mode(cc::Animation::FillModeForwards);
+ animation_->set_fill_mode(cc::Animation::FILL_MODE_FORWARDS);
break;
case FillModeBackwards:
- animation_->set_fill_mode(cc::Animation::FillModeBackwards);
+ animation_->set_fill_mode(cc::Animation::FILL_MODE_BACKWARDS);
break;
case FillModeBoth:
- animation_->set_fill_mode(cc::Animation::FillModeBoth);
+ animation_->set_fill_mode(cc::Animation::FILL_MODE_BOTH);
break;
}
}
diff --git a/cc/blink/web_layer_impl.cc b/cc/blink/web_layer_impl.cc
index 2d5e459..0ef5ae7 100644
--- a/cc/blink/web_layer_impl.cc
+++ b/cc/blink/web_layer_impl.cc
@@ -397,17 +397,17 @@ WebVector<WebRect> WebLayerImpl::touchEventHandlerRegion() const {
}
static_assert(static_cast<ScrollBlocksOn>(blink::WebScrollBlocksOnNone) ==
- ScrollBlocksOnNone,
+ SCROLL_BLOCKS_ON_NONE,
"ScrollBlocksOn and WebScrollBlocksOn enums must match");
static_assert(static_cast<ScrollBlocksOn>(blink::WebScrollBlocksOnStartTouch) ==
- ScrollBlocksOnStartTouch,
+ SCROLL_BLOCKS_ON_START_TOUCH,
"ScrollBlocksOn and WebScrollBlocksOn enums must match");
static_assert(static_cast<ScrollBlocksOn>(blink::WebScrollBlocksOnWheelEvent) ==
- ScrollBlocksOnWheelEvent,
+ SCROLL_BLOCKS_ON_WHEEL_EVENT,
"ScrollBlocksOn and WebScrollBlocksOn enums must match");
static_assert(
static_cast<ScrollBlocksOn>(blink::WebScrollBlocksOnScrollEvent) ==
- ScrollBlocksOnScrollEvent,
+ SCROLL_BLOCKS_ON_SCROLL_EVENT,
"ScrollBlocksOn and WebScrollBlocksOn enums must match");
void WebLayerImpl::setScrollBlocksOn(blink::WebScrollBlocksOn blocks) {
diff --git a/cc/input/input_handler.h b/cc/input/input_handler.h
index d899a85..954f8d7 100644
--- a/cc/input/input_handler.h
+++ b/cc/input/input_handler.h
@@ -66,14 +66,14 @@ class CC_EXPORT InputHandler {
// Note these are used in a histogram. Do not reorder or delete existing
// entries.
enum ScrollStatus {
- ScrollOnMainThread = 0,
- ScrollStarted,
- ScrollIgnored,
- ScrollUnknown,
+ SCROLL_ON_MAIN_THREAD = 0,
+ SCROLL_STARTED,
+ SCROLL_IGNORED,
+ SCROLL_UNKNOWN,
// This must be the last entry.
ScrollStatusCount
};
- enum ScrollInputType { Gesture, Wheel, NonBubblingGesture };
+ enum ScrollInputType { GESTURE, WHEEL, NON_BUBBLING_GESTURE };
// Binds a client to this handler to receive notifications. Only one client
// can be bound to an InputHandler. The client must live at least until the
@@ -81,10 +81,10 @@ class CC_EXPORT InputHandler {
virtual void BindToClient(InputHandlerClient* client) = 0;
// Selects a layer to be scrolled at a given point in viewport (logical
- // pixel) coordinates. Returns ScrollStarted if the layer at the coordinates
- // can be scrolled, ScrollOnMainThread if the scroll event should instead be
- // delegated to the main thread, or ScrollIgnored if there is nothing to be
- // scrolled at the given coordinates.
+ // pixel) coordinates. Returns SCROLL_STARTED if the layer at the coordinates
+ // can be scrolled, SCROLL_ON_MAIN_THREAD if the scroll event should instead
+ // be delegated to the main thread, or SCROLL_IGNORED if there is nothing to
+ // be scrolled at the given coordinates.
virtual ScrollStatus ScrollBegin(const gfx::Point& viewport_point,
ScrollInputType type) = 0;
@@ -102,7 +102,7 @@ class CC_EXPORT InputHandler {
// If the scroll delta hits the root layer, and the layer can no longer move,
// the root overscroll accumulated within this ScrollBegin() scope is reported
// in the return value's |accumulated_overscroll| field.
- // Should only be called if ScrollBegin() returned ScrollStarted.
+ // Should only be called if ScrollBegin() returned SCROLL_STARTED.
virtual InputHandlerScrollResult ScrollBy(
const gfx::Point& viewport_point,
const gfx::Vector2dF& scroll_delta) = 0;
@@ -110,14 +110,14 @@ class CC_EXPORT InputHandler {
virtual bool ScrollVerticallyByPage(const gfx::Point& viewport_point,
ScrollDirection direction) = 0;
- // Returns ScrollStarted if a layer was being actively being scrolled,
- // ScrollIgnored if not.
+ // Returns SCROLL_STARTED if a layer was being actively being scrolled,
+ // SCROLL_IGNORED if not.
virtual ScrollStatus FlingScrollBegin() = 0;
virtual void MouseMoveAt(const gfx::Point& mouse_position) = 0;
// Stop scrolling the selected layer. Should only be called if ScrollBegin()
- // returned ScrollStarted.
+ // returned SCROLL_STARTED.
virtual void ScrollEnd() = 0;
virtual void SetRootLayerScrollOffsetDelegate(
diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc
index e71ea67..19217c9 100644
--- a/cc/layers/heads_up_display_layer_impl.cc
+++ b/cc/layers/heads_up_display_layer_impl.cc
@@ -97,7 +97,7 @@ void HeadsUpDisplayLayerImpl::AcquireResource(
scoped_ptr<ScopedResource> resource =
ScopedResource::Create(resource_provider);
resource->Allocate(internal_content_bounds_,
- ResourceProvider::TextureHintImmutable, RGBA_8888);
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888);
resources_.push_back(resource.Pass());
}
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index f84736f..ca0e3b8 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -71,7 +71,7 @@ Layer::Layer()
force_render_surface_(false),
transform_is_invertible_(true),
has_render_surface_(false),
- scroll_blocks_on_(ScrollBlocksOnNone),
+ scroll_blocks_on_(SCROLL_BLOCKS_ON_NONE),
background_color_(0),
opacity_(1.f),
blend_mode_(SkXfermode::kSrcOver_Mode),
@@ -471,7 +471,7 @@ void Layer::SetFilters(const FilterOperations& filters) {
}
bool Layer::FilterIsAnimating() const {
- return layer_animation_controller_->IsAnimatingProperty(Animation::Filter);
+ return layer_animation_controller_->IsAnimatingProperty(Animation::FILTER);
}
void Layer::SetBackgroundFilters(const FilterOperations& filters) {
@@ -491,7 +491,7 @@ void Layer::SetOpacity(float opacity) {
}
bool Layer::OpacityIsAnimating() const {
- return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity);
+ return layer_animation_controller_->IsAnimatingProperty(Animation::OPACITY);
}
bool Layer::OpacityCanAnimateOnImplThread() const {
@@ -601,7 +601,7 @@ bool Layer::AnimationsPreserveAxisAlignment() const {
}
bool Layer::TransformIsAnimating() const {
- return layer_animation_controller_->IsAnimatingProperty(Animation::Transform);
+ return layer_animation_controller_->IsAnimatingProperty(Animation::TRANSFORM);
}
void Layer::SetScrollParent(Layer* parent) {
@@ -1181,7 +1181,7 @@ bool Layer::AddAnimation(scoped_ptr <Animation> animation) {
if (!layer_animation_controller_->animation_registrar())
return false;
- if (animation->target_property() == Animation::ScrollOffset &&
+ if (animation->target_property() == Animation::SCROLL_OFFSET &&
!layer_animation_controller_->animation_registrar()
->supports_scroll_animations())
return false;
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 3373023..63fd4dc 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -54,7 +54,7 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl,
should_scroll_on_main_thread_(false),
have_wheel_event_handlers_(false),
have_scroll_event_handlers_(false),
- scroll_blocks_on_(ScrollBlocksOnNone),
+ scroll_blocks_on_(SCROLL_BLOCKS_ON_NONE),
user_scrollable_horizontal_(true),
user_scrollable_vertical_(true),
stacking_order_changed_(false),
@@ -425,12 +425,12 @@ InputHandler::ScrollStatus LayerImpl::TryScroll(
ScrollBlocksOn effective_block_mode) const {
if (should_scroll_on_main_thread()) {
TRACE_EVENT0("cc", "LayerImpl::TryScroll: Failed ShouldScrollOnMainThread");
- return InputHandler::ScrollOnMainThread;
+ return InputHandler::SCROLL_ON_MAIN_THREAD;
}
if (!screen_space_transform().IsInvertible()) {
TRACE_EVENT0("cc", "LayerImpl::TryScroll: Ignored NonInvertibleTransform");
- return InputHandler::ScrollIgnored;
+ return InputHandler::SCROLL_IGNORED;
}
if (!non_fast_scrollable_region().IsEmpty()) {
@@ -440,7 +440,7 @@ InputHandler::ScrollStatus LayerImpl::TryScroll(
if (!screen_space_transform().GetInverse(&inverse_screen_space_transform)) {
// TODO(shawnsingh): We shouldn't be applying a projection if screen space
// transform is uninvertible here. Perhaps we should be returning
- // ScrollOnMainThread in this case?
+ // SCROLL_ON_MAIN_THREAD in this case?
}
gfx::PointF hit_test_point_in_content_space =
@@ -456,25 +456,25 @@ InputHandler::ScrollStatus LayerImpl::TryScroll(
gfx::ToRoundedPoint(hit_test_point_in_layer_space))) {
TRACE_EVENT0("cc",
"LayerImpl::tryScroll: Failed NonFastScrollableRegion");
- return InputHandler::ScrollOnMainThread;
+ return InputHandler::SCROLL_ON_MAIN_THREAD;
}
}
if (have_scroll_event_handlers() &&
- effective_block_mode & ScrollBlocksOnScrollEvent) {
+ effective_block_mode & SCROLL_BLOCKS_ON_SCROLL_EVENT) {
TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed ScrollEventHandlers");
- return InputHandler::ScrollOnMainThread;
+ return InputHandler::SCROLL_ON_MAIN_THREAD;
}
- if (type == InputHandler::Wheel && have_wheel_event_handlers() &&
- effective_block_mode & ScrollBlocksOnWheelEvent) {
+ if (type == InputHandler::WHEEL && have_wheel_event_handlers() &&
+ effective_block_mode & SCROLL_BLOCKS_ON_WHEEL_EVENT) {
TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed WheelEventHandlers");
- return InputHandler::ScrollOnMainThread;
+ return InputHandler::SCROLL_ON_MAIN_THREAD;
}
if (!scrollable()) {
TRACE_EVENT0("cc", "LayerImpl::tryScroll: Ignored not scrollable");
- return InputHandler::ScrollIgnored;
+ return InputHandler::SCROLL_IGNORED;
}
gfx::ScrollOffset max_scroll_offset = MaxScrollOffset();
@@ -482,10 +482,10 @@ InputHandler::ScrollStatus LayerImpl::TryScroll(
TRACE_EVENT0("cc",
"LayerImpl::tryScroll: Ignored. Technically scrollable,"
" but has no affordance in either direction.");
- return InputHandler::ScrollIgnored;
+ return InputHandler::SCROLL_IGNORED;
}
- return InputHandler::ScrollStarted;
+ return InputHandler::SCROLL_STARTED;
}
gfx::Rect LayerImpl::LayerRectToContentRect(
@@ -672,7 +672,7 @@ base::DictionaryValue* LayerImpl::LayerTreeAsJson() const {
result->SetBoolean("DrawsContent", draws_content_);
result->SetBoolean("Is3dSorted", Is3dSorted());
- result->SetDouble("Opacity", opacity());
+ result->SetDouble("OPACITY", opacity());
result->SetBoolean("ContentsOpaque", contents_opaque_);
if (scrollable())
@@ -689,11 +689,11 @@ base::DictionaryValue* LayerImpl::LayerTreeAsJson() const {
if (scroll_blocks_on_) {
list = new base::ListValue;
- if (scroll_blocks_on_ & ScrollBlocksOnStartTouch)
+ if (scroll_blocks_on_ & SCROLL_BLOCKS_ON_START_TOUCH)
list->AppendString("StartTouch");
- if (scroll_blocks_on_ & ScrollBlocksOnWheelEvent)
+ if (scroll_blocks_on_ & SCROLL_BLOCKS_ON_WHEEL_EVENT)
list->AppendString("WheelEvent");
- if (scroll_blocks_on_ & ScrollBlocksOnScrollEvent)
+ if (scroll_blocks_on_ & SCROLL_BLOCKS_ON_SCROLL_EVENT)
list->AppendString("ScrollEvent");
result->Set("ScrollBlocksOn", list);
}
@@ -946,12 +946,12 @@ void LayerImpl::SetFilters(const FilterOperations& filters) {
}
bool LayerImpl::FilterIsAnimating() const {
- return layer_animation_controller_->IsAnimatingProperty(Animation::Filter);
+ return layer_animation_controller_->IsAnimatingProperty(Animation::FILTER);
}
bool LayerImpl::FilterIsAnimatingOnImplOnly() const {
Animation* filter_animation =
- layer_animation_controller_->GetAnimation(Animation::Filter);
+ layer_animation_controller_->GetAnimation(Animation::FILTER);
return filter_animation && filter_animation->is_impl_only();
}
@@ -989,12 +989,12 @@ void LayerImpl::SetOpacity(float opacity) {
}
bool LayerImpl::OpacityIsAnimating() const {
- return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity);
+ return layer_animation_controller_->IsAnimatingProperty(Animation::OPACITY);
}
bool LayerImpl::OpacityIsAnimatingOnImplOnly() const {
Animation* opacity_animation =
- layer_animation_controller_->GetAnimation(Animation::Opacity);
+ layer_animation_controller_->GetAnimation(Animation::OPACITY);
return opacity_animation && opacity_animation->is_impl_only();
}
@@ -1066,12 +1066,12 @@ void LayerImpl::SetTransformAndInvertibility(const gfx::Transform& transform,
}
bool LayerImpl::TransformIsAnimating() const {
- return layer_animation_controller_->IsAnimatingProperty(Animation::Transform);
+ return layer_animation_controller_->IsAnimatingProperty(Animation::TRANSFORM);
}
bool LayerImpl::TransformIsAnimatingOnImplOnly() const {
Animation* transform_animation =
- layer_animation_controller_->GetAnimation(Animation::Transform);
+ layer_animation_controller_->GetAnimation(Animation::TRANSFORM);
return transform_animation && transform_animation->is_impl_only();
}
@@ -1332,7 +1332,7 @@ void LayerImpl::SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer,
void LayerImpl::DidBecomeActive() {
if (layer_tree_impl_->settings().scrollbar_animator ==
- LayerTreeSettings::NoAnimator) {
+ LayerTreeSettings::NO_ANIMATOR) {
return;
}
@@ -1573,7 +1573,7 @@ void LayerImpl::NotifyAnimationFinished(
base::TimeTicks monotonic_time,
Animation::TargetProperty target_property,
int group) {
- if (target_property == Animation::ScrollOffset)
+ if (target_property == Animation::SCROLL_OFFSET)
layer_tree_impl_->InputScrollAnimationFinished();
}
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index 97fd205..5de0d9a 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -667,7 +667,7 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
bool have_wheel_event_handlers_ : 1;
bool have_scroll_event_handlers_ : 1;
- static_assert(ScrollBlocksOnMax < (1 << 3), "ScrollBlocksOn too big");
+ static_assert(SCROLL_BLOCKS_ON_MAX < (1 << 3), "ScrollBlocksOn too big");
ScrollBlocksOn scroll_blocks_on_ : 3;
bool user_scrollable_horizontal_ : 1;
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc
index 460726f..8a61510 100644
--- a/cc/layers/layer_unittest.cc
+++ b/cc/layers/layer_unittest.cc
@@ -738,8 +738,9 @@ TEST_F(LayerTest,
1.0,
0,
100);
- impl_layer->layer_animation_controller()->GetAnimation(Animation::Transform)->
- set_is_impl_only(true);
+ impl_layer->layer_animation_controller()
+ ->GetAnimation(Animation::TRANSFORM)
+ ->set_is_impl_only(true);
transform.Rotate(45.0);
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform(transform));
@@ -779,8 +780,9 @@ TEST_F(LayerTest,
0.3f,
0.7f,
false);
- impl_layer->layer_animation_controller()->GetAnimation(Animation::Opacity)->
- set_is_impl_only(true);
+ impl_layer->layer_animation_controller()
+ ->GetAnimation(Animation::OPACITY)
+ ->set_is_impl_only(true);
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.75f));
EXPECT_FALSE(impl_layer->LayerPropertyChanged());
@@ -815,8 +817,9 @@ TEST_F(LayerTest,
impl_layer->ResetAllChangeTrackingForSubtree();
AddAnimatedFilterToController(
impl_layer->layer_animation_controller(), 1.0, 1.f, 2.f);
- impl_layer->layer_animation_controller()->GetAnimation(Animation::Filter)->
- set_is_impl_only(true);
+ impl_layer->layer_animation_controller()
+ ->GetAnimation(Animation::FILTER)
+ ->set_is_impl_only(true);
filters.Append(FilterOperation::CreateSepiaFilter(0.5f));
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters));
@@ -1148,7 +1151,7 @@ static bool AddTestAnimation(Layer* layer) {
curve->AddKeyframe(
FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.7f, nullptr));
scoped_ptr<Animation> animation =
- Animation::Create(curve.Pass(), 0, 0, Animation::Opacity);
+ Animation::Create(curve.Pass(), 0, 0, Animation::OPACITY);
return layer->AddAnimation(animation.Pass());
}
diff --git a/cc/layers/picture_image_layer_impl_unittest.cc b/cc/layers/picture_image_layer_impl_unittest.cc
index d40f555..3d2d38e 100644
--- a/cc/layers/picture_image_layer_impl_unittest.cc
+++ b/cc/layers/picture_image_layer_impl_unittest.cc
@@ -52,9 +52,6 @@ class PictureImageLayerImplTest : public testing::Test {
case PENDING_TREE:
tree = host_impl_.pending_tree();
break;
- case NUM_TREES:
- NOTREACHED();
- break;
}
TestablePictureImageLayerImpl* layer =
new TestablePictureImageLayerImpl(tree, id);
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index d669560..26f3be5 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -3914,7 +3914,7 @@ class OcclusionTrackingPictureLayerImplTest : public PictureLayerImplTest {
WhichTree tree,
size_t expected_occluded_tile_count) {
WhichTree twin_tree = tree == ACTIVE_TREE ? PENDING_TREE : ACTIVE_TREE;
- for (int priority_count = 0; priority_count < NUM_TREE_PRIORITIES;
+ for (int priority_count = 0; priority_count <= LAST_TREE_PRIORITY;
++priority_count) {
TreePriority tree_priority = static_cast<TreePriority>(priority_count);
size_t occluded_tile_count = 0u;
@@ -4015,9 +4015,6 @@ class OcclusionTrackingPictureLayerImplTest : public PictureLayerImplTest {
// eviction queue.
EXPECT_EQ(ACTIVE_TREE, tree);
break;
- case NUM_TREE_PRIORITIES:
- NOTREACHED();
- break;
}
}
queue->Pop();
diff --git a/cc/layers/scroll_blocks_on.h b/cc/layers/scroll_blocks_on.h
index 2447298..f41e7fd 100644
--- a/cc/layers/scroll_blocks_on.h
+++ b/cc/layers/scroll_blocks_on.h
@@ -6,12 +6,13 @@
#define CC_LAYERS_SCROLL_BLOCKS_ON_H_
enum ScrollBlocksOn {
- ScrollBlocksOnNone = 0x0,
- ScrollBlocksOnStartTouch = 0x1,
- ScrollBlocksOnWheelEvent = 0x2,
- ScrollBlocksOnScrollEvent = 0x4,
- ScrollBlocksOnMax = ScrollBlocksOnStartTouch | ScrollBlocksOnWheelEvent |
- ScrollBlocksOnScrollEvent
+ SCROLL_BLOCKS_ON_NONE = 0x0,
+ SCROLL_BLOCKS_ON_START_TOUCH = 0x1,
+ SCROLL_BLOCKS_ON_WHEEL_EVENT = 0x2,
+ SCROLL_BLOCKS_ON_SCROLL_EVENT = 0x4,
+ SCROLL_BLOCKS_ON_MAX = SCROLL_BLOCKS_ON_START_TOUCH |
+ SCROLL_BLOCKS_ON_WHEEL_EVENT |
+ SCROLL_BLOCKS_ON_SCROLL_EVENT
};
inline ScrollBlocksOn operator|(ScrollBlocksOn a, ScrollBlocksOn b) {
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc
index c70b93a..36c37e9 100644
--- a/cc/layers/scrollbar_layer_unittest.cc
+++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -173,9 +173,10 @@ TEST_F(ScrollbarLayerTest, ShouldScrollNonOverlayOnMainThread) {
// When the scrollbar is not an overlay scrollbar, the scroll should be
// responded to on the main thread as the compositor does not yet implement
// scrollbar scrolling.
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- scrollbar_layer_impl->TryScroll(
- gfx::Point(0, 0), InputHandler::Gesture, ScrollBlocksOnNone));
+ EXPECT_EQ(
+ InputHandler::SCROLL_ON_MAIN_THREAD,
+ scrollbar_layer_impl->TryScroll(gfx::Point(0, 0), InputHandler::GESTURE,
+ SCROLL_BLOCKS_ON_NONE));
// Create and attach an overlay scrollbar.
scrollbar.reset(new FakeScrollbar(false, false, true));
@@ -187,9 +188,10 @@ TEST_F(ScrollbarLayerTest, ShouldScrollNonOverlayOnMainThread) {
// The user shouldn't be able to drag an overlay scrollbar and the scroll
// may be handled in the compositor.
- EXPECT_EQ(InputHandler::ScrollIgnored,
- scrollbar_layer_impl->TryScroll(
- gfx::Point(0, 0), InputHandler::Gesture, ScrollBlocksOnNone));
+ EXPECT_EQ(
+ InputHandler::SCROLL_IGNORED,
+ scrollbar_layer_impl->TryScroll(gfx::Point(0, 0), InputHandler::GESTURE,
+ SCROLL_BLOCKS_ON_NONE));
}
TEST_F(ScrollbarLayerTest, ScrollOffsetSynchronization) {
diff --git a/cc/layers/texture_layer_impl.cc b/cc/layers/texture_layer_impl.cc
index d9ddee7..4f4b12e 100644
--- a/cc/layers/texture_layer_impl.cc
+++ b/cc/layers/texture_layer_impl.cc
@@ -105,7 +105,7 @@ bool TextureLayerImpl::WillDraw(DrawMode draw_mode,
if (!texture_copy_->id()) {
texture_copy_->Allocate(texture_mailbox_.shared_memory_size(),
- ResourceProvider::TextureHintImmutable,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE,
resource_provider->best_texture_format());
}
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc
index 9fbd4a5..5867fce 100644
--- a/cc/output/direct_renderer.cc
+++ b/cc/output/direct_renderer.cc
@@ -409,7 +409,7 @@ bool DirectRenderer::UseRenderPass(DrawingFrame* frame,
enlarge_pass_texture_amount_.y());
if (!texture->id())
texture->Allocate(
- size, ResourceProvider::TextureHintImmutableFramebuffer, RGBA_8888);
+ size, ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, RGBA_8888);
DCHECK(texture->id());
return BindFramebufferToTexture(frame, texture, render_pass->output_rect);
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 4c45727..6142d96 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -85,54 +85,54 @@ Float4 PremultipliedColor(SkColor color) {
SamplerType SamplerTypeFromTextureTarget(GLenum target) {
switch (target) {
case GL_TEXTURE_2D:
- return SamplerType2D;
+ return SAMPLER_TYPE_2D;
case GL_TEXTURE_RECTANGLE_ARB:
- return SamplerType2DRect;
+ return SAMPLER_TYPE_2D_RECT;
case GL_TEXTURE_EXTERNAL_OES:
- return SamplerTypeExternalOES;
+ return SAMPLER_TYPE_EXTERNAL_OES;
default:
NOTREACHED();
- return SamplerType2D;
+ return SAMPLER_TYPE_2D;
}
}
BlendMode BlendModeFromSkXfermode(SkXfermode::Mode mode) {
switch (mode) {
case SkXfermode::kSrcOver_Mode:
- return BlendModeNormal;
+ return BLEND_MODE_NORMAL;
case SkXfermode::kScreen_Mode:
- return BlendModeScreen;
+ return BLEND_MODE_SCREEN;
case SkXfermode::kOverlay_Mode:
- return BlendModeOverlay;
+ return BLEND_MODE_OVERLAY;
case SkXfermode::kDarken_Mode:
- return BlendModeDarken;
+ return BLEND_MODE_DARKEN;
case SkXfermode::kLighten_Mode:
- return BlendModeLighten;
+ return BLEND_MODE_LIGHTEN;
case SkXfermode::kColorDodge_Mode:
- return BlendModeColorDodge;
+ return BLEND_MODE_COLOR_DODGE;
case SkXfermode::kColorBurn_Mode:
- return BlendModeColorBurn;
+ return BLEND_MODE_COLOR_BURN;
case SkXfermode::kHardLight_Mode:
- return BlendModeHardLight;
+ return BLEND_MODE_HARD_LIGHT;
case SkXfermode::kSoftLight_Mode:
- return BlendModeSoftLight;
+ return BLEND_MODE_SOFT_LIGHT;
case SkXfermode::kDifference_Mode:
- return BlendModeDifference;
+ return BLEND_MODE_DIFFERENCE;
case SkXfermode::kExclusion_Mode:
- return BlendModeExclusion;
+ return BLEND_MODE_EXCLUSION;
case SkXfermode::kMultiply_Mode:
- return BlendModeMultiply;
+ return BLEND_MODE_MULTIPLY;
case SkXfermode::kHue_Mode:
- return BlendModeHue;
+ return BLEND_MODE_HUE;
case SkXfermode::kSaturation_Mode:
- return BlendModeSaturation;
+ return BLEND_MODE_SATURATION;
case SkXfermode::kColor_Mode:
- return BlendModeColor;
+ return BLEND_MODE_COLOR;
case SkXfermode::kLuminosity_Mode:
- return BlendModeLuminosity;
+ return BLEND_MODE_LUMINOSITY;
default:
NOTREACHED();
- return BlendModeNone;
+ return BLEND_MODE_NONE;
}
}
@@ -847,7 +847,7 @@ scoped_ptr<ScopedResource> GLRenderer::GetBackdropTexture(
ScopedResource::Create(resource_provider_);
// CopyTexImage2D fails when called on a texture having immutable storage.
device_background_texture->Allocate(
- bounding_rect.size(), ResourceProvider::TextureHintDefault, RGBA_8888);
+ bounding_rect.size(), ResourceProvider::TEXTURE_HINT_DEFAULT, RGBA_8888);
{
ResourceProvider::ScopedWriteLockGL lock(resource_provider_,
device_background_texture->id());
@@ -982,7 +982,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
scoped_ptr<ResourceProvider::ScopedSamplerGL> mask_resource_lock;
unsigned mask_texture_id = 0;
- SamplerType mask_sampler = SamplerTypeNA;
+ SamplerType mask_sampler = SAMPLER_TYPE_NA;
if (quad->mask_resource_id) {
mask_resource_lock.reset(new ResourceProvider::ScopedSamplerGL(
resource_provider_, quad->mask_resource_id, GL_TEXTURE1, GL_LINEAR));
@@ -1033,7 +1033,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
DCHECK_EQ(background_texture || background_image, use_shaders_for_blending);
BlendMode shader_blend_mode = use_shaders_for_blending
? BlendModeFromSkXfermode(blend_mode)
- : BlendModeNone;
+ : BLEND_MODE_NONE;
if (use_aa && mask_texture_id && !use_color_matrix) {
const RenderPassMaskProgramAA* program = GetRenderPassMaskProgramAA(
@@ -1220,7 +1220,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
GLC(gl_, gl_->Uniform1i(shader_mask_sampler_location, 1));
gfx::RectF mask_uv_rect = quad->MaskUVRect();
- if (mask_sampler != SamplerType2D) {
+ if (mask_sampler != SAMPLER_TYPE_2D) {
mask_uv_rect.Scale(quad->mask_texture_size.width(),
quad->mask_texture_size.height());
}
@@ -1639,7 +1639,7 @@ void GLRenderer::DrawContentQuadAA(const DrawingFrame* frame,
float fragment_tex_scale_y = clamp_tex_rect.height();
// Map to normalized texture coordinates.
- if (sampler != SamplerType2DRect) {
+ if (sampler != SAMPLER_TYPE_2D_RECT) {
gfx::Size texture_size = quad->texture_size;
DCHECK(!texture_size.IsEmpty());
fragment_tex_translate_x /= texture_size.width();
@@ -1729,7 +1729,7 @@ void GLRenderer::DrawContentQuadNoAA(const DrawingFrame* frame,
float vertex_tex_scale_y = tex_coord_rect.height();
// Map to normalized texture coordinates.
- if (sampler != SamplerType2DRect) {
+ if (sampler != SAMPLER_TYPE_2D_RECT) {
gfx::Size texture_size = quad->texture_size;
DCHECK(!texture_size.IsEmpty());
vertex_tex_translate_x /= texture_size.width();
@@ -2736,8 +2736,8 @@ GLRenderer::GetTileCheckerboardProgram() {
if (!tile_checkerboard_program_.initialized()) {
TRACE_EVENT0("cc", "GLRenderer::checkerboardProgram::initalize");
tile_checkerboard_program_.Initialize(output_surface_->context_provider(),
- TexCoordPrecisionNA,
- SamplerTypeNA);
+ TEX_COORD_PRECISION_NA,
+ SAMPLER_TYPE_NA);
}
return &tile_checkerboard_program_;
}
@@ -2746,8 +2746,7 @@ const GLRenderer::DebugBorderProgram* GLRenderer::GetDebugBorderProgram() {
if (!debug_border_program_.initialized()) {
TRACE_EVENT0("cc", "GLRenderer::debugBorderProgram::initialize");
debug_border_program_.Initialize(output_surface_->context_provider(),
- TexCoordPrecisionNA,
- SamplerTypeNA);
+ TEX_COORD_PRECISION_NA, SAMPLER_TYPE_NA);
}
return &debug_border_program_;
}
@@ -2756,8 +2755,7 @@ const GLRenderer::SolidColorProgram* GLRenderer::GetSolidColorProgram() {
if (!solid_color_program_.initialized()) {
TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize");
solid_color_program_.Initialize(output_surface_->context_provider(),
- TexCoordPrecisionNA,
- SamplerTypeNA);
+ TEX_COORD_PRECISION_NA, SAMPLER_TYPE_NA);
}
return &solid_color_program_;
}
@@ -2766,8 +2764,7 @@ const GLRenderer::SolidColorProgramAA* GLRenderer::GetSolidColorProgramAA() {
if (!solid_color_program_aa_.initialized()) {
TRACE_EVENT0("cc", "GLRenderer::solidColorProgramAA::initialize");
solid_color_program_aa_.Initialize(output_surface_->context_provider(),
- TexCoordPrecisionNA,
- SamplerTypeNA);
+ TEX_COORD_PRECISION_NA, SAMPLER_TYPE_NA);
}
return &solid_color_program_aa_;
}
@@ -2776,16 +2773,14 @@ const GLRenderer::RenderPassProgram* GLRenderer::GetRenderPassProgram(
TexCoordPrecision precision,
BlendMode blend_mode) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
DCHECK_GE(blend_mode, 0);
- DCHECK_LT(blend_mode, NumBlendModes);
+ DCHECK_LE(blend_mode, LAST_BLEND_MODE);
RenderPassProgram* program = &render_pass_program_[precision][blend_mode];
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize");
- program->Initialize(output_surface_->context_provider(),
- precision,
- SamplerType2D,
- blend_mode);
+ program->Initialize(output_surface_->context_provider(), precision,
+ SAMPLER_TYPE_2D, blend_mode);
}
return program;
}
@@ -2794,17 +2789,15 @@ const GLRenderer::RenderPassProgramAA* GLRenderer::GetRenderPassProgramAA(
TexCoordPrecision precision,
BlendMode blend_mode) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
DCHECK_GE(blend_mode, 0);
- DCHECK_LT(blend_mode, NumBlendModes);
+ DCHECK_LE(blend_mode, LAST_BLEND_MODE);
RenderPassProgramAA* program =
&render_pass_program_aa_[precision][blend_mode];
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::renderPassProgramAA::initialize");
- program->Initialize(output_surface_->context_provider(),
- precision,
- SamplerType2D,
- blend_mode);
+ program->Initialize(output_surface_->context_provider(), precision,
+ SAMPLER_TYPE_2D, blend_mode);
}
return program;
}
@@ -2814,11 +2807,11 @@ const GLRenderer::RenderPassMaskProgram* GLRenderer::GetRenderPassMaskProgram(
SamplerType sampler,
BlendMode blend_mode) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
DCHECK_GE(sampler, 0);
- DCHECK_LT(sampler, NumSamplerTypes);
+ DCHECK_LE(sampler, LAST_SAMPLER_TYPE);
DCHECK_GE(blend_mode, 0);
- DCHECK_LT(blend_mode, NumBlendModes);
+ DCHECK_LE(blend_mode, LAST_BLEND_MODE);
RenderPassMaskProgram* program =
&render_pass_mask_program_[precision][sampler][blend_mode];
if (!program->initialized()) {
@@ -2834,11 +2827,11 @@ GLRenderer::GetRenderPassMaskProgramAA(TexCoordPrecision precision,
SamplerType sampler,
BlendMode blend_mode) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
DCHECK_GE(sampler, 0);
- DCHECK_LT(sampler, NumSamplerTypes);
+ DCHECK_LE(sampler, LAST_SAMPLER_TYPE);
DCHECK_GE(blend_mode, 0);
- DCHECK_LT(blend_mode, NumBlendModes);
+ DCHECK_LE(blend_mode, LAST_BLEND_MODE);
RenderPassMaskProgramAA* program =
&render_pass_mask_program_aa_[precision][sampler][blend_mode];
if (!program->initialized()) {
@@ -2853,17 +2846,15 @@ const GLRenderer::RenderPassColorMatrixProgram*
GLRenderer::GetRenderPassColorMatrixProgram(TexCoordPrecision precision,
BlendMode blend_mode) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
DCHECK_GE(blend_mode, 0);
- DCHECK_LT(blend_mode, NumBlendModes);
+ DCHECK_LE(blend_mode, LAST_BLEND_MODE);
RenderPassColorMatrixProgram* program =
&render_pass_color_matrix_program_[precision][blend_mode];
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::renderPassColorMatrixProgram::initialize");
- program->Initialize(output_surface_->context_provider(),
- precision,
- SamplerType2D,
- blend_mode);
+ program->Initialize(output_surface_->context_provider(), precision,
+ SAMPLER_TYPE_2D, blend_mode);
}
return program;
}
@@ -2872,18 +2863,16 @@ const GLRenderer::RenderPassColorMatrixProgramAA*
GLRenderer::GetRenderPassColorMatrixProgramAA(TexCoordPrecision precision,
BlendMode blend_mode) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
DCHECK_GE(blend_mode, 0);
- DCHECK_LT(blend_mode, NumBlendModes);
+ DCHECK_LE(blend_mode, LAST_BLEND_MODE);
RenderPassColorMatrixProgramAA* program =
&render_pass_color_matrix_program_aa_[precision][blend_mode];
if (!program->initialized()) {
TRACE_EVENT0("cc",
"GLRenderer::renderPassColorMatrixProgramAA::initialize");
- program->Initialize(output_surface_->context_provider(),
- precision,
- SamplerType2D,
- blend_mode);
+ program->Initialize(output_surface_->context_provider(), precision,
+ SAMPLER_TYPE_2D, blend_mode);
}
return program;
}
@@ -2893,11 +2882,11 @@ GLRenderer::GetRenderPassMaskColorMatrixProgram(TexCoordPrecision precision,
SamplerType sampler,
BlendMode blend_mode) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
DCHECK_GE(sampler, 0);
- DCHECK_LT(sampler, NumSamplerTypes);
+ DCHECK_LE(sampler, LAST_SAMPLER_TYPE);
DCHECK_GE(blend_mode, 0);
- DCHECK_LT(blend_mode, NumBlendModes);
+ DCHECK_LE(blend_mode, LAST_BLEND_MODE);
RenderPassMaskColorMatrixProgram* program =
&render_pass_mask_color_matrix_program_[precision][sampler][blend_mode];
if (!program->initialized()) {
@@ -2914,11 +2903,11 @@ GLRenderer::GetRenderPassMaskColorMatrixProgramAA(TexCoordPrecision precision,
SamplerType sampler,
BlendMode blend_mode) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
DCHECK_GE(sampler, 0);
- DCHECK_LT(sampler, NumSamplerTypes);
+ DCHECK_LE(sampler, LAST_SAMPLER_TYPE);
DCHECK_GE(blend_mode, 0);
- DCHECK_LT(blend_mode, NumBlendModes);
+ DCHECK_LE(blend_mode, LAST_BLEND_MODE);
RenderPassMaskColorMatrixProgramAA* program =
&render_pass_mask_color_matrix_program_aa_[precision][sampler]
[blend_mode];
@@ -2935,9 +2924,9 @@ const GLRenderer::TileProgram* GLRenderer::GetTileProgram(
TexCoordPrecision precision,
SamplerType sampler) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
DCHECK_GE(sampler, 0);
- DCHECK_LT(sampler, NumSamplerTypes);
+ DCHECK_LE(sampler, LAST_SAMPLER_TYPE);
TileProgram* program = &tile_program_[precision][sampler];
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::tileProgram::initialize");
@@ -2951,9 +2940,9 @@ const GLRenderer::TileProgramOpaque* GLRenderer::GetTileProgramOpaque(
TexCoordPrecision precision,
SamplerType sampler) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
DCHECK_GE(sampler, 0);
- DCHECK_LT(sampler, NumSamplerTypes);
+ DCHECK_LE(sampler, LAST_SAMPLER_TYPE);
TileProgramOpaque* program = &tile_program_opaque_[precision][sampler];
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::tileProgramOpaque::initialize");
@@ -2967,9 +2956,9 @@ const GLRenderer::TileProgramAA* GLRenderer::GetTileProgramAA(
TexCoordPrecision precision,
SamplerType sampler) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
DCHECK_GE(sampler, 0);
- DCHECK_LT(sampler, NumSamplerTypes);
+ DCHECK_LE(sampler, LAST_SAMPLER_TYPE);
TileProgramAA* program = &tile_program_aa_[precision][sampler];
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::tileProgramAA::initialize");
@@ -2983,9 +2972,9 @@ const GLRenderer::TileProgramSwizzle* GLRenderer::GetTileProgramSwizzle(
TexCoordPrecision precision,
SamplerType sampler) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
DCHECK_GE(sampler, 0);
- DCHECK_LT(sampler, NumSamplerTypes);
+ DCHECK_LE(sampler, LAST_SAMPLER_TYPE);
TileProgramSwizzle* program = &tile_program_swizzle_[precision][sampler];
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzle::initialize");
@@ -2999,9 +2988,9 @@ const GLRenderer::TileProgramSwizzleOpaque*
GLRenderer::GetTileProgramSwizzleOpaque(TexCoordPrecision precision,
SamplerType sampler) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
DCHECK_GE(sampler, 0);
- DCHECK_LT(sampler, NumSamplerTypes);
+ DCHECK_LE(sampler, LAST_SAMPLER_TYPE);
TileProgramSwizzleOpaque* program =
&tile_program_swizzle_opaque_[precision][sampler];
if (!program->initialized()) {
@@ -3016,9 +3005,9 @@ const GLRenderer::TileProgramSwizzleAA* GLRenderer::GetTileProgramSwizzleAA(
TexCoordPrecision precision,
SamplerType sampler) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
DCHECK_GE(sampler, 0);
- DCHECK_LT(sampler, NumSamplerTypes);
+ DCHECK_LE(sampler, LAST_SAMPLER_TYPE);
TileProgramSwizzleAA* program = &tile_program_swizzle_aa_[precision][sampler];
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleAA::initialize");
@@ -3031,12 +3020,12 @@ const GLRenderer::TileProgramSwizzleAA* GLRenderer::GetTileProgramSwizzleAA(
const GLRenderer::TextureProgram* GLRenderer::GetTextureProgram(
TexCoordPrecision precision) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
TextureProgram* program = &texture_program_[precision];
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize");
- program->Initialize(
- output_surface_->context_provider(), precision, SamplerType2D);
+ program->Initialize(output_surface_->context_provider(), precision,
+ SAMPLER_TYPE_2D);
}
return program;
}
@@ -3044,14 +3033,14 @@ const GLRenderer::TextureProgram* GLRenderer::GetTextureProgram(
const GLRenderer::NonPremultipliedTextureProgram*
GLRenderer::GetNonPremultipliedTextureProgram(TexCoordPrecision precision) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
NonPremultipliedTextureProgram* program =
&nonpremultiplied_texture_program_[precision];
if (!program->initialized()) {
TRACE_EVENT0("cc",
"GLRenderer::NonPremultipliedTextureProgram::Initialize");
- program->Initialize(
- output_surface_->context_provider(), precision, SamplerType2D);
+ program->Initialize(output_surface_->context_provider(), precision,
+ SAMPLER_TYPE_2D);
}
return program;
}
@@ -3059,12 +3048,12 @@ GLRenderer::GetNonPremultipliedTextureProgram(TexCoordPrecision precision) {
const GLRenderer::TextureBackgroundProgram*
GLRenderer::GetTextureBackgroundProgram(TexCoordPrecision precision) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
TextureBackgroundProgram* program = &texture_background_program_[precision];
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize");
- program->Initialize(
- output_surface_->context_provider(), precision, SamplerType2D);
+ program->Initialize(output_surface_->context_provider(), precision,
+ SAMPLER_TYPE_2D);
}
return program;
}
@@ -3073,14 +3062,14 @@ const GLRenderer::NonPremultipliedTextureBackgroundProgram*
GLRenderer::GetNonPremultipliedTextureBackgroundProgram(
TexCoordPrecision precision) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
NonPremultipliedTextureBackgroundProgram* program =
&nonpremultiplied_texture_background_program_[precision];
if (!program->initialized()) {
TRACE_EVENT0("cc",
"GLRenderer::NonPremultipliedTextureProgram::Initialize");
- program->Initialize(
- output_surface_->context_provider(), precision, SamplerType2D);
+ program->Initialize(output_surface_->context_provider(), precision,
+ SAMPLER_TYPE_2D);
}
return program;
}
@@ -3088,12 +3077,12 @@ GLRenderer::GetNonPremultipliedTextureBackgroundProgram(
const GLRenderer::TextureProgram* GLRenderer::GetTextureIOSurfaceProgram(
TexCoordPrecision precision) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
TextureProgram* program = &texture_io_surface_program_[precision];
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::textureIOSurfaceProgram::initialize");
- program->Initialize(
- output_surface_->context_provider(), precision, SamplerType2DRect);
+ program->Initialize(output_surface_->context_provider(), precision,
+ SAMPLER_TYPE_2D_RECT);
}
return program;
}
@@ -3101,12 +3090,12 @@ const GLRenderer::TextureProgram* GLRenderer::GetTextureIOSurfaceProgram(
const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram(
TexCoordPrecision precision) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
VideoYUVProgram* program = &video_yuv_program_[precision];
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::videoYUVProgram::initialize");
- program->Initialize(
- output_surface_->context_provider(), precision, SamplerType2D);
+ program->Initialize(output_surface_->context_provider(), precision,
+ SAMPLER_TYPE_2D);
}
return program;
}
@@ -3114,12 +3103,12 @@ const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram(
const GLRenderer::VideoYUVAProgram* GLRenderer::GetVideoYUVAProgram(
TexCoordPrecision precision) {
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
VideoYUVAProgram* program = &video_yuva_program_[precision];
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::videoYUVAProgram::initialize");
- program->Initialize(
- output_surface_->context_provider(), precision, SamplerType2D);
+ program->Initialize(output_surface_->context_provider(), precision,
+ SAMPLER_TYPE_2D);
}
return program;
}
@@ -3129,13 +3118,13 @@ GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) {
if (!Capabilities().using_egl_image)
return NULL;
DCHECK_GE(precision, 0);
- DCHECK_LT(precision, NumTexCoordPrecisions);
+ DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
VideoStreamTextureProgram* program =
&video_stream_texture_program_[precision];
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::streamTextureProgram::initialize");
- program->Initialize(
- output_surface_->context_provider(), precision, SamplerTypeExternalOES);
+ program->Initialize(output_surface_->context_provider(), precision,
+ SAMPLER_TYPE_EXTERNAL_OES);
}
return program;
}
@@ -3143,8 +3132,8 @@ GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) {
void GLRenderer::CleanupSharedObjects() {
shared_geometry_ = nullptr;
- for (int i = 0; i < NumTexCoordPrecisions; ++i) {
- for (int j = 0; j < NumSamplerTypes; ++j) {
+ for (int i = 0; i <= LAST_TEX_COORD_PRECISION; ++i) {
+ for (int j = 0; j <= LAST_SAMPLER_TYPE; ++j) {
tile_program_[i][j].Cleanup(gl_);
tile_program_opaque_[i][j].Cleanup(gl_);
tile_program_swizzle_[i][j].Cleanup(gl_);
@@ -3152,14 +3141,14 @@ void GLRenderer::CleanupSharedObjects() {
tile_program_aa_[i][j].Cleanup(gl_);
tile_program_swizzle_aa_[i][j].Cleanup(gl_);
- for (int k = 0; k < NumBlendModes; k++) {
+ for (int k = 0; k <= LAST_BLEND_MODE; k++) {
render_pass_mask_program_[i][j][k].Cleanup(gl_);
render_pass_mask_program_aa_[i][j][k].Cleanup(gl_);
render_pass_mask_color_matrix_program_aa_[i][j][k].Cleanup(gl_);
render_pass_mask_color_matrix_program_[i][j][k].Cleanup(gl_);
}
}
- for (int j = 0; j < NumBlendModes; j++) {
+ for (int j = 0; j <= LAST_BLEND_MODE; j++) {
render_pass_program_[i][j].Cleanup(gl_);
render_pass_program_aa_[i][j].Cleanup(gl_);
render_pass_color_matrix_program_[i][j].Cleanup(gl_);
diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h
index 22e7706..25c7096 100644
--- a/cc/output/gl_renderer.h
+++ b/cc/output/gl_renderer.h
@@ -376,47 +376,62 @@ class CC_EXPORT GLRenderer : public DirectRenderer {
const SolidColorProgram* GetSolidColorProgram();
const SolidColorProgramAA* GetSolidColorProgramAA();
- TileProgram tile_program_[NumTexCoordPrecisions][NumSamplerTypes];
+ TileProgram
+ tile_program_[LAST_TEX_COORD_PRECISION + 1][LAST_SAMPLER_TYPE + 1];
TileProgramOpaque
- tile_program_opaque_[NumTexCoordPrecisions][NumSamplerTypes];
- TileProgramAA tile_program_aa_[NumTexCoordPrecisions][NumSamplerTypes];
- TileProgramSwizzle
- tile_program_swizzle_[NumTexCoordPrecisions][NumSamplerTypes];
+ tile_program_opaque_[LAST_TEX_COORD_PRECISION + 1][LAST_SAMPLER_TYPE + 1];
+ TileProgramAA
+ tile_program_aa_[LAST_TEX_COORD_PRECISION + 1][LAST_SAMPLER_TYPE + 1];
+ TileProgramSwizzle tile_program_swizzle_[LAST_TEX_COORD_PRECISION +
+ 1][LAST_SAMPLER_TYPE + 1];
TileProgramSwizzleOpaque
- tile_program_swizzle_opaque_[NumTexCoordPrecisions][NumSamplerTypes];
- TileProgramSwizzleAA
- tile_program_swizzle_aa_[NumTexCoordPrecisions][NumSamplerTypes];
+ tile_program_swizzle_opaque_[LAST_TEX_COORD_PRECISION +
+ 1][LAST_SAMPLER_TYPE + 1];
+ TileProgramSwizzleAA tile_program_swizzle_aa_[LAST_TEX_COORD_PRECISION +
+ 1][LAST_SAMPLER_TYPE + 1];
TileCheckerboardProgram tile_checkerboard_program_;
- TextureProgram texture_program_[NumTexCoordPrecisions];
+ TextureProgram texture_program_[LAST_TEX_COORD_PRECISION + 1];
NonPremultipliedTextureProgram
- nonpremultiplied_texture_program_[NumTexCoordPrecisions];
- TextureBackgroundProgram texture_background_program_[NumTexCoordPrecisions];
+ nonpremultiplied_texture_program_[LAST_TEX_COORD_PRECISION + 1];
+ TextureBackgroundProgram
+ texture_background_program_[LAST_TEX_COORD_PRECISION + 1];
NonPremultipliedTextureBackgroundProgram
- nonpremultiplied_texture_background_program_[NumTexCoordPrecisions];
- TextureProgram texture_io_surface_program_[NumTexCoordPrecisions];
-
- RenderPassProgram render_pass_program_[NumTexCoordPrecisions][NumBlendModes];
- RenderPassProgramAA
- render_pass_program_aa_[NumTexCoordPrecisions][NumBlendModes];
- RenderPassMaskProgram render_pass_mask_program_
- [NumTexCoordPrecisions][NumSamplerTypes][NumBlendModes];
- RenderPassMaskProgramAA render_pass_mask_program_aa_
- [NumTexCoordPrecisions][NumSamplerTypes][NumBlendModes];
+ nonpremultiplied_texture_background_program_[LAST_TEX_COORD_PRECISION +
+ 1];
+ TextureProgram texture_io_surface_program_[LAST_TEX_COORD_PRECISION + 1];
+
+ RenderPassProgram
+ render_pass_program_[LAST_TEX_COORD_PRECISION + 1][LAST_BLEND_MODE + 1];
+ RenderPassProgramAA render_pass_program_aa_[LAST_TEX_COORD_PRECISION +
+ 1][LAST_BLEND_MODE + 1];
+ RenderPassMaskProgram
+ render_pass_mask_program_[LAST_TEX_COORD_PRECISION +
+ 1][LAST_SAMPLER_TYPE + 1][LAST_BLEND_MODE + 1];
+ RenderPassMaskProgramAA
+ render_pass_mask_program_aa_[LAST_TEX_COORD_PRECISION +
+ 1][LAST_SAMPLER_TYPE + 1][LAST_BLEND_MODE +
+ 1];
RenderPassColorMatrixProgram
- render_pass_color_matrix_program_[NumTexCoordPrecisions][NumBlendModes];
- RenderPassColorMatrixProgramAA render_pass_color_matrix_program_aa_
- [NumTexCoordPrecisions][NumBlendModes];
- RenderPassMaskColorMatrixProgram render_pass_mask_color_matrix_program_
- [NumTexCoordPrecisions][NumSamplerTypes][NumBlendModes];
- RenderPassMaskColorMatrixProgramAA render_pass_mask_color_matrix_program_aa_
- [NumTexCoordPrecisions][NumSamplerTypes][NumBlendModes];
-
- VideoYUVProgram video_yuv_program_[NumTexCoordPrecisions];
- VideoYUVAProgram video_yuva_program_[NumTexCoordPrecisions];
+ render_pass_color_matrix_program_[LAST_TEX_COORD_PRECISION +
+ 1][LAST_BLEND_MODE + 1];
+ RenderPassColorMatrixProgramAA
+ render_pass_color_matrix_program_aa_[LAST_TEX_COORD_PRECISION +
+ 1][LAST_BLEND_MODE + 1];
+ RenderPassMaskColorMatrixProgram
+ render_pass_mask_color_matrix_program_[LAST_TEX_COORD_PRECISION +
+ 1][LAST_SAMPLER_TYPE +
+ 1][LAST_BLEND_MODE + 1];
+ RenderPassMaskColorMatrixProgramAA
+ render_pass_mask_color_matrix_program_aa_[LAST_TEX_COORD_PRECISION +
+ 1][LAST_SAMPLER_TYPE +
+ 1][LAST_BLEND_MODE + 1];
+
+ VideoYUVProgram video_yuv_program_[LAST_TEX_COORD_PRECISION + 1];
+ VideoYUVAProgram video_yuva_program_[LAST_TEX_COORD_PRECISION + 1];
VideoStreamTextureProgram
- video_stream_texture_program_[NumTexCoordPrecisions];
+ video_stream_texture_program_[LAST_TEX_COORD_PRECISION + 1];
DebugBorderProgram debug_border_program_;
SolidColorProgram solid_color_program_;
diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc
index c5c1e4d..fc70900 100644
--- a/cc/output/gl_renderer_unittest.cc
+++ b/cc/output/gl_renderer_unittest.cc
@@ -57,41 +57,39 @@ class GLRendererTest : public testing::Test {
static inline SkXfermode::Mode BlendModeToSkXfermode(BlendMode blend_mode) {
switch (blend_mode) {
- case BlendModeNone:
- case BlendModeNormal:
+ case BLEND_MODE_NONE:
+ case BLEND_MODE_NORMAL:
return SkXfermode::kSrcOver_Mode;
- case BlendModeScreen:
+ case BLEND_MODE_SCREEN:
return SkXfermode::kScreen_Mode;
- case BlendModeOverlay:
+ case BLEND_MODE_OVERLAY:
return SkXfermode::kOverlay_Mode;
- case BlendModeDarken:
+ case BLEND_MODE_DARKEN:
return SkXfermode::kDarken_Mode;
- case BlendModeLighten:
+ case BLEND_MODE_LIGHTEN:
return SkXfermode::kLighten_Mode;
- case BlendModeColorDodge:
+ case BLEND_MODE_COLOR_DODGE:
return SkXfermode::kColorDodge_Mode;
- case BlendModeColorBurn:
+ case BLEND_MODE_COLOR_BURN:
return SkXfermode::kColorBurn_Mode;
- case BlendModeHardLight:
+ case BLEND_MODE_HARD_LIGHT:
return SkXfermode::kHardLight_Mode;
- case BlendModeSoftLight:
+ case BLEND_MODE_SOFT_LIGHT:
return SkXfermode::kSoftLight_Mode;
- case BlendModeDifference:
+ case BLEND_MODE_DIFFERENCE:
return SkXfermode::kDifference_Mode;
- case BlendModeExclusion:
+ case BLEND_MODE_EXCLUSION:
return SkXfermode::kExclusion_Mode;
- case BlendModeMultiply:
+ case BLEND_MODE_MULTIPLY:
return SkXfermode::kMultiply_Mode;
- case BlendModeHue:
+ case BLEND_MODE_HUE:
return SkXfermode::kHue_Mode;
- case BlendModeSaturation:
+ case BLEND_MODE_SATURATION:
return SkXfermode::kSaturation_Mode;
- case BlendModeColor:
+ case BLEND_MODE_COLOR:
return SkXfermode::kColor_Mode;
- case BlendModeLuminosity:
+ case BLEND_MODE_LUMINOSITY:
return SkXfermode::kLuminosity_Mode;
- case NumBlendModes:
- NOTREACHED();
}
return SkXfermode::kSrcOver_Mode;
}
@@ -105,13 +103,13 @@ class GLRendererShaderPixelTest : public GLRendererPixelTest {
EXPECT_PROGRAM_VALID(renderer()->GetDebugBorderProgram());
EXPECT_PROGRAM_VALID(renderer()->GetSolidColorProgram());
EXPECT_PROGRAM_VALID(renderer()->GetSolidColorProgramAA());
- TestShadersWithTexCoordPrecision(TexCoordPrecisionMedium);
- TestShadersWithTexCoordPrecision(TexCoordPrecisionHigh);
+ TestShadersWithTexCoordPrecision(TEX_COORD_PRECISION_MEDIUM);
+ TestShadersWithTexCoordPrecision(TEX_COORD_PRECISION_HIGH);
ASSERT_FALSE(renderer()->IsContextLost());
}
void TestShadersWithTexCoordPrecision(TexCoordPrecision precision) {
- for (int i = 0; i < NumBlendModes; ++i) {
+ for (int i = 0; i <= LAST_BLEND_MODE; ++i) {
BlendMode blend_mode = static_cast<BlendMode>(i);
EXPECT_PROGRAM_VALID(
renderer()->GetRenderPassProgram(precision, blend_mode));
@@ -132,11 +130,11 @@ class GLRendererShaderPixelTest : public GLRendererPixelTest {
EXPECT_PROGRAM_VALID(renderer()->GetVideoStreamTextureProgram(precision));
else
EXPECT_FALSE(renderer()->GetVideoStreamTextureProgram(precision));
- TestShadersWithSamplerType(precision, SamplerType2D);
- TestShadersWithSamplerType(precision, SamplerType2DRect);
+ TestShadersWithSamplerType(precision, SAMPLER_TYPE_2D);
+ TestShadersWithSamplerType(precision, SAMPLER_TYPE_2D_RECT);
// This is unlikely to be ever true in tests due to usage of osmesa.
if (renderer()->Capabilities().using_egl_image)
- TestShadersWithSamplerType(precision, SamplerTypeExternalOES);
+ TestShadersWithSamplerType(precision, SAMPLER_TYPE_EXTERNAL_OES);
}
void TestShadersWithSamplerType(TexCoordPrecision precision,
@@ -149,7 +147,7 @@ class GLRendererShaderPixelTest : public GLRendererPixelTest {
renderer()->GetTileProgramSwizzleOpaque(precision, sampler));
EXPECT_PROGRAM_VALID(
renderer()->GetTileProgramSwizzleAA(precision, sampler));
- for (int i = 0; i < NumBlendModes; ++i) {
+ for (int i = 0; i <= LAST_BLEND_MODE; ++i) {
BlendMode blend_mode = static_cast<BlendMode>(i);
EXPECT_PROGRAM_VALID(
renderer()->GetRenderPassMaskProgram(precision, sampler, blend_mode));
@@ -1437,9 +1435,8 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) {
TestRenderPass* root_pass;
ResourceProvider::ResourceId mask = resource_provider_->CreateResource(
- gfx::Size(20, 12),
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ gfx::Size(20, 12), GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE,
resource_provider_->best_texture_format());
resource_provider_->AllocateForTesting(mask);
@@ -1469,10 +1466,10 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) {
gfx::Transform transform_causing_aa;
transform_causing_aa.Rotate(20.0);
- for (int i = 0; i < NumBlendModes; ++i) {
+ for (int i = 0; i <= LAST_BLEND_MODE; ++i) {
BlendMode blend_mode = static_cast<BlendMode>(i);
SkXfermode::Mode xfer_mode = BlendModeToSkXfermode(blend_mode);
- settings_.force_blending_with_shaders = (blend_mode != BlendModeNone);
+ settings_.force_blending_with_shaders = (blend_mode != BLEND_MODE_NONE);
// RenderPassProgram
render_passes_in_draw_order_.clear();
child_pass = AddRenderPass(&render_passes_in_draw_order_,
@@ -1499,7 +1496,7 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) {
viewport_rect,
viewport_rect,
false);
- TestRenderPassProgram(TexCoordPrecisionMedium, blend_mode);
+ TestRenderPassProgram(TEX_COORD_PRECISION_MEDIUM, blend_mode);
// RenderPassColorMatrixProgram
render_passes_in_draw_order_.clear();
@@ -1524,7 +1521,7 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) {
viewport_rect,
viewport_rect,
false);
- TestRenderPassColorMatrixProgram(TexCoordPrecisionMedium, blend_mode);
+ TestRenderPassColorMatrixProgram(TEX_COORD_PRECISION_MEDIUM, blend_mode);
// RenderPassMaskProgram
render_passes_in_draw_order_.clear();
@@ -1553,8 +1550,8 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) {
viewport_rect,
viewport_rect,
false);
- TestRenderPassMaskProgram(
- TexCoordPrecisionMedium, SamplerType2D, blend_mode);
+ TestRenderPassMaskProgram(TEX_COORD_PRECISION_MEDIUM, SAMPLER_TYPE_2D,
+ blend_mode);
// RenderPassMaskColorMatrixProgram
render_passes_in_draw_order_.clear();
@@ -1579,8 +1576,8 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) {
viewport_rect,
viewport_rect,
false);
- TestRenderPassMaskColorMatrixProgram(
- TexCoordPrecisionMedium, SamplerType2D, blend_mode);
+ TestRenderPassMaskColorMatrixProgram(TEX_COORD_PRECISION_MEDIUM,
+ SAMPLER_TYPE_2D, blend_mode);
// RenderPassProgramAA
render_passes_in_draw_order_.clear();
@@ -1609,7 +1606,7 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) {
viewport_rect,
viewport_rect,
false);
- TestRenderPassProgramAA(TexCoordPrecisionMedium, blend_mode);
+ TestRenderPassProgramAA(TEX_COORD_PRECISION_MEDIUM, blend_mode);
// RenderPassColorMatrixProgramAA
render_passes_in_draw_order_.clear();
@@ -1634,7 +1631,7 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) {
viewport_rect,
viewport_rect,
false);
- TestRenderPassColorMatrixProgramAA(TexCoordPrecisionMedium, blend_mode);
+ TestRenderPassColorMatrixProgramAA(TEX_COORD_PRECISION_MEDIUM, blend_mode);
// RenderPassMaskProgramAA
render_passes_in_draw_order_.clear();
@@ -1663,8 +1660,8 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) {
viewport_rect,
viewport_rect,
false);
- TestRenderPassMaskProgramAA(
- TexCoordPrecisionMedium, SamplerType2D, blend_mode);
+ TestRenderPassMaskProgramAA(TEX_COORD_PRECISION_MEDIUM, SAMPLER_TYPE_2D,
+ blend_mode);
// RenderPassMaskColorMatrixProgramAA
render_passes_in_draw_order_.clear();
@@ -1689,8 +1686,8 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) {
viewport_rect,
viewport_rect,
false);
- TestRenderPassMaskColorMatrixProgramAA(
- TexCoordPrecisionMedium, SamplerType2D, blend_mode);
+ TestRenderPassMaskColorMatrixProgramAA(TEX_COORD_PRECISION_MEDIUM,
+ SAMPLER_TYPE_2D, blend_mode);
}
}
@@ -1742,7 +1739,7 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadSkipsAAForClippingTransform) {
// If use_aa incorrectly ignores clipping, it will use the
// RenderPassProgramAA shader instead of the RenderPassProgram.
- TestRenderPassProgram(TexCoordPrecisionMedium, BlendModeNone);
+ TestRenderPassProgram(TEX_COORD_PRECISION_MEDIUM, BLEND_MODE_NONE);
}
TEST_F(GLRendererShaderTest, DrawSolidColorShader) {
diff --git a/cc/output/program_binding.h b/cc/output/program_binding.h
index a10d0ab..9c3244c 100644
--- a/cc/output/program_binding.h
+++ b/cc/output/program_binding.h
@@ -59,7 +59,7 @@ class ProgramBinding : public ProgramBindingBase {
void Initialize(ContextProvider* context_provider,
TexCoordPrecision precision,
SamplerType sampler,
- BlendMode blend_mode = BlendModeNone) {
+ BlendMode blend_mode = BLEND_MODE_NONE) {
DCHECK(context_provider);
DCHECK(!initialized_);
diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc
index 4f1ee0c..743e1cf 100644
--- a/cc/output/renderer_pixeltest.cc
+++ b/cc/output/renderer_pixeltest.cc
@@ -127,11 +127,9 @@ void CreateTestTextureDrawQuad(const gfx::Rect& rect,
size_t num_pixels = static_cast<size_t>(rect.width()) * rect.height();
std::vector<uint32_t> pixels(num_pixels, pixel_color);
- ResourceProvider::ResourceId resource =
- resource_provider->CreateResource(rect.size(),
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
- RGBA_8888);
+ ResourceProvider::ResourceId resource = resource_provider->CreateResource(
+ rect.size(), GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
+ RGBA_8888);
resource_provider->CopyToResource(
resource, reinterpret_cast<uint8_t*>(&pixels.front()), rect.size());
@@ -1324,10 +1322,8 @@ TYPED_TEST(RendererPixelTest, RenderPassAndMaskWithPartialQuad) {
ResourceProvider::ResourceId mask_resource_id =
this->resource_provider_->CreateResource(
- mask_rect.size(),
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
- RGBA_8888);
+ mask_rect.size(), GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888);
{
SkAutoLockPixels lock(bitmap);
this->resource_provider_->CopyToResource(
@@ -2111,9 +2107,7 @@ TYPED_TEST(RendererPixelTest, TileDrawQuadNearestNeighbor) {
gfx::Size tile_size(2, 2);
ResourceProvider::ResourceId resource =
this->resource_provider_->CreateResource(
- tile_size,
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ tile_size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
RGBA_8888);
{
@@ -2470,7 +2464,7 @@ TYPED_TEST(RendererPixelTest, WrapModeRepeat) {
};
ResourceProvider::ResourceId resource =
this->resource_provider_->CreateResource(
- texture_size, GL_REPEAT, ResourceProvider::TextureHintImmutable,
+ texture_size, GL_REPEAT, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
RGBA_8888);
this->resource_provider_->CopyToResource(
resource, reinterpret_cast<uint8_t*>(pixels), texture_size);
diff --git a/cc/output/shader.cc b/cc/output/shader.cc
index 0a33e53..1891546 100644
--- a/cc/output/shader.cc
+++ b/cc/output/shader.cc
@@ -52,7 +52,7 @@ static std::string SetFragmentTexCoordPrecision(
TexCoordPrecision requested_precision,
std::string shader_string) {
switch (requested_precision) {
- case TexCoordPrecisionHigh:
+ case TEX_COORD_PRECISION_HIGH:
DCHECK_NE(shader_string.find("TexCoordPrecision"), std::string::npos);
return "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
" #define TexCoordPrecision highp\n"
@@ -60,10 +60,10 @@ static std::string SetFragmentTexCoordPrecision(
" #define TexCoordPrecision mediump\n"
"#endif\n" +
shader_string;
- case TexCoordPrecisionMedium:
+ case TEX_COORD_PRECISION_MEDIUM:
DCHECK_NE(shader_string.find("TexCoordPrecision"), std::string::npos);
return "#define TexCoordPrecision mediump\n" + shader_string;
- case TexCoordPrecisionNA:
+ case TEX_COORD_PRECISION_NA:
DCHECK_EQ(shader_string.find("TexCoordPrecision"), std::string::npos);
DCHECK_EQ(shader_string.find("texture2D"), std::string::npos);
DCHECK_EQ(shader_string.find("texture2DRect"), std::string::npos);
@@ -104,34 +104,34 @@ TexCoordPrecision TexCoordPrecisionRequired(GLES2Interface* context,
int highp_threshold = std::max(*highp_threshold_cache, highp_threshold_min);
if (x > highp_threshold || y > highp_threshold)
- return TexCoordPrecisionHigh;
- return TexCoordPrecisionMedium;
+ return TEX_COORD_PRECISION_HIGH;
+ return TEX_COORD_PRECISION_MEDIUM;
}
static std::string SetFragmentSamplerType(SamplerType requested_type,
std::string shader_string) {
switch (requested_type) {
- case SamplerType2D:
+ case SAMPLER_TYPE_2D:
DCHECK_NE(shader_string.find("SamplerType"), std::string::npos);
DCHECK_NE(shader_string.find("TextureLookup"), std::string::npos);
return "#define SamplerType sampler2D\n"
"#define TextureLookup texture2D\n" +
shader_string;
- case SamplerType2DRect:
+ case SAMPLER_TYPE_2D_RECT:
DCHECK_NE(shader_string.find("SamplerType"), std::string::npos);
DCHECK_NE(shader_string.find("TextureLookup"), std::string::npos);
return "#extension GL_ARB_texture_rectangle : require\n"
"#define SamplerType sampler2DRect\n"
"#define TextureLookup texture2DRect\n" +
shader_string;
- case SamplerTypeExternalOES:
+ case SAMPLER_TYPE_EXTERNAL_OES:
DCHECK_NE(shader_string.find("SamplerType"), std::string::npos);
DCHECK_NE(shader_string.find("TextureLookup"), std::string::npos);
return "#extension GL_OES_EGL_image_external : require\n"
"#define SamplerType samplerExternalOES\n"
"#define TextureLookup texture2D\n" +
shader_string;
- case SamplerTypeNA:
+ case SAMPLER_TYPE_NA:
DCHECK_EQ(shader_string.find("SamplerType"), std::string::npos);
DCHECK_EQ(shader_string.find("TextureLookup"), std::string::npos);
return shader_string;
@@ -734,7 +734,7 @@ std::string VertexShaderVideoTransform::GetShaderBody() {
FragmentTexBlendMode::FragmentTexBlendMode()
: backdrop_location_(-1),
backdrop_rect_location_(-1),
- blend_mode_(BlendModeNone) {
+ blend_mode_(BLEND_MODE_NONE) {
}
std::string FragmentTexBlendMode::SetBlendModeFunctions(
@@ -908,20 +908,20 @@ std::string FragmentTexBlendMode::GetHelperFunctions() const {
});
switch (blend_mode_) {
- case BlendModeOverlay:
- case BlendModeHardLight:
+ case BLEND_MODE_OVERLAY:
+ case BLEND_MODE_HARD_LIGHT:
return kFunctionHardLight;
- case BlendModeColorDodge:
+ case BLEND_MODE_COLOR_DODGE:
return kFunctionColorDodgeComponent;
- case BlendModeColorBurn:
+ case BLEND_MODE_COLOR_BURN:
return kFunctionColorBurnComponent;
- case BlendModeSoftLight:
+ case BLEND_MODE_SOFT_LIGHT:
return kFunctionSoftLightComponentPosDstAlpha;
- case BlendModeHue:
- case BlendModeSaturation:
+ case BLEND_MODE_HUE:
+ case BLEND_MODE_SATURATION:
return kFunctionLum + kFunctionSat;
- case BlendModeColor:
- case BlendModeLuminosity:
+ case BLEND_MODE_COLOR:
+ case BLEND_MODE_LUMINOSITY:
return kFunctionLum;
default:
return std::string();
@@ -939,29 +939,29 @@ std::string FragmentTexBlendMode::GetBlendFunction() const {
std::string FragmentTexBlendMode::GetBlendFunctionBodyForRGB() const {
switch (blend_mode_) {
- case BlendModeNormal:
+ case BLEND_MODE_NORMAL:
return "result.rgb = src.rgb + dst.rgb * (1.0 - src.a);";
- case BlendModeScreen:
+ case BLEND_MODE_SCREEN:
return "result.rgb = src.rgb + (1.0 - src.rgb) * dst.rgb;";
- case BlendModeLighten:
+ case BLEND_MODE_LIGHTEN:
return "result.rgb = max((1.0 - src.a) * dst.rgb + src.rgb,"
" (1.0 - dst.a) * src.rgb + dst.rgb);";
- case BlendModeOverlay:
+ case BLEND_MODE_OVERLAY:
return "result.rgb = hardLight(dst, src);";
- case BlendModeDarken:
+ case BLEND_MODE_DARKEN:
return "result.rgb = min((1.0 - src.a) * dst.rgb + src.rgb,"
" (1.0 - dst.a) * src.rgb + dst.rgb);";
- case BlendModeColorDodge:
+ case BLEND_MODE_COLOR_DODGE:
return "result.r = getColorDodgeComponent(src.r, src.a, dst.r, dst.a);"
"result.g = getColorDodgeComponent(src.g, src.a, dst.g, dst.a);"
"result.b = getColorDodgeComponent(src.b, src.a, dst.b, dst.a);";
- case BlendModeColorBurn:
+ case BLEND_MODE_COLOR_BURN:
return "result.r = getColorBurnComponent(src.r, src.a, dst.r, dst.a);"
"result.g = getColorBurnComponent(src.g, src.a, dst.g, dst.a);"
"result.b = getColorBurnComponent(src.b, src.a, dst.b, dst.a);";
- case BlendModeHardLight:
+ case BLEND_MODE_HARD_LIGHT:
return "result.rgb = hardLight(src, dst);";
- case BlendModeSoftLight:
+ case BLEND_MODE_SOFT_LIGHT:
return "if (0.0 == dst.a) {"
" result.rgb = src.rgb;"
"} else {"
@@ -969,15 +969,15 @@ std::string FragmentTexBlendMode::GetBlendFunctionBodyForRGB() const {
" result.g = getSoftLightComponent(src.g, src.a, dst.g, dst.a);"
" result.b = getSoftLightComponent(src.b, src.a, dst.b, dst.a);"
"}";
- case BlendModeDifference:
+ case BLEND_MODE_DIFFERENCE:
return "result.rgb = src.rgb + dst.rgb -"
" 2.0 * min(src.rgb * dst.a, dst.rgb * src.a);";
- case BlendModeExclusion:
+ case BLEND_MODE_EXCLUSION:
return "result.rgb = dst.rgb + src.rgb - 2.0 * dst.rgb * src.rgb;";
- case BlendModeMultiply:
+ case BLEND_MODE_MULTIPLY:
return "result.rgb = (1.0 - src.a) * dst.rgb +"
" (1.0 - dst.a) * src.rgb + src.rgb * dst.rgb;";
- case BlendModeHue:
+ case BLEND_MODE_HUE:
return "vec4 dstSrcAlpha = dst * src.a;"
"result.rgb ="
" set_luminance(set_saturation(src.rgb * dst.a,"
@@ -985,27 +985,26 @@ std::string FragmentTexBlendMode::GetBlendFunctionBodyForRGB() const {
" dstSrcAlpha.a,"
" dstSrcAlpha.rgb);"
"result.rgb += (1.0 - src.a) * dst.rgb + (1.0 - dst.a) * src.rgb;";
- case BlendModeSaturation:
+ case BLEND_MODE_SATURATION:
return "vec4 dstSrcAlpha = dst * src.a;"
"result.rgb = set_luminance(set_saturation(dstSrcAlpha.rgb,"
" src.rgb * dst.a),"
" dstSrcAlpha.a,"
" dstSrcAlpha.rgb);"
"result.rgb += (1.0 - src.a) * dst.rgb + (1.0 - dst.a) * src.rgb;";
- case BlendModeColor:
+ case BLEND_MODE_COLOR:
return "vec4 srcDstAlpha = src * dst.a;"
"result.rgb = set_luminance(srcDstAlpha.rgb,"
" srcDstAlpha.a,"
" dst.rgb * src.a);"
"result.rgb += (1.0 - src.a) * dst.rgb + (1.0 - dst.a) * src.rgb;";
- case BlendModeLuminosity:
+ case BLEND_MODE_LUMINOSITY:
return "vec4 srcDstAlpha = src * dst.a;"
"result.rgb = set_luminance(dst.rgb * src.a,"
" srcDstAlpha.a,"
" srcDstAlpha.rgb);"
"result.rgb += (1.0 - src.a) * dst.rgb + (1.0 - dst.a) * src.rgb;";
- case BlendModeNone:
- case NumBlendModes:
+ case BLEND_MODE_NONE:
NOTREACHED();
}
return "result = vec4(1.0, 0.0, 0.0, 1.0);";
diff --git a/cc/output/shader.h b/cc/output/shader.h
index 3c8102e..93407d4 100644
--- a/cc/output/shader.h
+++ b/cc/output/shader.h
@@ -24,39 +24,39 @@ class GLES2Interface;
namespace cc {
enum TexCoordPrecision {
- TexCoordPrecisionNA = 0,
- TexCoordPrecisionMedium = 1,
- TexCoordPrecisionHigh = 2,
- NumTexCoordPrecisions = 3
+ TEX_COORD_PRECISION_NA = 0,
+ TEX_COORD_PRECISION_MEDIUM = 1,
+ TEX_COORD_PRECISION_HIGH = 2,
+ LAST_TEX_COORD_PRECISION = 2
};
enum SamplerType {
- SamplerTypeNA = 0,
- SamplerType2D = 1,
- SamplerType2DRect = 2,
- SamplerTypeExternalOES = 3,
- NumSamplerTypes = 4
+ SAMPLER_TYPE_NA = 0,
+ SAMPLER_TYPE_2D = 1,
+ SAMPLER_TYPE_2D_RECT = 2,
+ SAMPLER_TYPE_EXTERNAL_OES = 3,
+ LAST_SAMPLER_TYPE = 3
};
enum BlendMode {
- BlendModeNone,
- BlendModeNormal,
- BlendModeScreen,
- BlendModeOverlay,
- BlendModeDarken,
- BlendModeLighten,
- BlendModeColorDodge,
- BlendModeColorBurn,
- BlendModeHardLight,
- BlendModeSoftLight,
- BlendModeDifference,
- BlendModeExclusion,
- BlendModeMultiply,
- BlendModeHue,
- BlendModeSaturation,
- BlendModeColor,
- BlendModeLuminosity,
- NumBlendModes
+ BLEND_MODE_NONE,
+ BLEND_MODE_NORMAL,
+ BLEND_MODE_SCREEN,
+ BLEND_MODE_OVERLAY,
+ BLEND_MODE_DARKEN,
+ BLEND_MODE_LIGHTEN,
+ BLEND_MODE_COLOR_DODGE,
+ BLEND_MODE_COLOR_BURN,
+ BLEND_MODE_HARD_LIGHT,
+ BLEND_MODE_SOFT_LIGHT,
+ BLEND_MODE_DIFFERENCE,
+ BLEND_MODE_EXCLUSION,
+ BLEND_MODE_MULTIPLY,
+ BLEND_MODE_HUE,
+ BLEND_MODE_SATURATION,
+ BLEND_MODE_COLOR,
+ BLEND_MODE_LUMINOSITY,
+ LAST_BLEND_MODE = BLEND_MODE_LUMINOSITY
};
// Note: The highp_threshold_cache must be provided by the caller to make
@@ -329,7 +329,7 @@ class FragmentTexBlendMode {
BlendMode blend_mode() const { return blend_mode_; }
void set_blend_mode(BlendMode blend_mode) { blend_mode_ = blend_mode; }
- bool has_blend_mode() const { return blend_mode_ != BlendModeNone; }
+ bool has_blend_mode() const { return blend_mode_ != BLEND_MODE_NONE; }
protected:
FragmentTexBlendMode();
diff --git a/cc/output/shader_unittest.cc b/cc/output/shader_unittest.cc
index 4fd696f..675e47f 100644
--- a/cc/output/shader_unittest.cc
+++ b/cc/output/shader_unittest.cc
@@ -27,24 +27,32 @@ TEST(ShaderTest, HighpThresholds) {
gfx::Size bigSize(2560, 2560);
threshold_min = 0;
- EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired(
- &stub_gl, &threshold_cache, threshold_min, closePoint));
- EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired(
- &stub_gl, &threshold_cache, threshold_min, smallSize));
- EXPECT_EQ(TexCoordPrecisionHigh, TexCoordPrecisionRequired(
- &stub_gl, &threshold_cache, threshold_min, farPoint));
- EXPECT_EQ(TexCoordPrecisionHigh, TexCoordPrecisionRequired(
- &stub_gl, &threshold_cache, threshold_min, bigSize));
+ EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM,
+ TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min,
+ closePoint));
+ EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM,
+ TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min,
+ smallSize));
+ EXPECT_EQ(TEX_COORD_PRECISION_HIGH,
+ TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min,
+ farPoint));
+ EXPECT_EQ(TEX_COORD_PRECISION_HIGH,
+ TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min,
+ bigSize));
threshold_min = 3000;
- EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired(
- &stub_gl, &threshold_cache, threshold_min, closePoint));
- EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired(
- &stub_gl, &threshold_cache, threshold_min, smallSize));
- EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired(
- &stub_gl, &threshold_cache, threshold_min, farPoint));
- EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired(
- &stub_gl, &threshold_cache, threshold_min, bigSize));
+ EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM,
+ TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min,
+ closePoint));
+ EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM,
+ TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min,
+ smallSize));
+ EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM,
+ TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min,
+ farPoint));
+ EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM,
+ TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min,
+ bigSize));
}
} // namespace cc
diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc
index 488ca09..5360d59 100644
--- a/cc/output/software_renderer.cc
+++ b/cc/output/software_renderer.cc
@@ -223,11 +223,11 @@ void SoftwareRenderer::SetDrawViewport(
bool SoftwareRenderer::IsSoftwareResource(
ResourceProvider::ResourceId resource_id) const {
switch (resource_provider_->GetResourceType(resource_id)) {
- case ResourceProvider::GLTexture:
+ case ResourceProvider::RESOURCE_TYPE_GL_TEXTURE:
return false;
- case ResourceProvider::Bitmap:
+ case ResourceProvider::RESOURCE_TYPE_BITMAP:
return true;
- case ResourceProvider::InvalidType:
+ case ResourceProvider::RESOURCE_TYPE_INVALID:
break;
}
diff --git a/cc/output/software_renderer_unittest.cc b/cc/output/software_renderer_unittest.cc
index 28036bb..3b2c4bc 100644
--- a/cc/output/software_renderer_unittest.cc
+++ b/cc/output/software_renderer_unittest.cc
@@ -155,16 +155,12 @@ TEST_F(SoftwareRendererTest, TileQuad) {
ResourceProvider::ResourceId resource_yellow =
resource_provider()->CreateResource(
- outer_size,
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
- RGBA_8888);
+ outer_size, GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888);
ResourceProvider::ResourceId resource_cyan =
resource_provider()->CreateResource(
- inner_size,
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
- RGBA_8888);
+ inner_size, GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888);
SkBitmap yellow_tile;
yellow_tile.allocN32Pixels(outer_size.width(), outer_size.height());
@@ -246,9 +242,7 @@ TEST_F(SoftwareRendererTest, TileQuadVisibleRect) {
ResourceProvider::ResourceId resource_cyan =
resource_provider()->CreateResource(
- tile_size,
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ tile_size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
RGBA_8888);
SkBitmap cyan_tile; // The lowest five rows are yellow.
diff --git a/cc/quads/draw_polygon.cc b/cc/quads/draw_polygon.cc
index 71dbf36..026be2c 100644
--- a/cc/quads/draw_polygon.cc
+++ b/cc/quads/draw_polygon.cc
@@ -93,7 +93,7 @@ float DrawPolygon::SignedPointDistance(const gfx::Point3F& point) const {
// Checks whether or not shape a lies on the front or back side of b, or
// whether they should be considered coplanar. If on the back side, we
-// say ABeforeB because it should be drawn in that order.
+// say A_BEFORE_B because it should be drawn in that order.
// Assumes that layers are split and there are no intersecting planes.
BspCompareResult DrawPolygon::SideCompare(const DrawPolygon& a,
const DrawPolygon& b) {
diff --git a/cc/resources/prioritized_resource_manager.cc b/cc/resources/prioritized_resource_manager.cc
index 48177e3..236377b 100644
--- a/cc/resources/prioritized_resource_manager.cc
+++ b/cc/resources/prioritized_resource_manager.cc
@@ -451,11 +451,8 @@ PrioritizedResource::Backing* PrioritizedResourceManager::CreateBacking(
DCHECK(resource_provider);
ResourceProvider::ResourceId resource_id =
resource_provider->CreateManagedResource(
- size,
- GL_TEXTURE_2D,
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
- format);
+ size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
PrioritizedResource::Backing* backing = new PrioritizedResource::Backing(
resource_id, resource_provider, size, format);
memory_use_bytes_ += backing->bytes();
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index b04708a..115238f 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -266,7 +266,7 @@ ResourceProvider::Resource::Resource()
allow_overlay(false),
read_lock_fence(NULL),
size(),
- origin(Internal),
+ origin(INTERNAL),
target(0),
original_filter(0),
filter(0),
@@ -274,8 +274,8 @@ ResourceProvider::Resource::Resource()
bound_image_id(0),
texture_pool(0),
wrap_mode(0),
- hint(TextureHintImmutable),
- type(InvalidType),
+ hint(TEXTURE_HINT_IMMUTABLE),
+ type(RESOURCE_TYPE_INVALID),
format(RGBA_8888),
shared_bitmap(NULL),
gpu_memory_buffer(NULL) {
@@ -322,12 +322,12 @@ ResourceProvider::Resource::Resource(GLuint texture_id,
texture_pool(texture_pool),
wrap_mode(wrap_mode),
hint(hint),
- type(GLTexture),
+ type(RESOURCE_TYPE_GL_TEXTURE),
format(format),
shared_bitmap(NULL),
gpu_memory_buffer(NULL) {
DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT);
- DCHECK_EQ(origin == Internal, !!texture_pool);
+ DCHECK_EQ(origin == INTERNAL, !!texture_pool);
}
ResourceProvider::Resource::Resource(uint8_t* pixels,
@@ -365,13 +365,13 @@ ResourceProvider::Resource::Resource(uint8_t* pixels,
bound_image_id(0),
texture_pool(0),
wrap_mode(wrap_mode),
- hint(TextureHintImmutable),
- type(Bitmap),
+ hint(TEXTURE_HINT_IMMUTABLE),
+ type(RESOURCE_TYPE_BITMAP),
format(RGBA_8888),
shared_bitmap(bitmap),
gpu_memory_buffer(NULL) {
DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT);
- DCHECK(origin == Delegated || pixels);
+ DCHECK(origin == DELEGATED || pixels);
if (bitmap)
shared_bitmap_id = bitmap->id();
}
@@ -410,8 +410,8 @@ ResourceProvider::Resource::Resource(const SharedBitmapId& bitmap_id,
bound_image_id(0),
texture_pool(0),
wrap_mode(wrap_mode),
- hint(TextureHintImmutable),
- type(Bitmap),
+ hint(TEXTURE_HINT_IMMUTABLE),
+ type(RESOURCE_TYPE_BITMAP),
format(RGBA_8888),
shared_bitmap_id(bitmap_id),
shared_bitmap(NULL),
@@ -445,15 +445,15 @@ scoped_ptr<ResourceProvider> ResourceProvider::Create(
else
resource_provider->InitializeSoftware();
- DCHECK_NE(InvalidType, resource_provider->default_resource_type());
+ DCHECK_NE(RESOURCE_TYPE_INVALID, resource_provider->default_resource_type());
return resource_provider.Pass();
}
ResourceProvider::~ResourceProvider() {
while (!children_.empty())
- DestroyChildInternal(children_.begin(), ForShutdown);
+ DestroyChildInternal(children_.begin(), FOR_SHUTDOWN);
while (!resources_.empty())
- DeleteResourceInternal(resources_.begin(), ForShutdown);
+ DeleteResourceInternal(resources_.begin(), FOR_SHUTDOWN);
CleanUpGLIfNeeded();
}
@@ -481,17 +481,17 @@ ResourceProvider::ResourceId ResourceProvider::CreateResource(
ResourceFormat format) {
DCHECK(!size.IsEmpty());
switch (default_resource_type_) {
- case GLTexture:
+ case RESOURCE_TYPE_GL_TEXTURE:
return CreateGLTexture(size,
GL_TEXTURE_2D,
GL_TEXTURE_POOL_UNMANAGED_CHROMIUM,
wrap_mode,
hint,
format);
- case Bitmap:
+ case RESOURCE_TYPE_BITMAP:
DCHECK_EQ(RGBA_8888, format);
return CreateBitmap(size, wrap_mode);
- case InvalidType:
+ case RESOURCE_TYPE_INVALID:
break;
}
@@ -507,17 +507,17 @@ ResourceProvider::ResourceId ResourceProvider::CreateManagedResource(
ResourceFormat format) {
DCHECK(!size.IsEmpty());
switch (default_resource_type_) {
- case GLTexture:
+ case RESOURCE_TYPE_GL_TEXTURE:
return CreateGLTexture(size,
target,
GL_TEXTURE_POOL_MANAGED_CHROMIUM,
wrap_mode,
hint,
format);
- case Bitmap:
+ case RESOURCE_TYPE_BITMAP:
DCHECK_EQ(RGBA_8888, format);
return CreateBitmap(size, wrap_mode);
- case InvalidType:
+ case RESOURCE_TYPE_INVALID:
break;
}
@@ -537,15 +537,8 @@ ResourceProvider::ResourceId ResourceProvider::CreateGLTexture(
DCHECK(thread_checker_.CalledOnValidThread());
ResourceId id = next_id_++;
- Resource resource(0,
- size,
- Resource::Internal,
- target,
- GL_LINEAR,
- texture_pool,
- wrap_mode,
- hint,
- format);
+ Resource resource(0, size, Resource::INTERNAL, target, GL_LINEAR,
+ texture_pool, wrap_mode, hint, format);
resource.allocated = false;
resources_[id] = resource;
return id;
@@ -561,8 +554,8 @@ ResourceProvider::ResourceId ResourceProvider::CreateBitmap(
DCHECK(pixels);
ResourceId id = next_id_++;
- Resource resource(
- pixels, bitmap.release(), size, Resource::Internal, GL_LINEAR, wrap_mode);
+ Resource resource(pixels, bitmap.release(), size, Resource::INTERNAL,
+ GL_LINEAR, wrap_mode);
resource.allocated = true;
resources_[id] = resource;
return id;
@@ -574,15 +567,10 @@ ResourceProvider::ResourceId ResourceProvider::CreateResourceFromIOSurface(
DCHECK(thread_checker_.CalledOnValidThread());
ResourceId id = next_id_++;
- Resource resource(0,
- gfx::Size(),
- Resource::Internal,
- GL_TEXTURE_RECTANGLE_ARB,
- GL_LINEAR,
- GL_TEXTURE_POOL_UNMANAGED_CHROMIUM,
- GL_CLAMP_TO_EDGE,
- TextureHintImmutable,
- RGBA_8888);
+ Resource resource(0, gfx::Size(), Resource::INTERNAL,
+ GL_TEXTURE_RECTANGLE_ARB, GL_LINEAR,
+ GL_TEXTURE_POOL_UNMANAGED_CHROMIUM, GL_CLAMP_TO_EDGE,
+ TEXTURE_HINT_IMMUTABLE, RGBA_8888);
LazyCreate(&resource);
GLES2Interface* gl = ContextGL();
DCHECK(gl);
@@ -603,22 +591,16 @@ ResourceProvider::ResourceId ResourceProvider::CreateResourceFromTextureMailbox(
DCHECK(mailbox.IsValid());
Resource& resource = resources_[id];
if (mailbox.IsTexture()) {
- resource = Resource(0,
- gfx::Size(),
- Resource::External,
- mailbox.target(),
- mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR,
- 0,
- GL_CLAMP_TO_EDGE,
- TextureHintImmutable,
- RGBA_8888);
+ resource = Resource(0, gfx::Size(), Resource::EXTERNAL, mailbox.target(),
+ mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR, 0,
+ GL_CLAMP_TO_EDGE, TEXTURE_HINT_IMMUTABLE, RGBA_8888);
} else {
DCHECK(mailbox.IsSharedMemory());
SharedBitmap* shared_bitmap = mailbox.shared_bitmap();
uint8_t* pixels = shared_bitmap->pixels();
DCHECK(pixels);
resource = Resource(pixels, shared_bitmap, mailbox.shared_memory_size(),
- Resource::External, GL_LINEAR, GL_CLAMP_TO_EDGE);
+ Resource::EXTERNAL, GL_LINEAR, GL_CLAMP_TO_EDGE);
}
resource.allocated = true;
resource.mailbox = mailbox;
@@ -642,7 +624,7 @@ void ResourceProvider::DeleteResource(ResourceId id) {
resource->marked_for_deletion = true;
return;
} else {
- DeleteResourceInternal(it, Normal);
+ DeleteResourceInternal(it, NORMAL);
}
}
@@ -652,38 +634,38 @@ void ResourceProvider::DeleteResourceInternal(ResourceMap::iterator it,
Resource* resource = &it->second;
bool lost_resource = resource->lost;
- DCHECK(resource->exported_count == 0 || style != Normal);
- if (style == ForShutdown && resource->exported_count > 0)
+ DCHECK(resource->exported_count == 0 || style != NORMAL);
+ if (style == FOR_SHUTDOWN && resource->exported_count > 0)
lost_resource = true;
if (resource->image_id) {
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
GLES2Interface* gl = ContextGL();
DCHECK(gl);
GLC(gl, gl->DestroyImageCHROMIUM(resource->image_id));
}
if (resource->gl_upload_query_id) {
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
GLES2Interface* gl = ContextGL();
DCHECK(gl);
GLC(gl, gl->DeleteQueriesEXT(1, &resource->gl_upload_query_id));
}
if (resource->gl_read_lock_query_id) {
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
GLES2Interface* gl = ContextGL();
DCHECK(gl);
GLC(gl, gl->DeleteQueriesEXT(1, &resource->gl_read_lock_query_id));
}
if (resource->gl_pixel_buffer_id) {
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
GLES2Interface* gl = ContextGL();
DCHECK(gl);
GLC(gl, gl->DeleteBuffers(1, &resource->gl_pixel_buffer_id));
}
- if (resource->origin == Resource::External) {
+ if (resource->origin == Resource::EXTERNAL) {
DCHECK(resource->mailbox.IsValid());
GLuint sync_point = resource->mailbox.sync_point();
- if (resource->type == GLTexture) {
+ if (resource->type == RESOURCE_TYPE_GL_TEXTURE) {
DCHECK(resource->mailbox.IsTexture());
lost_resource |= lost_output_surface_;
GLES2Interface* gl = ContextGL();
@@ -709,18 +691,18 @@ void ResourceProvider::DeleteResourceInternal(ResourceMap::iterator it,
resource->gl_id = 0;
}
if (resource->shared_bitmap) {
- DCHECK(resource->origin != Resource::External);
- DCHECK_EQ(Bitmap, resource->type);
+ DCHECK(resource->origin != Resource::EXTERNAL);
+ DCHECK_EQ(RESOURCE_TYPE_BITMAP, resource->type);
delete resource->shared_bitmap;
resource->pixels = NULL;
}
if (resource->pixels) {
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
delete[] resource->pixels;
resource->pixels = NULL;
}
if (resource->gpu_memory_buffer) {
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
delete resource->gpu_memory_buffer;
resource->gpu_memory_buffer = NULL;
}
@@ -740,12 +722,12 @@ void ResourceProvider::SetPixels(ResourceId id,
Resource* resource = GetResource(id);
DCHECK(!resource->locked_for_write);
DCHECK(!resource->lock_for_read_count);
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
DCHECK_EQ(resource->exported_count, 0);
DCHECK(ReadLockFenceHasPassed(resource));
LazyAllocate(resource);
- if (resource->type == GLTexture) {
+ if (resource->type == RESOURCE_TYPE_GL_TEXTURE) {
DCHECK(resource->gl_id);
DCHECK(!resource->pending_set_pixels);
DCHECK_EQ(resource->target, static_cast<GLenum>(GL_TEXTURE_2D));
@@ -760,7 +742,7 @@ void ResourceProvider::SetPixels(ResourceId id,
resource->format,
resource->size);
} else {
- DCHECK_EQ(Bitmap, resource->type);
+ DCHECK_EQ(RESOURCE_TYPE_BITMAP, resource->type);
DCHECK(resource->allocated);
DCHECK_EQ(RGBA_8888, resource->format);
DCHECK(source_rect.x() >= image_rect.x());
@@ -786,7 +768,7 @@ void ResourceProvider::CopyToResource(ResourceId id,
Resource* resource = GetResource(id);
DCHECK(!resource->locked_for_write);
DCHECK(!resource->lock_for_read_count);
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
DCHECK_EQ(resource->exported_count, 0);
DCHECK(ReadLockFenceHasPassed(resource));
LazyAllocate(resource);
@@ -794,8 +776,8 @@ void ResourceProvider::CopyToResource(ResourceId id,
DCHECK_EQ(image_size.width(), resource->size.width());
DCHECK_EQ(image_size.height(), resource->size.height());
- if (resource->type == Bitmap) {
- DCHECK_EQ(Bitmap, resource->type);
+ if (resource->type == RESOURCE_TYPE_BITMAP) {
+ DCHECK_EQ(RESOURCE_TYPE_BITMAP, resource->type);
DCHECK(resource->allocated);
DCHECK_EQ(RGBA_8888, resource->format);
SkImageInfo source_info =
@@ -906,8 +888,8 @@ const ResourceProvider::Resource* ResourceProvider::LockForRead(ResourceId id) {
LazyCreate(resource);
- if (resource->type == GLTexture && !resource->gl_id) {
- DCHECK(resource->origin != Resource::Internal);
+ if (resource->type == RESOURCE_TYPE_GL_TEXTURE && !resource->gl_id) {
+ DCHECK(resource->origin != Resource::INTERNAL);
DCHECK(resource->mailbox.IsTexture());
// Mailbox sync_points must be processed by a call to
@@ -956,12 +938,12 @@ void ResourceProvider::UnlockForRead(ResourceId id) {
if (resource->marked_for_deletion && !resource->lock_for_read_count) {
if (!resource->child_id) {
// The resource belongs to this ResourceProvider, so it can be destroyed.
- DeleteResourceInternal(it, Normal);
+ DeleteResourceInternal(it, NORMAL);
} else {
ChildMap::iterator child_it = children_.find(resource->child_id);
ResourceIdArray unused;
unused.push_back(id);
- DeleteAndReturnUnusedResourcesToChild(child_it, Normal, unused);
+ DeleteAndReturnUnusedResourcesToChild(child_it, NORMAL, unused);
}
}
}
@@ -977,14 +959,14 @@ ResourceProvider::Resource* ResourceProvider::LockForWrite(ResourceId id) {
bool ResourceProvider::CanLockForWrite(ResourceId id) {
Resource* resource = GetResource(id);
return !resource->locked_for_write && !resource->lock_for_read_count &&
- !resource->exported_count && resource->origin == Resource::Internal &&
+ !resource->exported_count && resource->origin == Resource::INTERNAL &&
!resource->lost && ReadLockFenceHasPassed(resource);
}
void ResourceProvider::UnlockForWrite(ResourceProvider::Resource* resource) {
DCHECK(resource->locked_for_write);
DCHECK_EQ(resource->exported_count, 0);
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
resource->locked_for_write = false;
}
@@ -1082,7 +1064,7 @@ ResourceProvider::ScopedWriteLockGpuMemoryBuffer::
gpu_memory_buffer_(nullptr),
size_(resource_->size),
format_(resource_->format) {
- DCHECK_EQ(GLTexture, resource_->type);
+ DCHECK_EQ(RESOURCE_TYPE_GL_TEXTURE, resource_->type);
std::swap(gpu_memory_buffer_, resource_->gpu_memory_buffer);
}
@@ -1235,7 +1217,7 @@ ResourceProvider::ResourceProvider(
highp_threshold_min_(highp_threshold_min),
next_id_(1),
next_child_(1),
- default_resource_type_(InvalidType),
+ default_resource_type_(RESOURCE_TYPE_INVALID),
use_texture_storage_ext_(false),
use_texture_format_bgra_(false),
use_texture_usage_hint_(false),
@@ -1252,11 +1234,11 @@ ResourceProvider::ResourceProvider(
void ResourceProvider::InitializeSoftware() {
DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK_NE(Bitmap, default_resource_type_);
+ DCHECK_NE(RESOURCE_TYPE_BITMAP, default_resource_type_);
CleanUpGLIfNeeded();
- default_resource_type_ = Bitmap;
+ default_resource_type_ = RESOURCE_TYPE_BITMAP;
// Pick an arbitrary limit here similar to what hardware might.
max_texture_size_ = 16 * 1024;
best_texture_format_ = RGBA_8888;
@@ -1265,11 +1247,11 @@ void ResourceProvider::InitializeSoftware() {
void ResourceProvider::InitializeGL() {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(!texture_uploader_);
- DCHECK_NE(GLTexture, default_resource_type_);
+ DCHECK_NE(RESOURCE_TYPE_GL_TEXTURE, default_resource_type_);
DCHECK(!texture_id_allocator_);
DCHECK(!buffer_id_allocator_);
- default_resource_type_ = GLTexture;
+ default_resource_type_ = RESOURCE_TYPE_GL_TEXTURE;
const ContextProvider::Capabilities& caps =
output_surface_->context_provider()->ContextCapabilities();
@@ -1298,7 +1280,7 @@ void ResourceProvider::InitializeGL() {
void ResourceProvider::CleanUpGLIfNeeded() {
GLES2Interface* gl = ContextGL();
- if (default_resource_type_ != GLTexture) {
+ if (default_resource_type_ != RESOURCE_TYPE_GL_TEXTURE) {
// We are not in GL mode, but double check before returning.
DCHECK(!gl);
DCHECK(!texture_uploader_);
@@ -1311,7 +1293,7 @@ void ResourceProvider::CleanUpGLIfNeeded() {
for (ResourceMap::const_iterator itr = resources_.begin();
itr != resources_.end();
++itr) {
- DCHECK_NE(GLTexture, itr->second.type);
+ DCHECK_NE(RESOURCE_TYPE_GL_TEXTURE, itr->second.type);
}
#endif // DCHECK_IS_ON()
@@ -1335,7 +1317,7 @@ int ResourceProvider::CreateChild(const ReturnCallback& return_callback) {
void ResourceProvider::DestroyChild(int child_id) {
ChildMap::iterator it = children_.find(child_id);
DCHECK(it != children_.end());
- DestroyChildInternal(it, Normal);
+ DestroyChildInternal(it, NORMAL);
}
void ResourceProvider::DestroyChildInternal(ChildMap::iterator it,
@@ -1343,7 +1325,7 @@ void ResourceProvider::DestroyChildInternal(ChildMap::iterator it,
DCHECK(thread_checker_.CalledOnValidThread());
Child& child = it->second;
- DCHECK(style == ForShutdown || !child.marked_for_deletion);
+ DCHECK(style == FOR_SHUTDOWN || !child.marked_for_deletion);
ResourceIdArray resources_for_child;
@@ -1427,21 +1409,14 @@ void ResourceProvider::ReceiveFromChild(
ResourceId local_id = next_id_++;
Resource& resource = resources_[local_id];
if (it->is_software) {
- resource = Resource(it->mailbox_holder.mailbox,
- it->size,
- Resource::Delegated,
- GL_LINEAR,
- it->is_repeated ? GL_REPEAT : GL_CLAMP_TO_EDGE);
+ resource =
+ Resource(it->mailbox_holder.mailbox, it->size, Resource::DELEGATED,
+ GL_LINEAR, it->is_repeated ? GL_REPEAT : GL_CLAMP_TO_EDGE);
} else {
- resource = Resource(0,
- it->size,
- Resource::Delegated,
- it->mailbox_holder.texture_target,
- it->filter,
- 0,
+ resource = Resource(0, it->size, Resource::DELEGATED,
+ it->mailbox_holder.texture_target, it->filter, 0,
it->is_repeated ? GL_REPEAT : GL_CLAMP_TO_EDGE,
- TextureHintImmutable,
- it->format);
+ TEXTURE_HINT_IMMUTABLE, it->format);
resource.mailbox = TextureMailbox(it->mailbox_holder.mailbox,
it->mailbox_holder.texture_target,
it->mailbox_holder.sync_point);
@@ -1486,7 +1461,7 @@ void ResourceProvider::DeclareUsedResourcesFromChild(
if (!resource_is_in_use)
unused.push_back(local_id);
}
- DeleteAndReturnUnusedResourcesToChild(child_it, Normal, unused);
+ DeleteAndReturnUnusedResourcesToChild(child_it, NORMAL, unused);
}
// static
@@ -1553,7 +1528,7 @@ void ResourceProvider::ReceiveReturnsFromParent(
if (returned.sync_point) {
DCHECK(!resource->has_shared_bitmap_id);
- if (resource->origin == Resource::Internal) {
+ if (resource->origin == Resource::INTERNAL) {
DCHECK(resource->gl_id);
GLC(gl, gl->WaitSyncPointCHROMIUM(returned.sync_point));
} else {
@@ -1567,18 +1542,18 @@ void ResourceProvider::ReceiveReturnsFromParent(
if (!resource->child_id) {
// The resource belongs to this ResourceProvider, so it can be destroyed.
- DeleteResourceInternal(map_iterator, Normal);
+ DeleteResourceInternal(map_iterator, NORMAL);
continue;
}
- DCHECK(resource->origin == Resource::Delegated);
+ DCHECK(resource->origin == Resource::DELEGATED);
// Delete the resource and return it to the child it came from one.
if (resource->child_id != child_id) {
if (child_id) {
DCHECK_NE(resources_for_child.size(), 0u);
DCHECK(child_it != children_.end());
- DeleteAndReturnUnusedResourcesToChild(
- child_it, Normal, resources_for_child);
+ DeleteAndReturnUnusedResourcesToChild(child_it, NORMAL,
+ resources_for_child);
resources_for_child.clear();
}
@@ -1592,8 +1567,8 @@ void ResourceProvider::ReceiveReturnsFromParent(
if (child_id) {
DCHECK_NE(resources_for_child.size(), 0u);
DCHECK(child_it != children_.end());
- DeleteAndReturnUnusedResourcesToChild(
- child_it, Normal, resources_for_child);
+ DeleteAndReturnUnusedResourcesToChild(child_it, NORMAL,
+ resources_for_child);
}
}
@@ -1603,7 +1578,7 @@ void ResourceProvider::TransferResource(GLES2Interface* gl,
Resource* source = GetResource(id);
DCHECK(!source->locked_for_write);
DCHECK(!source->lock_for_read_count);
- DCHECK(source->origin != Resource::External || source->mailbox.IsValid());
+ DCHECK(source->origin != Resource::EXTERNAL || source->mailbox.IsValid());
DCHECK(source->allocated);
resource->id = id;
resource->format = source->format;
@@ -1613,13 +1588,13 @@ void ResourceProvider::TransferResource(GLES2Interface* gl,
resource->is_repeated = (source->wrap_mode == GL_REPEAT);
resource->allow_overlay = source->allow_overlay;
- if (source->type == Bitmap) {
+ if (source->type == RESOURCE_TYPE_BITMAP) {
resource->mailbox_holder.mailbox = source->shared_bitmap_id;
resource->is_software = true;
} else if (!source->mailbox.IsValid()) {
LazyCreate(source);
DCHECK(source->gl_id);
- DCHECK(source->origin == Resource::Internal);
+ DCHECK(source->origin == Resource::INTERNAL);
GLC(gl,
gl->BindTexture(resource->mailbox_holder.texture_target,
source->gl_id));
@@ -1638,7 +1613,7 @@ void ResourceProvider::TransferResource(GLES2Interface* gl,
DCHECK(source->mailbox.IsTexture());
if (source->image_id && source->dirty_image) {
DCHECK(source->gl_id);
- DCHECK(source->origin == Resource::Internal);
+ DCHECK(source->origin == Resource::INTERNAL);
GLC(gl,
gl->BindTexture(resource->mailbox_holder.texture_target,
source->gl_id));
@@ -1683,9 +1658,10 @@ void ResourceProvider::DeleteAndReturnUnusedResourcesToChild(
DCHECK(child_info->child_to_parent_map.count(child_id));
bool is_lost =
- resource.lost || (resource.type == GLTexture && lost_output_surface_);
+ resource.lost ||
+ (resource.type == RESOURCE_TYPE_GL_TEXTURE && lost_output_surface_);
if (resource.exported_count > 0 || resource.lock_for_read_count > 0) {
- if (style != ForShutdown) {
+ if (style != FOR_SHUTDOWN) {
// Defer this until we receive the resource back from the parent or
// the read lock is released.
resource.marked_for_deletion = true;
@@ -1714,7 +1690,7 @@ void ResourceProvider::DeleteAndReturnUnusedResourcesToChild(
ReturnedResource returned;
returned.id = child_id;
returned.sync_point = resource.mailbox.sync_point();
- if (!returned.sync_point && resource.type == GLTexture)
+ if (!returned.sync_point && resource.type == RESOURCE_TYPE_GL_TEXTURE)
need_sync_point = true;
returned.count = resource.imported_count;
returned.lost = is_lost;
@@ -1750,12 +1726,12 @@ void ResourceProvider::AcquirePixelBuffer(ResourceId id) {
"ResourceProvider::AcquirePixelBuffer");
Resource* resource = GetResource(id);
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
DCHECK_EQ(resource->exported_count, 0);
DCHECK(!resource->image_id);
DCHECK_NE(ETC1, resource->format);
- DCHECK_EQ(GLTexture, resource->type);
+ DCHECK_EQ(RESOURCE_TYPE_GL_TEXTURE, resource->type);
GLES2Interface* gl = ContextGL();
DCHECK(gl);
if (!resource->gl_pixel_buffer_id)
@@ -1776,7 +1752,7 @@ void ResourceProvider::ReleasePixelBuffer(ResourceId id) {
"ResourceProvider::ReleasePixelBuffer");
Resource* resource = GetResource(id);
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
DCHECK_EQ(resource->exported_count, 0);
DCHECK(!resource->image_id);
@@ -1792,7 +1768,7 @@ void ResourceProvider::ReleasePixelBuffer(ResourceId id) {
resource->locked_for_write = false;
}
- DCHECK_EQ(GLTexture, resource->type);
+ DCHECK_EQ(RESOURCE_TYPE_GL_TEXTURE, resource->type);
if (!resource->gl_pixel_buffer_id)
return;
GLES2Interface* gl = ContextGL();
@@ -1809,12 +1785,12 @@ uint8_t* ResourceProvider::MapPixelBuffer(ResourceId id, int* stride) {
"ResourceProvider::MapPixelBuffer");
Resource* resource = GetResource(id);
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
DCHECK_EQ(resource->exported_count, 0);
DCHECK(!resource->image_id);
*stride = 0;
- DCHECK_EQ(GLTexture, resource->type);
+ DCHECK_EQ(RESOURCE_TYPE_GL_TEXTURE, resource->type);
GLES2Interface* gl = ContextGL();
DCHECK(gl);
DCHECK(resource->gl_pixel_buffer_id);
@@ -1833,11 +1809,11 @@ void ResourceProvider::UnmapPixelBuffer(ResourceId id) {
"ResourceProvider::UnmapPixelBuffer");
Resource* resource = GetResource(id);
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
DCHECK_EQ(resource->exported_count, 0);
DCHECK(!resource->image_id);
- DCHECK_EQ(GLTexture, resource->type);
+ DCHECK_EQ(RESOURCE_TYPE_GL_TEXTURE, resource->type);
GLES2Interface* gl = ContextGL();
DCHECK(gl);
DCHECK(resource->gl_pixel_buffer_id);
@@ -1881,7 +1857,7 @@ void ResourceProvider::BeginSetPixels(ResourceId id) {
DCHECK(!resource->pending_set_pixels);
LazyCreate(resource);
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
DCHECK(resource->gl_id || resource->allocated);
DCHECK(ReadLockFenceHasPassed(resource));
DCHECK(!resource->image_id);
@@ -1890,7 +1866,7 @@ void ResourceProvider::BeginSetPixels(ResourceId id) {
resource->allocated = true;
LockForWrite(id);
- DCHECK_EQ(GLTexture, resource->type);
+ DCHECK_EQ(RESOURCE_TYPE_GL_TEXTURE, resource->type);
DCHECK(resource->gl_id);
GLES2Interface* gl = ContextGL();
DCHECK(gl);
@@ -1992,14 +1968,15 @@ GLenum ResourceProvider::TargetForTesting(ResourceId id) {
}
void ResourceProvider::LazyCreate(Resource* resource) {
- if (resource->type != GLTexture || resource->origin != Resource::Internal)
+ if (resource->type != RESOURCE_TYPE_GL_TEXTURE ||
+ resource->origin != Resource::INTERNAL)
return;
if (resource->gl_id)
return;
DCHECK(resource->texture_pool);
- DCHECK(resource->origin == Resource::Internal);
+ DCHECK(resource->origin == Resource::INTERNAL);
DCHECK(!resource->mailbox.IsValid());
resource->gl_id = texture_id_allocator_->NextId();
@@ -2023,7 +2000,7 @@ void ResourceProvider::LazyCreate(Resource* resource) {
GLC(gl,
gl->TexParameteri(
resource->target, GL_TEXTURE_POOL_CHROMIUM, resource->texture_pool));
- if (use_texture_usage_hint_ && (resource->hint & TextureHintFramebuffer)) {
+ if (use_texture_usage_hint_ && (resource->hint & TEXTURE_HINT_FRAMEBUFFER)) {
GLC(gl,
gl->TexParameteri(resource->target,
GL_TEXTURE_USAGE_ANGLE,
@@ -2050,7 +2027,7 @@ void ResourceProvider::LazyAllocate(Resource* resource) {
GLC(gl, gl->BindTexture(GL_TEXTURE_2D, resource->gl_id));
if (use_texture_storage_ext_ &&
IsFormatSupportedForStorage(format, use_texture_format_bgra_) &&
- (resource->hint & TextureHintImmutable)) {
+ (resource->hint & TEXTURE_HINT_IMMUTABLE)) {
GLenum storage_format = TextureToStorageFormat(format);
GLC(gl,
gl->TexStorage2DEXT(
@@ -2090,18 +2067,18 @@ void ResourceProvider::CopyResource(ResourceId source_id, ResourceId dest_id) {
Resource* source_resource = GetResource(source_id);
DCHECK(!source_resource->lock_for_read_count);
- DCHECK(source_resource->origin == Resource::Internal);
+ DCHECK(source_resource->origin == Resource::INTERNAL);
DCHECK_EQ(source_resource->exported_count, 0);
- DCHECK_EQ(GLTexture, source_resource->type);
+ DCHECK_EQ(RESOURCE_TYPE_GL_TEXTURE, source_resource->type);
DCHECK(source_resource->allocated);
LazyCreate(source_resource);
Resource* dest_resource = GetResource(dest_id);
DCHECK(!dest_resource->locked_for_write);
DCHECK(!dest_resource->lock_for_read_count);
- DCHECK(dest_resource->origin == Resource::Internal);
+ DCHECK(dest_resource->origin == Resource::INTERNAL);
DCHECK_EQ(dest_resource->exported_count, 0);
- DCHECK_EQ(GLTexture, dest_resource->type);
+ DCHECK_EQ(RESOURCE_TYPE_GL_TEXTURE, dest_resource->type);
LazyAllocate(dest_resource);
DCHECK_EQ(source_resource->type, dest_resource->type);
@@ -2162,7 +2139,7 @@ void ResourceProvider::WaitSyncPointIfNeeded(ResourceId id) {
Resource* resource = GetResource(id);
DCHECK_EQ(resource->exported_count, 0);
DCHECK(resource->allocated);
- if (resource->type != GLTexture || resource->gl_id)
+ if (resource->type != RESOURCE_TYPE_GL_TEXTURE || resource->gl_id)
return;
if (!resource->mailbox.sync_point())
return;
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h
index 6315140..95e1294 100644
--- a/cc/resources/resource_provider.h
+++ b/cc/resources/resource_provider.h
@@ -67,16 +67,16 @@ class CC_EXPORT ResourceProvider {
typedef std::set<ResourceId> ResourceIdSet;
typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap;
enum TextureHint {
- TextureHintDefault = 0x0,
- TextureHintImmutable = 0x1,
- TextureHintFramebuffer = 0x2,
- TextureHintImmutableFramebuffer =
- TextureHintImmutable | TextureHintFramebuffer
+ TEXTURE_HINT_DEFAULT = 0x0,
+ TEXTURE_HINT_IMMUTABLE = 0x1,
+ TEXTURE_HINT_FRAMEBUFFER = 0x2,
+ TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER =
+ TEXTURE_HINT_IMMUTABLE | TEXTURE_HINT_FRAMEBUFFER
};
enum ResourceType {
- InvalidType = 0,
- GLTexture = 1,
- Bitmap,
+ RESOURCE_TYPE_INVALID = 0,
+ RESOURCE_TYPE_GL_TEXTURE = 1,
+ RESOURCE_TYPE_BITMAP,
};
static scoped_ptr<ResourceProvider> Create(
@@ -438,7 +438,7 @@ class CC_EXPORT ResourceProvider {
private:
struct Resource {
- enum Origin { Internal, External, Delegated };
+ enum Origin { INTERNAL, EXTERNAL, DELEGATED };
Resource();
~Resource();
@@ -551,8 +551,8 @@ class CC_EXPORT ResourceProvider {
ResourceId id,
TransferableResource* resource);
enum DeleteStyle {
- Normal,
- ForShutdown,
+ NORMAL,
+ FOR_SHUTDOWN,
};
void DeleteResourceInternal(ResourceMap::iterator it, DeleteStyle style);
void DeleteAndReturnUnusedResourcesToChild(ChildMap::iterator child_it,
diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc
index 7717894..fdd7fc0 100644
--- a/cc/resources/resource_provider_unittest.cc
+++ b/cc/resources/resource_provider_unittest.cc
@@ -354,14 +354,14 @@ void GetResourcePixels(ResourceProvider* resource_provider,
uint8_t* pixels) {
resource_provider->WaitSyncPointIfNeeded(id);
switch (resource_provider->default_resource_type()) {
- case ResourceProvider::GLTexture: {
+ case ResourceProvider::RESOURCE_TYPE_GL_TEXTURE: {
ResourceProvider::ScopedReadLockGL lock_gl(resource_provider, id);
ASSERT_NE(0U, lock_gl.texture_id());
context->bindTexture(GL_TEXTURE_2D, lock_gl.texture_id());
context->GetPixels(size, format, pixels);
break;
}
- case ResourceProvider::Bitmap: {
+ case ResourceProvider::RESOURCE_TYPE_BITMAP: {
ResourceProvider::ScopedReadLockSoftware lock_software(resource_provider,
id);
memcpy(pixels,
@@ -369,7 +369,7 @@ void GetResourcePixels(ResourceProvider* resource_provider,
lock_software.sk_bitmap()->getSize());
break;
}
- case ResourceProvider::InvalidType:
+ case ResourceProvider::RESOURCE_TYPE_INVALID:
NOTREACHED();
break;
}
@@ -384,7 +384,7 @@ class ResourceProviderTest
child_context_(NULL),
main_thread_task_runner_(BlockingTaskRunner::Create(NULL)) {
switch (GetParam()) {
- case ResourceProvider::GLTexture: {
+ case ResourceProvider::RESOURCE_TYPE_GL_TEXTURE: {
scoped_ptr<ResourceProviderContext> context3d(
ResourceProviderContext::Create(shared_data_.get()));
context3d_ = context3d.get();
@@ -401,13 +401,13 @@ class ResourceProviderTest
FakeOutputSurface::Create3d(child_context_owned.Pass());
break;
}
- case ResourceProvider::Bitmap:
+ case ResourceProvider::RESOURCE_TYPE_BITMAP:
output_surface_ = FakeOutputSurface::CreateSoftware(
make_scoped_ptr(new SoftwareOutputDevice));
child_output_surface_ = FakeOutputSurface::CreateSoftware(
make_scoped_ptr(new SoftwareOutputDevice));
break;
- case ResourceProvider::InvalidType:
+ case ResourceProvider::RESOURCE_TYPE_INVALID:
NOTREACHED();
break;
}
@@ -458,7 +458,7 @@ class ResourceProviderTest
bool* lost_resource,
bool* release_called,
uint32* sync_point) {
- if (GetParam() == ResourceProvider::GLTexture) {
+ if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
unsigned texture = child_context_->createTexture();
gpu::Mailbox gpu_mailbox;
child_context_->bindTexture(GL_TEXTURE_2D, texture);
@@ -516,14 +516,14 @@ void CheckCreateResource(ResourceProvider::ResourceType expected_default_type,
ASSERT_EQ(4U, pixel_size);
ResourceProvider::ResourceId id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
EXPECT_EQ(1, static_cast<int>(resource_provider->num_resources()));
- if (expected_default_type == ResourceProvider::GLTexture)
+ if (expected_default_type == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
EXPECT_EQ(0u, context->NumTextures());
uint8_t data[4] = { 1, 2, 3, 4 };
resource_provider->CopyToResource(id, data, size);
- if (expected_default_type == ResourceProvider::GLTexture)
+ if (expected_default_type == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
EXPECT_EQ(1u, context->NumTextures());
uint8_t result[4] = { 0 };
@@ -532,7 +532,7 @@ void CheckCreateResource(ResourceProvider::ResourceType expected_default_type,
resource_provider->DeleteResource(id);
EXPECT_EQ(0, static_cast<int>(resource_provider->num_resources()));
- if (expected_default_type == ResourceProvider::GLTexture)
+ if (expected_default_type == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
EXPECT_EQ(0u, context->NumTextures());
}
@@ -547,7 +547,7 @@ TEST_P(ResourceProviderTest, Upload) {
ASSERT_EQ(16U, pixel_size);
ResourceProvider::ResourceId id = resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t image[16] = { 0 };
gfx::Rect image_rect(size);
@@ -614,7 +614,7 @@ TEST_P(ResourceProviderTest, SimpleUpload) {
ASSERT_EQ(16U, pixel_size);
ResourceProvider::ResourceId id = resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t image[16] = {0};
resource_provider_->CopyToResource(id, image, size);
@@ -640,7 +640,7 @@ TEST_P(ResourceProviderTest, SimpleUpload) {
}
TEST_P(ResourceProviderTest, TransferGLResources) {
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
gfx::Size size(1, 1);
ResourceFormat format = RGBA_8888;
@@ -648,17 +648,17 @@ TEST_P(ResourceProviderTest, TransferGLResources) {
ASSERT_EQ(4U, pixel_size);
ResourceProvider::ResourceId id1 = child_resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t data1[4] = { 1, 2, 3, 4 };
child_resource_provider_->CopyToResource(id1, data1, size);
ResourceProvider::ResourceId id2 = child_resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t data2[4] = { 5, 5, 5, 5 };
child_resource_provider_->CopyToResource(id2, data2, size);
ResourceProvider::ResourceId id3 = child_resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
{
ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock(
child_resource_provider_.get(), id3);
@@ -885,13 +885,13 @@ TEST_P(ResourceProviderTest, TransferGLResources) {
}
TEST_P(ResourceProviderTest, ReadLockCountStopsReturnToChildOrDelete) {
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
gfx::Size size(1, 1);
ResourceFormat format = RGBA_8888;
ResourceProvider::ResourceId id1 = child_resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t data1[4] = {1, 2, 3, 4};
child_resource_provider_->CopyToResource(id1, data1, size);
@@ -937,7 +937,7 @@ TEST_P(ResourceProviderTest, ReadLockCountStopsReturnToChildOrDelete) {
TEST_P(ResourceProviderTest, AllowOverlayTransfersToParent) {
// Overlays only supported on the GL path.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
uint32 sync_point = 0;
@@ -987,7 +987,7 @@ TEST_P(ResourceProviderTest, AllowOverlayTransfersToParent) {
}
TEST_P(ResourceProviderTest, TransferSoftwareResources) {
- if (GetParam() != ResourceProvider::Bitmap)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_BITMAP)
return;
gfx::Size size(1, 1);
@@ -996,12 +996,12 @@ TEST_P(ResourceProviderTest, TransferSoftwareResources) {
ASSERT_EQ(4U, pixel_size);
ResourceProvider::ResourceId id1 = child_resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t data1[4] = { 1, 2, 3, 4 };
child_resource_provider_->CopyToResource(id1, data1, size);
ResourceProvider::ResourceId id2 = child_resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t data2[4] = { 5, 5, 5, 5 };
child_resource_provider_->CopyToResource(id2, data2, size);
@@ -1171,7 +1171,7 @@ TEST_P(ResourceProviderTest, TransferSoftwareResources) {
}
TEST_P(ResourceProviderTest, TransferGLToSoftware) {
- if (GetParam() != ResourceProvider::Bitmap)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_BITMAP)
return;
scoped_ptr<ResourceProviderContext> child_context_owned(
@@ -1197,7 +1197,7 @@ TEST_P(ResourceProviderTest, TransferGLToSoftware) {
ASSERT_EQ(4U, pixel_size);
ResourceProvider::ResourceId id1 = child_resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t data1[4] = { 1, 2, 3, 4 };
child_resource_provider->CopyToResource(id1, data1, size);
@@ -1234,7 +1234,7 @@ TEST_P(ResourceProviderTest, TransferGLToSoftware) {
}
TEST_P(ResourceProviderTest, TransferInvalidSoftware) {
- if (GetParam() != ResourceProvider::Bitmap)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_BITMAP)
return;
gfx::Size size(1, 1);
@@ -1243,7 +1243,7 @@ TEST_P(ResourceProviderTest, TransferInvalidSoftware) {
ASSERT_EQ(4U, pixel_size);
ResourceProvider::ResourceId id1 = child_resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t data1[4] = { 1, 2, 3, 4 };
child_resource_provider_->CopyToResource(id1, data1, size);
@@ -1290,12 +1290,12 @@ TEST_P(ResourceProviderTest, DeleteExportedResources) {
ASSERT_EQ(4U, pixel_size);
ResourceProvider::ResourceId id1 = child_resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t data1[4] = { 1, 2, 3, 4 };
child_resource_provider_->CopyToResource(id1, data1, size);
ResourceProvider::ResourceId id2 = child_resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t data2[4] = {5, 5, 5, 5};
child_resource_provider_->CopyToResource(id2, data2, size);
@@ -1311,7 +1311,7 @@ TEST_P(ResourceProviderTest, DeleteExportedResources) {
child_resource_provider_->PrepareSendToParent(resource_ids_to_transfer,
&list);
ASSERT_EQ(2u, list.size());
- if (GetParam() == ResourceProvider::GLTexture) {
+ if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
EXPECT_NE(0u, list[0].mailbox_holder.sync_point);
EXPECT_NE(0u, list[1].mailbox_holder.sync_point);
}
@@ -1341,7 +1341,7 @@ TEST_P(ResourceProviderTest, DeleteExportedResources) {
resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list);
ASSERT_EQ(2u, list.size());
- if (GetParam() == ResourceProvider::GLTexture) {
+ if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
EXPECT_NE(0u, list[0].mailbox_holder.sync_point);
EXPECT_NE(0u, list[1].mailbox_holder.sync_point);
}
@@ -1367,7 +1367,7 @@ TEST_P(ResourceProviderTest, DeleteExportedResources) {
EXPECT_EQ(0u, resource_provider_->num_resources());
ASSERT_EQ(2u, returned_to_child.size());
- if (GetParam() == ResourceProvider::GLTexture) {
+ if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
EXPECT_NE(0u, returned_to_child[0].sync_point);
EXPECT_NE(0u, returned_to_child[1].sync_point);
}
@@ -1383,12 +1383,12 @@ TEST_P(ResourceProviderTest, DestroyChildWithExportedResources) {
ASSERT_EQ(4U, pixel_size);
ResourceProvider::ResourceId id1 = child_resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t data1[4] = {1, 2, 3, 4};
child_resource_provider_->CopyToResource(id1, data1, size);
ResourceProvider::ResourceId id2 = child_resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t data2[4] = {5, 5, 5, 5};
child_resource_provider_->CopyToResource(id2, data2, size);
@@ -1404,7 +1404,7 @@ TEST_P(ResourceProviderTest, DestroyChildWithExportedResources) {
child_resource_provider_->PrepareSendToParent(resource_ids_to_transfer,
&list);
ASSERT_EQ(2u, list.size());
- if (GetParam() == ResourceProvider::GLTexture) {
+ if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
EXPECT_NE(0u, list[0].mailbox_holder.sync_point);
EXPECT_NE(0u, list[1].mailbox_holder.sync_point);
}
@@ -1434,7 +1434,7 @@ TEST_P(ResourceProviderTest, DestroyChildWithExportedResources) {
resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list);
ASSERT_EQ(2u, list.size());
- if (GetParam() == ResourceProvider::GLTexture) {
+ if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
EXPECT_NE(0u, list[0].mailbox_holder.sync_point);
EXPECT_NE(0u, list[1].mailbox_holder.sync_point);
}
@@ -1469,7 +1469,7 @@ TEST_P(ResourceProviderTest, DestroyChildWithExportedResources) {
EXPECT_EQ(1u, resource_provider_->num_resources());
ASSERT_EQ(1u, returned_to_child.size());
- if (GetParam() == ResourceProvider::GLTexture) {
+ if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
EXPECT_NE(0u, returned_to_child[0].sync_point);
}
EXPECT_FALSE(returned_to_child[0].lost);
@@ -1479,7 +1479,7 @@ TEST_P(ResourceProviderTest, DestroyChildWithExportedResources) {
// lost at this point, and returned.
resource_provider_ = nullptr;
ASSERT_EQ(1u, returned_to_child.size());
- if (GetParam() == ResourceProvider::GLTexture) {
+ if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
EXPECT_NE(0u, returned_to_child[0].sync_point);
}
EXPECT_TRUE(returned_to_child[0].lost);
@@ -1493,7 +1493,7 @@ TEST_P(ResourceProviderTest, DeleteTransferredResources) {
ASSERT_EQ(4U, pixel_size);
ResourceProvider::ResourceId id = child_resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t data[4] = { 1, 2, 3, 4 };
child_resource_provider_->CopyToResource(id, data, size);
@@ -1508,7 +1508,7 @@ TEST_P(ResourceProviderTest, DeleteTransferredResources) {
child_resource_provider_->PrepareSendToParent(resource_ids_to_transfer,
&list);
ASSERT_EQ(1u, list.size());
- if (GetParam() == ResourceProvider::GLTexture)
+ if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
EXPECT_NE(0u, list[0].mailbox_holder.sync_point);
EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id));
resource_provider_->ReceiveFromChild(child_id, list);
@@ -1528,7 +1528,7 @@ TEST_P(ResourceProviderTest, DeleteTransferredResources) {
resource_provider_->DeclareUsedResourcesFromChild(child_id, no_resources);
ASSERT_EQ(1u, returned_to_child.size());
- if (GetParam() == ResourceProvider::GLTexture)
+ if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
EXPECT_NE(0u, returned_to_child[0].sync_point);
child_resource_provider_->ReceiveReturnsFromParent(returned_to_child);
}
@@ -1542,7 +1542,7 @@ TEST_P(ResourceProviderTest, UnuseTransferredResources) {
ASSERT_EQ(4U, pixel_size);
ResourceProvider::ResourceId id = child_resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
uint8_t data[4] = {1, 2, 3, 4};
child_resource_provider_->CopyToResource(id, data, size);
@@ -1694,7 +1694,8 @@ class ResourceProviderTestTextureFilters : public ResourceProviderTest {
ASSERT_EQ(4U, pixel_size);
ResourceProvider::ResourceId id = child_resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
+ format);
// The new texture is created with GL_LINEAR.
EXPECT_CALL(*child_context, bindTexture(GL_TEXTURE_2D, child_texture_id))
@@ -1819,20 +1820,20 @@ class ResourceProviderTestTextureFilters : public ResourceProviderTest {
};
TEST_P(ResourceProviderTest, TextureFilters_ChildNearestParentLinear) {
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
ResourceProviderTestTextureFilters::RunTest(GL_NEAREST, GL_LINEAR);
}
TEST_P(ResourceProviderTest, TextureFilters_ChildLinearParentNearest) {
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
ResourceProviderTestTextureFilters::RunTest(GL_LINEAR, GL_NEAREST);
}
TEST_P(ResourceProviderTest, TransferMailboxResources) {
// Other mailbox transfers tested elsewhere.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
unsigned texture = context()->createTexture();
context()->bindTexture(GL_TEXTURE_2D, texture);
@@ -1964,13 +1965,12 @@ TEST_P(ResourceProviderTest, LostResourceInParent) {
ResourceFormat format = RGBA_8888;
ResourceProvider::ResourceId resource =
child_resource_provider_->CreateResource(
- size,
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
format);
child_resource_provider_->AllocateForTesting(resource);
// Expect a GL resource to be lost.
- bool should_lose_resource = GetParam() == ResourceProvider::GLTexture;
+ bool should_lose_resource =
+ GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE;
ReturnedResourceArray returned_to_child;
int child_id =
@@ -2020,9 +2020,7 @@ TEST_P(ResourceProviderTest, LostResourceInGrandParent) {
ResourceFormat format = RGBA_8888;
ResourceProvider::ResourceId resource =
child_resource_provider_->CreateResource(
- size,
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
format);
child_resource_provider_->AllocateForTesting(resource);
@@ -2133,7 +2131,7 @@ TEST_P(ResourceProviderTest, LostMailboxInParent) {
ASSERT_EQ(1u, returned_to_child.size());
// Losing an output surface only loses hardware resources.
EXPECT_EQ(returned_to_child[0].lost,
- GetParam() == ResourceProvider::GLTexture);
+ GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE);
child_resource_provider_->ReceiveReturnsFromParent(returned_to_child);
returned_to_child.clear();
}
@@ -2141,7 +2139,8 @@ TEST_P(ResourceProviderTest, LostMailboxInParent) {
// Delete the resource in the child. Expect the resource to be lost if it's
// a GL texture.
child_resource_provider_->DeleteResource(resource);
- EXPECT_EQ(lost_resource, GetParam() == ResourceProvider::GLTexture);
+ EXPECT_EQ(lost_resource,
+ GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE);
}
TEST_P(ResourceProviderTest, LostMailboxInGrandParent) {
@@ -2225,7 +2224,7 @@ TEST_P(ResourceProviderTest, Shutdown) {
child_resource_provider_ = nullptr;
- if (GetParam() == ResourceProvider::GLTexture) {
+ if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) {
EXPECT_LE(sync_point, release_sync_point);
}
EXPECT_TRUE(release_called);
@@ -2259,7 +2258,7 @@ TEST_P(ResourceProviderTest, ShutdownWithExportedResource) {
TEST_P(ResourceProviderTest, LostContext) {
// TextureMailbox callbacks only exist for GL textures for now.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
unsigned texture = context()->createTexture();
context()->bindTexture(GL_TEXTURE_2D, texture);
@@ -2295,7 +2294,7 @@ TEST_P(ResourceProviderTest, LostContext) {
TEST_P(ResourceProviderTest, ScopedSampler) {
// Sampling is only supported for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<TextureStateTrackingContext> context_owned(
@@ -2321,7 +2320,7 @@ TEST_P(ResourceProviderTest, ScopedSampler) {
int texture_id = 1;
ResourceProvider::ResourceId id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
// Check that the texture gets created with the right sampler settings.
EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id))
@@ -2382,7 +2381,7 @@ TEST_P(ResourceProviderTest, ScopedSampler) {
TEST_P(ResourceProviderTest, ManagedResource) {
// Sampling is only supported for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<TextureStateTrackingContext> context_owned(
@@ -2409,11 +2408,8 @@ TEST_P(ResourceProviderTest, ManagedResource) {
// Check that the texture gets created with the right sampler settings.
ResourceProvider::ResourceId id = resource_provider->CreateManagedResource(
- size,
- GL_TEXTURE_2D,
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
- format);
+ size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id));
EXPECT_CALL(*context,
texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
@@ -2437,7 +2433,7 @@ TEST_P(ResourceProviderTest, ManagedResource) {
TEST_P(ResourceProviderTest, TextureWrapMode) {
// Sampling is only supported for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<TextureStateTrackingContext> context_owned(
@@ -2466,12 +2462,8 @@ TEST_P(ResourceProviderTest, TextureWrapMode) {
GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT;
// Check that the texture gets created with the right sampler settings.
ResourceProvider::ResourceId id = resource_provider->CreateGLTexture(
- size,
- GL_TEXTURE_2D,
- texture_pool,
- wrap_mode,
- ResourceProvider::TextureHintImmutable,
- format);
+ size, GL_TEXTURE_2D, texture_pool, wrap_mode,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id));
EXPECT_CALL(*context,
texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
@@ -2494,7 +2486,7 @@ TEST_P(ResourceProviderTest, TextureWrapMode) {
TEST_P(ResourceProviderTest, TextureHint) {
// Sampling is only supported for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<TextureStateTrackingContext> context_owned(
@@ -2522,10 +2514,10 @@ TEST_P(ResourceProviderTest, TextureHint) {
GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM;
const ResourceProvider::TextureHint hints[4] = {
- ResourceProvider::TextureHintDefault,
- ResourceProvider::TextureHintImmutable,
- ResourceProvider::TextureHintFramebuffer,
- ResourceProvider::TextureHintImmutableFramebuffer,
+ ResourceProvider::TEXTURE_HINT_DEFAULT,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE,
+ ResourceProvider::TEXTURE_HINT_FRAMEBUFFER,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER,
};
for (GLuint texture_id = 1; texture_id <= arraysize(hints); ++texture_id) {
// Check that the texture gets created with the right sampler settings.
@@ -2551,9 +2543,9 @@ TEST_P(ResourceProviderTest, TextureHint) {
texParameteri(GL_TEXTURE_2D,
GL_TEXTURE_POOL_CHROMIUM,
GL_TEXTURE_POOL_UNMANAGED_CHROMIUM));
- // Check only TextureHintFramebuffer set GL_TEXTURE_USAGE_ANGLE.
+ // Check only TEXTURE_HINT_FRAMEBUFFER set GL_TEXTURE_USAGE_ANGLE.
bool is_framebuffer_hint =
- hints[texture_id - 1] & ResourceProvider::TextureHintFramebuffer;
+ hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_FRAMEBUFFER;
EXPECT_CALL(*context,
texParameteri(GL_TEXTURE_2D,
GL_TEXTURE_USAGE_ANGLE,
@@ -2567,7 +2559,7 @@ TEST_P(ResourceProviderTest, TextureHint) {
}
TEST_P(ResourceProviderTest, TextureMailbox_SharedMemory) {
- if (GetParam() != ResourceProvider::Bitmap)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_BITMAP)
return;
gfx::Size size(64, 64);
@@ -2721,7 +2713,7 @@ class ResourceProviderTestTextureMailboxGLFilters
TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToLinear) {
// Mailboxing is only supported for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
ResourceProviderTestTextureMailboxGLFilters::RunTest(
@@ -2734,7 +2726,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToLinear) {
TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_NearestToNearest) {
// Mailboxing is only supported for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
ResourceProviderTestTextureMailboxGLFilters::RunTest(
@@ -2747,7 +2739,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_NearestToNearest) {
TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_NearestToLinear) {
// Mailboxing is only supported for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
ResourceProviderTestTextureMailboxGLFilters::RunTest(
@@ -2760,7 +2752,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_NearestToLinear) {
TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToNearest) {
// Mailboxing is only supported for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
ResourceProviderTestTextureMailboxGLFilters::RunTest(
@@ -2773,7 +2765,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToNearest) {
TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) {
// Mailboxing is only supported for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<TextureStateTrackingContext> context_owned(
@@ -2848,7 +2840,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) {
TEST_P(ResourceProviderTest,
TextureMailbox_WaitSyncPointIfNeeded_WithSyncPoint) {
// Mailboxing is only supported for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<TextureStateTrackingContext> context_owned(
@@ -2907,7 +2899,7 @@ TEST_P(ResourceProviderTest,
TEST_P(ResourceProviderTest, TextureMailbox_WaitSyncPointIfNeeded_NoSyncPoint) {
// Mailboxing is only supported for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<TextureStateTrackingContext> context_owned(
@@ -3034,7 +3026,7 @@ class AllocationTrackingContext3D : public TestWebGraphicsContext3D {
TEST_P(ResourceProviderTest, TextureAllocation) {
// Only for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<AllocationTrackingContext3D> context_owned(
new StrictMock<AllocationTrackingContext3D>);
@@ -3063,7 +3055,7 @@ TEST_P(ResourceProviderTest, TextureAllocation) {
// Lazy allocation. Don't allocate when creating the resource.
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(1);
@@ -3076,7 +3068,7 @@ TEST_P(ResourceProviderTest, TextureAllocation) {
// Do allocate when we set the pixels.
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3);
@@ -3091,7 +3083,7 @@ TEST_P(ResourceProviderTest, TextureAllocation) {
// Same for async version.
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
resource_provider->AcquirePixelBuffer(id);
EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
@@ -3111,7 +3103,7 @@ TEST_P(ResourceProviderTest, TextureAllocation) {
TEST_P(ResourceProviderTest, TextureAllocationHint) {
// Only for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<AllocationTrackingContext3D> context_owned(
new StrictMock<AllocationTrackingContext3D>);
@@ -3137,10 +3129,10 @@ TEST_P(ResourceProviderTest, TextureAllocationHint) {
const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888};
const ResourceProvider::TextureHint hints[4] = {
- ResourceProvider::TextureHintDefault,
- ResourceProvider::TextureHintImmutable,
- ResourceProvider::TextureHintFramebuffer,
- ResourceProvider::TextureHintImmutableFramebuffer,
+ ResourceProvider::TEXTURE_HINT_DEFAULT,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE,
+ ResourceProvider::TEXTURE_HINT_FRAMEBUFFER,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER,
};
for (size_t i = 0; i < arraysize(formats); ++i) {
for (GLuint texture_id = 1; texture_id <= arraysize(hints); ++texture_id) {
@@ -3151,7 +3143,7 @@ TEST_P(ResourceProviderTest, TextureAllocationHint) {
EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2);
bool is_immutable_hint =
- hints[texture_id - 1] & ResourceProvider::TextureHintImmutable;
+ hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_IMMUTABLE;
bool support_immutable_texture =
is_immutable_hint && formats[i] == RGBA_8888;
EXPECT_CALL(*context, texStorage2DEXT(_, _, _, 2, 2))
@@ -3170,7 +3162,7 @@ TEST_P(ResourceProviderTest, TextureAllocationHint) {
TEST_P(ResourceProviderTest, TextureAllocationHint_BGRA) {
// Only for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<AllocationTrackingContext3D> context_owned(
new StrictMock<AllocationTrackingContext3D>);
@@ -3197,10 +3189,10 @@ TEST_P(ResourceProviderTest, TextureAllocationHint_BGRA) {
const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888};
const ResourceProvider::TextureHint hints[4] = {
- ResourceProvider::TextureHintDefault,
- ResourceProvider::TextureHintImmutable,
- ResourceProvider::TextureHintFramebuffer,
- ResourceProvider::TextureHintImmutableFramebuffer,
+ ResourceProvider::TEXTURE_HINT_DEFAULT,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE,
+ ResourceProvider::TEXTURE_HINT_FRAMEBUFFER,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER,
};
for (size_t i = 0; i < arraysize(formats); ++i) {
for (GLuint texture_id = 1; texture_id <= arraysize(hints); ++texture_id) {
@@ -3211,7 +3203,7 @@ TEST_P(ResourceProviderTest, TextureAllocationHint_BGRA) {
EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2);
bool is_immutable_hint =
- hints[texture_id - 1] & ResourceProvider::TextureHintImmutable;
+ hints[texture_id - 1] & ResourceProvider::TEXTURE_HINT_IMMUTABLE;
EXPECT_CALL(*context, texStorage2DEXT(_, _, _, 2, 2))
.Times(is_immutable_hint ? 1 : 0);
EXPECT_CALL(*context, texImage2D(_, _, _, 2, 2, _, _, _, _))
@@ -3227,7 +3219,7 @@ TEST_P(ResourceProviderTest, TextureAllocationHint_BGRA) {
}
TEST_P(ResourceProviderTest, PixelBuffer_GLTexture) {
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<AllocationTrackingContext3D> context_owned(
new StrictMock<AllocationTrackingContext3D>);
@@ -3253,7 +3245,7 @@ TEST_P(ResourceProviderTest, PixelBuffer_GLTexture) {
1));
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
resource_provider->AcquirePixelBuffer(id);
EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
@@ -3274,7 +3266,7 @@ TEST_P(ResourceProviderTest, PixelBuffer_GLTexture) {
TEST_P(ResourceProviderTest, ForcingAsyncUploadToComplete) {
// Only for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<AllocationTrackingContext3D> context_owned(
new StrictMock<AllocationTrackingContext3D>);
@@ -3300,7 +3292,7 @@ TEST_P(ResourceProviderTest, ForcingAsyncUploadToComplete) {
1));
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
resource_provider->AcquirePixelBuffer(id);
EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
@@ -3349,7 +3341,7 @@ TEST_P(ResourceProviderTest, PixelBufferLostContext) {
EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id));
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
GL_INNOCENT_CONTEXT_RESET_ARB);
@@ -3363,7 +3355,7 @@ TEST_P(ResourceProviderTest, PixelBufferLostContext) {
TEST_P(ResourceProviderTest, Image_GLTexture) {
// Only for GL textures.
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<AllocationTrackingContext3D> context_owned(
new StrictMock<AllocationTrackingContext3D>);
@@ -3392,7 +3384,7 @@ TEST_P(ResourceProviderTest, Image_GLTexture) {
1));
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA))
.WillOnce(Return(kImageId))
@@ -3447,7 +3439,7 @@ TEST_P(ResourceProviderTest, Image_GLTexture) {
}
TEST_P(ResourceProviderTest, CopyResource_GLTexture) {
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<AllocationTrackingContext3D> context_owned(
new StrictMock<AllocationTrackingContext3D>);
@@ -3479,7 +3471,7 @@ TEST_P(ResourceProviderTest, CopyResource_GLTexture) {
1));
source_id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA))
.WillOnce(Return(kImageId))
@@ -3492,7 +3484,7 @@ TEST_P(ResourceProviderTest, CopyResource_GLTexture) {
Mock::VerifyAndClearExpectations(context);
dest_id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
EXPECT_CALL(*context, NextTextureId())
.WillOnce(Return(kDestTextureId))
@@ -3541,7 +3533,8 @@ void InitializeGLAndCheck(ContextSharedData* shared_data,
output_surface->InitializeAndSetContext3d(context_provider, nullptr);
resource_provider->InitializeGL();
- CheckCreateResource(ResourceProvider::GLTexture, resource_provider, context);
+ CheckCreateResource(ResourceProvider::RESOURCE_TYPE_GL_TEXTURE,
+ resource_provider, context);
}
TEST(ResourceProviderTest, BasicInitializeGLSoftware) {
@@ -3564,7 +3557,8 @@ TEST(ResourceProviderTest, BasicInitializeGLSoftware) {
false,
1));
- CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL);
+ CheckCreateResource(ResourceProvider::RESOURCE_TYPE_BITMAP,
+ resource_provider.get(), NULL);
InitializeGLAndCheck(shared_data.get(),
resource_provider.get(),
@@ -3572,7 +3566,8 @@ TEST(ResourceProviderTest, BasicInitializeGLSoftware) {
resource_provider->InitializeSoftware();
output_surface->ReleaseGL();
- CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL);
+ CheckCreateResource(ResourceProvider::RESOURCE_TYPE_BITMAP,
+ resource_provider.get(), NULL);
InitializeGLAndCheck(shared_data.get(),
resource_provider.get(),
@@ -3580,7 +3575,7 @@ TEST(ResourceProviderTest, BasicInitializeGLSoftware) {
}
TEST_P(ResourceProviderTest, CompressedTextureETC1Allocate) {
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<AllocationTrackingContext3D> context_owned(
@@ -3605,7 +3600,7 @@ TEST_P(ResourceProviderTest, CompressedTextureETC1Allocate) {
int texture_id = 123;
ResourceProvider::ResourceId id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1);
EXPECT_NE(0u, id);
EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2);
@@ -3616,7 +3611,7 @@ TEST_P(ResourceProviderTest, CompressedTextureETC1Allocate) {
}
TEST_P(ResourceProviderTest, CompressedTextureETC1Upload) {
- if (GetParam() != ResourceProvider::GLTexture)
+ if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE)
return;
scoped_ptr<AllocationTrackingContext3D> context_owned(
@@ -3642,7 +3637,7 @@ TEST_P(ResourceProviderTest, CompressedTextureETC1Upload) {
uint8_t pixels[8];
ResourceProvider::ResourceId id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1);
EXPECT_NE(0u, id);
EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3);
@@ -3658,7 +3653,8 @@ TEST_P(ResourceProviderTest, CompressedTextureETC1Upload) {
INSTANTIATE_TEST_CASE_P(
ResourceProviderTests,
ResourceProviderTest,
- ::testing::Values(ResourceProvider::GLTexture, ResourceProvider::Bitmap));
+ ::testing::Values(ResourceProvider::RESOURCE_TYPE_GL_TEXTURE,
+ ResourceProvider::RESOURCE_TYPE_BITMAP));
class TextureIdAllocationTrackingContext : public TestWebGraphicsContext3D {
public:
@@ -3700,7 +3696,8 @@ TEST(ResourceProviderTest, TextureAllocationChunkSize) {
kTextureAllocationChunkSize));
ResourceProvider::ResourceId id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
+ format);
resource_provider->AllocateForTesting(id);
Mock::VerifyAndClearExpectations(context);
@@ -3720,7 +3717,8 @@ TEST(ResourceProviderTest, TextureAllocationChunkSize) {
kTextureAllocationChunkSize));
ResourceProvider::ResourceId id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
+ format);
resource_provider->AllocateForTesting(id);
Mock::VerifyAndClearExpectations(context);
diff --git a/cc/resources/scoped_resource.cc b/cc/resources/scoped_resource.cc
index 3b13559..e701182 100644
--- a/cc/resources/scoped_resource.cc
+++ b/cc/resources/scoped_resource.cc
@@ -38,10 +38,7 @@ void ScopedResource::AllocateManaged(const gfx::Size& size,
set_dimensions(size, format);
set_id(resource_provider_->CreateManagedResource(
- size,
- target,
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ size, target, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
format));
#if DCHECK_IS_ON()
diff --git a/cc/resources/scoped_resource_unittest.cc b/cc/resources/scoped_resource_unittest.cc
index a141218..b95d814 100644
--- a/cc/resources/scoped_resource_unittest.cc
+++ b/cc/resources/scoped_resource_unittest.cc
@@ -57,8 +57,8 @@ TEST(ScopedResourceTest, CreateScopedResource) {
1));
scoped_ptr<ScopedResource> texture =
ScopedResource::Create(resource_provider.get());
- texture->Allocate(
- gfx::Size(30, 30), ResourceProvider::TextureHintImmutable, RGBA_8888);
+ texture->Allocate(gfx::Size(30, 30), ResourceProvider::TEXTURE_HINT_IMMUTABLE,
+ RGBA_8888);
// The texture has an allocated byte-size now.
size_t expected_bytes = 30 * 30 * 4;
@@ -89,8 +89,8 @@ TEST(ScopedResourceTest, ScopedResourceIsDeleted) {
ScopedResource::Create(resource_provider.get());
EXPECT_EQ(0u, resource_provider->num_resources());
- texture->Allocate(
- gfx::Size(30, 30), ResourceProvider::TextureHintImmutable, RGBA_8888);
+ texture->Allocate(gfx::Size(30, 30),
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888);
EXPECT_LT(0u, texture->id());
EXPECT_EQ(1u, resource_provider->num_resources());
}
@@ -100,8 +100,8 @@ TEST(ScopedResourceTest, ScopedResourceIsDeleted) {
scoped_ptr<ScopedResource> texture =
ScopedResource::Create(resource_provider.get());
EXPECT_EQ(0u, resource_provider->num_resources());
- texture->Allocate(
- gfx::Size(30, 30), ResourceProvider::TextureHintImmutable, RGBA_8888);
+ texture->Allocate(gfx::Size(30, 30),
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888);
EXPECT_LT(0u, texture->id());
EXPECT_EQ(1u, resource_provider->num_resources());
texture->Free();
diff --git a/cc/resources/tile.cc b/cc/resources/tile.cc
index 39d48a8..1576047 100644
--- a/cc/resources/tile.cc
+++ b/cc/resources/tile.cc
@@ -39,7 +39,7 @@ Tile::Tile(TileManager* tile_manager,
id_(s_next_id_++),
scheduled_priority_(0) {
set_raster_source(raster_source);
- for (int i = 0; i < NUM_TREES; i++)
+ for (int i = 0; i <= LAST_TREE; i++)
is_occluded_[i] = false;
}
diff --git a/cc/resources/tile.h b/cc/resources/tile.h
index d4697cc..c3ca623 100644
--- a/cc/resources/tile.h
+++ b/cc/resources/tile.h
@@ -150,9 +150,9 @@ class CC_EXPORT Tile : public RefCountedManaged<Tile> {
gfx::Size desired_texture_size_;
gfx::Rect content_rect_;
float contents_scale_;
- bool is_occluded_[NUM_TREES];
+ bool is_occluded_[LAST_TREE + 1];
- TilePriority priority_[NUM_TREES];
+ TilePriority priority_[LAST_TREE + 1];
TileDrawInfo draw_info_;
int layer_id_;
diff --git a/cc/resources/tile_priority.h b/cc/resources/tile_priority.h
index 5067aa6..5247b3c 100644
--- a/cc/resources/tile_priority.h
+++ b/cc/resources/tile_priority.h
@@ -24,7 +24,7 @@ enum WhichTree {
// e.g. in Tile::priority_.
ACTIVE_TREE = 0,
PENDING_TREE = 1,
- NUM_TREES = 2
+ LAST_TREE = 1
// Be sure to update WhichTreeAsValue when adding new fields.
};
scoped_ptr<base::Value> WhichTreeAsValue(WhichTree tree);
@@ -118,7 +118,7 @@ enum TreePriority {
SAME_PRIORITY_FOR_BOTH_TREES,
SMOOTHNESS_TAKES_PRIORITY,
NEW_CONTENT_TAKES_PRIORITY,
- NUM_TREE_PRIORITIES
+ LAST_TREE_PRIORITY = NEW_CONTENT_TAKES_PRIORITY
// Be sure to update TreePriorityAsValue when adding new fields.
};
std::string TreePriorityToString(TreePriority prio);
diff --git a/cc/resources/tile_task_worker_pool_perftest.cc b/cc/resources/tile_task_worker_pool_perftest.cc
index ca219b8..71da7b1 100644
--- a/cc/resources/tile_task_worker_pool_perftest.cc
+++ b/cc/resources/tile_task_worker_pool_perftest.cc
@@ -206,7 +206,7 @@ class TileTaskWorkerPoolPerfTestBase {
for (unsigned i = 0; i < num_raster_tasks; ++i) {
scoped_ptr<ScopedResource> resource(
ScopedResource::Create(resource_provider_.get()));
- resource->Allocate(size, ResourceProvider::TextureHintImmutable,
+ resource->Allocate(size, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
RGBA_8888);
ImageDecodeTask::Vector dependencies = image_decode_tasks;
diff --git a/cc/resources/tile_task_worker_pool_unittest.cc b/cc/resources/tile_task_worker_pool_unittest.cc
index 1e84674..d7cb155 100644
--- a/cc/resources/tile_task_worker_pool_unittest.cc
+++ b/cc/resources/tile_task_worker_pool_unittest.cc
@@ -240,7 +240,8 @@ class TileTaskWorkerPoolTest
void AppendTask(unsigned id, const gfx::Size& size) {
scoped_ptr<ScopedResource> resource(
ScopedResource::Create(resource_provider_.get()));
- resource->Allocate(size, ResourceProvider::TextureHintImmutable, RGBA_8888);
+ resource->Allocate(size, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
+ RGBA_8888);
const Resource* const_resource = resource.get();
ImageDecodeTask::Vector empty;
@@ -258,7 +259,8 @@ class TileTaskWorkerPoolTest
scoped_ptr<ScopedResource> resource(
ScopedResource::Create(resource_provider_.get()));
- resource->Allocate(size, ResourceProvider::TextureHintImmutable, RGBA_8888);
+ resource->Allocate(size, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
+ RGBA_8888);
const Resource* const_resource = resource.get();
ImageDecodeTask::Vector empty;
@@ -387,7 +389,8 @@ TEST_P(TileTaskWorkerPoolTest, LargeResources) {
// Verify a resource of this size is larger than the transfer buffer.
scoped_ptr<ScopedResource> resource(
ScopedResource::Create(resource_provider_.get()));
- resource->Allocate(size, ResourceProvider::TextureHintImmutable, RGBA_8888);
+ resource->Allocate(size, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
+ RGBA_8888);
EXPECT_GE(resource->bytes(), kMaxTransferBufferUsageBytes);
}
diff --git a/cc/resources/tiling_set_eviction_queue.cc b/cc/resources/tiling_set_eviction_queue.cc
index f13c915..1f0e213 100644
--- a/cc/resources/tiling_set_eviction_queue.cc
+++ b/cc/resources/tiling_set_eviction_queue.cc
@@ -330,9 +330,6 @@ bool TilingSetEvictionQueue::IsSharedOutOfOrderTile(const Tile* tile) const {
return false;
case SAME_PRIORITY_FOR_BOTH_TREES:
break;
- case NUM_TREE_PRIORITIES:
- NOTREACHED();
- break;
}
// The priority for tile priority of a shared tile will be a combined
diff --git a/cc/resources/ui_resource_request.h b/cc/resources/ui_resource_request.h
index 6d89761..b89e567 100644
--- a/cc/resources/ui_resource_request.h
+++ b/cc/resources/ui_resource_request.h
@@ -16,9 +16,9 @@ namespace cc {
class CC_EXPORT UIResourceRequest {
public:
enum UIResourceRequestType {
- UIResourceCreate,
- UIResourceDelete,
- UIResourceInvalidRequest
+ UI_RESOURCE_CREATE,
+ UI_RESOURCE_DELETE,
+ UI_RESOURCE_INVALID_REQUEST
};
UIResourceRequest(UIResourceRequestType type, UIResourceId id);
diff --git a/cc/resources/video_resource_updater.cc b/cc/resources/video_resource_updater.cc
index 4a5f642..1b089df 100644
--- a/cc/resources/video_resource_updater.cc
+++ b/cc/resources/video_resource_updater.cc
@@ -96,9 +96,9 @@ VideoResourceUpdater::AllocateResource(const gfx::Size& plane_size,
// TODO(danakj): Abstract out hw/sw resource create/delete from
// ResourceProvider and stop using ResourceProvider in this class.
const ResourceProvider::ResourceId resource_id =
- resource_provider_->CreateResource(plane_size, GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
- format);
+ resource_provider_->CreateResource(
+ plane_size, GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
if (resource_id == 0)
return all_resources_.end();
diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc
index f6179cc..d04c5d3 100644
--- a/cc/test/animation_test_common.cc
+++ b/cc/test/animation_test_common.cc
@@ -44,10 +44,8 @@ int AddOpacityTransition(Target* target,
int id = AnimationIdProvider::NextAnimationId();
scoped_ptr<Animation> animation(
- Animation::Create(curve.Pass(),
- id,
- AnimationIdProvider::NextGroupId(),
- Animation::Opacity));
+ Animation::Create(curve.Pass(), id, AnimationIdProvider::NextGroupId(),
+ Animation::OPACITY));
animation->set_needs_synchronized_start_time(true);
target->AddAnimation(animation.Pass());
@@ -73,10 +71,8 @@ int AddAnimatedTransform(Target* target,
int id = AnimationIdProvider::NextAnimationId();
scoped_ptr<Animation> animation(
- Animation::Create(curve.Pass(),
- id,
- AnimationIdProvider::NextGroupId(),
- Animation::Transform));
+ Animation::Create(curve.Pass(), id, AnimationIdProvider::NextGroupId(),
+ Animation::TRANSFORM));
animation->set_needs_synchronized_start_time(true);
target->AddAnimation(animation.Pass());
@@ -122,7 +118,7 @@ int AddAnimatedFilter(Target* target,
int id = AnimationIdProvider::NextAnimationId();
scoped_ptr<Animation> animation(Animation::Create(
- curve.Pass(), id, AnimationIdProvider::NextGroupId(), Animation::Filter));
+ curve.Pass(), id, AnimationIdProvider::NextGroupId(), Animation::FILTER));
animation->set_needs_synchronized_start_time(true);
target->AddAnimation(animation.Pass());
diff --git a/cc/test/layer_tree_json_parser.cc b/cc/test/layer_tree_json_parser.cc
index efe70a0..b0b81f7 100644
--- a/cc/test/layer_tree_json_parser.cc
+++ b/cc/test/layer_tree_json_parser.cc
@@ -156,11 +156,11 @@ scoped_refptr<Layer> ParseTreeFromValue(base::Value* val,
for (size_t i = 0; i < list->GetSize(); i++) {
success &= list->GetString(i, &str);
if (str == "StartTouch")
- blocks |= ScrollBlocksOnStartTouch;
+ blocks |= SCROLL_BLOCKS_ON_START_TOUCH;
else if (str == "WheelEvent")
- blocks |= ScrollBlocksOnWheelEvent;
+ blocks |= SCROLL_BLOCKS_ON_WHEEL_EVENT;
else if (str == "ScrollEvent")
- blocks |= ScrollBlocksOnScrollEvent;
+ blocks |= SCROLL_BLOCKS_ON_SCROLL_EVENT;
else
success = false;
}
diff --git a/cc/test/render_pass_test_common.cc b/cc/test/render_pass_test_common.cc
index 7c91f0d..0e3fe22 100644
--- a/cc/test/render_pass_test_common.cc
+++ b/cc/test/render_pass_test_common.cc
@@ -35,46 +35,39 @@ void TestRenderPass::AppendOneOfEveryQuadType(
const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f};
ResourceProvider::ResourceId resource1 = resource_provider->CreateResource(
- gfx::Size(45, 5),
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ gfx::Size(45, 5), GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE,
resource_provider->best_texture_format());
resource_provider->AllocateForTesting(resource1);
ResourceProvider::ResourceId resource2 = resource_provider->CreateResource(
- gfx::Size(346, 61),
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ gfx::Size(346, 61), GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE,
resource_provider->best_texture_format());
resource_provider->AllocateForTesting(resource2);
ResourceProvider::ResourceId resource3 = resource_provider->CreateResource(
- gfx::Size(12, 134),
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ gfx::Size(12, 134), GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE,
resource_provider->best_texture_format());
resource_provider->AllocateForTesting(resource3);
ResourceProvider::ResourceId resource4 = resource_provider->CreateResource(
- gfx::Size(56, 12),
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ gfx::Size(56, 12), GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE,
resource_provider->best_texture_format());
resource_provider->AllocateForTesting(resource4);
gfx::Size resource5_size(73, 26);
ResourceProvider::ResourceId resource5 = resource_provider->CreateResource(
- resource5_size,
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ resource5_size, GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE,
resource_provider->best_texture_format());
resource_provider->AllocateForTesting(resource5);
ResourceProvider::ResourceId resource6 = resource_provider->CreateResource(
- gfx::Size(64, 92),
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ gfx::Size(64, 92), GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE,
resource_provider->best_texture_format());
resource_provider->AllocateForTesting(resource6);
ResourceProvider::ResourceId resource7 = resource_provider->CreateResource(
- gfx::Size(9, 14),
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ gfx::Size(9, 14), GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE,
resource_provider->best_texture_format());
resource_provider->AllocateForTesting(resource7);
@@ -243,9 +236,8 @@ void TestRenderPass::AppendOneOfEveryQuadType(
ResourceProvider::ResourceId plane_resources[4];
for (int i = 0; i < 4; ++i) {
plane_resources[i] = resource_provider->CreateResource(
- gfx::Size(20, 12),
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ gfx::Size(20, 12), GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE,
resource_provider->best_texture_format());
resource_provider->AllocateForTesting(plane_resources[i]);
}
diff --git a/cc/test/test_web_graphics_context_3d.cc b/cc/test/test_web_graphics_context_3d.cc
index 8aa392d..28b16c8 100644
--- a/cc/test/test_web_graphics_context_3d.cc
+++ b/cc/test/test_web_graphics_context_3d.cc
@@ -64,7 +64,7 @@ TestWebGraphicsContext3D::TestWebGraphicsContext3D()
height_(0),
scale_factor_(-1.f),
test_support_(NULL),
- last_update_type_(NoUpdate),
+ last_update_type_(NO_UPDATE),
next_insert_sync_point_(1),
last_waited_sync_point_(0),
unpack_alignment_(4),
diff --git a/cc/test/test_web_graphics_context_3d.h b/cc/test/test_web_graphics_context_3d.h
index 31182f8..c2dee45 100644
--- a/cc/test/test_web_graphics_context_3d.h
+++ b/cc/test/test_web_graphics_context_3d.h
@@ -373,11 +373,7 @@ class TestWebGraphicsContext3D {
void clear_reshape_called() { reshape_called_ = false; }
float scale_factor() const { return scale_factor_; }
- enum UpdateType {
- NoUpdate = 0,
- PrepareTexture,
- PostSubBuffer
- };
+ enum UpdateType { NO_UPDATE = 0, PREPARE_TEXTURE, POST_SUB_BUFFER };
gfx::Rect update_rect() const { return update_rect_; }
diff --git a/cc/trees/layer_sorter.cc b/cc/trees/layer_sorter.cc
index e171fe0..bde4920 100644
--- a/cc/trees/layer_sorter.cc
+++ b/cc/trees/layer_sorter.cc
@@ -90,7 +90,7 @@ LayerSorter::ABCompareResult LayerSorter::CheckOverlap(LayerShape* a,
// Early out if the projected bounds don't overlap.
if (!a->projected_bounds.Intersects(b->projected_bounds))
- return None;
+ return NONE;
gfx::PointF aPoints[4] = { a->projected_quad.p1(),
a->projected_quad.p2(),
@@ -123,7 +123,7 @@ LayerSorter::ABCompareResult LayerSorter::CheckOverlap(LayerShape* a,
overlap_points.push_back(r);
if (overlap_points.empty())
- return None;
+ return NONE;
// Check the corresponding layer depth value for all overlap points to
// determine which layer is in front.
@@ -157,7 +157,7 @@ LayerSorter::ABCompareResult LayerSorter::CheckOverlap(LayerShape* a,
// If we can't tell which should come first, we use document order.
if (!accurate)
- return ABeforeB;
+ return A_BEFORE_B;
float max_diff =
std::abs(max_positive) > std::abs(max_negative) ?
@@ -176,9 +176,9 @@ LayerSorter::ABCompareResult LayerSorter::CheckOverlap(LayerShape* a,
// Maintain relative order if the layers have the same depth at all
// intersection points.
if (max_diff <= 0.f)
- return ABeforeB;
+ return A_BEFORE_B;
- return BBeforeA;
+ return B_BEFORE_A;
}
LayerShape::LayerShape() {}
@@ -320,10 +320,10 @@ void LayerSorter::CreateGraphEdges() {
&weight);
GraphNode* start_node = NULL;
GraphNode* end_node = NULL;
- if (overlap_result == ABeforeB) {
+ if (overlap_result == A_BEFORE_B) {
start_node = &node_a;
end_node = &node_b;
- } else if (overlap_result == BBeforeA) {
+ } else if (overlap_result == B_BEFORE_A) {
start_node = &node_b;
end_node = &node_a;
}
diff --git a/cc/trees/layer_sorter.h b/cc/trees/layer_sorter.h
index b783ded..4cfa8fe 100644
--- a/cc/trees/layer_sorter.h
+++ b/cc/trees/layer_sorter.h
@@ -68,11 +68,7 @@ class CC_EXPORT LayerSorter {
void Sort(LayerImplList::iterator first, LayerImplList::iterator last);
- enum ABCompareResult {
- ABeforeB,
- BBeforeA,
- None
- };
+ enum ABCompareResult { A_BEFORE_B, B_BEFORE_A, NONE };
static ABCompareResult CheckOverlap(LayerShape* a,
LayerShape* b,
diff --git a/cc/trees/layer_sorter_unittest.cc b/cc/trees/layer_sorter_unittest.cc
index ba7765b..74d3cf5 100644
--- a/cc/trees/layer_sorter_unittest.cc
+++ b/cc/trees/layer_sorter_unittest.cc
@@ -37,12 +37,12 @@ TEST(LayerSorterTest, BasicOverlap) {
overlap_result =
LayerSorter::CheckOverlap(&front, &back, z_threshold, &weight);
- EXPECT_EQ(LayerSorter::BBeforeA, overlap_result);
+ EXPECT_EQ(LayerSorter::B_BEFORE_A, overlap_result);
EXPECT_EQ(1.f, weight);
overlap_result =
LayerSorter::CheckOverlap(&back, &front, z_threshold, &weight);
- EXPECT_EQ(LayerSorter::ABeforeB, overlap_result);
+ EXPECT_EQ(LayerSorter::A_BEFORE_B, overlap_result);
EXPECT_EQ(1.f, weight);
// One layer translated off to the right. No overlap should be detected.
@@ -51,7 +51,7 @@ TEST(LayerSorterTest, BasicOverlap) {
LayerShape back_right(2.f, 2.f, right_translate);
overlap_result =
LayerSorter::CheckOverlap(&front, &back_right, z_threshold, &weight);
- EXPECT_EQ(LayerSorter::None, overlap_result);
+ EXPECT_EQ(LayerSorter::NONE, overlap_result);
// When comparing a layer with itself, z difference is always 0.
overlap_result =
@@ -80,7 +80,7 @@ TEST(LayerSorterTest, RightAngleOverlap) {
overlap_result =
LayerSorter::CheckOverlap(&front_face, &left_face, z_threshold, &weight);
- EXPECT_EQ(LayerSorter::BBeforeA, overlap_result);
+ EXPECT_EQ(LayerSorter::B_BEFORE_A, overlap_result);
}
TEST(LayerSorterTest, IntersectingLayerOverlap) {
@@ -107,7 +107,7 @@ TEST(LayerSorterTest, IntersectingLayerOverlap) {
&rotated_face,
z_threshold,
&weight);
- EXPECT_NE(LayerSorter::None, overlap_result);
+ EXPECT_NE(LayerSorter::NONE, overlap_result);
EXPECT_EQ(0.f, weight);
}
@@ -145,13 +145,13 @@ TEST(LayerSorterTest, LayersAtAngleOverlap) {
overlap_result =
LayerSorter::CheckOverlap(&layer_a, &layer_c, z_threshold, &weight);
- EXPECT_EQ(LayerSorter::ABeforeB, overlap_result);
+ EXPECT_EQ(LayerSorter::A_BEFORE_B, overlap_result);
overlap_result =
LayerSorter::CheckOverlap(&layer_c, &layer_b, z_threshold, &weight);
- EXPECT_EQ(LayerSorter::ABeforeB, overlap_result);
+ EXPECT_EQ(LayerSorter::A_BEFORE_B, overlap_result);
overlap_result =
LayerSorter::CheckOverlap(&layer_a, &layer_b, z_threshold, &weight);
- EXPECT_EQ(LayerSorter::None, overlap_result);
+ EXPECT_EQ(LayerSorter::NONE, overlap_result);
}
TEST(LayerSorterTest, LayersUnderPathologicalPerspectiveTransform) {
@@ -192,7 +192,7 @@ TEST(LayerSorterTest, LayersUnderPathologicalPerspectiveTransform) {
overlap_result =
LayerSorter::CheckOverlap(&layer_a, &layer_b, z_threshold, &weight);
- EXPECT_EQ(LayerSorter::ABeforeB, overlap_result);
+ EXPECT_EQ(LayerSorter::A_BEFORE_B, overlap_result);
}
TEST(LayerSorterTest, VerifyExistingOrderingPreservedWhenNoZDiff) {
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 426927a..49e374d 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -562,19 +562,19 @@ void LayerTreeHost::SetAnimationEvents(
animation_controllers.find(event_layer_id);
if (iter != animation_controllers.end()) {
switch ((*events)[event_index].type) {
- case AnimationEvent::Started:
+ case AnimationEvent::STARTED:
(*iter).second->NotifyAnimationStarted((*events)[event_index]);
break;
- case AnimationEvent::Finished:
+ case AnimationEvent::FINISHED:
(*iter).second->NotifyAnimationFinished((*events)[event_index]);
break;
- case AnimationEvent::Aborted:
+ case AnimationEvent::ABORTED:
(*iter).second->NotifyAnimationAborted((*events)[event_index]);
break;
- case AnimationEvent::PropertyUpdate:
+ case AnimationEvent::PROPERTY_UPDATE:
(*iter).second->NotifyAnimationPropertyUpdate((*events)[event_index]);
break;
}
@@ -1219,8 +1219,7 @@ UIResourceId LayerTreeHost::CreateUIResource(UIResourceClient* client) {
ui_resource_client_map_.end());
bool resource_lost = false;
- UIResourceRequest request(UIResourceRequest::UIResourceCreate,
- next_id,
+ UIResourceRequest request(UIResourceRequest::UI_RESOURCE_CREATE, next_id,
client->GetBitmap(next_id, resource_lost));
ui_resource_request_queue_.push_back(request);
@@ -1238,7 +1237,7 @@ void LayerTreeHost::DeleteUIResource(UIResourceId uid) {
if (iter == ui_resource_client_map_.end())
return;
- UIResourceRequest request(UIResourceRequest::UIResourceDelete, uid);
+ UIResourceRequest request(UIResourceRequest::UI_RESOURCE_DELETE, uid);
ui_resource_request_queue_.push_back(request);
ui_resource_client_map_.erase(iter);
}
@@ -1250,8 +1249,7 @@ void LayerTreeHost::RecreateUIResources() {
UIResourceId uid = iter->first;
const UIResourceClientData& data = iter->second;
bool resource_lost = true;
- UIResourceRequest request(UIResourceRequest::UIResourceCreate,
- uid,
+ UIResourceRequest request(UIResourceRequest::UI_RESOURCE_CREATE, uid,
data.client->GetBitmap(uid, resource_lost));
ui_resource_request_queue_.push_back(request);
}
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 75535ad..7a3b5ad 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -161,8 +161,8 @@ static gfx::Vector2dF ComputeChangeOfBasisTranslation(
}
enum TranslateRectDirection {
- TranslateRectDirectionToAncestor,
- TranslateRectDirectionToDescendant
+ TRANSLATE_RECT_DIRECTION_TO_ANCESTOR,
+ TRANSLATE_RECT_DIRECTION_TO_DESCENDANT
};
template <typename LayerType>
@@ -172,7 +172,7 @@ static gfx::Rect TranslateRectToTargetSpace(const LayerType& ancestor_layer,
TranslateRectDirection direction) {
gfx::Vector2dF translation = ComputeChangeOfBasisTranslation<LayerType>(
ancestor_layer, descendant_layer);
- if (direction == TranslateRectDirectionToDescendant)
+ if (direction == TRANSLATE_RECT_DIRECTION_TO_DESCENDANT)
translation.Scale(-1.f);
return gfx::ToEnclosingRect(
gfx::RectF(rect.origin() + translation, rect.size()));
@@ -211,20 +211,16 @@ static void UpdateClipRectsForClipChild(
// clip rects will want to be in its target space, not ours.
if (clip_parent == layer->clip_parent()) {
*clip_rect_in_parent_target_space = TranslateRectToTargetSpace<LayerType>(
- *clip_parent,
- *layer->parent(),
- *clip_rect_in_parent_target_space,
- TranslateRectDirectionToDescendant);
+ *clip_parent, *layer->parent(), *clip_rect_in_parent_target_space,
+ TRANSLATE_RECT_DIRECTION_TO_DESCENDANT);
} else {
// If we're being clipped by our scroll parent, we must translate through
// our common ancestor. This happens to be our parent, so it is sufficent to
// translate from our clip parent's space to the space of its ancestor (our
// parent).
- *clip_rect_in_parent_target_space =
- TranslateRectToTargetSpace<LayerType>(*layer->parent(),
- *clip_parent,
- *clip_rect_in_parent_target_space,
- TranslateRectDirectionToAncestor);
+ *clip_rect_in_parent_target_space = TranslateRectToTargetSpace<LayerType>(
+ *layer->parent(), *clip_parent, *clip_rect_in_parent_target_space,
+ TRANSLATE_RECT_DIRECTION_TO_ANCESTOR);
}
}
@@ -286,10 +282,8 @@ void UpdateAccumulatedSurfaceState(
// so we'll need to transform it before it is applied.
if (layer->clip_parent()) {
clip_rect = TranslateRectToTargetSpace<LayerType>(
- *layer->clip_parent(),
- *layer,
- clip_rect,
- TranslateRectDirectionToDescendant);
+ *layer->clip_parent(), *layer, clip_rect,
+ TRANSLATE_RECT_DIRECTION_TO_DESCENDANT);
}
target_rect.Intersect(clip_rect);
}
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index c8d8732..30cc15ab 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -7975,11 +7975,11 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) {
0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
grand_parent->layer_animation_controller()->AbortAnimations(
- Animation::Transform);
+ Animation::TRANSFORM);
parent_raw->layer_animation_controller()->AbortAnimations(
- Animation::Transform);
+ Animation::TRANSFORM);
child_raw->layer_animation_controller()->AbortAnimations(
- Animation::Transform);
+ Animation::TRANSFORM);
TransformOperations perspective;
perspective.AppendPerspective(10.f);
@@ -7999,7 +7999,7 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) {
0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
child_raw->layer_animation_controller()->AbortAnimations(
- Animation::Transform);
+ Animation::TRANSFORM);
gfx::Transform scale_matrix;
scale_matrix.Scale(1.f, 2.f);
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index ebd8990..eef1cc3 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -476,7 +476,7 @@ static LayerImpl* NextScrollLayer(LayerImpl* layer) {
}
static ScrollBlocksOn EffectiveScrollBlocksOn(LayerImpl* layer) {
- ScrollBlocksOn blocks = ScrollBlocksOnNone;
+ ScrollBlocksOn blocks = SCROLL_BLOCKS_ON_NONE;
for (; layer; layer = NextScrollLayer(layer)) {
blocks |= layer->scroll_blocks_on();
}
@@ -495,7 +495,7 @@ bool LayerTreeHostImpl::DoTouchEventsBlockScrollAt(
LayerImpl* layer_impl =
active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
ScrollBlocksOn blocking = EffectiveScrollBlocksOn(layer_impl);
- if (!(blocking & ScrollBlocksOnStartTouch))
+ if (!(blocking & SCROLL_BLOCKS_ON_START_TOUCH))
return false;
// Now determine if there are actually any handlers at that point.
@@ -2306,7 +2306,7 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint(
// thread.
ScrollStatus status =
layer_impl->TryScroll(device_viewport_point, type, block_mode);
- if (status == ScrollOnMainThread) {
+ if (status == SCROLL_ON_MAIN_THREAD) {
*scroll_on_main_thread = true;
return NULL;
}
@@ -2318,7 +2318,7 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint(
status =
scroll_layer_impl->TryScroll(device_viewport_point, type, block_mode);
// If any layer wants to divert the scroll event to the main thread, abort.
- if (status == ScrollOnMainThread) {
+ if (status == SCROLL_ON_MAIN_THREAD) {
*scroll_on_main_thread = true;
return NULL;
}
@@ -2327,7 +2327,7 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint(
scroll_layer_impl->have_scroll_event_handlers())
*optional_has_ancestor_scroll_handler = true;
- if (status == ScrollStarted && !potentially_scrolling_layer_impl)
+ if (status == SCROLL_STARTED && !potentially_scrolling_layer_impl)
potentially_scrolling_layer_impl = scroll_layer_impl;
}
@@ -2374,7 +2374,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
active_tree_->FindFirstScrollingLayerThatIsHitByPoint(
device_viewport_point);
if (scroll_layer_impl && !HasScrollAncestor(layer_impl, scroll_layer_impl))
- return ScrollUnknown;
+ return SCROLL_UNKNOWN;
}
bool scroll_on_main_thread = false;
@@ -2387,18 +2387,18 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
if (scroll_on_main_thread) {
UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true);
- return ScrollOnMainThread;
+ return SCROLL_ON_MAIN_THREAD;
}
if (scrolling_layer_impl) {
active_tree_->SetCurrentlyScrollingLayer(scrolling_layer_impl);
- should_bubble_scrolls_ = (type != NonBubblingGesture);
- wheel_scrolling_ = (type == Wheel);
+ should_bubble_scrolls_ = (type != NON_BUBBLING_GESTURE);
+ wheel_scrolling_ = (type == WHEEL);
client_->RenewTreePriority();
UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false);
- return ScrollStarted;
+ return SCROLL_STARTED;
}
- return ScrollIgnored;
+ return SCROLL_IGNORED;
}
InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
@@ -2407,9 +2407,9 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
if (LayerImpl* layer_impl = CurrentlyScrollingLayer()) {
Animation* animation =
layer_impl->layer_animation_controller()->GetAnimation(
- Animation::ScrollOffset);
+ Animation::SCROLL_OFFSET);
if (!animation)
- return ScrollIgnored;
+ return SCROLL_IGNORED;
ScrollOffsetAnimationCurve* curve =
animation->curve()->ToScrollOffsetAnimationCurve();
@@ -2424,13 +2424,13 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
CurrentBeginFrameArgs().frame_time).InSecondsF(),
new_target);
- return ScrollStarted;
+ return SCROLL_STARTED;
}
// ScrollAnimated is only used for wheel scrolls. We use the same bubbling
// behavior as ScrollBy to determine which layer to animate, but we do not
// do the Android-specific things in ScrollBy like showing top controls.
- InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, Wheel);
- if (scroll_status == ScrollStarted) {
+ InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, WHEEL);
+ if (scroll_status == SCROLL_STARTED) {
gfx::Vector2dF pending_delta = scroll_delta;
for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl;
layer_impl = layer_impl->parent()) {
@@ -2461,17 +2461,15 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
EaseInOutTimingFunction::Create());
curve->SetInitialValue(current_offset);
- scoped_ptr<Animation> animation =
- Animation::Create(curve.Pass(),
- AnimationIdProvider::NextAnimationId(),
- AnimationIdProvider::NextGroupId(),
- Animation::ScrollOffset);
+ scoped_ptr<Animation> animation = Animation::Create(
+ curve.Pass(), AnimationIdProvider::NextAnimationId(),
+ AnimationIdProvider::NextGroupId(), Animation::SCROLL_OFFSET);
animation->set_is_impl_only(true);
layer_impl->layer_animation_controller()->AddAnimation(animation.Pass());
SetNeedsAnimate();
- return ScrollStarted;
+ return SCROLL_STARTED;
}
}
ScrollEnd();
@@ -2822,13 +2820,13 @@ void LayerTreeHostImpl::ScrollEnd() {
InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() {
if (!active_tree_->CurrentlyScrollingLayer())
- return ScrollIgnored;
+ return SCROLL_IGNORED;
if (settings_.ignore_root_layer_flings &&
(active_tree_->CurrentlyScrollingLayer() == InnerViewportScrollLayer() ||
active_tree_->CurrentlyScrollingLayer() == OuterViewportScrollLayer())) {
ClearCurrentlyScrollingLayer();
- return ScrollIgnored;
+ return SCROLL_IGNORED;
}
if (!wheel_scrolling_) {
@@ -2838,7 +2836,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() {
should_bubble_scrolls_ = false;
}
- return ScrollStarted;
+ return SCROLL_STARTED;
}
float LayerTreeHostImpl::DeviceSpaceDistanceToLayer(
@@ -2882,12 +2880,9 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) {
}
bool scroll_on_main_thread = false;
- LayerImpl* scroll_layer_impl =
- FindScrollLayerForDeviceViewportPoint(device_viewport_point,
- InputHandler::Gesture,
- layer_impl,
- &scroll_on_main_thread,
- NULL);
+ LayerImpl* scroll_layer_impl = FindScrollLayerForDeviceViewportPoint(
+ device_viewport_point, InputHandler::GESTURE, layer_impl,
+ &scroll_on_main_thread, NULL);
if (scroll_on_main_thread || !scroll_layer_impl)
return;
@@ -3385,7 +3380,7 @@ void LayerTreeHostImpl::CreateUIResource(UIResourceId uid,
break;
}
id = resource_provider_->CreateResource(
- bitmap.GetSize(), wrap_mode, ResourceProvider::TextureHintImmutable,
+ bitmap.GetSize(), wrap_mode, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
format);
UIResourceData data;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 5f18538..70fa92b 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -502,16 +502,16 @@ TEST_F(LayerTreeHostImplTest, ScrollRootCallsCommitAndRedraw) {
host_impl_->SetViewportSize(gfx::Size(50, 50));
DrawFrame();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
- InputHandler::Wheel));
+ InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, 10),
- InputHandler::Wheel));
+ InputHandler::WHEEL));
host_impl_->ScrollEnd();
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
- InputHandler::Wheel));
+ InputHandler::WHEEL));
EXPECT_TRUE(did_request_redraw_);
EXPECT_TRUE(did_request_commit_);
}
@@ -521,8 +521,8 @@ TEST_F(LayerTreeHostImplTest, ScrollActiveOnlyAfterScrollMovement) {
host_impl_->SetViewportSize(gfx::Size(50, 50));
DrawFrame();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
EXPECT_FALSE(host_impl_->IsActivelyScrolling());
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
EXPECT_TRUE(host_impl_->IsActivelyScrolling());
@@ -532,8 +532,8 @@ TEST_F(LayerTreeHostImplTest, ScrollActiveOnlyAfterScrollMovement) {
TEST_F(LayerTreeHostImplTest, ScrollWithoutRootLayer) {
// We should not crash when trying to scroll an empty layer tree.
- EXPECT_EQ(InputHandler::ScrollIgnored,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_IGNORED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
}
TEST_F(LayerTreeHostImplTest, ScrollWithoutRenderer) {
@@ -549,8 +549,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutRenderer) {
// We should not crash when trying to scroll after the renderer initialization
// fails.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
}
TEST_F(LayerTreeHostImplTest, ReplaceTreeWhileScrolling) {
@@ -559,8 +559,8 @@ TEST_F(LayerTreeHostImplTest, ReplaceTreeWhileScrolling) {
DrawFrame();
// We should not crash if the tree is replaced while we are scrolling.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
host_impl_->active_tree()->DetachLayerTree();
scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100));
@@ -583,25 +583,26 @@ TEST_F(LayerTreeHostImplTest, ScrollBlocksOnWheelEventHandlers) {
// With registered event handlers, wheel scrolls don't necessarily
// have to go to the main thread.
root->SetHaveWheelEventHandlers(true);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
host_impl_->ScrollEnd();
// But typically the scroll-blocks-on mode will require them to.
- root->SetScrollBlocksOn(ScrollBlocksOnWheelEvent | ScrollBlocksOnStartTouch);
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ root->SetScrollBlocksOn(SCROLL_BLOCKS_ON_WHEEL_EVENT |
+ SCROLL_BLOCKS_ON_START_TOUCH);
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
// But gesture scrolls can still be handled.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollEnd();
// And if the handlers go away, wheel scrolls can again be processed
// on impl (despite the scroll-blocks-on mode).
root->SetHaveWheelEventHandlers(false);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
host_impl_->ScrollEnd();
}
@@ -626,20 +627,21 @@ TEST_F(LayerTreeHostImplTest, ScrollBlocksOnTouchEventHandlers) {
// Touch handler regions determine whether touch events block scroll.
root->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 100, 100));
EXPECT_FALSE(host_impl_->DoTouchEventsBlockScrollAt(gfx::Point(10, 10)));
- root->SetScrollBlocksOn(ScrollBlocksOnStartTouch | ScrollBlocksOnWheelEvent);
+ root->SetScrollBlocksOn(SCROLL_BLOCKS_ON_START_TOUCH |
+ SCROLL_BLOCKS_ON_WHEEL_EVENT);
EXPECT_TRUE(host_impl_->DoTouchEventsBlockScrollAt(gfx::Point(10, 10)));
// But they don't influence the actual handling of the scroll gestures.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollEnd();
// It's the union of scroll-blocks-on mode bits across all layers in the
// scroll paret chain that matters.
EXPECT_TRUE(host_impl_->DoTouchEventsBlockScrollAt(gfx::Point(10, 30)));
- root->SetScrollBlocksOn(ScrollBlocksOnNone);
+ root->SetScrollBlocksOn(SCROLL_BLOCKS_ON_NONE);
EXPECT_FALSE(host_impl_->DoTouchEventsBlockScrollAt(gfx::Point(10, 30)));
- child->SetScrollBlocksOn(ScrollBlocksOnStartTouch);
+ child->SetScrollBlocksOn(SCROLL_BLOCKS_ON_START_TOUCH);
EXPECT_TRUE(host_impl_->DoTouchEventsBlockScrollAt(gfx::Point(10, 30)));
}
@@ -652,30 +654,31 @@ TEST_F(LayerTreeHostImplTest, ScrollBlocksOnScrollEventHandlers) {
// With registered scroll handlers, scrolls don't generally have to go
// to the main thread.
root->SetHaveScrollEventHandlers(true);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
host_impl_->ScrollEnd();
// Even the default scroll blocks on mode doesn't require this.
- root->SetScrollBlocksOn(ScrollBlocksOnWheelEvent | ScrollBlocksOnStartTouch);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ root->SetScrollBlocksOn(SCROLL_BLOCKS_ON_WHEEL_EVENT |
+ SCROLL_BLOCKS_ON_START_TOUCH);
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollEnd();
// But the page can opt in to blocking on scroll event handlers.
- root->SetScrollBlocksOn(ScrollBlocksOnScrollEvent);
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ root->SetScrollBlocksOn(SCROLL_BLOCKS_ON_SCROLL_EVENT);
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- // Gesture and Wheel scrolls behave identically in this regard.
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ // GESTURE and WHEEL scrolls behave identically in this regard.
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
// And if the handlers go away, scrolls can again be processed on impl
// (despite the scroll-blocks-on mode).
root->SetHaveScrollEventHandlers(false);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollEnd();
}
@@ -718,36 +721,36 @@ TEST_F(LayerTreeHostImplTest, ScrollBlocksOnLayerTopology) {
}
// Scroll-blocks-on on a layer affects scrolls that hit that layer.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::GESTURE));
host_impl_->ScrollEnd();
- child1->SetScrollBlocksOn(ScrollBlocksOnScrollEvent);
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::Gesture));
+ child1->SetScrollBlocksOn(SCROLL_BLOCKS_ON_SCROLL_EVENT);
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::GESTURE));
// But not those that hit only other layers.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::GESTURE));
host_impl_->ScrollEnd();
// It's the union of bits set across the scroll ancestor chain that matters.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::GESTURE));
host_impl_->ScrollEnd();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::WHEEL));
host_impl_->ScrollEnd();
- root->SetScrollBlocksOn(ScrollBlocksOnWheelEvent);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::Gesture));
+ root->SetScrollBlocksOn(SCROLL_BLOCKS_ON_WHEEL_EVENT);
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::GESTURE));
host_impl_->ScrollEnd();
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::Wheel));
- child2->SetScrollBlocksOn(ScrollBlocksOnScrollEvent);
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::Wheel));
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::WHEEL));
+ child2->SetScrollBlocksOn(SCROLL_BLOCKS_ON_SCROLL_EVENT);
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::WHEEL));
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::GESTURE));
}
TEST_F(LayerTreeHostImplTest, FlingOnlyWhenScrollingTouchscreen) {
@@ -756,16 +759,14 @@ TEST_F(LayerTreeHostImplTest, FlingOnlyWhenScrollingTouchscreen) {
DrawFrame();
// Ignore the fling since no layer is being scrolled
- EXPECT_EQ(InputHandler::ScrollIgnored,
- host_impl_->FlingScrollBegin());
+ EXPECT_EQ(InputHandler::SCROLL_IGNORED, host_impl_->FlingScrollBegin());
// Start scrolling a layer
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
// Now the fling should go ahead since we've started scrolling a layer
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->FlingScrollBegin());
+ EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
}
TEST_F(LayerTreeHostImplTest, FlingOnlyWhenScrollingTouchpad) {
@@ -774,16 +775,14 @@ TEST_F(LayerTreeHostImplTest, FlingOnlyWhenScrollingTouchpad) {
DrawFrame();
// Ignore the fling since no layer is being scrolled
- EXPECT_EQ(InputHandler::ScrollIgnored,
- host_impl_->FlingScrollBegin());
+ EXPECT_EQ(InputHandler::SCROLL_IGNORED, host_impl_->FlingScrollBegin());
// Start scrolling a layer
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
// Now the fling should go ahead since we've started scrolling a layer
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->FlingScrollBegin());
+ EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
}
TEST_F(LayerTreeHostImplTest, NoFlingWhenScrollingOnMain) {
@@ -795,12 +794,11 @@ TEST_F(LayerTreeHostImplTest, NoFlingWhenScrollingOnMain) {
root->SetShouldScrollOnMainThread(true);
// Start scrolling a layer
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
// The fling should be ignored since there's no layer being scrolled impl-side
- EXPECT_EQ(InputHandler::ScrollIgnored,
- host_impl_->FlingScrollBegin());
+ EXPECT_EQ(InputHandler::SCROLL_IGNORED, host_impl_->FlingScrollBegin());
}
TEST_F(LayerTreeHostImplTest, ShouldScrollOnMainThread) {
@@ -811,10 +809,10 @@ TEST_F(LayerTreeHostImplTest, ShouldScrollOnMainThread) {
root->SetShouldScrollOnMainThread(true);
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
}
TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionBasic) {
@@ -828,38 +826,34 @@ TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionBasic) {
DrawFrame();
// All scroll types inside the non-fast scrollable region should fail.
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- host_impl_->ScrollBegin(gfx::Point(25, 25),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_->ScrollBegin(gfx::Point(25, 25), InputHandler::WHEEL));
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(25, 25),
- InputHandler::Wheel));
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- host_impl_->ScrollBegin(gfx::Point(25, 25),
- InputHandler::Gesture));
+ InputHandler::WHEEL));
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_->ScrollBegin(gfx::Point(25, 25), InputHandler::GESTURE));
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(25, 25),
- InputHandler::Gesture));
+ InputHandler::GESTURE));
// All scroll types outside this region should succeed.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(75, 75),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(75, 75), InputHandler::WHEEL));
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(75, 75),
- InputHandler::Gesture));
+ InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(25, 25),
- InputHandler::Gesture));
+ InputHandler::GESTURE));
host_impl_->ScrollEnd();
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(75, 75),
- InputHandler::Gesture));
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(75, 75),
- InputHandler::Gesture));
+ InputHandler::GESTURE));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(75, 75), InputHandler::GESTURE));
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(75, 75),
- InputHandler::Gesture));
+ InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
host_impl_->ScrollEnd();
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(75, 75),
- InputHandler::Gesture));
+ InputHandler::GESTURE));
}
TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionWithOffset) {
@@ -875,18 +869,16 @@ TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionWithOffset) {
// This point would fall into the non-fast scrollable region except that we've
// moved the layer down by 25 pixels.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(40, 10),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(40, 10), InputHandler::WHEEL));
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(40, 10),
- InputHandler::Wheel));
+ InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 1));
host_impl_->ScrollEnd();
// This point is still inside the non-fast region.
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- host_impl_->ScrollBegin(gfx::Point(10, 10),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::WHEEL));
}
TEST_F(LayerTreeHostImplTest, ScrollHandlerNotPresent) {
@@ -896,7 +888,7 @@ TEST_F(LayerTreeHostImplTest, ScrollHandlerNotPresent) {
DrawFrame();
EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
host_impl_->ScrollEnd();
EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
@@ -909,7 +901,7 @@ TEST_F(LayerTreeHostImplTest, ScrollHandlerPresent) {
DrawFrame();
EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
EXPECT_TRUE(host_impl_->scroll_affects_scroll_handler());
host_impl_->ScrollEnd();
EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
@@ -921,8 +913,8 @@ TEST_F(LayerTreeHostImplTest, ScrollByReturnsCorrectValue) {
DrawFrame();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
// Trying to scroll to the left/top will not succeed.
EXPECT_FALSE(
@@ -967,9 +959,8 @@ TEST_F(LayerTreeHostImplTest, ScrollVerticallyByPageReturnsCorrectValue) {
DrawFrame();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
// Trying to scroll without a vertical scrollbar will fail.
EXPECT_FALSE(host_impl_->ScrollVerticallyByPage(
@@ -1011,8 +1002,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) {
DrawFrame();
gfx::Point scroll_position(10, 10);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(scroll_position, InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(scroll_position, InputHandler::WHEEL));
EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->CurrentScrollOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(), overflow->CurrentScrollOffset());
@@ -1024,8 +1015,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) {
overflow->set_user_scrollable_horizontal(false);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(scroll_position, InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(scroll_position, InputHandler::WHEEL));
EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->CurrentScrollOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 10), overflow->CurrentScrollOffset());
@@ -1036,8 +1027,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) {
overflow->set_user_scrollable_vertical(false);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(scroll_position, InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(scroll_position, InputHandler::WHEEL));
EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 0), scroll_layer->CurrentScrollOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->CurrentScrollOffset());
@@ -1068,7 +1059,7 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) {
float page_scale_delta = 2.f;
- host_impl_->ScrollBegin(gfx::Point(50, 50), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(50, 50), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50));
host_impl_->PinchGestureEnd();
@@ -1095,16 +1086,15 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) {
scroll_layer->SetScrollDelta(gfx::Vector2d());
float page_scale_delta = 2.f;
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point());
host_impl_->PinchGestureEnd();
host_impl_->ScrollEnd();
gfx::Vector2d scroll_delta(0, 10);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
host_impl_->ScrollEnd();
@@ -1122,8 +1112,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithSwapPromises) {
new LatencyInfoSwapPromise(latency_info));
SetupScrollAndContentsLayers(gfx::Size(100, 100));
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
host_impl_->QueueSwapPromiseForMainThreadScrollUpdate(swap_promise.Pass());
host_impl_->ScrollEnd();
@@ -1151,7 +1141,7 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
scroll_layer->SetScrollDelta(gfx::Vector2d());
float page_scale_delta = 2.f;
- host_impl_->ScrollBegin(gfx::Point(50, 50), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(50, 50), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50));
host_impl_->PinchGestureEnd();
@@ -1172,7 +1162,7 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
scroll_layer->SetScrollDelta(gfx::Vector2d());
float page_scale_delta = 10.f;
- host_impl_->ScrollBegin(gfx::Point(50, 50), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(50, 50), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50));
host_impl_->PinchGestureEnd();
@@ -1192,7 +1182,7 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50));
float page_scale_delta = 0.1f;
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point());
host_impl_->PinchGestureEnd();
@@ -1214,7 +1204,7 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(20, 20));
float page_scale_delta = 1.f;
- host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(10, 10));
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(20, 20));
@@ -1236,7 +1226,7 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(20, 20));
float page_scale_delta = 1.f;
- host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(10, 10));
host_impl_->ScrollBy(gfx::Point(10, 10), gfx::Vector2d(-10, -10));
@@ -1257,7 +1247,7 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
scroll_layer->PullDeltaForMainThread();
scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 0));
- host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(2.f, gfx::Point(0, 0));
host_impl_->PinchGestureUpdate(1.f, gfx::Point(0, 0));
@@ -1623,7 +1613,7 @@ class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl {
TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) {
LayerTreeSettings settings;
- settings.scrollbar_animator = LayerTreeSettings::LinearFade;
+ settings.scrollbar_animator = LayerTreeSettings::LINEAR_FADE;
settings.scrollbar_fade_delay_ms = 20;
settings.scrollbar_fade_duration_ms = 20;
@@ -1635,14 +1625,14 @@ TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) {
EXPECT_FALSE(did_request_redraw_);
// If no scroll happened during a scroll gesture, it should have no effect.
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
host_impl_->ScrollEnd();
EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_);
EXPECT_FALSE(did_request_redraw_);
EXPECT_TRUE(scrollbar_fade_start_.Equals(base::Closure()));
// After a scroll, a fade animation should be scheduled about 20ms from now.
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 5));
host_impl_->ScrollEnd();
did_request_redraw_ = false;
@@ -1673,7 +1663,7 @@ TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) {
requested_scrollbar_animation_delay_ = base::TimeDelta();
// Unnecessarily Fade animation of solid color scrollbar is not triggered.
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0));
host_impl_->ScrollEnd();
EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_);
@@ -1681,7 +1671,7 @@ TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) {
TEST_F(LayerTreeHostImplTest, ScrollbarFadePinchZoomScrollbars) {
LayerTreeSettings settings;
- settings.scrollbar_animator = LayerTreeSettings::LinearFade;
+ settings.scrollbar_animator = LayerTreeSettings::LINEAR_FADE;
settings.scrollbar_fade_delay_ms = 20;
settings.scrollbar_fade_duration_ms = 20;
settings.use_pinch_zoom_scrollbars = true;
@@ -1696,14 +1686,14 @@ TEST_F(LayerTreeHostImplTest, ScrollbarFadePinchZoomScrollbars) {
EXPECT_FALSE(did_request_animate_);
// If no scroll happened during a scroll gesture, it should have no effect.
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
host_impl_->ScrollEnd();
EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_);
EXPECT_FALSE(did_request_animate_);
EXPECT_TRUE(scrollbar_fade_start_.Equals(base::Closure()));
// After a scroll, no fade animation should be scheduled.
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0));
host_impl_->ScrollEnd();
did_request_redraw_ = false;
@@ -1720,7 +1710,7 @@ TEST_F(LayerTreeHostImplTest, ScrollbarFadePinchZoomScrollbars) {
host_impl_->SetPageScaleOnActiveTree(1.1f);
// After a scroll, a fade animation should be scheduled about 20ms from now.
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0));
host_impl_->ScrollEnd();
did_request_redraw_ = false;
@@ -1742,7 +1732,7 @@ void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale(
LayerTreeSettings settings;
settings.scrollbar_fade_delay_ms = 500;
settings.scrollbar_fade_duration_ms = 300;
- settings.scrollbar_animator = LayerTreeSettings::Thinning;
+ settings.scrollbar_animator = LayerTreeSettings::THINNING;
gfx::Size viewport_size(300, 200);
gfx::Size device_viewport_size = gfx::ToFlooredSize(
@@ -1849,8 +1839,8 @@ TEST_F(LayerTreeHostImplTest, CompositorFrameMetadata) {
}
// Scrolling should update metadata immediately.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
{
CompositorFrameMetadata metadata =
@@ -1883,7 +1873,7 @@ TEST_F(LayerTreeHostImplTest, CompositorFrameMetadata) {
}
// Page scale should update metadata correctly (shrinking only the viewport).
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(2.f, gfx::Point());
host_impl_->PinchGestureEnd();
@@ -2449,8 +2439,8 @@ TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) {
DrawFrame();
// Scroll event is ignored because layer is not scrollable.
- EXPECT_EQ(InputHandler::ScrollIgnored,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_IGNORED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
EXPECT_FALSE(did_request_redraw_);
EXPECT_FALSE(did_request_commit_);
}
@@ -2607,8 +2597,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, ScrollTopControlsByFractionalAmount) {
gfx::Size(10, 10), gfx::Size(10, 10), gfx::Size(10, 10));
DrawFrame();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
// Make the test scroll delta a fractional amount, to verify that the
// fixed container size delta is (1) non-zero, and (2) fractional, and
@@ -2648,8 +2638,8 @@ TEST_F(LayerTreeHostImplTopControlsTest,
outer_scroll->SetDrawsContent(true);
host_impl_->active_tree()->PushPageScaleFromMainThread(2.f, 1.f, 2.f);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, 50.f));
// The entire scroll delta should have been used to hide the top controls.
@@ -2667,8 +2657,8 @@ TEST_F(LayerTreeHostImplTopControlsTest,
host_impl_->ScrollEnd();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), inner_scroll);
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -50.f));
@@ -2714,8 +2704,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, FixedContainerDelta) {
// not be scaled.
host_impl_->active_tree()->PushPageScaleFromMainThread(page_scale, 1.f, 2.f);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
// Scroll down, the top controls hiding should expand the viewport size so
// the delta should be equal to the scroll distance.
@@ -2786,8 +2776,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollableSublayer) {
// Scroll 25px to hide top controls
gfx::Vector2dF scroll_delta(0.f, 25.f);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
host_impl_->ScrollEnd();
@@ -2935,8 +2925,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsViewportOffsetClamping) {
// Hide the top controls by 25px.
gfx::Vector2dF scroll_delta(0.f, 25.f);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
// scrolling down at the max extents no longer hides the top controls
@@ -2961,8 +2951,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsViewportOffsetClamping) {
// Bring the top controls down by 25px.
scroll_delta = gfx::Vector2dF(0.f, -25.f);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
host_impl_->ScrollEnd();
@@ -2988,8 +2978,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsAspectRatio) {
host_impl_->top_controls_manager()->ContentTopOffset());
gfx::Vector2dF scroll_delta(0.f, 25.f);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
host_impl_->ScrollEnd();
@@ -3026,8 +3016,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
// Send a gesture scroll that will scroll the outer viewport, make sure the
// top controls get scrolled.
gfx::Vector2dF scroll_delta(0.f, 15.f);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
EXPECT_EQ(host_impl_->OuterViewportScrollLayer(),
host_impl_->CurrentlyScrollingLayer());
@@ -3038,8 +3028,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
host_impl_->top_controls_manager()->ContentTopOffset());
scroll_delta = gfx::Vector2dF(0.f, 50.f);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
EXPECT_EQ(0, host_impl_->top_controls_manager()->ContentTopOffset());
@@ -3054,8 +3044,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
host_impl_->InnerViewportScrollLayer()->SetScrollDelta(inner_viewport_offset);
scroll_delta = gfx::Vector2dF(0.f, -65.f);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
EXPECT_EQ(top_controls_height_,
@@ -3073,8 +3063,8 @@ TEST_F(LayerTreeHostImplTopControlsTest,
SetupTopControlsAndScrollLayer();
DrawFrame();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->top_controls_manager()->ScrollBegin();
host_impl_->top_controls_manager()->ScrollBy(gfx::Vector2dF(0.f, 50.f));
@@ -3086,8 +3076,8 @@ TEST_F(LayerTreeHostImplTopControlsTest,
host_impl_->ScrollEnd();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
float scroll_increment_y = -25.f;
host_impl_->top_controls_manager()->ScrollBegin();
@@ -3115,8 +3105,8 @@ TEST_F(LayerTreeHostImplTopControlsTest,
gfx::ScrollOffset(),
host_impl_->active_tree()->InnerViewportScrollLayer()->MaxScrollOffset());
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
}
TEST_F(LayerTreeHostImplTest, ScrollNonCompositedRoot) {
@@ -3151,9 +3141,8 @@ TEST_F(LayerTreeHostImplTest, ScrollNonCompositedRoot) {
host_impl_->SetViewportSize(surface_size);
DrawFrame();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
host_impl_->ScrollEnd();
EXPECT_TRUE(did_request_redraw_);
@@ -3172,9 +3161,8 @@ TEST_F(LayerTreeHostImplTest, ScrollChildCallsCommitAndRedraw) {
host_impl_->SetViewportSize(surface_size);
DrawFrame();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
host_impl_->ScrollEnd();
EXPECT_TRUE(did_request_redraw_);
@@ -3192,9 +3180,8 @@ TEST_F(LayerTreeHostImplTest, ScrollMissesChild) {
// Scroll event is ignored because the input coordinate is outside the layer
// boundaries.
- EXPECT_EQ(InputHandler::ScrollIgnored,
- host_impl_->ScrollBegin(gfx::Point(15, 5),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_IGNORED,
+ host_impl_->ScrollBegin(gfx::Point(15, 5), InputHandler::WHEEL));
EXPECT_FALSE(did_request_redraw_);
EXPECT_FALSE(did_request_commit_);
}
@@ -3218,9 +3205,8 @@ TEST_F(LayerTreeHostImplTest, ScrollMissesBackfacingChild) {
// Scroll event is ignored because the scrollable layer is not facing the
// viewer and there is nothing scrollable behind it.
- EXPECT_EQ(InputHandler::ScrollIgnored,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_IGNORED,
+ host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
EXPECT_FALSE(did_request_redraw_);
EXPECT_FALSE(did_request_commit_);
}
@@ -3248,9 +3234,8 @@ TEST_F(LayerTreeHostImplTest, ScrollBlockedByContentLayer) {
// Scrolling fails because the content layer is asking to be scrolled on the
// main thread.
- EXPECT_EQ(InputHandler::ScrollOnMainThread,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
}
TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnMainThread) {
@@ -3283,9 +3268,8 @@ TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnMainThread) {
gfx::Vector2d scroll_delta(0, 10);
gfx::Vector2d expected_scroll_delta = scroll_delta;
gfx::ScrollOffset expected_max_scroll = root_scroll->MaxScrollOffset();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
host_impl_->ScrollEnd();
@@ -3335,14 +3319,13 @@ TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnImplThread) {
gfx::Vector2d scroll_delta(0, 10);
gfx::Vector2d expected_scroll_delta = scroll_delta;
gfx::ScrollOffset expected_max_scroll = root_scroll->MaxScrollOffset();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
host_impl_->ScrollEnd();
// Set new page scale on impl thread by pinching.
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale, gfx::Point());
host_impl_->PinchGestureEnd();
@@ -3384,7 +3367,7 @@ TEST_F(LayerTreeHostImplTest, PageScaleDeltaAppliedToRootScrollLayerOnly) {
LayerImpl* grand_child = child->children()[0];
// Set new page scale on impl thread by pinching.
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(new_page_scale, gfx::Point());
host_impl_->PinchGestureEnd();
@@ -3447,9 +3430,8 @@ TEST_F(LayerTreeHostImplTest, ScrollChildAndChangePageScaleOnMainThread) {
gfx::Vector2d scroll_delta(0, 10);
gfx::Vector2d expected_scroll_delta(scroll_delta);
gfx::ScrollOffset expected_max_scroll(child->MaxScrollOffset());
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
host_impl_->ScrollEnd();
@@ -3499,9 +3481,8 @@ TEST_F(LayerTreeHostImplTest, ScrollChildBeyondLimit) {
DrawFrame();
{
gfx::Vector2d scroll_delta(-8, -7);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
host_impl_->ScrollEnd();
@@ -3553,9 +3534,9 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
DrawFrame();
{
gfx::Vector2d scroll_delta(0, -10);
- EXPECT_EQ(InputHandler::ScrollStarted,
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
host_impl_->ScrollBegin(gfx::Point(),
- InputHandler::NonBubblingGesture));
+ InputHandler::NON_BUBBLING_GESTURE));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
host_impl_->ScrollEnd();
@@ -3573,9 +3554,9 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
// The next time we scroll we should only scroll the parent.
scroll_delta = gfx::Vector2d(0, -3);
- EXPECT_EQ(InputHandler::ScrollStarted,
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::NonBubblingGesture));
+ InputHandler::NON_BUBBLING_GESTURE));
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child);
@@ -3592,9 +3573,9 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
// After scrolling the parent, another scroll on the opposite direction
// should still scroll the child.
scroll_delta = gfx::Vector2d(0, 7);
- EXPECT_EQ(InputHandler::ScrollStarted,
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::NonBubblingGesture));
+ InputHandler::NON_BUBBLING_GESTURE));
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
@@ -3614,9 +3595,9 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
host_impl_->SetPageScaleOnActiveTree(2.f);
scroll_delta = gfx::Vector2d(0, -2);
- EXPECT_EQ(InputHandler::ScrollStarted,
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
host_impl_->ScrollBegin(gfx::Point(1, 1),
- InputHandler::NonBubblingGesture));
+ InputHandler::NON_BUBBLING_GESTURE));
EXPECT_EQ(grand_child, host_impl_->CurrentlyScrollingLayer());
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
host_impl_->ScrollEnd();
@@ -3656,9 +3637,8 @@ TEST_F(LayerTreeHostImplTest, ScrollEventBubbling) {
DrawFrame();
{
gfx::Vector2d scroll_delta(0, 4);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
host_impl_->ScrollEnd();
@@ -3703,9 +3683,8 @@ TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) {
host_impl_->active_tree()->DidBecomeActive();
// Scrolling should still work even though we did not draw yet.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
}
TEST_F(LayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) {
@@ -3722,9 +3701,8 @@ TEST_F(LayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) {
// Scroll to the right in screen coordinates with a gesture.
gfx::Vector2d gesture_scroll_delta(10, 0);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(),
- InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta);
host_impl_->ScrollEnd();
@@ -3736,9 +3714,8 @@ TEST_F(LayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) {
// Reset and scroll down with the wheel.
scroll_layer->SetScrollDelta(gfx::Vector2dF());
gfx::Vector2d wheel_scroll_delta(0, 10);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), wheel_scroll_delta);
host_impl_->ScrollEnd();
@@ -3784,9 +3761,8 @@ TEST_F(LayerTreeHostImplTest, ScrollNonAxisAlignedRotatedLayer) {
{
// Scroll down in screen coordinates with a gesture.
gfx::Vector2d gesture_scroll_delta(0, 10);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(1, 1),
- InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(1, 1), InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta);
host_impl_->ScrollEnd();
@@ -3807,9 +3783,8 @@ TEST_F(LayerTreeHostImplTest, ScrollNonAxisAlignedRotatedLayer) {
// Now reset and scroll the same amount horizontally.
child_ptr->SetScrollDelta(gfx::Vector2dF());
gfx::Vector2d gesture_scroll_delta(10, 0);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(1, 1),
- InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(1, 1), InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta);
host_impl_->ScrollEnd();
@@ -3850,8 +3825,8 @@ TEST_F(LayerTreeHostImplTest, ScrollScaledLayer) {
// Scroll down in screen coordinates with a gesture.
gfx::Vector2d scroll_delta(0, 10);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
host_impl_->ScrollEnd();
@@ -3865,8 +3840,8 @@ TEST_F(LayerTreeHostImplTest, ScrollScaledLayer) {
// Reset and scroll down with the wheel.
scroll_layer->SetScrollDelta(gfx::Vector2dF());
gfx::Vector2d wheel_scroll_delta(0, 10);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), wheel_scroll_delta);
host_impl_->ScrollEnd();
@@ -4005,7 +3980,7 @@ TEST_F(LayerTreeHostImplTest, RootLayerScrollOffsetDelegation) {
// The pinch gesture doesn't put the delegate into a state where the scroll
// offset is outside of the scroll range. (this is verified by DCHECKs in the
// delegate).
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(2.f, gfx::Point());
host_impl_->PinchGestureUpdate(.5f, gfx::Point());
@@ -4017,8 +3992,8 @@ TEST_F(LayerTreeHostImplTest, RootLayerScrollOffsetDelegation) {
gfx::ScrollOffset current_offset(7.f, 8.f);
scroll_delegate.set_getter_return_value(current_offset);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
EXPECT_EQ(ScrollOffsetWithDelta(current_offset, scroll_delta),
@@ -4099,8 +4074,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
// In-bounds scrolling does not affect overscroll.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_FALSE(scroll_result.did_overscroll_root);
@@ -4234,9 +4209,9 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) {
DrawFrame();
{
gfx::Vector2d scroll_delta(0, -10);
- EXPECT_EQ(InputHandler::ScrollStarted,
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
host_impl_->ScrollBegin(gfx::Point(),
- InputHandler::NonBubblingGesture));
+ InputHandler::NON_BUBBLING_GESTURE));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
host_impl_->ScrollEnd();
@@ -4244,9 +4219,9 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) {
// The next time we scroll we should only scroll the parent, but overscroll
// should still not reach the root layer.
scroll_delta = gfx::Vector2d(0, -30);
- EXPECT_EQ(InputHandler::ScrollStarted,
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::NonBubblingGesture));
+ InputHandler::NON_BUBBLING_GESTURE));
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child_layer);
EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
@@ -4257,9 +4232,9 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) {
// After scrolling the parent, another scroll on the opposite direction
// should scroll the child.
scroll_delta = gfx::Vector2d(0, 70);
- EXPECT_EQ(InputHandler::ScrollStarted,
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::NonBubblingGesture));
+ InputHandler::NON_BUBBLING_GESTURE));
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child_layer);
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child_layer);
@@ -4296,9 +4271,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildEventBubbling) {
DrawFrame();
{
gfx::Vector2d scroll_delta(0, 8);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
- InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
@@ -4322,8 +4296,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollAlways) {
EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
// Even though the layer can't scroll the overscroll still happens.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
EXPECT_EQ(gfx::Vector2dF(0, 10), host_impl_->accumulated_root_overscroll());
}
@@ -4360,8 +4334,8 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollOnFractionalDeviceScale) {
// Horizontal & Vertical GlowEffect should not be applied when
// content size is less then view port size. For Example Horizontal &
// vertical GlowEffect should not be applied in about:blank page.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, -1));
EXPECT_EQ(gfx::Vector2dF().ToString(),
host_impl_->accumulated_root_overscroll().ToString());
@@ -4397,8 +4371,8 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) {
// Edge glow effect should be applicable only upon reaching Edges
// of the content. unnecessary glow effect calls shouldn't be
// called while scrolling up without reaching the edge of the content.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 100));
EXPECT_EQ(gfx::Vector2dF().ToString(),
host_impl_->accumulated_root_overscroll().ToString());
@@ -4408,10 +4382,10 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) {
host_impl_->ScrollEnd();
// unusedrootDelta should be subtracted from applied delta so that
// unwanted glow effect calls are not called.
- EXPECT_EQ(InputHandler::ScrollStarted,
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
host_impl_->ScrollBegin(gfx::Point(0, 0),
- InputHandler::NonBubblingGesture));
- EXPECT_EQ(InputHandler::ScrollStarted, host_impl_->FlingScrollBegin());
+ InputHandler::NON_BUBBLING_GESTURE));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 20));
EXPECT_EQ(gfx::Vector2dF(0.000000f, 17.699997f).ToString(),
host_impl_->accumulated_root_overscroll().ToString());
@@ -4422,8 +4396,8 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) {
host_impl_->ScrollEnd();
// TestCase to check kEpsilon, which prevents minute values to trigger
// gloweffect without reaching edge.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::WHEEL));
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(-0.12f, 0.1f));
EXPECT_EQ(gfx::Vector2dF().ToString(),
host_impl_->accumulated_root_overscroll().ToString());
@@ -4498,7 +4472,7 @@ class BlendStateCheckLayer : public LayerImpl {
resource_id_(resource_provider->CreateResource(
gfx::Size(1, 1),
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE,
RGBA_8888)) {
resource_provider->AllocateForTesting(resource_id_);
SetBounds(gfx::Size(10, 10));
@@ -6945,12 +6919,10 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldNotBubble) {
host_impl_->active_tree()->DidBecomeActive();
DrawFrame();
{
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(),
- InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->FlingScrollBegin());
+ EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
gfx::Vector2d scroll_delta(0, 100);
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
@@ -6998,8 +6970,8 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldLockToFirstScrolledLayer) {
LayerImpl* grand_child = child->children()[0];
gfx::Vector2d scroll_delta(0, -2);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
// The grand child should have scrolled up to its limit.
@@ -7019,7 +6991,7 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldLockToFirstScrolledLayer) {
// The first |ScrollBy| after the fling should re-lock the scrolling
// layer to the first layer that scrolled, which is the child.
- EXPECT_EQ(InputHandler::ScrollStarted, host_impl_->FlingScrollBegin());
+ EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child);
@@ -7058,11 +7030,10 @@ TEST_F(LayerTreeHostImplTest, WheelFlingShouldBubble) {
host_impl_->active_tree()->DidBecomeActive();
DrawFrame();
{
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->FlingScrollBegin());
+ EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
gfx::Vector2d scroll_delta(0, 100);
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
@@ -7081,7 +7052,7 @@ TEST_F(LayerTreeHostImplTest, WheelFlingShouldBubble) {
TEST_F(LayerTreeHostImplTest, ScrollUnknownNotOnAncestorChain) {
// If we ray cast a scroller that is not on the first layer's ancestor chain,
- // we should return ScrollUnknown.
+ // we should return SCROLL_UNKNOWN.
gfx::Size content_size(100, 100);
SetupScrollAndContentsLayers(content_size);
@@ -7107,14 +7078,14 @@ TEST_F(LayerTreeHostImplTest, ScrollUnknownNotOnAncestorChain) {
DrawFrame();
- EXPECT_EQ(InputHandler::ScrollUnknown,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_UNKNOWN,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
}
TEST_F(LayerTreeHostImplTest, ScrollUnknownScrollAncestorMismatch) {
// If we ray cast a scroller this is on the first layer's ancestor chain, but
// is not the first scroller we encounter when walking up from the layer, we
- // should also return ScrollUnknown.
+ // should also return SCROLL_UNKNOWN.
gfx::Size content_size(100, 100);
SetupScrollAndContentsLayers(content_size);
@@ -7146,8 +7117,8 @@ TEST_F(LayerTreeHostImplTest, ScrollUnknownScrollAncestorMismatch) {
DrawFrame();
- EXPECT_EQ(InputHandler::ScrollUnknown,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_UNKNOWN,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
}
TEST_F(LayerTreeHostImplTest, ScrollInvisibleScroller) {
@@ -7173,10 +7144,10 @@ TEST_F(LayerTreeHostImplTest, ScrollInvisibleScroller) {
// it. The reason for this is that if the scrolling the scroll would not move
// any layer that is a drawn RSLL member, then we can ignore the hit.
//
- // Why ScrollStarted? In this case, it's because we've bubbled out and started
- // overscrolling the inner viewport.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ // Why SCROLL_STARTED? In this case, it's because we've bubbled out and
+ // started overscrolling the inner viewport.
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
EXPECT_EQ(2, host_impl_->CurrentlyScrollingLayer()->id());
}
@@ -7230,10 +7201,10 @@ TEST_F(LayerTreeHostImplTest, ScrollInvisibleScrollerWithVisibleScrollChild) {
// it. The reason for this is that if the scrolling the scroll would not move
// any layer that is a drawn RSLL member, then we can ignore the hit.
//
- // Why ScrollStarted? In this case, it's because we've bubbled out and started
- // overscrolling the inner viewport.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ // Why SCROLL_STARTED? In this case, it's because we've bubbled out and
+ // started overscrolling the inner viewport.
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
EXPECT_EQ(7, host_impl_->CurrentlyScrollingLayer()->id());
}
@@ -7429,8 +7400,8 @@ TEST_F(LayerTreeHostImplTest, SimpleSwapPromiseMonitor) {
LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100));
// Scrolling normally should not trigger any forwarding.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
EXPECT_TRUE(
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)).did_scroll);
host_impl_->ScrollEnd();
@@ -7442,8 +7413,8 @@ TEST_F(LayerTreeHostImplTest, SimpleSwapPromiseMonitor) {
// Scrolling with a scroll handler should defer the swap to the main
// thread.
scroll_layer->SetHaveScrollEventHandlers(true);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
EXPECT_TRUE(
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)).did_scroll);
host_impl_->ScrollEnd();
@@ -7518,8 +7489,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
BOTH, SHOWN, false);
DrawFrame();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
scroll_layer->CurrentScrollOffset().ToString());
@@ -7577,8 +7548,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) {
BOTH, SHOWN, false);
DrawFrame();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
scroll_layer->CurrentScrollOffset().ToString());
@@ -7647,8 +7618,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) {
gfx::ScrollOffset(0, initial_scroll_offset));
DrawFrame();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
scroll_layer->CurrentScrollOffset().ToString());
@@ -7708,8 +7679,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
false);
DrawFrame();
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
float offset = 50;
@@ -7841,9 +7812,9 @@ TEST_F(LayerTreeHostImplVirtualViewportTest, FlingScrollBubblesToInner) {
EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset());
// Make sure the fling goes to the outer viewport first
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
- EXPECT_EQ(InputHandler::ScrollStarted, host_impl_->FlingScrollBegin());
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
gfx::Vector2d scroll_delta(inner_viewport.width(), inner_viewport.height());
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
@@ -7855,9 +7826,9 @@ TEST_F(LayerTreeHostImplVirtualViewportTest, FlingScrollBubblesToInner) {
EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset());
// Fling past the outer viewport boundry, make sure inner viewport scrolls.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
- EXPECT_EQ(InputHandler::ScrollStarted, host_impl_->FlingScrollBegin());
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
outer_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y());
@@ -7890,9 +7861,9 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset());
// Make sure the scroll goes to the outer viewport first.
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
- EXPECT_EQ(InputHandler::ScrollStarted, host_impl_->FlingScrollBegin());
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
// Scroll near the edge of the outer viewport.
gfx::Vector2d scroll_delta(inner_viewport.width(), inner_viewport.height());
@@ -7936,8 +7907,8 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
scoped_ptr<ScrollAndScaleSet> scroll_info;
gfx::Vector2d scroll_delta(0, inner_viewport.height());
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
// The child should have scrolled up to its limit.
@@ -7948,7 +7919,7 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
// The first |ScrollBy| after the fling should re-lock the scrolling
// layer to the first layer that scrolled, the inner viewport scroll layer.
- EXPECT_EQ(InputHandler::ScrollStarted, host_impl_->FlingScrollBegin());
+ EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), inner_scroll);
@@ -8024,7 +7995,7 @@ TEST_F(LayerTreeHostImplTest, ScrollAnimated) {
base::TimeTicks start_time =
base::TimeTicks() + base::TimeDelta::FromMilliseconds(100);
- EXPECT_EQ(InputHandler::ScrollStarted,
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 50)));
LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer();
@@ -8041,7 +8012,7 @@ TEST_F(LayerTreeHostImplTest, ScrollAnimated) {
EXPECT_TRUE(y > 1 && y < 49);
// Update target.
- EXPECT_EQ(InputHandler::ScrollStarted,
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 50)));
host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200));
@@ -8384,15 +8355,15 @@ TEST_F(LayerTreeHostImplTest, WheelScrollWithPageScaleFactorOnInnerLayer) {
scroll_layer->SetScrollDelta(gfx::Vector2d());
float page_scale_delta = 2.f;
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture);
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point());
host_impl_->PinchGestureEnd();
host_impl_->ScrollEnd();
gfx::Vector2dF scroll_delta(0, 5);
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_EQ(InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->CurrentScrollOffset());
host_impl_->ScrollBy(gfx::Point(), scroll_delta);
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index c8b7538..48be5b8 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -1322,7 +1322,7 @@ class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest {
// Make sure partial texture updates are turned off.
settings->max_partial_texture_updates = 0;
// Linear fade animator prevents scrollbars from drawing immediately.
- settings->scrollbar_animator = LayerTreeSettings::NoAnimator;
+ settings->scrollbar_animator = LayerTreeSettings::NO_ANIMATOR;
}
void SetupTree() override {
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
index e36f6a0..b8d0320 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -130,7 +130,7 @@ class LayerTreeHostAnimationTestAddAnimation
LayerAnimationController* controller =
layer_tree_host()->root_layer()->layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::Opacity);
+ Animation* animation = controller->GetAnimation(Animation::OPACITY);
if (animation)
controller->RemoveAnimation(animation->id());
@@ -471,8 +471,7 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
LayerAnimationController* controller_impl =
host_impl->active_tree()->root_layer()->children()[0]->
layer_animation_controller();
- Animation* animation =
- controller_impl->GetAnimation(Animation::Opacity);
+ Animation* animation = controller_impl->GetAnimation(Animation::OPACITY);
if (!animation)
return;
@@ -523,8 +522,7 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
LayerAnimationController* controller =
layer_tree_host()->root_layer()->children()[0]->
layer_animation_controller();
- Animation* animation =
- controller->GetAnimation(Animation::Opacity);
+ Animation* animation = controller->GetAnimation(Animation::OPACITY);
main_start_time_ = animation->start_time();
controller->RemoveAnimation(animation->id());
EndTest();
@@ -535,8 +533,7 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
LayerAnimationController* controller =
impl_host->active_tree()->root_layer()->children()[0]->
layer_animation_controller();
- Animation* animation =
- controller->GetAnimation(Animation::Opacity);
+ Animation* animation = controller->GetAnimation(Animation::OPACITY);
if (!animation)
return;
@@ -573,8 +570,7 @@ class LayerTreeHostAnimationTestAnimationFinishedEvents
int group) override {
LayerAnimationController* controller =
layer_tree_host()->root_layer()->layer_animation_controller();
- Animation* animation =
- controller->GetAnimation(Animation::Opacity);
+ Animation* animation = controller->GetAnimation(Animation::OPACITY);
if (animation)
controller->RemoveAnimation(animation->id());
EndTest();
@@ -609,7 +605,7 @@ class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity
LayerAnimationController* controller_impl =
host_impl->active_tree()->root_layer()->layer_animation_controller();
Animation* animation_impl =
- controller_impl->GetAnimation(Animation::Opacity);
+ controller_impl->GetAnimation(Animation::OPACITY);
controller_impl->RemoveAnimation(animation_impl->id());
EndTest();
}
@@ -648,8 +644,7 @@ class LayerTreeHostAnimationTestLayerAddedWithAnimation
// Any valid AnimationCurve will do here.
scoped_ptr<AnimationCurve> curve(new FakeFloatAnimationCurve());
scoped_ptr<Animation> animation(
- Animation::Create(curve.Pass(), 1, 1,
- Animation::Opacity));
+ Animation::Create(curve.Pass(), 1, 1, Animation::OPACITY));
layer->layer_animation_controller()->AddAnimation(animation.Pass());
// We add the animation *before* attaching the layer to the tree.
@@ -986,7 +981,7 @@ class LayerTreeHostAnimationTestScrollOffsetChangesArePropagated
gfx::ScrollOffset(500.f, 550.f),
EaseInOutTimingFunction::Create()));
scoped_ptr<Animation> animation(
- Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset));
+ Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET));
animation->set_needs_synchronized_start_time(true);
bool animation_added = scroll_layer_->AddAnimation(animation.Pass());
bool impl_scrolling_supported =
@@ -1036,7 +1031,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval
ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f),
EaseInOutTimingFunction::Create()));
scoped_ptr<Animation> animation(
- Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset));
+ Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET));
animation->set_needs_synchronized_start_time(true);
scroll_layer_->AddAnimation(animation.Pass());
}
@@ -1050,7 +1045,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval
case 1: {
Animation* animation =
scroll_layer_->layer_animation_controller()->GetAnimation(
- Animation::ScrollOffset);
+ Animation::SCROLL_OFFSET);
scroll_layer_->layer_animation_controller()->RemoveAnimation(
animation->id());
scroll_layer_->SetScrollOffset(final_postion_);
@@ -1080,9 +1075,9 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval
host_impl->active_tree()->root_layer()->children()[0];
Animation* animation =
scroll_layer_impl->layer_animation_controller()->GetAnimation(
- Animation::ScrollOffset);
+ Animation::SCROLL_OFFSET);
- if (!animation || animation->run_state() != Animation::Running) {
+ if (!animation || animation->run_state() != Animation::RUNNING) {
host_impl->BlockNotifyReadyToActivateForTesting(false);
return;
}
@@ -1187,20 +1182,20 @@ class LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers
LayerAnimationController* root_controller_impl =
host_impl->active_tree()->root_layer()->layer_animation_controller();
Animation* root_animation =
- root_controller_impl->GetAnimation(Animation::Opacity);
- if (!root_animation || root_animation->run_state() != Animation::Running)
+ root_controller_impl->GetAnimation(Animation::OPACITY);
+ if (!root_animation || root_animation->run_state() != Animation::RUNNING)
return;
LayerAnimationController* child_controller_impl =
host_impl->active_tree()->root_layer()->children()
[0]->layer_animation_controller();
Animation* child_animation =
- child_controller_impl->GetAnimation(Animation::Opacity);
- EXPECT_EQ(Animation::Running, child_animation->run_state());
+ child_controller_impl->GetAnimation(Animation::OPACITY);
+ EXPECT_EQ(Animation::RUNNING, child_animation->run_state());
EXPECT_EQ(root_animation->start_time(), child_animation->start_time());
- root_controller_impl->AbortAnimations(Animation::Opacity);
- root_controller_impl->AbortAnimations(Animation::Transform);
- child_controller_impl->AbortAnimations(Animation::Opacity);
+ root_controller_impl->AbortAnimations(Animation::OPACITY);
+ root_controller_impl->AbortAnimations(Animation::TRANSFORM);
+ child_controller_impl->AbortAnimations(Animation::OPACITY);
EndTest();
}
@@ -1257,10 +1252,10 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating
++iter) {
int id = ((*iter).second->id());
if (id == host_impl->RootLayer()->id()) {
- Animation* anim = (*iter).second->GetAnimation(Animation::Transform);
+ Animation* anim = (*iter).second->GetAnimation(Animation::TRANSFORM);
EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0);
} else if (id == host_impl->RootLayer()->children()[0]->id()) {
- Animation* anim = (*iter).second->GetAnimation(Animation::Opacity);
+ Animation* anim = (*iter).second->GetAnimation(Animation::OPACITY);
EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0);
}
}
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index 596adc0..c99180d 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -1000,10 +1000,8 @@ class LayerTreeHostContextTestDontUseLostResources
ResourceProvider::ResourceId resource =
child_resource_provider_->CreateResource(
- gfx::Size(4, 4),
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureHintImmutable,
- RGBA_8888);
+ gfx::Size(4, 4), GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888);
ResourceProvider::ScopedWriteLockGL lock(child_resource_provider_.get(),
resource);
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc
index 03a0860..547ece7 100644
--- a/cc/trees/layer_tree_host_unittest_scroll.cc
+++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -582,12 +582,12 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest {
EXPECT_EQ(device_scale_factor_, impl->active_tree()->device_scale_factor());
switch (impl->active_tree()->source_frame_number()) {
case 0: {
- // Gesture scroll on impl thread.
+ // GESTURE scroll on impl thread.
InputHandler::ScrollStatus status = impl->ScrollBegin(
gfx::ToCeiledPoint(expected_scroll_layer_impl->position() -
gfx::Vector2dF(0.5f, 0.5f)),
- InputHandler::Gesture);
- EXPECT_EQ(InputHandler::ScrollStarted, status);
+ InputHandler::GESTURE);
+ EXPECT_EQ(InputHandler::SCROLL_STARTED, status);
impl->ScrollBy(gfx::Point(), scroll_amount_);
impl->ScrollEnd();
@@ -599,12 +599,12 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest {
break;
}
case 1: {
- // Wheel scroll on impl thread.
+ // WHEEL scroll on impl thread.
InputHandler::ScrollStatus status = impl->ScrollBegin(
gfx::ToCeiledPoint(expected_scroll_layer_impl->position() +
gfx::Vector2dF(0.5f, 0.5f)),
- InputHandler::Wheel);
- EXPECT_EQ(InputHandler::ScrollStarted, status);
+ InputHandler::WHEEL);
+ EXPECT_EQ(InputHandler::SCROLL_STARTED, status);
impl->ScrollBy(gfx::Point(), scroll_amount_);
impl->ScrollEnd();
@@ -1040,23 +1040,23 @@ class LayerTreeHostScrollTestScrollZeroMaxScrollOffset
scroll_layer->SetBounds(
gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100));
EXPECT_EQ(
- InputHandler::ScrollStarted,
- scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture,
- ScrollBlocksOnNone));
+ InputHandler::SCROLL_STARTED,
+ scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE,
+ SCROLL_BLOCKS_ON_NONE));
// Set max_scroll_offset = (0, 0).
scroll_layer->SetBounds(root->bounds());
EXPECT_EQ(
- InputHandler::ScrollIgnored,
- scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture,
- ScrollBlocksOnNone));
+ InputHandler::SCROLL_IGNORED,
+ scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE,
+ SCROLL_BLOCKS_ON_NONE));
// Set max_scroll_offset = (-100, -100).
scroll_layer->SetBounds(gfx::Size());
EXPECT_EQ(
- InputHandler::ScrollIgnored,
- scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture,
- ScrollBlocksOnNone));
+ InputHandler::SCROLL_IGNORED,
+ scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE,
+ SCROLL_BLOCKS_ON_NONE));
EndTest();
}
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 0b865cc7..e86e785 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -942,7 +942,7 @@ LayerTreeImpl::CreateScrollbarAnimationController(LayerImpl* scrolling_layer) {
base::TimeDelta duration =
base::TimeDelta::FromMilliseconds(settings().scrollbar_fade_duration_ms);
switch (settings().scrollbar_animator) {
- case LayerTreeSettings::LinearFade: {
+ case LayerTreeSettings::LINEAR_FADE: {
return ScrollbarAnimationControllerLinearFade::Create(
scrolling_layer,
layer_tree_host_impl_,
@@ -950,14 +950,14 @@ LayerTreeImpl::CreateScrollbarAnimationController(LayerImpl* scrolling_layer) {
resize_delay,
duration);
}
- case LayerTreeSettings::Thinning: {
+ case LayerTreeSettings::THINNING: {
return ScrollbarAnimationControllerThinning::Create(scrolling_layer,
layer_tree_host_impl_,
delay,
resize_delay,
duration);
}
- case LayerTreeSettings::NoAnimator:
+ case LayerTreeSettings::NO_ANIMATOR:
NOTREACHED();
break;
}
@@ -1191,13 +1191,13 @@ bool LayerTreeImpl::IsUIResourceOpaque(UIResourceId uid) const {
void LayerTreeImpl::ProcessUIResourceRequestQueue() {
for (const auto& req : ui_resource_request_queue_) {
switch (req.GetType()) {
- case UIResourceRequest::UIResourceCreate:
+ case UIResourceRequest::UI_RESOURCE_CREATE:
layer_tree_host_impl_->CreateUIResource(req.GetId(), req.GetBitmap());
break;
- case UIResourceRequest::UIResourceDelete:
+ case UIResourceRequest::UI_RESOURCE_DELETE:
layer_tree_host_impl_->DeleteUIResource(req.GetId());
break;
- case UIResourceRequest::UIResourceInvalidRequest:
+ case UIResourceRequest::UI_RESOURCE_INVALID_REQUEST:
NOTREACHED();
break;
}
diff --git a/cc/trees/layer_tree_settings.cc b/cc/trees/layer_tree_settings.cc
index d3afbe2..9d605ae 100644
--- a/cc/trees/layer_tree_settings.cc
+++ b/cc/trees/layer_tree_settings.cc
@@ -33,7 +33,7 @@ LayerTreeSettings::LayerTreeSettings()
gpu_rasterization_skewport_target_time_in_seconds(0.0f),
threaded_gpu_rasterization_enabled(false),
create_low_res_tiling(false),
- scrollbar_animator(NoAnimator),
+ scrollbar_animator(NO_ANIMATOR),
scrollbar_fade_delay_ms(0),
scrollbar_fade_resize_delay_ms(0),
scrollbar_fade_duration_ms(0),
diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h
index fd108f4..a0fbeaa 100644
--- a/cc/trees/layer_tree_settings.h
+++ b/cc/trees/layer_tree_settings.h
@@ -43,9 +43,9 @@ class CC_EXPORT LayerTreeSettings {
bool create_low_res_tiling;
enum ScrollbarAnimator {
- NoAnimator,
- LinearFade,
- Thinning,
+ NO_ANIMATOR,
+ LINEAR_FADE,
+ THINNING,
};
ScrollbarAnimator scrollbar_animator;
int scrollbar_fade_delay_ms;
diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc
index ae39f03..7fe0494 100644
--- a/cc/trees/property_tree_builder.cc
+++ b/cc/trees/property_tree_builder.cc
@@ -118,7 +118,7 @@ void AddTransformNodeIfNeeded(const DataForRecursion& data_from_ancestor,
const bool has_animated_transform =
layer->layer_animation_controller()->IsAnimatingProperty(
- Animation::Transform);
+ Animation::TRANSFORM);
const bool has_transform_origin = layer->transform_origin() != gfx::Point3F();
diff --git a/content/child/assert_matching_enums.cc b/content/child/assert_matching_enums.cc
index 33a4fbd..0d087ed 100644
--- a/content/child/assert_matching_enums.cc
+++ b/content/child/assert_matching_enums.cc
@@ -49,15 +49,14 @@ STATIC_ASSERT_MATCHING_ENUM(blink::WebMimeRegistry::MayBeSupported,
// TargetProperty
STATIC_ASSERT_MATCHING_ENUM(
blink::WebCompositorAnimation::TargetPropertyTransform,
- cc::Animation::Transform);
+ cc::Animation::TRANSFORM);
STATIC_ASSERT_MATCHING_ENUM(
blink::WebCompositorAnimation::TargetPropertyOpacity,
- cc::Animation::Opacity);
-STATIC_ASSERT_MATCHING_ENUM(
- blink::WebCompositorAnimation::TargetPropertyFilter,
- cc::Animation::Filter);
+ cc::Animation::OPACITY);
+STATIC_ASSERT_MATCHING_ENUM(blink::WebCompositorAnimation::TargetPropertyFilter,
+ cc::Animation::FILTER);
STATIC_ASSERT_MATCHING_ENUM(
blink::WebCompositorAnimation::TargetPropertyScrollOffset,
- cc::Animation::ScrollOffset);
+ cc::Animation::SCROLL_OFFSET);
} // namespace content
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index c6d1eb2..716bd49 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -360,10 +360,10 @@ void RenderWidgetCompositor::Initialize() {
settings.max_partial_texture_updates = 0;
if (synchronous_compositor_factory) {
// Android WebView uses system scrollbars, so make ours invisible.
- settings.scrollbar_animator = cc::LayerTreeSettings::NoAnimator;
+ settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR;
settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT;
} else {
- settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade;
+ settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE;
settings.scrollbar_fade_delay_ms = 300;
settings.scrollbar_fade_resize_delay_ms = 2000;
settings.scrollbar_fade_duration_ms = 300;
@@ -400,13 +400,13 @@ void RenderWidgetCompositor::Initialize() {
#elif !defined(OS_MACOSX)
if (ui::IsOverlayScrollbarEnabled()) {
- settings.scrollbar_animator = cc::LayerTreeSettings::Thinning;
+ settings.scrollbar_animator = cc::LayerTreeSettings::THINNING;
settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
} else if (cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport)) {
// use_pinch_zoom_scrollbars is only true on desktop when non-overlay
// scrollbars are in use.
settings.use_pinch_zoom_scrollbars = true;
- settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade;
+ settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE;
settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
}
settings.scrollbar_fade_delay_ms = 500;
diff --git a/content/renderer/input/input_handler_proxy.cc b/content/renderer/input/input_handler_proxy.cc
index 6030558..f9cc75b 100644
--- a/content/renderer/input/input_handler_proxy.cc
+++ b/content/renderer/input/input_handler_proxy.cc
@@ -346,10 +346,10 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel(
gfx::Point(wheel_event.x, wheel_event.y),
gfx::Vector2dF(-wheel_event.deltaX, -wheel_event.deltaY));
switch (scroll_status) {
- case cc::InputHandler::ScrollStarted:
+ case cc::InputHandler::SCROLL_STARTED:
result = DID_HANDLE;
break;
- case cc::InputHandler::ScrollIgnored:
+ case cc::InputHandler::SCROLL_IGNORED:
result = DROP_EVENT;
default:
result = DID_NOT_HANDLE;
@@ -357,9 +357,9 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel(
}
} else {
cc::InputHandler::ScrollStatus scroll_status = input_handler_->ScrollBegin(
- gfx::Point(wheel_event.x, wheel_event.y), cc::InputHandler::Wheel);
+ gfx::Point(wheel_event.x, wheel_event.y), cc::InputHandler::WHEEL);
switch (scroll_status) {
- case cc::InputHandler::ScrollStarted: {
+ case cc::InputHandler::SCROLL_STARTED: {
TRACE_EVENT_INSTANT2(
"input", "InputHandlerProxy::handle_input wheel scroll",
TRACE_EVENT_SCOPE_THREAD, "deltaX", -wheel_event.deltaX, "deltaY",
@@ -372,15 +372,15 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel(
result = scroll_result.did_scroll ? DID_HANDLE : DROP_EVENT;
break;
}
- case cc::InputHandler::ScrollIgnored:
+ case cc::InputHandler::SCROLL_IGNORED:
// TODO(jamesr): This should be DROP_EVENT, but in cases where we fail
// to properly sync scrollability it's safer to send the event to the
// main thread. Change back to DROP_EVENT once we have synchronization
// bugs sorted out.
result = DID_NOT_HANDLE;
break;
- case cc::InputHandler::ScrollUnknown:
- case cc::InputHandler::ScrollOnMainThread:
+ case cc::InputHandler::SCROLL_UNKNOWN:
+ case cc::InputHandler::SCROLL_ON_MAIN_THREAD:
result = DID_NOT_HANDLE;
break;
case cc::InputHandler::ScrollStatusCount:
@@ -414,22 +414,21 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureScrollBegin(
expect_scroll_update_end_ = true;
#endif
cc::InputHandler::ScrollStatus scroll_status = input_handler_->ScrollBegin(
- gfx::Point(gesture_event.x, gesture_event.y),
- cc::InputHandler::Gesture);
+ gfx::Point(gesture_event.x, gesture_event.y), cc::InputHandler::GESTURE);
UMA_HISTOGRAM_ENUMERATION("Renderer4.CompositorScrollHitTestResult",
scroll_status,
cc::InputHandler::ScrollStatusCount);
switch (scroll_status) {
- case cc::InputHandler::ScrollStarted:
+ case cc::InputHandler::SCROLL_STARTED:
TRACE_EVENT_INSTANT0("input",
"InputHandlerProxy::handle_input gesture scroll",
TRACE_EVENT_SCOPE_THREAD);
gesture_scroll_on_impl_thread_ = true;
return DID_HANDLE;
- case cc::InputHandler::ScrollUnknown:
- case cc::InputHandler::ScrollOnMainThread:
+ case cc::InputHandler::SCROLL_UNKNOWN:
+ case cc::InputHandler::SCROLL_ON_MAIN_THREAD:
return DID_NOT_HANDLE;
- case cc::InputHandler::ScrollIgnored:
+ case cc::InputHandler::SCROLL_IGNORED:
return DROP_EVENT;
case cc::InputHandler::ScrollStatusCount:
NOTREACHED();
@@ -477,10 +476,10 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart(
if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad) {
scroll_status = input_handler_->ScrollBegin(
gfx::Point(gesture_event.x, gesture_event.y),
- cc::InputHandler::NonBubblingGesture);
+ cc::InputHandler::NON_BUBBLING_GESTURE);
} else {
if (!gesture_scroll_on_impl_thread_)
- scroll_status = cc::InputHandler::ScrollOnMainThread;
+ scroll_status = cc::InputHandler::SCROLL_ON_MAIN_THREAD;
else
scroll_status = input_handler_->FlingScrollBegin();
}
@@ -490,7 +489,7 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart(
#endif
switch (scroll_status) {
- case cc::InputHandler::ScrollStarted: {
+ case cc::InputHandler::SCROLL_STARTED: {
if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad)
input_handler_->ScrollEnd();
@@ -524,8 +523,8 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart(
input_handler_->SetNeedsAnimate();
return DID_HANDLE;
}
- case cc::InputHandler::ScrollUnknown:
- case cc::InputHandler::ScrollOnMainThread: {
+ case cc::InputHandler::SCROLL_UNKNOWN:
+ case cc::InputHandler::SCROLL_ON_MAIN_THREAD: {
TRACE_EVENT_INSTANT0("input",
"InputHandlerProxy::HandleGestureFling::"
"scroll_on_main_thread",
@@ -533,7 +532,7 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart(
fling_may_be_active_on_main_thread_ = true;
return DID_NOT_HANDLE;
}
- case cc::InputHandler::ScrollIgnored: {
+ case cc::InputHandler::SCROLL_IGNORED: {
TRACE_EVENT_INSTANT0(
"input",
"InputHandlerProxy::HandleGestureFling::ignored",
@@ -616,8 +615,8 @@ bool InputHandlerProxy::FilterInputEventForFlingBoosting(
if (!input_handler_->IsCurrentlyScrollingLayerAt(
gfx::Point(gesture_event.x, gesture_event.y),
fling_parameters_.sourceDevice == blink::WebGestureDeviceTouchpad
- ? cc::InputHandler::NonBubblingGesture
- : cc::InputHandler::Gesture)) {
+ ? cc::InputHandler::NON_BUBBLING_GESTURE
+ : cc::InputHandler::GESTURE)) {
CancelCurrentFling();
return false;
}
diff --git a/content/renderer/input/input_handler_proxy_unittest.cc b/content/renderer/input/input_handler_proxy_unittest.cc
index bfbd5cc..caa771f 100644
--- a/content/renderer/input/input_handler_proxy_unittest.cc
+++ b/content/renderer/input/input_handler_proxy_unittest.cc
@@ -241,7 +241,7 @@ class InputHandlerProxyTest : public testing::Test {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
gesture_.type = WebInputEvent::GestureScrollBegin;
gesture_.sourceDevice = source_device;
EXPECT_EQ(expected_disposition_,
@@ -250,7 +250,7 @@ class InputHandlerProxyTest : public testing::Test {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
gesture_ =
@@ -306,7 +306,7 @@ TEST_F(InputHandlerProxyTest, GestureScrollStarted) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
gesture_.type = WebInputEvent::GestureScrollBegin;
EXPECT_EQ(expected_disposition_,input_handler_->HandleInputEvent(gesture_));
@@ -351,7 +351,7 @@ TEST_F(InputHandlerProxyTest, GestureScrollOnMainThread) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(::testing::_, ::testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollOnMainThread));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_ON_MAIN_THREAD));
gesture_.type = WebInputEvent::GestureScrollBegin;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -380,7 +380,7 @@ TEST_F(InputHandlerProxyTest, GestureScrollIgnored) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollIgnored));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_IGNORED));
gesture_.type = WebInputEvent::GestureScrollBegin;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -465,7 +465,7 @@ TEST_F(InputHandlerProxyTest, GesturePinchAfterScrollOnMainThread) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(::testing::_, ::testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollOnMainThread));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_ON_MAIN_THREAD));
gesture_.type = WebInputEvent::GestureScrollBegin;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -540,7 +540,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingStartedTouchpad) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
@@ -563,7 +563,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingOnMainThreadTouchpad) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollOnMainThread));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_ON_MAIN_THREAD));
gesture_.type = WebInputEvent::GestureFlingStart;
gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
@@ -587,7 +587,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingIgnoredTouchpad) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollIgnored));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_IGNORED));
gesture_.type = WebInputEvent::GestureFlingStart;
gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
@@ -624,7 +624,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
modifiers);
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -645,7 +645,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
// The second call should start scrolling in the -X direction.
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
@@ -662,7 +662,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
// rest of the fling can be
// transferred to the main thread.
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollOnMainThread));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_ON_MAIN_THREAD));
EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_)).Times(0);
EXPECT_CALL(mock_input_handler_, ScrollEnd()).Times(0);
// Expected wheel fling animation parameters:
@@ -729,7 +729,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
modifiers);
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -748,7 +748,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
// The second call should start scrolling in the -X direction.
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
@@ -765,7 +765,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
// rest of the fling can be
// transferred to the main thread.
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollOnMainThread));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_ON_MAIN_THREAD));
EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_)).Times(0);
EXPECT_CALL(mock_input_handler_, ScrollEnd()).Times(0);
@@ -830,7 +830,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
modifiers);
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
expected_disposition_ = InputHandlerProxy::DID_HANDLE;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -849,7 +849,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
// Tick the second fling once normally.
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::y, testing::Gt(0))))
@@ -862,7 +862,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
// Then abort the second fling.
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollOnMainThread));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_ON_MAIN_THREAD));
EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_)).Times(0);
EXPECT_CALL(mock_input_handler_, ScrollEnd()).Times(0);
@@ -893,7 +893,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingStartedTouchscreen) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
gesture_.type = WebInputEvent::GestureScrollBegin;
gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -901,7 +901,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingStartedTouchscreen) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
gesture_.type = WebInputEvent::GestureFlingStart;
@@ -925,7 +925,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingOnMainThreadTouchscreen) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollOnMainThread));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_ON_MAIN_THREAD));
gesture_.type = WebInputEvent::GestureScrollBegin;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -952,7 +952,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingIgnoredTouchscreen) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
gesture_.type = WebInputEvent::GestureScrollBegin;
gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
@@ -962,7 +962,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingIgnoredTouchscreen) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
- .WillOnce(testing::Return(cc::InputHandler::ScrollIgnored));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_IGNORED));
gesture_.type = WebInputEvent::GestureFlingStart;
gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
@@ -983,7 +983,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchscreen) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
gesture_.type = WebInputEvent::GestureScrollBegin;
gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
@@ -1005,7 +1005,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchscreen) {
modifiers);
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
@@ -1042,7 +1042,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithValidTimestamp) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
gesture_.type = WebInputEvent::GestureScrollBegin;
gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
@@ -1066,7 +1066,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithValidTimestamp) {
modifiers);
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
@@ -1096,7 +1096,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithInvalidTimestamp) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
gesture_.type = WebInputEvent::GestureScrollBegin;
gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
@@ -1123,7 +1123,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithInvalidTimestamp) {
gesture_.modifiers = modifiers;
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
@@ -1160,7 +1160,7 @@ TEST_F(InputHandlerProxyTest,
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
gesture_.type = WebInputEvent::GestureScrollBegin;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1185,7 +1185,7 @@ TEST_F(InputHandlerProxyTest,
modifiers);
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
// |gesture_scroll_on_impl_thread_| should still be true after
@@ -1236,7 +1236,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
gesture_.data.flingStart.velocityX = fling_delta.x;
gesture_.data.flingStart.velocityY = fling_delta.y;
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1250,7 +1250,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
// The second animate starts scrolling in the positive X and Y directions.
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))
@@ -1269,7 +1269,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
overscroll.accumulated_root_overscroll = gfx::Vector2dF(0, 100);
overscroll.unused_scroll_delta = gfx::Vector2dF(0, 10);
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))
@@ -1295,7 +1295,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
// The next call to animate will no longer scroll vertically.
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::y, testing::Eq(0))))
@@ -1312,7 +1312,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
gesture_.type = WebInputEvent::GestureScrollBegin;
gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
@@ -1336,7 +1336,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) {
modifiers);
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
@@ -1393,7 +1393,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
gesture_.type = WebInputEvent::GestureScrollBegin;
gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1406,7 +1406,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
gesture_.data.flingStart.velocityX = fling_delta.x;
gesture_.data.flingStart.velocityY = fling_delta.y;
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
@@ -1553,7 +1553,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingCancelledByKeyboardEvent) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
gesture_.type = WebInputEvent::GestureScrollBegin;
gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1574,7 +1574,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingCancelledByKeyboardEvent) {
gesture_.data.flingStart.velocityX = fling_delta.x;
gesture_.data.flingStart.velocityY = fling_delta.y;
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
@@ -1605,7 +1605,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithNegativeTimeDelta) {
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
gesture_.type = WebInputEvent::GestureScrollBegin;
gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
@@ -1629,7 +1629,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithNegativeTimeDelta) {
modifiers);
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
@@ -1818,7 +1818,7 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfScrollTargetsDifferentLayer) {
.WillOnce(testing::Return(false));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
time += dt;
gesture_.timeStampSeconds = InSecondsF(time);
@@ -1859,7 +1859,7 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfScrollDelayed) {
time += base::TimeDelta::FromMilliseconds(100);
EXPECT_CALL(mock_input_handler_, ScrollEnd());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
input_handler_->Animate(time);
VERIFY_AND_RESET_MOCKS();
@@ -1941,7 +1941,7 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfScrollInDifferentDirection) {
gesture_.data.scrollUpdate.deltaX = -fling_delta.x;
EXPECT_CALL(mock_input_handler_, ScrollEnd());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_,
ScrollBy(testing::_,
testing::Property(&gfx::Vector2dF::x,
@@ -2051,7 +2051,7 @@ TEST_F(InputHandlerProxyTest, FlingBoostTerminatedDuringScrollSequence) {
.WillOnce(testing::Return(scroll_result_did_not_scroll_));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
input_handler_->Animate(time);
VERIFY_AND_RESET_MOCKS();
@@ -2113,7 +2113,7 @@ TEST_F(InputHandlerProxyTest, DidReceiveInputEvent_ForFling) {
gesture_.data.flingStart.velocityY = fling_delta.y;
EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_, ScrollEnd());
EXPECT_CALL(mock_client,
DidReceiveInputEvent(Field(&WebInputEvent::type,
diff --git a/ui/compositor/layer_animation_element.cc b/ui/compositor/layer_animation_element.cc
index 3e667df..9a528e5 100644
--- a/ui/compositor/layer_animation_element.cc
+++ b/ui/compositor/layer_animation_element.cc
@@ -411,10 +411,8 @@ class ThreadedOpacityTransition : public ThreadedLayerAnimationElement {
target_,
duration()));
scoped_ptr<cc::Animation> animation(
- cc::Animation::Create(animation_curve.Pass(),
- animation_id(),
- animation_group_id(),
- cc::Animation::Opacity));
+ cc::Animation::Create(animation_curve.Pass(), animation_id(),
+ animation_group_id(), cc::Animation::OPACITY));
return animation.Pass();
}
@@ -466,10 +464,8 @@ class ThreadedTransformTransition : public ThreadedLayerAnimationElement {
target_,
duration()));
scoped_ptr<cc::Animation> animation(
- cc::Animation::Create(animation_curve.Pass(),
- animation_id(),
- animation_group_id(),
- cc::Animation::Transform));
+ cc::Animation::Create(animation_curve.Pass(), animation_id(),
+ animation_group_id(), cc::Animation::TRANSFORM));
return animation.Pass();
}
@@ -540,10 +536,8 @@ class InverseTransformTransition : public ThreadedLayerAnimationElement {
scoped_ptr<cc::Animation> CreateCCAnimation() override {
scoped_ptr<cc::Animation> animation(
- cc::Animation::Create(animation_curve_->Clone(),
- animation_id(),
- animation_group_id(),
- cc::Animation::Transform));
+ cc::Animation::Create(animation_curve_->Clone(), animation_id(),
+ animation_group_id(), cc::Animation::TRANSFORM));
return animation.Pass();
}
@@ -738,9 +732,9 @@ LayerAnimationElement::AnimatableProperty
LayerAnimationElement::ToAnimatableProperty(
cc::Animation::TargetProperty property) {
switch (property) {
- case cc::Animation::Transform:
+ case cc::Animation::TRANSFORM:
return TRANSFORM;
- case cc::Animation::Opacity:
+ case cc::Animation::OPACITY:
return OPACITY;
default:
NOTREACHED();
diff --git a/ui/compositor/layer_animation_sequence_unittest.cc b/ui/compositor/layer_animation_sequence_unittest.cc
index 2d3b8be..c416fab 100644
--- a/ui/compositor/layer_animation_sequence_unittest.cc
+++ b/ui/compositor/layer_animation_sequence_unittest.cc
@@ -92,12 +92,9 @@ TEST(LayerAnimationSequenceTest, SingleThreadedElement) {
sequence.Progress(start_time, &delegate);
EXPECT_FLOAT_EQ(start, sequence.last_progressed_fraction());
effective_start = start_time + delta;
- sequence.OnThreadedAnimationStarted(
- cc::AnimationEvent(cc::AnimationEvent::Started,
- 0,
- sequence.animation_group_id(),
- cc::Animation::Opacity,
- effective_start));
+ sequence.OnThreadedAnimationStarted(cc::AnimationEvent(
+ cc::AnimationEvent::STARTED, 0, sequence.animation_group_id(),
+ cc::Animation::OPACITY, effective_start));
sequence.Progress(effective_start + delta/2, &delegate);
EXPECT_FLOAT_EQ(middle, sequence.last_progressed_fraction());
EXPECT_TRUE(sequence.IsFinished(effective_start + delta));
@@ -149,12 +146,9 @@ TEST(LayerAnimationSequenceTest, MultipleElement) {
EXPECT_FLOAT_EQ(0.0, sequence.last_progressed_fraction());
opacity_effective_start = start_time + delta;
EXPECT_EQ(starting_group_id, sequence.animation_group_id());
- sequence.OnThreadedAnimationStarted(
- cc::AnimationEvent(cc::AnimationEvent::Started,
- 0,
- sequence.animation_group_id(),
- cc::Animation::Opacity,
- opacity_effective_start));
+ sequence.OnThreadedAnimationStarted(cc::AnimationEvent(
+ cc::AnimationEvent::STARTED, 0, sequence.animation_group_id(),
+ cc::Animation::OPACITY, opacity_effective_start));
sequence.Progress(opacity_effective_start + delta/2, &delegate);
EXPECT_FLOAT_EQ(0.5, sequence.last_progressed_fraction());
sequence.Progress(opacity_effective_start + delta, &delegate);
@@ -180,12 +174,9 @@ TEST(LayerAnimationSequenceTest, MultipleElement) {
EXPECT_FLOAT_EQ(0.0, sequence.last_progressed_fraction());
transform_effective_start = opacity_effective_start + 3 * delta;
EXPECT_NE(starting_group_id, sequence.animation_group_id());
- sequence.OnThreadedAnimationStarted(
- cc::AnimationEvent(cc::AnimationEvent::Started,
- 0,
- sequence.animation_group_id(),
- cc::Animation::Transform,
- transform_effective_start));
+ sequence.OnThreadedAnimationStarted(cc::AnimationEvent(
+ cc::AnimationEvent::STARTED, 0, sequence.animation_group_id(),
+ cc::Animation::TRANSFORM, transform_effective_start));
sequence.Progress(transform_effective_start + delta/2, &delegate);
EXPECT_FLOAT_EQ(0.5, sequence.last_progressed_fraction());
EXPECT_TRUE(sequence.IsFinished(transform_effective_start + delta));
diff --git a/ui/compositor/layer_animator_unittest.cc b/ui/compositor/layer_animator_unittest.cc
index f6aff59..613eb1c 100644
--- a/ui/compositor/layer_animator_unittest.cc
+++ b/ui/compositor/layer_animator_unittest.cc
@@ -340,12 +340,10 @@ TEST(LayerAnimatorTest, ScheduleThreadedAnimationThatCanRunImmediately) {
base::TimeTicks effective_start = start_time + delta;
test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::Started,
- 0,
+ cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::Opacity,
- effective_start));
+ cc::Animation::OPACITY, effective_start));
animator->Step(effective_start + delta / 2);
@@ -455,12 +453,10 @@ TEST(LayerAnimatorTest, ScheduleThreadedAndNonThreadedAnimations) {
base::TimeTicks effective_start = start_time + delta;
test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::Started,
- 0,
+ cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::Opacity,
- effective_start));
+ cc::Animation::OPACITY, effective_start));
animator->Step(effective_start + delta / 2);
@@ -729,12 +725,10 @@ TEST(LayerAnimatorTest, StartThreadedAnimationThatCanRunImmediately) {
base::TimeTicks effective_start = start_time + delta;
test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::Started,
- 0,
+ cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::Opacity,
- effective_start));
+ cc::Animation::OPACITY, effective_start));
animator->Step(effective_start + delta / 2);
@@ -861,12 +855,10 @@ TEST(LayerAnimatorTest, PreemptThreadedByImmediatelyAnimatingToNewTarget) {
base::TimeTicks effective_start = start_time + delta;
test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::Started,
- 0,
+ cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::Opacity,
- effective_start));
+ cc::Animation::OPACITY, effective_start));
animator->Step(effective_start + delta / 2);
@@ -886,12 +878,10 @@ TEST(LayerAnimatorTest, PreemptThreadedByImmediatelyAnimatingToNewTarget) {
base::TimeTicks second_effective_start = effective_start + delta;
test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::Started,
- 0,
+ cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::Opacity,
- second_effective_start));
+ cc::Animation::OPACITY, second_effective_start));
animator->Step(second_effective_start + delta / 2);
@@ -1200,12 +1190,10 @@ TEST(LayerAnimatorTest, MultiPreemptThreadedByImmediatelyAnimatingToNewTarget) {
base::TimeTicks effective_start = start_time + delta;
test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::Started,
- 0,
+ cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::Opacity,
- effective_start));
+ cc::Animation::OPACITY, effective_start));
animator->Step(effective_start + delta / 2);
@@ -1230,12 +1218,10 @@ TEST(LayerAnimatorTest, MultiPreemptThreadedByImmediatelyAnimatingToNewTarget) {
base::TimeTicks second_effective_start = effective_start + delta;
test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::Started,
- 0,
+ cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::Opacity,
- second_effective_start));
+ cc::Animation::OPACITY, second_effective_start));
animator->Step(second_effective_start + delta / 2);
@@ -1484,12 +1470,10 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) {
base::TimeTicks effective_start = start_time + delta;
test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::Started,
- 0,
+ cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::Opacity,
- effective_start));
+ cc::Animation::OPACITY, effective_start));
animator->Step(effective_start + delta);
EXPECT_TRUE(test_controller.animator()->is_animating());
@@ -1497,12 +1481,10 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) {
base::TimeTicks second_effective_start = effective_start + 2 * delta;
test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::Started,
- 0,
+ cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::Opacity,
- second_effective_start));
+ cc::Animation::OPACITY, second_effective_start));
animator->Step(second_effective_start + delta);
@@ -1511,12 +1493,10 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) {
base::TimeTicks third_effective_start = second_effective_start + 2 * delta;
test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::Started,
- 0,
+ cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::Opacity,
- third_effective_start));
+ cc::Animation::OPACITY, third_effective_start));
animator->Step(third_effective_start + delta);
EXPECT_TRUE(test_controller.animator()->is_animating());
@@ -1524,12 +1504,10 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) {
base::TimeTicks fourth_effective_start = third_effective_start + 2 * delta;
test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::Started,
- 0,
+ cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::Opacity,
- fourth_effective_start));
+ cc::Animation::OPACITY, fourth_effective_start));
// Skip ahead by a lot.
animator->Step(fourth_effective_start + 1000 * delta);
@@ -1539,12 +1517,10 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) {
base::TimeTicks fifth_effective_start = fourth_effective_start + 1001 * delta;
test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::Started,
- 0,
+ cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::Opacity,
- fifth_effective_start));
+ cc::Animation::OPACITY, fifth_effective_start));
// Skip ahead by a lot.
animator->Step(fifth_effective_start + 999 * delta);
diff --git a/ui/compositor/test/layer_animator_test_controller.cc b/ui/compositor/test/layer_animator_test_controller.cc
index 121b8af..860d903 100644
--- a/ui/compositor/test/layer_animator_test_controller.cc
+++ b/ui/compositor/test/layer_animator_test_controller.cc
@@ -30,8 +30,8 @@ LayerAnimationSequence* LayerAnimatorTestController::GetRunningSequence(
void LayerAnimatorTestController::StartThreadedAnimationsIfNeeded() {
std::vector<cc::Animation::TargetProperty> threaded_properties;
- threaded_properties.push_back(cc::Animation::Opacity);
- threaded_properties.push_back(cc::Animation::Transform);
+ threaded_properties.push_back(cc::Animation::OPACITY);
+ threaded_properties.push_back(cc::Animation::TRANSFORM);
for (size_t i = 0; i < threaded_properties.size(); i++) {
LayerAnimationElement::AnimatableProperty animatable_property =
@@ -48,12 +48,9 @@ void LayerAnimatorTestController::StartThreadedAnimationsIfNeeded() {
element->effective_start_time() != base::TimeTicks())
continue;
- animator_->OnThreadedAnimationStarted(
- cc::AnimationEvent(cc::AnimationEvent::Started,
- 0,
- element->animation_group_id(),
- threaded_properties[i],
- gfx::FrameTime::Now()));
+ animator_->OnThreadedAnimationStarted(cc::AnimationEvent(
+ cc::AnimationEvent::STARTED, 0, element->animation_group_id(),
+ threaded_properties[i], gfx::FrameTime::Now()));
}
}