LCOV - code coverage report
Current view: top level - gfx/thebes - gfxFontFeatures.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 39 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #include "gfxFontFeatures.h"
       7             : #include "nsUnicharUtils.h"
       8             : #include "nsHashKeys.h"
       9             : 
      10             : using namespace mozilla;
      11             : 
      12           0 : gfxFontFeatureValueSet::gfxFontFeatureValueSet()
      13           0 :     : mFontFeatureValues(8)
      14             : {
      15           0 : }
      16             : 
      17             : bool
      18           0 : gfxFontFeatureValueSet::GetFontFeatureValuesFor(const nsAString& aFamily,
      19             :                                                 uint32_t aVariantProperty,
      20             :                                                 const nsAString& aName,
      21             :                                                 nsTArray<uint32_t>& aValues)
      22             : {
      23           0 :     nsAutoString family(aFamily), name(aName);
      24           0 :     ToLowerCase(family);
      25           0 :     ToLowerCase(name);
      26           0 :     FeatureValueHashKey key(family, aVariantProperty, name);
      27             : 
      28           0 :     aValues.Clear();
      29           0 :     FeatureValueHashEntry *entry = mFontFeatureValues.GetEntry(key);
      30           0 :     if (entry) {
      31           0 :         NS_ASSERTION(entry->mValues.Length() > 0,
      32             :                      "null array of font feature values");
      33           0 :         aValues.AppendElements(entry->mValues);
      34           0 :         return true;
      35             :     }
      36             : 
      37           0 :     return false;
      38             : }
      39             : 
      40             : 
      41             : void
      42           0 : gfxFontFeatureValueSet::AddFontFeatureValues(const nsAString& aFamily,
      43             :                  const nsTArray<gfxFontFeatureValueSet::FeatureValues>& aValues)
      44             : {
      45           0 :     nsAutoString family(aFamily);
      46           0 :     ToLowerCase(family);
      47             : 
      48           0 :     uint32_t i, numFeatureValues = aValues.Length();
      49           0 :     for (i = 0; i < numFeatureValues; i++) {
      50           0 :         const FeatureValues& fv = aValues.ElementAt(i);
      51           0 :         uint32_t alternate = fv.alternate;
      52           0 :         uint32_t j, numValues = fv.valuelist.Length();
      53           0 :         for (j = 0; j < numValues; j++) {
      54           0 :             const ValueList& v = fv.valuelist.ElementAt(j);
      55           0 :             nsAutoString name(v.name);
      56           0 :             ToLowerCase(name);
      57           0 :             FeatureValueHashKey key(family, alternate, name);
      58           0 :             FeatureValueHashEntry *entry = mFontFeatureValues.PutEntry(key);
      59           0 :             entry->mKey = key;
      60           0 :             entry->mValues = v.featureSelectors;
      61             :         }
      62             :     }
      63           0 : }
      64             : 
      65             : bool
      66           0 : gfxFontFeatureValueSet::FeatureValueHashEntry::KeyEquals(
      67             :                                                const KeyTypePointer aKey) const
      68             : {
      69           0 :     return aKey->mPropVal == mKey.mPropVal &&
      70           0 :            aKey->mFamily.Equals(mKey.mFamily) &&
      71           0 :            aKey->mName.Equals(mKey.mName);
      72             : }
      73             : 
      74             : PLDHashNumber
      75           0 : gfxFontFeatureValueSet::FeatureValueHashEntry::HashKey(
      76             :                                                      const KeyTypePointer aKey)
      77             : {
      78           0 :     return HashString(aKey->mFamily) + HashString(aKey->mName) +
      79           0 :            aKey->mPropVal * uint32_t(0xdeadbeef);
      80             : }
      81             : 

Generated by: LCOV version 1.13