LCOV - code coverage report
Current view: top level - layout/style - nsComputedDOMStyle.h (source / functions) Hit Total Coverage
Test: output.info Lines: 5 12 41.7 %
Date: 2018-08-07 16:35:00 Functions: 0 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             : /* DOM object returned from element.getComputedStyle() */
       8             : 
       9             : #ifndef nsComputedDOMStyle_h__
      10             : #define nsComputedDOMStyle_h__
      11             : 
      12             : #include "mozilla/ArenaRefPtr.h"
      13             : #include "mozilla/ArenaRefPtrInlines.h"
      14             : #include "mozilla/Attributes.h"
      15             : #include "mozilla/StyleComplexColor.h"
      16             : #include "mozilla/UniquePtr.h"
      17             : #include "mozilla/dom/Element.h"
      18             : #include "nsCOMPtr.h"
      19             : #include "nsContentUtils.h"
      20             : #include "nscore.h"
      21             : #include "nsDOMCSSDeclaration.h"
      22             : #include "mozilla/ComputedStyle.h"
      23             : #include "nsIWeakReferenceUtils.h"
      24             : #include "mozilla/gfx/Types.h"
      25             : #include "nsCoord.h"
      26             : #include "nsColor.h"
      27             : #include "nsStyleStruct.h"
      28             : #include "mozilla/WritingModes.h"
      29             : 
      30             : namespace mozilla {
      31             : namespace dom {
      32             : class DocGroup;
      33             : class Element;
      34             : } // namespace dom
      35             : struct ComputedGridTrackInfo;
      36             : } // namespace mozilla
      37             : 
      38             : struct ComputedStyleMap;
      39             : struct nsCSSKTableEntry;
      40             : class nsIFrame;
      41             : class nsIPresShell;
      42             : class nsDOMCSSValueList;
      43             : struct nsMargin;
      44             : class nsROCSSPrimitiveValue;
      45             : class nsStyleCoord;
      46             : class nsStyleCorners;
      47             : struct nsStyleFilter;
      48             : class nsStyleGradient;
      49             : struct nsStyleImage;
      50             : class nsStyleSides;
      51             : struct nsTimingFunction;
      52             : 
      53             : class nsComputedDOMStyle final : public nsDOMCSSDeclaration
      54             :                                , public nsStubMutationObserver
      55             : {
      56             : private:
      57             :   // Convenience typedefs:
      58             :   typedef nsCSSKTableEntry KTableEntry;
      59             :   typedef mozilla::dom::CSSValue CSSValue;
      60             :   typedef mozilla::StyleGeometryBox StyleGeometryBox;
      61             : 
      62             : public:
      63             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      64          18 :   NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsComputedDOMStyle,
      65             :                                                                    nsICSSDeclaration)
      66             : 
      67             :   NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER
      68             :   nsresult GetPropertyValue(const nsCSSPropertyID aPropID,
      69             :                             nsAString& aValue) override;
      70             :   nsresult SetPropertyValue(const nsCSSPropertyID aPropID,
      71             :                             const nsAString& aValue,
      72             :                             nsIPrincipal* aSubjectPrincipal) override;
      73             : 
      74             :   void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName) final;
      75             : 
      76             :   enum StyleType {
      77             :     eDefaultOnly, // Only includes UA and user sheets
      78             :     eAll // Includes all stylesheets
      79             :   };
      80             : 
      81             :   nsComputedDOMStyle(mozilla::dom::Element* aElement,
      82             :                      const nsAString& aPseudoElt,
      83             :                      nsIPresShell* aPresShell,
      84             :                      StyleType aStyleType);
      85             : 
      86           6 :   virtual nsINode *GetParentObject() override
      87             :   {
      88          12 :     return mContent;
      89             :   }
      90             : 
      91             :   static already_AddRefed<mozilla::ComputedStyle>
      92             :   GetComputedStyle(mozilla::dom::Element* aElement, nsAtom* aPseudo,
      93             :                    StyleType aStyleType = eAll);
      94             : 
      95             :   static already_AddRefed<mozilla::ComputedStyle>
      96         143 :   GetComputedStyleNoFlush(mozilla::dom::Element* aElement,
      97             :                           nsAtom* aPseudo,
      98             :                           StyleType aStyleType = eAll)
      99             :   {
     100             :     return DoGetComputedStyleNoFlush(aElement,
     101             :                                      aPseudo,
     102             :                                      nsContentUtils::GetPresShellForContent(aElement),
     103         143 :                                      aStyleType);
     104             :   }
     105             : 
     106             :   static already_AddRefed<mozilla::ComputedStyle>
     107             :   GetUnanimatedComputedStyleNoFlush(mozilla::dom::Element* aElement,
     108             :                                     nsAtom* aPseudo);
     109             : 
     110             :   // Helper for nsDOMWindowUtils::GetVisitedDependentComputedStyle
     111           0 :   void SetExposeVisitedStyle(bool aExpose) {
     112           0 :     NS_ASSERTION(aExpose != mExposeVisitedStyle, "should always be changing");
     113           0 :     mExposeVisitedStyle = aExpose;
     114           0 :   }
     115             : 
     116             : 
     117             :   void GetCSSImageURLs(const nsAString& aPropertyName,
     118             :                        nsTArray<nsString>& aImageURLs,
     119             :                        mozilla::ErrorResult& aRv) final;
     120             : 
     121             :   // nsDOMCSSDeclaration abstract methods which should never be called
     122             :   // on a nsComputedDOMStyle object, but must be defined to avoid
     123             :   // compile errors.
     124             :   virtual mozilla::DeclarationBlock* GetCSSDeclaration(Operation) override;
     125             :   virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock*) override;
     126             :   virtual nsIDocument* DocToUpdate() override;
     127             : 
     128             :   nsDOMCSSDeclaration::ParsingEnvironment
     129             :   GetParsingEnvironment(nsIPrincipal* aSubjectPrincipal) const final;
     130             : 
     131             :   static already_AddRefed<nsROCSSPrimitiveValue>
     132             :     MatrixToCSSValue(const mozilla::gfx::Matrix4x4& aMatrix);
     133             : 
     134             :   static void RegisterPrefChangeCallbacks();
     135             :   static void UnregisterPrefChangeCallbacks();
     136             : 
     137             :   // nsIMutationObserver
     138             :   NS_DECL_NSIMUTATIONOBSERVER_PARENTCHAINCHANGED
     139             : 
     140             : private:
     141             :   virtual ~nsComputedDOMStyle();
     142             : 
     143           0 :   void AssertFlushedPendingReflows() {
     144           0 :     NS_ASSERTION(mFlushedPendingReflows,
     145             :                  "property getter should have been marked layout-dependent");
     146           0 :   }
     147             : 
     148             :   nsMargin GetAdjustedValuesForBoxSizing();
     149             : 
     150             :   // Helper method for DoGetTextAlign[Last].
     151             :   already_AddRefed<CSSValue> CreateTextAlignValue(uint8_t aAlign,
     152             :                                                   bool aAlignTrue,
     153             :                                                   const KTableEntry aTable[]);
     154             :   // This indicates error by leaving mComputedStyle null.
     155             :   void UpdateCurrentStyleSources(bool aNeedsLayoutFlush);
     156             :   void ClearCurrentStyleSources();
     157             : 
     158             :   // Helper functions called by UpdateCurrentStyleSources.
     159             :   void ClearComputedStyle();
     160             :   void SetResolvedComputedStyle(RefPtr<mozilla::ComputedStyle>&& aContext,
     161             :                                 uint64_t aGeneration);
     162             :   void SetFrameComputedStyle(mozilla::ComputedStyle* aStyle, uint64_t aGeneration);
     163             : 
     164             :   static already_AddRefed<mozilla::ComputedStyle>
     165             :   DoGetComputedStyleNoFlush(mozilla::dom::Element* aElement,
     166             :                             nsAtom* aPseudo,
     167             :                             nsIPresShell* aPresShell,
     168             :                             StyleType aStyleType);
     169             : 
     170             : #define STYLE_STRUCT(name_)                 \
     171             :   const nsStyle##name_ * Style##name_() {   \
     172             :     return mComputedStyle->Style##name_();  \
     173             :   }
     174             : #include "nsStyleStructList.h"
     175             : #undef STYLE_STRUCT
     176             : 
     177             :   already_AddRefed<CSSValue> GetEllipseRadii(const nsStyleCorners& aRadius,
     178             :                                              mozilla::Corner aFullCorner);
     179             : 
     180             :   already_AddRefed<CSSValue> GetOffsetWidthFor(mozilla::Side aSide);
     181             : 
     182             :   already_AddRefed<CSSValue> GetAbsoluteOffset(mozilla::Side aSide);
     183             : 
     184             :   already_AddRefed<CSSValue> GetRelativeOffset(mozilla::Side aSide);
     185             : 
     186             :   already_AddRefed<CSSValue> GetStickyOffset(mozilla::Side aSide);
     187             : 
     188             :   already_AddRefed<CSSValue> GetStaticOffset(mozilla::Side aSide);
     189             : 
     190             :   already_AddRefed<CSSValue> GetPaddingWidthFor(mozilla::Side aSide);
     191             : 
     192             :   already_AddRefed<CSSValue> GetBorderStyleFor(mozilla::Side aSide);
     193             : 
     194             :   already_AddRefed<CSSValue> GetBorderWidthFor(mozilla::Side aSide);
     195             : 
     196             :   already_AddRefed<CSSValue> GetBorderColorFor(mozilla::Side aSide);
     197             : 
     198             :   already_AddRefed<CSSValue> GetMarginWidthFor(mozilla::Side aSide);
     199             : 
     200             :   already_AddRefed<CSSValue> GetFallbackValue(const nsStyleSVGPaint* aPaint);
     201             : 
     202             :   already_AddRefed<CSSValue> GetSVGPaintFor(bool aFill);
     203             : 
     204             :   already_AddRefed<CSSValue> GetTransformValue(nsCSSValueSharedList* aSpecifiedTransform);
     205             : 
     206             :   // Appends all aLineNames (may be empty) space-separated to aResult.
     207             :   void AppendGridLineNames(nsString& aResult,
     208             :                            const nsTArray<nsString>& aLineNames);
     209             :   // Appends aLineNames as a CSSValue* to aValueList.  If aLineNames is empty
     210             :   // a value ("[]") is only appended if aSuppressEmptyList is false.
     211             :   void AppendGridLineNames(nsDOMCSSValueList* aValueList,
     212             :                            const nsTArray<nsString>& aLineNames,
     213             :                            bool aSuppressEmptyList = true);
     214             :   // Appends aLineNames1/2 (if non-empty) as a CSSValue* to aValueList.
     215             :   void AppendGridLineNames(nsDOMCSSValueList* aValueList,
     216             :                            const nsTArray<nsString>& aLineNames1,
     217             :                            const nsTArray<nsString>& aLineNames2);
     218             :   already_AddRefed<CSSValue> GetGridTrackSize(const nsStyleCoord& aMinSize,
     219             :                                               const nsStyleCoord& aMaxSize);
     220             :   already_AddRefed<CSSValue> GetGridTemplateColumnsRows(
     221             :     const nsStyleGridTemplate& aTrackList,
     222             :     const mozilla::ComputedGridTrackInfo* aTrackInfo);
     223             :   already_AddRefed<CSSValue> GetGridLine(const nsStyleGridLine& aGridLine);
     224             : 
     225             :   bool GetLineHeightCoord(nscoord& aCoord);
     226             : 
     227             :   already_AddRefed<CSSValue> GetCSSShadowArray(nsCSSShadowArray* aArray,
     228             :                                                const nscolor& aDefaultColor,
     229             :                                                bool aIsBoxShadow);
     230             : 
     231             :   void GetCSSGradientString(const nsStyleGradient* aGradient,
     232             :                             nsAString& aString);
     233             :   void GetImageRectString(nsIURI* aURI,
     234             :                           const nsStyleSides& aCropRect,
     235             :                           nsString& aString);
     236             :   already_AddRefed<CSSValue> GetScrollSnapPoints(const nsStyleCoord& aCoord);
     237             :   void AppendTimingFunction(nsDOMCSSValueList *aValueList,
     238             :                             const nsTimingFunction& aTimingFunction);
     239             : 
     240             :   bool ShouldHonorMinSizeAutoInAxis(mozilla::PhysicalAxis aAxis);
     241             : 
     242             :   /* Properties queryable as CSSValues.
     243             :    * To avoid a name conflict with nsIDOM*CSS2Properties, these are all
     244             :    * DoGetXXX instead of GetXXX.
     245             :    */
     246             : 
     247             :   already_AddRefed<CSSValue> DoGetAppearance();
     248             : 
     249             :   /* Box properties */
     250             :   already_AddRefed<CSSValue> DoGetBoxAlign();
     251             :   already_AddRefed<CSSValue> DoGetBoxDecorationBreak();
     252             :   already_AddRefed<CSSValue> DoGetBoxDirection();
     253             :   already_AddRefed<CSSValue> DoGetBoxFlex();
     254             :   already_AddRefed<CSSValue> DoGetBoxOrdinalGroup();
     255             :   already_AddRefed<CSSValue> DoGetBoxOrient();
     256             :   already_AddRefed<CSSValue> DoGetBoxPack();
     257             :   already_AddRefed<CSSValue> DoGetBoxSizing();
     258             : 
     259             :   already_AddRefed<CSSValue> DoGetWidth();
     260             :   already_AddRefed<CSSValue> DoGetHeight();
     261             :   already_AddRefed<CSSValue> DoGetMaxHeight();
     262             :   already_AddRefed<CSSValue> DoGetMaxWidth();
     263             :   already_AddRefed<CSSValue> DoGetMinHeight();
     264             :   already_AddRefed<CSSValue> DoGetMinWidth();
     265             :   already_AddRefed<CSSValue> DoGetMixBlendMode();
     266             :   already_AddRefed<CSSValue> DoGetIsolation();
     267             :   already_AddRefed<CSSValue> DoGetObjectFit();
     268             :   already_AddRefed<CSSValue> DoGetObjectPosition();
     269             :   already_AddRefed<CSSValue> DoGetLeft();
     270             :   already_AddRefed<CSSValue> DoGetTop();
     271             :   already_AddRefed<CSSValue> DoGetRight();
     272             :   already_AddRefed<CSSValue> DoGetBottom();
     273             :   already_AddRefed<CSSValue> DoGetStackSizing();
     274             : 
     275             :   /* Font properties */
     276             :   already_AddRefed<CSSValue> DoGetColor();
     277             :   already_AddRefed<CSSValue> DoGetFontFamily();
     278             :   already_AddRefed<CSSValue> DoGetFontFeatureSettings();
     279             :   already_AddRefed<CSSValue> DoGetFontVariationSettings();
     280             :   already_AddRefed<CSSValue> DoGetFontKerning();
     281             :   already_AddRefed<CSSValue> DoGetFontLanguageOverride();
     282             :   already_AddRefed<CSSValue> DoGetFontOpticalSizing();
     283             :   already_AddRefed<CSSValue> DoGetFontSize();
     284             :   already_AddRefed<CSSValue> DoGetFontSizeAdjust();
     285             :   already_AddRefed<CSSValue> DoGetOsxFontSmoothing();
     286             :   already_AddRefed<CSSValue> DoGetFontSmoothingBackgroundColor();
     287             :   already_AddRefed<CSSValue> DoGetFontStretch();
     288             :   already_AddRefed<CSSValue> DoGetFontStyle();
     289             :   already_AddRefed<CSSValue> DoGetFontSynthesis();
     290             :   already_AddRefed<CSSValue> DoGetFontVariant();
     291             :   already_AddRefed<CSSValue> DoGetFontVariantAlternates();
     292             :   already_AddRefed<CSSValue> DoGetFontVariantCaps();
     293             :   already_AddRefed<CSSValue> DoGetFontVariantEastAsian();
     294             :   already_AddRefed<CSSValue> DoGetFontVariantLigatures();
     295             :   already_AddRefed<CSSValue> DoGetFontVariantNumeric();
     296             :   already_AddRefed<CSSValue> DoGetFontVariantPosition();
     297             :   already_AddRefed<CSSValue> DoGetFontWeight();
     298             : 
     299             :   /* Grid properties */
     300             :   already_AddRefed<CSSValue> DoGetGridAutoFlow();
     301             :   already_AddRefed<CSSValue> DoGetGridAutoColumns();
     302             :   already_AddRefed<CSSValue> DoGetGridAutoRows();
     303             :   already_AddRefed<CSSValue> DoGetGridTemplateAreas();
     304             :   already_AddRefed<CSSValue> DoGetGridTemplateColumns();
     305             :   already_AddRefed<CSSValue> DoGetGridTemplateRows();
     306             :   already_AddRefed<CSSValue> DoGetGridColumnStart();
     307             :   already_AddRefed<CSSValue> DoGetGridColumnEnd();
     308             :   already_AddRefed<CSSValue> DoGetGridRowStart();
     309             :   already_AddRefed<CSSValue> DoGetGridRowEnd();
     310             : 
     311             :   /* StyleImageLayer properties */
     312             :   already_AddRefed<CSSValue> DoGetImageLayerImage(const nsStyleImageLayers& aLayers);
     313             :   already_AddRefed<CSSValue> DoGetImageLayerPosition(const nsStyleImageLayers& aLayers);
     314             :   already_AddRefed<CSSValue> DoGetImageLayerPositionX(const nsStyleImageLayers& aLayers);
     315             :   already_AddRefed<CSSValue> DoGetImageLayerPositionY(const nsStyleImageLayers& aLayers);
     316             :   already_AddRefed<CSSValue> DoGetImageLayerRepeat(const nsStyleImageLayers& aLayers);
     317             :   already_AddRefed<CSSValue> DoGetImageLayerSize(const nsStyleImageLayers& aLayers);
     318             : 
     319             :   /* Background properties */
     320             :   already_AddRefed<CSSValue> DoGetBackgroundAttachment();
     321             :   already_AddRefed<CSSValue> DoGetBackgroundColor();
     322             :   already_AddRefed<CSSValue> DoGetBackgroundImage();
     323             :   already_AddRefed<CSSValue> DoGetBackgroundPosition();
     324             :   already_AddRefed<CSSValue> DoGetBackgroundPositionX();
     325             :   already_AddRefed<CSSValue> DoGetBackgroundPositionY();
     326             :   already_AddRefed<CSSValue> DoGetBackgroundRepeat();
     327             :   already_AddRefed<CSSValue> DoGetBackgroundClip();
     328             :   already_AddRefed<CSSValue> DoGetBackgroundBlendMode();
     329             :   already_AddRefed<CSSValue> DoGetBackgroundOrigin();
     330             :   already_AddRefed<CSSValue> DoGetBackgroundSize();
     331             : 
     332             :   /* Mask properties */
     333             :   already_AddRefed<CSSValue> DoGetMask();
     334             :   already_AddRefed<CSSValue> DoGetMaskImage();
     335             :   already_AddRefed<CSSValue> DoGetMaskPosition();
     336             :   already_AddRefed<CSSValue> DoGetMaskPositionX();
     337             :   already_AddRefed<CSSValue> DoGetMaskPositionY();
     338             :   already_AddRefed<CSSValue> DoGetMaskRepeat();
     339             :   already_AddRefed<CSSValue> DoGetMaskClip();
     340             :   already_AddRefed<CSSValue> DoGetMaskOrigin();
     341             :   already_AddRefed<CSSValue> DoGetMaskSize();
     342             :   already_AddRefed<CSSValue> DoGetMaskMode();
     343             :   already_AddRefed<CSSValue> DoGetMaskComposite();
     344             : 
     345             :   /* Padding properties */
     346             :   already_AddRefed<CSSValue> DoGetPaddingTop();
     347             :   already_AddRefed<CSSValue> DoGetPaddingBottom();
     348             :   already_AddRefed<CSSValue> DoGetPaddingLeft();
     349             :   already_AddRefed<CSSValue> DoGetPaddingRight();
     350             : 
     351             :   /* Table Properties */
     352             :   already_AddRefed<CSSValue> DoGetBorderCollapse();
     353             :   already_AddRefed<CSSValue> DoGetBorderSpacing();
     354             :   already_AddRefed<CSSValue> DoGetCaptionSide();
     355             :   already_AddRefed<CSSValue> DoGetEmptyCells();
     356             :   already_AddRefed<CSSValue> DoGetTableLayout();
     357             :   already_AddRefed<CSSValue> DoGetVerticalAlign();
     358             : 
     359             :   /* Border Properties */
     360             :   already_AddRefed<CSSValue> DoGetBorderTopStyle();
     361             :   already_AddRefed<CSSValue> DoGetBorderBottomStyle();
     362             :   already_AddRefed<CSSValue> DoGetBorderLeftStyle();
     363             :   already_AddRefed<CSSValue> DoGetBorderRightStyle();
     364             :   already_AddRefed<CSSValue> DoGetBorderTopWidth();
     365             :   already_AddRefed<CSSValue> DoGetBorderBottomWidth();
     366             :   already_AddRefed<CSSValue> DoGetBorderLeftWidth();
     367             :   already_AddRefed<CSSValue> DoGetBorderRightWidth();
     368             :   already_AddRefed<CSSValue> DoGetBorderTopColor();
     369             :   already_AddRefed<CSSValue> DoGetBorderBottomColor();
     370             :   already_AddRefed<CSSValue> DoGetBorderLeftColor();
     371             :   already_AddRefed<CSSValue> DoGetBorderRightColor();
     372             :   already_AddRefed<CSSValue> DoGetBorderBottomLeftRadius();
     373             :   already_AddRefed<CSSValue> DoGetBorderBottomRightRadius();
     374             :   already_AddRefed<CSSValue> DoGetBorderTopLeftRadius();
     375             :   already_AddRefed<CSSValue> DoGetBorderTopRightRadius();
     376             :   already_AddRefed<CSSValue> DoGetFloatEdge();
     377             : 
     378             :   /* Border Image */
     379             :   already_AddRefed<CSSValue> DoGetBorderImageSource();
     380             :   already_AddRefed<CSSValue> DoGetBorderImageSlice();
     381             :   already_AddRefed<CSSValue> DoGetBorderImageWidth();
     382             :   already_AddRefed<CSSValue> DoGetBorderImageOutset();
     383             :   already_AddRefed<CSSValue> DoGetBorderImageRepeat();
     384             : 
     385             :   /* Box Shadow */
     386             :   already_AddRefed<CSSValue> DoGetBoxShadow();
     387             : 
     388             :   /* Window Shadow */
     389             :   already_AddRefed<CSSValue> DoGetWindowShadow();
     390             : 
     391             :   /* Margin Properties */
     392             :   already_AddRefed<CSSValue> DoGetMarginTopWidth();
     393             :   already_AddRefed<CSSValue> DoGetMarginBottomWidth();
     394             :   already_AddRefed<CSSValue> DoGetMarginLeftWidth();
     395             :   already_AddRefed<CSSValue> DoGetMarginRightWidth();
     396             : 
     397             :   /* Outline Properties */
     398             :   already_AddRefed<CSSValue> DoGetOutlineWidth();
     399             :   already_AddRefed<CSSValue> DoGetOutlineStyle();
     400             :   already_AddRefed<CSSValue> DoGetOutlineColor();
     401             :   already_AddRefed<CSSValue> DoGetOutlineOffset();
     402             :   already_AddRefed<CSSValue> DoGetOutlineRadiusBottomLeft();
     403             :   already_AddRefed<CSSValue> DoGetOutlineRadiusBottomRight();
     404             :   already_AddRefed<CSSValue> DoGetOutlineRadiusTopLeft();
     405             :   already_AddRefed<CSSValue> DoGetOutlineRadiusTopRight();
     406             : 
     407             :   /* Content Properties */
     408             :   already_AddRefed<CSSValue> DoGetContent();
     409             :   already_AddRefed<CSSValue> DoGetCounterIncrement();
     410             :   already_AddRefed<CSSValue> DoGetCounterReset();
     411             : 
     412             :   /* Quotes Properties */
     413             :   already_AddRefed<CSSValue> DoGetQuotes();
     414             : 
     415             :   /* z-index */
     416             :   already_AddRefed<CSSValue> DoGetZIndex();
     417             : 
     418             :   /* List properties */
     419             :   already_AddRefed<CSSValue> DoGetListStyleImage();
     420             :   already_AddRefed<CSSValue> DoGetListStylePosition();
     421             :   already_AddRefed<CSSValue> DoGetListStyleType();
     422             :   already_AddRefed<CSSValue> DoGetImageRegion();
     423             : 
     424             :   /* Text Properties */
     425             :   already_AddRefed<CSSValue> DoGetInitialLetter();
     426             :   already_AddRefed<CSSValue> DoGetLineHeight();
     427             :   already_AddRefed<CSSValue> DoGetRubyAlign();
     428             :   already_AddRefed<CSSValue> DoGetRubyPosition();
     429             :   already_AddRefed<CSSValue> DoGetTextAlign();
     430             :   already_AddRefed<CSSValue> DoGetTextAlignLast();
     431             :   already_AddRefed<CSSValue> DoGetTextCombineUpright();
     432             :   already_AddRefed<CSSValue> DoGetTextDecoration();
     433             :   already_AddRefed<CSSValue> DoGetTextDecorationColor();
     434             :   already_AddRefed<CSSValue> DoGetTextDecorationLine();
     435             :   already_AddRefed<CSSValue> DoGetTextDecorationStyle();
     436             :   already_AddRefed<CSSValue> DoGetTextEmphasisColor();
     437             :   already_AddRefed<CSSValue> DoGetTextEmphasisPosition();
     438             :   already_AddRefed<CSSValue> DoGetTextEmphasisStyle();
     439             :   already_AddRefed<CSSValue> DoGetTextIndent();
     440             :   already_AddRefed<CSSValue> DoGetTextJustify();
     441             :   already_AddRefed<CSSValue> DoGetTextOrientation();
     442             :   already_AddRefed<CSSValue> DoGetTextOverflow();
     443             :   already_AddRefed<CSSValue> DoGetTextShadow();
     444             :   already_AddRefed<CSSValue> DoGetTextSizeAdjust();
     445             :   already_AddRefed<CSSValue> DoGetTextTransform();
     446             :   already_AddRefed<CSSValue> DoGetLetterSpacing();
     447             :   already_AddRefed<CSSValue> DoGetWordSpacing();
     448             :   already_AddRefed<CSSValue> DoGetWhiteSpace();
     449             :   already_AddRefed<CSSValue> DoGetWordBreak();
     450             :   already_AddRefed<CSSValue> DoGetOverflowWrap();
     451             :   already_AddRefed<CSSValue> DoGetHyphens();
     452             :   already_AddRefed<CSSValue> DoGetTabSize();
     453             :   already_AddRefed<CSSValue> DoGetWebkitTextFillColor();
     454             :   already_AddRefed<CSSValue> DoGetWebkitTextStrokeColor();
     455             :   already_AddRefed<CSSValue> DoGetWebkitTextStrokeWidth();
     456             : 
     457             :   /* Visibility properties */
     458             :   already_AddRefed<CSSValue> DoGetColorAdjust();
     459             :   already_AddRefed<CSSValue> DoGetOpacity();
     460             :   already_AddRefed<CSSValue> DoGetPointerEvents();
     461             :   already_AddRefed<CSSValue> DoGetVisibility();
     462             :   already_AddRefed<CSSValue> DoGetWritingMode();
     463             : 
     464             :   /* Direction properties */
     465             :   already_AddRefed<CSSValue> DoGetDirection();
     466             :   already_AddRefed<CSSValue> DoGetUnicodeBidi();
     467             : 
     468             :   /* Display properties */
     469             :   already_AddRefed<CSSValue> DoGetBinding();
     470             :   already_AddRefed<CSSValue> DoGetClear();
     471             :   already_AddRefed<CSSValue> DoGetFloat();
     472             :   already_AddRefed<CSSValue> DoGetDisplay();
     473             :   already_AddRefed<CSSValue> DoGetContain();
     474             :   already_AddRefed<CSSValue> DoGetPosition();
     475             :   already_AddRefed<CSSValue> DoGetClip();
     476             :   already_AddRefed<CSSValue> DoGetImageOrientation();
     477             :   already_AddRefed<CSSValue> DoGetWillChange();
     478             :   already_AddRefed<CSSValue> DoGetOverflow();
     479             :   already_AddRefed<CSSValue> DoGetOverflowX();
     480             :   already_AddRefed<CSSValue> DoGetOverflowY();
     481             :   already_AddRefed<CSSValue> DoGetOverflowClipBoxBlock();
     482             :   already_AddRefed<CSSValue> DoGetOverflowClipBoxInline();
     483             :   already_AddRefed<CSSValue> DoGetResize();
     484             :   already_AddRefed<CSSValue> DoGetPageBreakAfter();
     485             :   already_AddRefed<CSSValue> DoGetPageBreakBefore();
     486             :   already_AddRefed<CSSValue> DoGetPageBreakInside();
     487             :   already_AddRefed<CSSValue> DoGetTouchAction();
     488             :   already_AddRefed<CSSValue> DoGetTransform();
     489             :   already_AddRefed<CSSValue> DoGetTranslate();
     490             :   already_AddRefed<CSSValue> DoGetRotate();
     491             :   already_AddRefed<CSSValue> DoGetScale();
     492             :   already_AddRefed<CSSValue> DoGetTransformBox();
     493             :   already_AddRefed<CSSValue> DoGetTransformOrigin();
     494             :   already_AddRefed<CSSValue> DoGetPerspective();
     495             :   already_AddRefed<CSSValue> DoGetBackfaceVisibility();
     496             :   already_AddRefed<CSSValue> DoGetPerspectiveOrigin();
     497             :   already_AddRefed<CSSValue> DoGetTransformStyle();
     498             :   already_AddRefed<CSSValue> DoGetOrient();
     499             :   already_AddRefed<CSSValue> DoGetScrollBehavior();
     500             :   already_AddRefed<CSSValue> DoGetOverscrollBehaviorX();
     501             :   already_AddRefed<CSSValue> DoGetOverscrollBehaviorY();
     502             :   already_AddRefed<CSSValue> DoGetScrollSnapType();
     503             :   already_AddRefed<CSSValue> DoGetScrollSnapTypeX();
     504             :   already_AddRefed<CSSValue> DoGetScrollSnapTypeY();
     505             :   already_AddRefed<CSSValue> DoGetScrollSnapPointsX();
     506             :   already_AddRefed<CSSValue> DoGetScrollSnapPointsY();
     507             :   already_AddRefed<CSSValue> DoGetScrollSnapDestination();
     508             :   already_AddRefed<CSSValue> DoGetScrollSnapCoordinate();
     509             :   already_AddRefed<CSSValue> DoGetScrollbarFaceColor();
     510             :   already_AddRefed<CSSValue> DoGetScrollbarTrackColor();
     511             :   already_AddRefed<CSSValue> DoGetShapeImageThreshold();
     512             :   already_AddRefed<CSSValue> DoGetShapeMargin();
     513             :   already_AddRefed<CSSValue> DoGetShapeOutside();
     514             : 
     515             :   /* User interface properties */
     516             :   already_AddRefed<CSSValue> DoGetCaretColor();
     517             :   already_AddRefed<CSSValue> DoGetCursor();
     518             :   already_AddRefed<CSSValue> DoGetForceBrokenImageIcon();
     519             :   already_AddRefed<CSSValue> DoGetIMEMode();
     520             :   already_AddRefed<CSSValue> DoGetUserFocus();
     521             :   already_AddRefed<CSSValue> DoGetUserInput();
     522             :   already_AddRefed<CSSValue> DoGetUserModify();
     523             :   already_AddRefed<CSSValue> DoGetUserSelect();
     524             :   already_AddRefed<CSSValue> DoGetWindowDragging();
     525             :   already_AddRefed<CSSValue> DoGetWindowOpacity();
     526             :   already_AddRefed<CSSValue> DoGetWindowTransform();
     527             :   already_AddRefed<CSSValue> DoGetWindowTransformOrigin();
     528             : 
     529             :   /* Column properties */
     530             :   already_AddRefed<CSSValue> DoGetColumnCount();
     531             :   already_AddRefed<CSSValue> DoGetColumnFill();
     532             :   already_AddRefed<CSSValue> DoGetColumnSpan();
     533             :   already_AddRefed<CSSValue> DoGetColumnWidth();
     534             :   already_AddRefed<CSSValue> DoGetColumnRuleWidth();
     535             :   already_AddRefed<CSSValue> DoGetColumnRuleStyle();
     536             :   already_AddRefed<CSSValue> DoGetColumnRuleColor();
     537             : 
     538             :   /* CSS Transitions */
     539             :   already_AddRefed<CSSValue> DoGetTransitionProperty();
     540             :   already_AddRefed<CSSValue> DoGetTransitionDuration();
     541             :   already_AddRefed<CSSValue> DoGetTransitionDelay();
     542             :   already_AddRefed<CSSValue> DoGetTransitionTimingFunction();
     543             : 
     544             :   /* CSS Animations */
     545             :   already_AddRefed<CSSValue> DoGetAnimationName();
     546             :   already_AddRefed<CSSValue> DoGetAnimationDuration();
     547             :   already_AddRefed<CSSValue> DoGetAnimationDelay();
     548             :   already_AddRefed<CSSValue> DoGetAnimationTimingFunction();
     549             :   already_AddRefed<CSSValue> DoGetAnimationDirection();
     550             :   already_AddRefed<CSSValue> DoGetAnimationFillMode();
     551             :   already_AddRefed<CSSValue> DoGetAnimationIterationCount();
     552             :   already_AddRefed<CSSValue> DoGetAnimationPlayState();
     553             : 
     554             :   /* CSS Flexbox properties */
     555             :   already_AddRefed<CSSValue> DoGetFlexBasis();
     556             :   already_AddRefed<CSSValue> DoGetFlexDirection();
     557             :   already_AddRefed<CSSValue> DoGetFlexGrow();
     558             :   already_AddRefed<CSSValue> DoGetFlexShrink();
     559             :   already_AddRefed<CSSValue> DoGetFlexWrap();
     560             : 
     561             :   /* CSS Flexbox/Grid properties */
     562             :   already_AddRefed<CSSValue> DoGetOrder();
     563             : 
     564             :   /* CSS Box Alignment properties */
     565             :   already_AddRefed<CSSValue> DoGetAlignContent();
     566             :   already_AddRefed<CSSValue> DoGetAlignItems();
     567             :   already_AddRefed<CSSValue> DoGetAlignSelf();
     568             :   already_AddRefed<CSSValue> DoGetJustifyContent();
     569             :   already_AddRefed<CSSValue> DoGetJustifyItems();
     570             :   already_AddRefed<CSSValue> DoGetJustifySelf();
     571             :   already_AddRefed<CSSValue> DoGetColumnGap();
     572             :   already_AddRefed<CSSValue> DoGetRowGap();
     573             : 
     574             :   /* SVG properties */
     575             :   already_AddRefed<CSSValue> DoGetFill();
     576             :   already_AddRefed<CSSValue> DoGetStroke();
     577             :   already_AddRefed<CSSValue> DoGetMarkerEnd();
     578             :   already_AddRefed<CSSValue> DoGetMarkerMid();
     579             :   already_AddRefed<CSSValue> DoGetMarkerStart();
     580             :   already_AddRefed<CSSValue> DoGetStrokeDasharray();
     581             : 
     582             :   already_AddRefed<CSSValue> DoGetStrokeDashoffset();
     583             :   already_AddRefed<CSSValue> DoGetStrokeWidth();
     584             :   already_AddRefed<CSSValue> DoGetVectorEffect();
     585             : 
     586             :   already_AddRefed<CSSValue> DoGetFillOpacity();
     587             :   already_AddRefed<CSSValue> DoGetFloodOpacity();
     588             :   already_AddRefed<CSSValue> DoGetStopOpacity();
     589             :   already_AddRefed<CSSValue> DoGetStrokeMiterlimit();
     590             :   already_AddRefed<CSSValue> DoGetStrokeOpacity();
     591             : 
     592             :   already_AddRefed<CSSValue> DoGetClipRule();
     593             :   already_AddRefed<CSSValue> DoGetFillRule();
     594             :   already_AddRefed<CSSValue> DoGetStrokeLinecap();
     595             :   already_AddRefed<CSSValue> DoGetStrokeLinejoin();
     596             :   already_AddRefed<CSSValue> DoGetTextAnchor();
     597             : 
     598             :   already_AddRefed<CSSValue> DoGetColorInterpolation();
     599             :   already_AddRefed<CSSValue> DoGetColorInterpolationFilters();
     600             :   already_AddRefed<CSSValue> DoGetDominantBaseline();
     601             :   already_AddRefed<CSSValue> DoGetImageRendering();
     602             :   already_AddRefed<CSSValue> DoGetShapeRendering();
     603             :   already_AddRefed<CSSValue> DoGetTextRendering();
     604             : 
     605             :   already_AddRefed<CSSValue> DoGetFloodColor();
     606             :   already_AddRefed<CSSValue> DoGetLightingColor();
     607             :   already_AddRefed<CSSValue> DoGetStopColor();
     608             : 
     609             :   already_AddRefed<CSSValue> DoGetClipPath();
     610             :   already_AddRefed<CSSValue> DoGetFilter();
     611             :   already_AddRefed<CSSValue> DoGetMaskType();
     612             :   already_AddRefed<CSSValue> DoGetPaintOrder();
     613             : 
     614             :   already_AddRefed<CSSValue> DoGetContextProperties();
     615             : 
     616             :   /* Helper functions */
     617             :   void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor);
     618             :   void SetValueFromComplexColor(nsROCSSPrimitiveValue* aValue,
     619             :                                 const mozilla::StyleComplexColor& aColor);
     620             :   void SetValueForWidgetColor(nsROCSSPrimitiveValue* aValue,
     621             :                               const mozilla::StyleComplexColor& aColor,
     622             :                               uint8_t aWidgetType);
     623             :   void SetValueToStyleImage(const nsStyleImage& aStyleImage,
     624             :                             nsROCSSPrimitiveValue* aValue);
     625             :   void SetValueToPositionCoord(const mozilla::Position::Coord& aCoord,
     626             :                                nsROCSSPrimitiveValue* aValue);
     627             :   void SetValueToPosition(const mozilla::Position& aPosition,
     628             :                           nsDOMCSSValueList* aValueList);
     629             :   void SetValueToURLValue(const mozilla::css::URLValueData* aURL,
     630             :                           nsROCSSPrimitiveValue* aValue);
     631             : 
     632             :   /**
     633             :    * A method to get a percentage base for a percentage value.  Returns true
     634             :    * if a percentage base value was determined, false otherwise.
     635             :    */
     636             :   typedef bool (nsComputedDOMStyle::*PercentageBaseGetter)(nscoord&);
     637             : 
     638             :   /**
     639             :    * Method to set aValue to aCoord.  If aCoord is a percentage value and
     640             :    * aPercentageBaseGetter is not null, aPercentageBaseGetter is called.  If it
     641             :    * returns true, the percentage base it outputs in its out param is used
     642             :    * to compute an nscoord value.  If the getter is null or returns false,
     643             :    * the percent value of aCoord is set as a percent value on aValue.  aTable,
     644             :    * if not null, is the keyword table to handle eStyleUnit_Enumerated.  When
     645             :    * calling SetAppUnits on aValue (for coord or percent values), the value
     646             :    * passed in will be clamped to be no less than aMinAppUnits and no more than
     647             :    * aMaxAppUnits.
     648             :    *
     649             :    * XXXbz should caller pass in some sort of bitfield indicating which units
     650             :    * can be expected or something?
     651             :    */
     652             :   void SetValueToCoord(nsROCSSPrimitiveValue* aValue,
     653             :                        const nsStyleCoord& aCoord,
     654             :                        bool aClampNegativeCalc,
     655             :                        PercentageBaseGetter aPercentageBaseGetter = nullptr,
     656             :                        const KTableEntry aTable[] = nullptr,
     657             :                        nscoord aMinAppUnits = nscoord_MIN,
     658             :                        nscoord aMaxAppUnits = nscoord_MAX);
     659             : 
     660             :   /**
     661             :    * If aCoord is a eStyleUnit_Coord returns the nscoord.  If it's
     662             :    * eStyleUnit_Percent, attempts to resolve the percentage base and returns
     663             :    * the resulting nscoord.  If it's some other unit or a percentge base can't
     664             :    * be determined, returns aDefaultValue.
     665             :    */
     666             :   nscoord StyleCoordToNSCoord(const nsStyleCoord& aCoord,
     667             :                               PercentageBaseGetter aPercentageBaseGetter,
     668             :                               nscoord aDefaultValue,
     669             :                               bool aClampNegativeCalc);
     670             : 
     671             :   /**
     672             :    * Append coord values from four sides. It omits values when possible.
     673             :    */
     674             :   void AppendFourSideCoordValues(nsDOMCSSValueList* aList,
     675             :                                  const nsStyleSides& aValues);
     676             : 
     677             :   bool GetCBContentWidth(nscoord& aWidth);
     678             :   bool GetCBContentHeight(nscoord& aWidth);
     679             :   bool GetScrollFrameContentWidth(nscoord& aWidth);
     680             :   bool GetScrollFrameContentHeight(nscoord& aHeight);
     681             :   bool GetFrameBoundsWidthForTransform(nscoord &aWidth);
     682             :   bool GetFrameBoundsHeightForTransform(nscoord &aHeight);
     683             :   bool GetFrameBorderRectWidth(nscoord& aWidth);
     684             :   bool GetFrameBorderRectHeight(nscoord& aHeight);
     685             : 
     686             :   /* Helper functions for computing and serializing a nsStyleCoord. */
     687             :   void SetCssTextToCoord(nsAString& aCssText, const nsStyleCoord& aCoord,
     688             :                          bool aClampNegativeCalc);
     689             :   already_AddRefed<CSSValue> CreatePrimitiveValueForStyleFilter(
     690             :     const nsStyleFilter& aStyleFilter);
     691             : 
     692             :   already_AddRefed<CSSValue>
     693             :   GetShapeSource(const mozilla::StyleShapeSource& aShapeSource,
     694             :                  const KTableEntry aBoxKeywordTable[]);
     695             : 
     696             :   template<typename ReferenceBox>
     697             :   already_AddRefed<CSSValue>
     698             :   CreatePrimitiveValueForShapeSource(
     699             :     const mozilla::UniquePtr<mozilla::StyleBasicShape>& aStyleBasicShape,
     700             :     ReferenceBox aReferenceBox,
     701             :     const KTableEntry aBoxKeywordTable[]);
     702             : 
     703             :   // Helper function for computing basic shape styles.
     704             :   already_AddRefed<CSSValue> CreatePrimitiveValueForBasicShape(
     705             :     const mozilla::UniquePtr<mozilla::StyleBasicShape>& aStyleBasicShape);
     706             :   void BoxValuesToString(nsAString& aString,
     707             :                          const nsTArray<nsStyleCoord>& aBoxValues,
     708             :                          bool aClampNegativeCalc);
     709             :   void BasicShapeRadiiToString(nsAString& aCssText,
     710             :                                const nsStyleCorners& aCorners);
     711             : 
     712             :   // Find out if we can safely skip flushing for aDocument (i.e. pending
     713             :   // restyles does not affect mContent).
     714             :   bool NeedsToFlush(nsIDocument* aDocument) const;
     715             : 
     716             : 
     717             :   static ComputedStyleMap* GetComputedStyleMap();
     718             : 
     719             :   // We don't really have a good immutable representation of "presentation".
     720             :   // Given the way GetComputedStyle is currently used, we should just grab the
     721             :   // 0th presshell, if any, from the document.
     722             :   nsWeakPtr mDocumentWeak;
     723             :   nsCOMPtr<nsIContent> mContent;
     724             : 
     725             :   /**
     726             :    * Strong reference to the ComputedStyle we access data from.  This can be
     727             :    * either a ComputedStyle we resolved ourselves or a ComputedStyle we got
     728             :    * from our frame.
     729             :    *
     730             :    * If we got the ComputedStyle from the frame, we clear out mComputedStyle
     731             :    * in ClearCurrentStyleSources.  If we resolved one ourselves, then
     732             :    * ClearCurrentStyleSources leaves it in mComputedStyle for use the next
     733             :    * time this nsComputedDOMStyle object is queried.  UpdateCurrentStyleSources
     734             :    * in this case will check that the ComputedStyle is still valid to be used,
     735             :    * by checking whether flush styles results in any restyles having been
     736             :    * processed.
     737             :    *
     738             :    * Since an ArenaRefPtr is used to hold the ComputedStyle, it will be cleared
     739             :    * if the pres arena from which it was allocated goes away.
     740             :    */
     741             :   mozilla::ArenaRefPtr<mozilla::ComputedStyle> mComputedStyle;
     742             :   RefPtr<nsAtom> mPseudo;
     743             : 
     744             :   /*
     745             :    * While computing style data, the primary frame for mContent --- named "outer"
     746             :    * because we should use it to compute positioning data.  Null
     747             :    * otherwise.
     748             :    */
     749             :   nsIFrame* mOuterFrame;
     750             :   /*
     751             :    * While computing style data, the "inner frame" for mContent --- the frame
     752             :    * which we should use to compute margin, border, padding and content data.  Null
     753             :    * otherwise.
     754             :    */
     755             :   nsIFrame* mInnerFrame;
     756             :   /*
     757             :    * While computing style data, the presshell we're working with.  Null
     758             :    * otherwise.
     759             :    */
     760             :   nsIPresShell* mPresShell;
     761             : 
     762             :   /*
     763             :    * The kind of styles we should be returning.
     764             :    */
     765             :   StyleType mStyleType;
     766             : 
     767             :   /**
     768             :    * The nsComputedDOMStyle generation at the time we last resolved a style
     769             :    * context and stored it in mComputedStyle.
     770             :    */
     771             :   uint64_t mComputedStyleGeneration;
     772             : 
     773             :   bool mExposeVisitedStyle;
     774             : 
     775             :   /**
     776             :    * Whether we resolved a ComputedStyle last time we called
     777             :    * UpdateCurrentStyleSources.  Initially false.
     778             :    */
     779             :   bool mResolvedComputedStyle;
     780             : 
     781             : #ifdef DEBUG
     782             :   bool mFlushedPendingReflows;
     783             : #endif
     784             : };
     785             : 
     786             : already_AddRefed<nsComputedDOMStyle>
     787             : NS_NewComputedDOMStyle(mozilla::dom::Element* aElement,
     788             :                        const nsAString& aPseudoElt,
     789             :                        nsIPresShell* aPresShell,
     790             :                        nsComputedDOMStyle::StyleType aStyleType =
     791             :                          nsComputedDOMStyle::eAll);
     792             : 
     793             : #endif /* nsComputedDOMStyle_h__ */

Generated by: LCOV version 1.13-14-ga5dd952