diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /layout/style/ServoStyleSheet.cpp | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/style/ServoStyleSheet.cpp')
-rw-r--r-- | layout/style/ServoStyleSheet.cpp | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/layout/style/ServoStyleSheet.cpp b/layout/style/ServoStyleSheet.cpp new file mode 100644 index 000000000..cfeae20d2 --- /dev/null +++ b/layout/style/ServoStyleSheet.cpp @@ -0,0 +1,143 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "mozilla/ServoStyleSheet.h" +#include "mozilla/StyleBackendType.h" + +namespace mozilla { + +ServoStyleSheet::ServoStyleSheet(css::SheetParsingMode aParsingMode, + CORSMode aCORSMode, + net::ReferrerPolicy aReferrerPolicy, + const dom::SRIMetadata& aIntegrity) + : StyleSheet(StyleBackendType::Servo, aParsingMode) + , mSheetInfo(aCORSMode, aReferrerPolicy, aIntegrity) +{ +} + +ServoStyleSheet::~ServoStyleSheet() +{ + DropSheet(); +} + +bool +ServoStyleSheet::HasRules() const +{ + return mSheet && Servo_StyleSheet_HasRules(mSheet); +} + +void +ServoStyleSheet::SetOwningDocument(nsIDocument* aDocument) +{ + // XXXheycam: Traverse to child ServoStyleSheets to set this, like + // CSSStyleSheet::SetOwningDocument does. + + mDocument = aDocument; +} + +ServoStyleSheet* +ServoStyleSheet::GetParentSheet() const +{ + // XXXheycam: When we implement support for child sheets, we'll have + // to fix SetOwningDocument to propagate the owning document down + // to the children. + MOZ_CRASH("stylo: not implemented"); +} + +void +ServoStyleSheet::AppendStyleSheet(ServoStyleSheet* aSheet) +{ + // XXXheycam: When we implement support for child sheets, we'll have + // to fix SetOwningDocument to propagate the owning document down + // to the children. + MOZ_CRASH("stylo: not implemented"); +} + +nsresult +ServoStyleSheet::ParseSheet(const nsAString& aInput, + nsIURI* aSheetURI, + nsIURI* aBaseURI, + nsIPrincipal* aSheetPrincipal, + uint32_t aLineNumber) +{ + DropSheet(); + + RefPtr<ThreadSafeURIHolder> base = new ThreadSafeURIHolder(aBaseURI); + RefPtr<ThreadSafeURIHolder> referrer = new ThreadSafeURIHolder(aSheetURI); + RefPtr<ThreadSafePrincipalHolder> principal = + new ThreadSafePrincipalHolder(aSheetPrincipal); + + nsCString baseString; + nsresult rv = aBaseURI->GetSpec(baseString); + NS_ENSURE_SUCCESS(rv, rv); + + NS_ConvertUTF16toUTF8 input(aInput); + mSheet = Servo_StyleSheet_FromUTF8Bytes(&input, mParsingMode, &baseString, + base, referrer, principal).Consume(); + + return NS_OK; +} + +void +ServoStyleSheet::LoadFailed() +{ + mSheet = Servo_StyleSheet_Empty(mParsingMode).Consume(); +} + +void +ServoStyleSheet::DropSheet() +{ + mSheet = nullptr; +} + +size_t +ServoStyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const +{ + MOZ_CRASH("stylo: not implemented"); +} + +#ifdef DEBUG +void +ServoStyleSheet::List(FILE* aOut, int32_t aIndex) const +{ + MOZ_CRASH("stylo: not implemented"); +} +#endif + +nsMediaList* +ServoStyleSheet::Media() +{ + return nullptr; +} + +nsIDOMCSSRule* +ServoStyleSheet::GetDOMOwnerRule() const +{ + return nullptr; +} + +CSSRuleList* +ServoStyleSheet::GetCssRulesInternal(ErrorResult& aRv) +{ + aRv.Throw(NS_ERROR_NOT_IMPLEMENTED); + return nullptr; +} + +uint32_t +ServoStyleSheet::InsertRuleInternal(const nsAString& aRule, + uint32_t aIndex, ErrorResult& aRv) +{ + aRv.Throw(NS_ERROR_NOT_IMPLEMENTED); + return 0; +} + +void +ServoStyleSheet::DeleteRuleInternal(uint32_t aIndex, ErrorResult& aRv) +{ + aRv.Throw(NS_ERROR_NOT_IMPLEMENTED); +} + +} // namespace mozilla |