Bug 764299 (Part 1) - Add hashing to SVGImageContext. r=dholbert
authorSeth Fowler <seth@mozilla.com>
Mon, 21 Oct 2013 18:10:40 +0200
changeset 165311 bc31e05eddb8d0e161dc0a11112cc2232e813aeb
parent 165310 38d2cbc118684c9a3afa3c6ef6eaacdcca91e9ae
child 165312 4d8068fd3271c0ad2eab42037e41702deb559598
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs764299
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 764299 (Part 1) - Add hashing to SVGImageContext. r=dholbert
content/svg/content/src/SVGPreserveAspectRatio.h
layout/svg/SVGImageContext.h
--- a/content/svg/content/src/SVGPreserveAspectRatio.h
+++ b/content/svg/content/src/SVGPreserveAspectRatio.h
@@ -1,15 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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"
 #include "nsAutoPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/ErrorResult.h"
 #include "nsSVGElement.h"
 
@@ -93,16 +95,20 @@ public:
   void SetDefer(bool aDefer) {
     mDefer = aDefer;
   }
 
   bool GetDefer() const {
     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;
   uint8_t mMeetOrSlice;
   bool mDefer;
 };
 
 namespace dom {
@@ -136,8 +142,10 @@ public:
 protected:
   SVGAnimatedPreserveAspectRatio* mVal; // kept alive because it belongs to mSVGElement
   nsRefPtr<nsSVGElement> mSVGElement;
   const bool mIsBaseValue;
 };
 
 } //namespace dom
 } //namespace mozilla
+
+#endif // MOZILLA_CONTENT_SVGPRESERVEASPECTRATIO_H_
--- a/layout/svg/SVGImageContext.h
+++ b/layout/svg/SVGImageContext.h
@@ -11,31 +11,37 @@
 namespace mozilla {
 
 // SVG image-specific rendering context. For imgIContainer::Draw.
 // Used to pass information about overridden attributes from an SVG <image>
 // element to the image's internal SVG document when it's drawn.
 class SVGImageContext
 {
 public:
+  SVGImageContext() { }
+
   SVGImageContext(SVGPreserveAspectRatio aPreserveAspectRatio)
     : mPreserveAspectRatio(aPreserveAspectRatio)
   { }
 
   const SVGPreserveAspectRatio& GetPreserveAspectRatio() const {
     return mPreserveAspectRatio;
   }
 
   bool operator==(const SVGImageContext& aOther) const {
     return mPreserveAspectRatio == aOther.mPreserveAspectRatio;
   }
 
   bool operator!=(const SVGImageContext& aOther) const {
     return !(*this == aOther);
   }
 
+  uint32_t Hash() const {
+    return mPreserveAspectRatio.Hash();
+  }
+
 private:
-  const SVGPreserveAspectRatio mPreserveAspectRatio;
+  SVGPreserveAspectRatio mPreserveAspectRatio;
 };
 
 } // namespace mozilla
 
 #endif // MOZILLA_SVGCONTEXT_H_