tor-browser

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

CSSPropertyRule.cpp (2125B)


      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 #include "mozilla/dom/CSSPropertyRule.h"
      8 
      9 #include "mozilla/ServoBindings.h"
     10 #include "mozilla/dom/CSSPropertyRuleBinding.h"
     11 
     12 namespace mozilla::dom {
     13 
     14 bool CSSPropertyRule::IsCCLeaf() const { return Rule::IsCCLeaf(); }
     15 
     16 void CSSPropertyRule::SetRawAfterClone(RefPtr<StylePropertyRule> aRaw) {
     17  mRawRule = std::move(aRaw);
     18 }
     19 
     20 /* virtual */
     21 JSObject* CSSPropertyRule::WrapObject(JSContext* aCx,
     22                                      JS::Handle<JSObject*> aGivenProto) {
     23  return CSSPropertyRule_Binding::Wrap(aCx, this, aGivenProto);
     24 }
     25 
     26 #ifdef DEBUG
     27 void CSSPropertyRule::List(FILE* out, int32_t aIndent) const {
     28  nsAutoCString str;
     29  for (int32_t i = 0; i < aIndent; i++) {
     30    str.AppendLiteral("  ");
     31  }
     32  Servo_PropertyRule_Debug(mRawRule, &str);
     33  fprintf_stderr(out, "%s\n", str.get());
     34 }
     35 #endif
     36 
     37 size_t CSSPropertyRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
     38  // TODO Implement this!
     39  return aMallocSizeOf(this);
     40 }
     41 
     42 StyleCssRuleType CSSPropertyRule::Type() const {
     43  return StyleCssRuleType::Property;
     44 }
     45 
     46 /* CSSRule implementation */
     47 
     48 void CSSPropertyRule::GetCssText(nsACString& aCssText) const {
     49  Servo_PropertyRule_GetCssText(mRawRule, &aCssText);
     50 }
     51 
     52 /* CSSPropertyRule implementation */
     53 
     54 void CSSPropertyRule::GetName(nsACString& aNameStr) const {
     55  Servo_PropertyRule_GetName(mRawRule, &aNameStr);
     56 }
     57 
     58 void CSSPropertyRule::GetSyntax(nsACString& aSyntaxStr) const {
     59  Servo_PropertyRule_GetSyntax(mRawRule, &aSyntaxStr);
     60 }
     61 
     62 bool CSSPropertyRule::Inherits() const {
     63  return Servo_PropertyRule_GetInherits(mRawRule);
     64 }
     65 
     66 void CSSPropertyRule::GetInitialValue(nsACString& aInitialValueStr) const {
     67  bool found = Servo_PropertyRule_GetInitialValue(mRawRule, &aInitialValueStr);
     68  if (!found) {
     69    aInitialValueStr.SetIsVoid(true);
     70  }
     71 }
     72 
     73 }  // namespace mozilla::dom