diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-13 15:05:36 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-14 10:33:47 +0000 |
commit | e684a3455bcc29a6e3e66a004e352dea4e1141e7 (patch) | |
tree | d55b4003bde34d7d05f558f02cfd82b2a66a7aac /chromium/third_party/blink/renderer/core/svg/svg_enumeration.h | |
parent | 2b94bfe47ccb6c08047959d1c26e392919550e86 (diff) | |
download | qtwebengine-chromium-e684a3455bcc29a6e3e66a004e352dea4e1141e7.tar.gz |
BASELINE: Update Chromium to 72.0.3626.110 and Ninja to 1.9.0
Change-Id: Ic57220b00ecc929a893c91f5cc552f5d3e99e922
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/svg/svg_enumeration.h')
-rw-r--r-- | chromium/third_party/blink/renderer/core/svg/svg_enumeration.h | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/chromium/third_party/blink/renderer/core/svg/svg_enumeration.h b/chromium/third_party/blink/renderer/core/svg/svg_enumeration.h index 4b4a0749312..9e70421b56e 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_enumeration.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_enumeration.h @@ -36,11 +36,10 @@ namespace blink { +class SVGEnumerationMap; + class SVGEnumerationBase : public SVGPropertyBase { public: - typedef std::pair<unsigned short, String> StringEntry; - typedef Vector<StringEntry> StringEntries; - // SVGEnumeration does not have a tear-off type. typedef void TearOffType; typedef unsigned short PrimitiveType; @@ -72,13 +71,9 @@ class SVGEnumerationBase : public SVGPropertyBase { static AnimatedPropertyType ClassType() { return kAnimatedEnumeration; } AnimatedPropertyType GetType() const override { return ClassType(); } - static unsigned short ValueOfLastEnum(const StringEntries& entries) { - return entries.back().first; - } - // This is the maximum value that is exposed as an IDL constant on the // relevant interface. - unsigned short MaxExposedEnumValue() const { return max_exposed_; } + unsigned short MaxExposedEnumValue() const; void SetInitial(unsigned value) { SetValue(static_cast<unsigned short>(value)); @@ -86,32 +81,26 @@ class SVGEnumerationBase : public SVGPropertyBase { static constexpr int kInitialValueBits = 3; protected: - SVGEnumerationBase(unsigned short value, - const StringEntries& entries, - unsigned short max_exposed) - : value_(value), max_exposed_(max_exposed), entries_(entries) {} + SVGEnumerationBase(unsigned short value, const SVGEnumerationMap& map) + : value_(value), map_(map) {} // This is the maximum value of all the internal enumeration values. - // This assumes that |m_entries| are sorted. - unsigned short MaxInternalEnumValue() const { - return ValueOfLastEnum(entries_); - } + // This assumes that the map is sorted on the enumeration value. + unsigned short MaxInternalEnumValue() const; // Used by SVGMarkerOrientEnumeration. virtual void NotifyChange() {} unsigned short value_; - const unsigned short max_exposed_; - const StringEntries& entries_; + const SVGEnumerationMap& map_; }; -typedef SVGEnumerationBase::StringEntries SVGEnumerationStringEntries; template <typename Enum> -const SVGEnumerationStringEntries& GetStaticStringEntries(); -template <typename Enum> -unsigned short GetMaxExposedEnumValue() { - return SVGEnumerationBase::ValueOfLastEnum(GetStaticStringEntries<Enum>()); -} +const SVGEnumerationMap& GetEnumerationMap(); + +#define DECLARE_SVG_ENUM_MAP(cpp_enum_type) \ + template <> \ + const SVGEnumerationMap& GetEnumerationMap<cpp_enum_type>() template <typename Enum> class SVGEnumeration : public SVGEnumerationBase { @@ -136,9 +125,7 @@ class SVGEnumeration : public SVGEnumerationBase { protected: explicit SVGEnumeration(Enum new_value) - : SVGEnumerationBase(new_value, - GetStaticStringEntries<Enum>(), - GetMaxExposedEnumValue<Enum>()) {} + : SVGEnumerationBase(new_value, GetEnumerationMap<Enum>()) {} }; } // namespace blink |