LCOV - code coverage report
Current view: top level - layout/style - GenericSpecifiedValuesInlines.h (source / functions) Hit Total Coverage
Test: output.info Lines: 6 59 10.2 %
Date: 2017-07-14 16:53:18 Functions: 3 23 13.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : /*
       8             :  * Inlined methods for GenericSpecifiedValues. Will just redirect to
       9             :  * nsRuleData methods when compiled without stylo, but will do
      10             :  * virtual dispatch (by checking which kind of container it is)
      11             :  * in stylo mode.
      12             :  */
      13             : 
      14             : #ifndef mozilla_GenericSpecifiedValuesInlines_h
      15             : #define mozilla_GenericSpecifiedValuesInlines_h
      16             : 
      17             : #include "nsRuleData.h"
      18             : #include "mozilla/GenericSpecifiedValues.h"
      19             : #include "mozilla/ServoSpecifiedValues.h"
      20             : 
      21             : namespace mozilla {
      22             : 
      23         108 : MOZ_DEFINE_STYLO_METHODS(GenericSpecifiedValues,
      24             :                          nsRuleData,
      25             :                          ServoSpecifiedValues)
      26             : 
      27             : bool
      28          80 : GenericSpecifiedValues::PropertyIsSet(nsCSSPropertyID aId)
      29             : {
      30          80 :   MOZ_STYLO_FORWARD(PropertyIsSet, (aId))
      31             : }
      32             : 
      33             : void
      34             : GenericSpecifiedValues::SetIdentStringValue(nsCSSPropertyID aId,
      35             :                                             const nsString& aValue)
      36             : {
      37             :   MOZ_STYLO_FORWARD(SetIdentStringValue, (aId, aValue))
      38             : }
      39             : 
      40             : void
      41             : GenericSpecifiedValues::SetIdentStringValueIfUnset(nsCSSPropertyID aId,
      42             :                                                    const nsString& aValue)
      43             : {
      44             :   if (!PropertyIsSet(aId)) {
      45             :     SetIdentStringValue(aId, aValue);
      46             :   }
      47             : }
      48             : 
      49             : void
      50           0 : GenericSpecifiedValues::SetIdentAtomValue(nsCSSPropertyID aId, nsIAtom* aValue)
      51             : {
      52           0 :   MOZ_STYLO_FORWARD(SetIdentAtomValue, (aId, aValue))
      53             : }
      54             : 
      55             : void
      56           0 : GenericSpecifiedValues::SetIdentAtomValueIfUnset(nsCSSPropertyID aId,
      57             :                                                  nsIAtom* aValue)
      58             : {
      59           0 :   if (!PropertyIsSet(aId)) {
      60           0 :     SetIdentAtomValue(aId, aValue);
      61             :   }
      62           0 : }
      63             : 
      64             : void
      65          28 : GenericSpecifiedValues::SetKeywordValue(nsCSSPropertyID aId, int32_t aValue)
      66             : {
      67             :   // there are some static asserts in MOZ_STYLO_FORWARD which
      68             :   // won't work with the overloaded SetKeywordValue function,
      69             :   // so we copy its expansion and use SetIntValue for decltype
      70             :   // instead
      71             :   static_assert(
      72             :     !mozilla::IsSame<decltype(&MOZ_STYLO_THIS_TYPE::SetIntValue),
      73             :                      decltype(&MOZ_STYLO_GECKO_TYPE::SetKeywordValue)>::value,
      74             :     "Gecko subclass should define its own SetKeywordValue");
      75             :   static_assert(
      76             :     !mozilla::IsSame<decltype(&MOZ_STYLO_THIS_TYPE::SetIntValue),
      77             :                      decltype(&MOZ_STYLO_SERVO_TYPE::SetKeywordValue)>::value,
      78             :     "Servo subclass should define its own SetKeywordValue");
      79             : 
      80          28 :   if (IsServo()) {
      81           0 :     return AsServo()->SetKeywordValue(aId, aValue);
      82             :   }
      83          28 :   return AsGecko()->SetKeywordValue(aId, aValue);
      84             : }
      85             : 
      86             : void
      87           0 : GenericSpecifiedValues::SetKeywordValueIfUnset(nsCSSPropertyID aId,
      88             :                                                int32_t aValue)
      89             : {
      90           0 :   if (!PropertyIsSet(aId)) {
      91           0 :     SetKeywordValue(aId, aValue);
      92             :   }
      93           0 : }
      94             : 
      95             : void
      96           0 : GenericSpecifiedValues::SetIntValue(nsCSSPropertyID aId, int32_t aValue)
      97             : {
      98           0 :   MOZ_STYLO_FORWARD(SetIntValue, (aId, aValue))
      99             : }
     100             : 
     101             : void
     102           0 : GenericSpecifiedValues::SetPixelValue(nsCSSPropertyID aId, float aValue)
     103             : {
     104           0 :   MOZ_STYLO_FORWARD(SetPixelValue, (aId, aValue))
     105             : }
     106             : 
     107             : void
     108           0 : GenericSpecifiedValues::SetPixelValueIfUnset(nsCSSPropertyID aId, float aValue)
     109             : {
     110           0 :   if (!PropertyIsSet(aId)) {
     111           0 :     SetPixelValue(aId, aValue);
     112             :   }
     113           0 : }
     114             : 
     115             : void
     116           0 : GenericSpecifiedValues::SetLengthValue(nsCSSPropertyID aId, nsCSSValue aValue)
     117             : {
     118           0 :   MOZ_STYLO_FORWARD(SetLengthValue, (aId, aValue))
     119             : }
     120             : 
     121             : void
     122           0 : GenericSpecifiedValues::SetNumberValue(nsCSSPropertyID aId, float aValue)
     123             : {
     124           0 :   MOZ_STYLO_FORWARD(SetNumberValue, (aId, aValue))
     125             : }
     126             : 
     127             : void
     128           0 : GenericSpecifiedValues::SetPercentValue(nsCSSPropertyID aId, float aValue)
     129             : {
     130           0 :   MOZ_STYLO_FORWARD(SetPercentValue, (aId, aValue))
     131             : }
     132             : 
     133             : void
     134           0 : GenericSpecifiedValues::SetPercentValueIfUnset(nsCSSPropertyID aId,
     135             :                                                float aValue)
     136             : {
     137           0 :   if (!PropertyIsSet(aId)) {
     138           0 :     SetPercentValue(aId, aValue);
     139             :   }
     140           0 : }
     141             : 
     142             : void
     143           0 : GenericSpecifiedValues::SetAutoValue(nsCSSPropertyID aId)
     144             : {
     145           0 :   MOZ_STYLO_FORWARD(SetAutoValue, (aId))
     146             : }
     147             : 
     148             : void
     149           0 : GenericSpecifiedValues::SetAutoValueIfUnset(nsCSSPropertyID aId)
     150             : {
     151           0 :   if (!PropertyIsSet(aId)) {
     152           0 :     SetAutoValue(aId);
     153             :   }
     154           0 : }
     155             : 
     156             : void
     157           0 : GenericSpecifiedValues::SetCurrentColor(nsCSSPropertyID aId)
     158             : {
     159           0 :   MOZ_STYLO_FORWARD(SetCurrentColor, (aId))
     160             : }
     161             : 
     162             : void
     163           0 : GenericSpecifiedValues::SetCurrentColorIfUnset(nsCSSPropertyID aId)
     164             : {
     165           0 :   if (!PropertyIsSet(aId)) {
     166           0 :     SetCurrentColor(aId);
     167             :   }
     168           0 : }
     169             : 
     170             : void
     171           0 : GenericSpecifiedValues::SetColorValue(nsCSSPropertyID aId, nscolor aValue)
     172             : {
     173           0 :   MOZ_STYLO_FORWARD(SetColorValue, (aId, aValue))
     174             : }
     175             : 
     176             : void
     177           0 : GenericSpecifiedValues::SetColorValueIfUnset(nsCSSPropertyID aId,
     178             :                                              nscolor aValue)
     179             : {
     180           0 :   if (!PropertyIsSet(aId)) {
     181           0 :     SetColorValue(aId, aValue);
     182             :   }
     183           0 : }
     184             : 
     185             : void
     186           0 : GenericSpecifiedValues::SetFontFamily(const nsString& aValue)
     187             : {
     188           0 :   MOZ_STYLO_FORWARD(SetFontFamily, (aValue))
     189             : }
     190             : 
     191             : void
     192           0 : GenericSpecifiedValues::SetTextDecorationColorOverride()
     193             : {
     194           0 :   MOZ_STYLO_FORWARD(SetTextDecorationColorOverride, ())
     195             : }
     196             : 
     197             : void
     198           0 : GenericSpecifiedValues::SetBackgroundImage(nsAttrValue& aValue)
     199             : {
     200           0 :   MOZ_STYLO_FORWARD(SetBackgroundImage, (aValue))
     201             : }
     202             : 
     203             : } // namespace mozilla
     204             : 
     205             : #endif // mozilla_GenericSpecifiedValuesInlines_h

Generated by: LCOV version 1.13