diff options
author | loyso <loyso@chromium.org> | 2016-02-24 20:12:30 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-25 04:13:43 +0000 |
commit | 0c8e440950082a2b7f5eae1410264f75acdd0885 (patch) | |
tree | 26c436139e971b3ab9b09cf68528a0b124391c95 /cc/animation/target_property.cc | |
parent | de18d80600bb6e3413876e8d0af6c227ae504aa5 (diff) | |
download | chromium_src-0c8e440950082a2b7f5eae1410264f75acdd0885.zip chromium_src-0c8e440950082a2b7f5eae1410264f75acdd0885.tar.gz chromium_src-0c8e440950082a2b7f5eae1410264f75acdd0885.tar.bz2 |
CC Animation: Expose TargetProperty enum to be aliased in Blink Platform.
TargetProperty is intended to be used as an alias in Source/platform/animation/CompositorTargetProperty.h
This is slightly better then untyped approach used here:
https://codereview.chromium.org/1599673002
where we setup struct with constants in it and pass uint32_t everywhere.
An alternative approach with strongly typed enum
considered too verbose:
https://codereview.chromium.org/1698813002/
BUG=577016
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1700653002
Cr-Commit-Position: refs/heads/master@{#377501}
Diffstat (limited to 'cc/animation/target_property.cc')
-rw-r--r-- | cc/animation/target_property.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/cc/animation/target_property.cc b/cc/animation/target_property.cc new file mode 100644 index 0000000..15144a7 --- /dev/null +++ b/cc/animation/target_property.cc @@ -0,0 +1,28 @@ +// Copyright (c) 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "cc/animation/target_property.h" + +#include "base/macros.h" + +namespace cc { + +namespace { + +// This should match the TargetProperty enum. +static const char* const s_targetPropertyNames[] = { + "TRANSFORM", "OPACITY", "FILTER", "SCROLL_OFFSET", "BACKGROUND_COLOR"}; + +static_assert(static_cast<int>(TargetProperty::LAST_TARGET_PROPERTY) + 1 == + arraysize(s_targetPropertyNames), + "TargetPropertyEnumSize should equal the number of elements in " + "s_targetPropertyNames"); + +} // namespace + +const char* TargetProperty::GetName(TargetProperty::Type property) { + return s_targetPropertyNames[property]; +} + +} // namespace cc |