From 5e6d1f8386e084e64f92564eabdb3879bca7fc42 Mon Sep 17 00:00:00 2001 From: Seth Fowler Date: Tue, 22 Oct 2013 13:37:57 +0200 Subject: [PATCH] Bug 764299 (Part 1) - Add hashing to SVGImageContext. r=dholbert --- content/svg/content/src/SVGPreserveAspectRatio.h | 10 +++++++++- layout/svg/SVGImageContext.h | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/content/svg/content/src/SVGPreserveAspectRatio.h b/content/svg/content/src/SVGPreserveAspectRatio.h index bce48454b31b..f32bbc8401ad 100644 --- a/content/svg/content/src/SVGPreserveAspectRatio.h +++ b/content/svg/content/src/SVGPreserveAspectRatio.h @@ -3,8 +3,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#pragma once +#ifndef MOZILLA_CONTENT_SVGPRESERVEASPECTRATIO_H_ +#define MOZILLA_CONTENT_SVGPRESERVEASPECTRATIO_H_ +#include "mozilla/HashFunctions.h" // for HashGeneric #include "mozilla/TypedEnum.h" #include "nsWrapperCache.h" @@ -98,6 +100,10 @@ public: return mDefer; } + uint32_t Hash() const { + return HashGeneric(mAlign, mMeetOrSlice, mDefer); + } + private: // We can't use enum types here because some compilers fail to pack them. uint8_t mAlign; @@ -141,3 +147,5 @@ protected: } //namespace dom } //namespace mozilla + +#endif // MOZILLA_CONTENT_SVGPRESERVEASPECTRATIO_H_ diff --git a/layout/svg/SVGImageContext.h b/layout/svg/SVGImageContext.h index a0f4d5f32d7d..22560620b077 100644 --- a/layout/svg/SVGImageContext.h +++ b/layout/svg/SVGImageContext.h @@ -16,6 +16,8 @@ namespace mozilla { class SVGImageContext { public: + SVGImageContext() { } + SVGImageContext(SVGPreserveAspectRatio aPreserveAspectRatio) : mPreserveAspectRatio(aPreserveAspectRatio) { } @@ -32,8 +34,12 @@ public: return !(*this == aOther); } + uint32_t Hash() const { + return mPreserveAspectRatio.Hash(); + } + private: - const SVGPreserveAspectRatio mPreserveAspectRatio; + SVGPreserveAspectRatio mPreserveAspectRatio; }; } // namespace mozilla