tor-browser

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

CSSStyleValue.cpp (2745B)


      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/CSSStyleValue.h"
      8 
      9 #include "mozilla/Assertions.h"
     10 #include "mozilla/ErrorResult.h"
     11 #include "mozilla/dom/CSSStyleValueBinding.h"
     12 #include "nsCycleCollectionParticipant.h"
     13 
     14 namespace mozilla::dom {
     15 
     16 CSSStyleValue::CSSStyleValue(nsCOMPtr<nsISupports> aParent)
     17    : mParent(std::move(aParent)), mValueType(ValueType::Uninitialized) {
     18  MOZ_ASSERT(mParent);
     19 }
     20 
     21 CSSStyleValue::CSSStyleValue(nsCOMPtr<nsISupports> aParent,
     22                             ValueType aValueType)
     23    : mParent(std::move(aParent)), mValueType(aValueType) {
     24  MOZ_ASSERT(mParent);
     25 }
     26 
     27 NS_IMPL_CYCLE_COLLECTING_ADDREF(CSSStyleValue)
     28 NS_IMPL_CYCLE_COLLECTING_RELEASE(CSSStyleValue)
     29 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CSSStyleValue)
     30  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
     31  NS_INTERFACE_MAP_ENTRY(nsISupports)
     32 NS_INTERFACE_MAP_END
     33 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CSSStyleValue, mParent)
     34 
     35 nsISupports* CSSStyleValue::GetParentObject() const { return mParent; }
     36 
     37 JSObject* CSSStyleValue::WrapObject(JSContext* aCx,
     38                                    JS::Handle<JSObject*> aGivenProto) {
     39  return CSSStyleValue_Binding::Wrap(aCx, this, aGivenProto);
     40 }
     41 
     42 // start of CSSStyleValue Web IDL implementation
     43 
     44 // static
     45 RefPtr<CSSStyleValue> CSSStyleValue::Parse(const GlobalObject& aGlobal,
     46                                           const nsACString& aProperty,
     47                                           const nsACString& aCssText,
     48                                           ErrorResult& aRv) {
     49  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
     50  return nullptr;
     51 }
     52 
     53 // static
     54 void CSSStyleValue::ParseAll(const GlobalObject& aGlobal,
     55                             const nsACString& aProperty,
     56                             const nsACString& aCssText,
     57                             nsTArray<RefPtr<CSSStyleValue>>& aRetVal,
     58                             ErrorResult& aRv) {
     59  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
     60 }
     61 
     62 void CSSStyleValue::Stringify(nsAString& aRetVal) const {}
     63 
     64 // end of CSSStyleValue Web IDL implementation
     65 
     66 bool CSSStyleValue::IsCSSUnsupportedValue() const {
     67  return mValueType == ValueType::UnsupportedValue;
     68 }
     69 
     70 bool CSSStyleValue::IsCSSKeywordValue() const {
     71  return mValueType == ValueType::KeywordValue;
     72 }
     73 
     74 bool CSSStyleValue::IsCSSUnitValue() const {
     75  return mValueType == ValueType::UnitValue;
     76 }
     77 
     78 bool CSSStyleValue::IsCSSMathSum() const {
     79  return mValueType == ValueType::MathSum;
     80 }
     81 
     82 }  // namespace mozilla::dom