tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

CSSPositionTryRule.h (3296B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      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 #ifndef mozilla_dom_CSSPositionTryRule_h
      7 #define mozilla_dom_CSSPositionTryRule_h
      8 
      9 #include "mozilla/ServoBindingTypes.h"
     10 #include "mozilla/css/Rule.h"
     11 #include "nsDOMCSSDeclaration.h"
     12 #include "nsICSSDeclaration.h"
     13 // The following include provides nsCSSProps::PropertyIDLName(), used by
     14 // generated CSSPositionTryDescriptorsBinding.cpp
     15 // TODO: Ideally it would only be included from there.
     16 #include "nsCSSProps.h"
     17 
     18 namespace mozilla {
     19 class DeclarationBlock;
     20 
     21 namespace dom {
     22 
     23 class CSSPositionTryRule;
     24 class CSSPositionTryRuleDeclaration final : public nsDOMCSSDeclaration {
     25 public:
     26  NS_DECL_ISUPPORTS_INHERITED
     27 
     28  css::Rule* GetParentRule() final;
     29  nsINode* GetAssociatedNode() const final;
     30  nsISupports* GetParentObject() const final;
     31 
     32  JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
     33 
     34 protected:
     35  DeclarationBlock* GetOrCreateCSSDeclaration(
     36      Operation aOperation, DeclarationBlock** aCreated) final;
     37  nsresult SetCSSDeclaration(DeclarationBlock* aDecl,
     38                             MutationClosureData* aClosureData) final;
     39  nsDOMCSSDeclaration::ParsingEnvironment GetParsingEnvironment(
     40      nsIPrincipal* aSubjectPrincipal) const final;
     41 
     42 private:
     43  // For accessing the constructor.
     44  friend class CSSPositionTryRule;
     45 
     46  explicit CSSPositionTryRuleDeclaration(
     47      already_AddRefed<StyleLockedDeclarationBlock> aDecls);
     48  void SetRawAfterClone(RefPtr<StyleLockedDeclarationBlock>);
     49 
     50  ~CSSPositionTryRuleDeclaration();
     51 
     52  inline CSSPositionTryRule* Rule();
     53  inline const CSSPositionTryRule* Rule() const;
     54 
     55  RefPtr<DeclarationBlock> mDecls;
     56 };
     57 
     58 class CSSPositionTryRule final : public css::Rule {
     59 public:
     60  CSSPositionTryRule(RefPtr<StyleLockedPositionTryRule> aRawRule,
     61                     StyleSheet* aSheet, css::Rule* aParentRule, uint32_t aLine,
     62                     uint32_t aColumn);
     63 
     64  NS_DECL_ISUPPORTS_INHERITED
     65  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(CSSPositionTryRule,
     66                                                         css::Rule)
     67 
     68  bool IsCCLeaf() const final;
     69 
     70  StyleLockedPositionTryRule* Raw() const { return mRawRule; }
     71  void SetRawAfterClone(RefPtr<StyleLockedPositionTryRule>);
     72 
     73  // WebIDL interfaces
     74  StyleCssRuleType Type() const final;
     75  void GetCssText(nsACString& aCssText) const final;
     76  CSSPositionTryRuleDeclaration* Style() { return &mDecls; }
     77  void GetName(nsACString& aName);
     78 
     79  size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final;
     80 
     81 #ifdef DEBUG
     82  void List(FILE* out = stdout, int32_t aIndent = 0) const final;
     83 #endif
     84 
     85  JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
     86 
     87  const StyleLockedDeclarationBlock* RawStyle() const;
     88 
     89 private:
     90  ~CSSPositionTryRule() = default;
     91 
     92  // For computing the offset of mDecls.
     93  friend class CSSPositionTryRuleDeclaration;
     94 
     95  RefPtr<StyleLockedPositionTryRule> mRawRule;
     96  CSSPositionTryRuleDeclaration mDecls;
     97 };
     98 
     99 }  // namespace dom
    100 }  // namespace mozilla
    101 
    102 #endif  // mozilla_dom_CSSPositionTryRule_h