2016-11-23 02:26:20 +03:00
|
|
|
/* -*- 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/. */
|
|
|
|
|
2018-06-04 16:35:50 +03:00
|
|
|
#include "mozilla/dom/CSSStyleRule.h"
|
2016-11-23 02:26:20 +03:00
|
|
|
|
Bug 1590639 part 4: Fix non-unified build issues in layout/style. r=emilio
This patch:
- Gives layout/generic/AnonymousContentKey.h an include for `<stdint.h>` to
provide the uint8_t type, and TypedEnumBits.h to provide the
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS macro. (This is a change in another
directory, but it's needed in order for layout/style/ServoStyleSet.cpp to
build successfully.)
- Adds a missing "nsINode" forward-decl to dom/base/IdentifierMapEntry.h,
because it uses that type in function declarations. (This change is needed
in order for layout/style/CachedInheritingStyles.cpp to build successfully.)
- Gives CSSStyleRule.cpp an include for PseudoStyleType.h,
nsCSSPseudoElements.h, and CSSEnabledState.h because it uses those types.
- Gives GeckoBindings.cpp an include for gfxTextRun.h, to provide the definition
of type gfxFontGroup (so GeckoBindings can call GetFirstValidFont() on an
object of that type).
- Gives Loader.h an include for nsIContentInlines.h, to provide the inline
function IsInUAWidget().
- Gives Rule.cpp an include for HoldDropJSObjects.h, to provide DropJSObjects().
- Gives nsImageLoader.cpp an include for DocumentInlines.h (and Document.h for
good measure), to provide the inline function GetPresContext().
- Gives nsStyleStruct.cpp an include for DocumentInlines.h, to provide inline
function Document::GetPresContext().
- Gives nsStyleTransformMatrix.h an include for Units.h (instead of gfxPoint.h,
which isn't useful) to provide the CSSPoint type.
- Gives nsStyleTransformMatrix.h an include for ServoStyleConsts.h, to provide
LengthPercentage and the various StyleRotate/StyleScale/StyleTransform/etc
types. (These can't be easily forward-declared, because some of them are
legitimate types whereas others are type aliases. We could theoretically
forward-declare all of the underlying types and then repeat the type aliases,
but that'd be verbose and unmaintainable.)
Depends on D50165
Differential Revision: https://phabricator.services.mozilla.com/D50166
--HG--
extra : moz-landing-system : lando
2019-10-23 11:14:54 +03:00
|
|
|
#include "mozilla/CSSEnabledState.h"
|
2018-05-30 19:15:25 +03:00
|
|
|
#include "mozilla/DeclarationBlock.h"
|
Bug 1590639 part 4: Fix non-unified build issues in layout/style. r=emilio
This patch:
- Gives layout/generic/AnonymousContentKey.h an include for `<stdint.h>` to
provide the uint8_t type, and TypedEnumBits.h to provide the
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS macro. (This is a change in another
directory, but it's needed in order for layout/style/ServoStyleSet.cpp to
build successfully.)
- Adds a missing "nsINode" forward-decl to dom/base/IdentifierMapEntry.h,
because it uses that type in function declarations. (This change is needed
in order for layout/style/CachedInheritingStyles.cpp to build successfully.)
- Gives CSSStyleRule.cpp an include for PseudoStyleType.h,
nsCSSPseudoElements.h, and CSSEnabledState.h because it uses those types.
- Gives GeckoBindings.cpp an include for gfxTextRun.h, to provide the definition
of type gfxFontGroup (so GeckoBindings can call GetFirstValidFont() on an
object of that type).
- Gives Loader.h an include for nsIContentInlines.h, to provide the inline
function IsInUAWidget().
- Gives Rule.cpp an include for HoldDropJSObjects.h, to provide DropJSObjects().
- Gives nsImageLoader.cpp an include for DocumentInlines.h (and Document.h for
good measure), to provide the inline function GetPresContext().
- Gives nsStyleStruct.cpp an include for DocumentInlines.h, to provide inline
function Document::GetPresContext().
- Gives nsStyleTransformMatrix.h an include for Units.h (instead of gfxPoint.h,
which isn't useful) to provide the CSSPoint type.
- Gives nsStyleTransformMatrix.h an include for ServoStyleConsts.h, to provide
LengthPercentage and the various StyleRotate/StyleScale/StyleTransform/etc
types. (These can't be easily forward-declared, because some of them are
legitimate types whereas others are type aliases. We could theoretically
forward-declare all of the underlying types and then repeat the type aliases,
but that'd be verbose and unmaintainable.)
Depends on D50165
Differential Revision: https://phabricator.services.mozilla.com/D50166
--HG--
extra : moz-landing-system : lando
2019-10-23 11:14:54 +03:00
|
|
|
#include "mozilla/PseudoStyleType.h"
|
2016-11-23 02:26:20 +03:00
|
|
|
#include "mozilla/ServoBindings.h"
|
2017-01-13 18:41:03 +03:00
|
|
|
#include "mozilla/dom/CSSStyleRuleBinding.h"
|
Bug 1590639 part 4: Fix non-unified build issues in layout/style. r=emilio
This patch:
- Gives layout/generic/AnonymousContentKey.h an include for `<stdint.h>` to
provide the uint8_t type, and TypedEnumBits.h to provide the
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS macro. (This is a change in another
directory, but it's needed in order for layout/style/ServoStyleSet.cpp to
build successfully.)
- Adds a missing "nsINode" forward-decl to dom/base/IdentifierMapEntry.h,
because it uses that type in function declarations. (This change is needed
in order for layout/style/CachedInheritingStyles.cpp to build successfully.)
- Gives CSSStyleRule.cpp an include for PseudoStyleType.h,
nsCSSPseudoElements.h, and CSSEnabledState.h because it uses those types.
- Gives GeckoBindings.cpp an include for gfxTextRun.h, to provide the definition
of type gfxFontGroup (so GeckoBindings can call GetFirstValidFont() on an
object of that type).
- Gives Loader.h an include for nsIContentInlines.h, to provide the inline
function IsInUAWidget().
- Gives Rule.cpp an include for HoldDropJSObjects.h, to provide DropJSObjects().
- Gives nsImageLoader.cpp an include for DocumentInlines.h (and Document.h for
good measure), to provide the inline function GetPresContext().
- Gives nsStyleStruct.cpp an include for DocumentInlines.h, to provide inline
function Document::GetPresContext().
- Gives nsStyleTransformMatrix.h an include for Units.h (instead of gfxPoint.h,
which isn't useful) to provide the CSSPoint type.
- Gives nsStyleTransformMatrix.h an include for ServoStyleConsts.h, to provide
LengthPercentage and the various StyleRotate/StyleScale/StyleTransform/etc
types. (These can't be easily forward-declared, because some of them are
legitimate types whereas others are type aliases. We could theoretically
forward-declare all of the underlying types and then repeat the type aliases,
but that'd be verbose and unmaintainable.)
Depends on D50165
Differential Revision: https://phabricator.services.mozilla.com/D50166
--HG--
extra : moz-landing-system : lando
2019-10-23 11:14:54 +03:00
|
|
|
#include "nsCSSPseudoElements.h"
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2016-11-23 02:26:20 +03:00
|
|
|
#include "mozAutoDocUpdate.h"
|
2021-03-23 00:15:34 +03:00
|
|
|
#include "nsISupports.h"
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2021-09-08 14:18:32 +03:00
|
|
|
namespace mozilla::dom {
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2018-06-04 16:35:50 +03:00
|
|
|
// -- CSSStyleRuleDeclaration ---------------------------------------
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2018-06-04 16:35:50 +03:00
|
|
|
CSSStyleRuleDeclaration::CSSStyleRuleDeclaration(
|
2016-11-23 02:26:20 +03:00
|
|
|
already_AddRefed<RawServoDeclarationBlock> aDecls)
|
2021-07-20 16:17:02 +03:00
|
|
|
: mDecls(new DeclarationBlock(std::move(aDecls))) {
|
|
|
|
mDecls->SetOwningRule(Rule());
|
|
|
|
}
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2018-06-04 16:35:50 +03:00
|
|
|
CSSStyleRuleDeclaration::~CSSStyleRuleDeclaration() {
|
2017-11-29 02:06:51 +03:00
|
|
|
mDecls->SetOwningRule(nullptr);
|
2016-11-23 02:26:20 +03:00
|
|
|
}
|
|
|
|
|
2018-06-04 16:35:50 +03:00
|
|
|
// QueryInterface implementation for CSSStyleRuleDeclaration
|
|
|
|
NS_INTERFACE_MAP_BEGIN(CSSStyleRuleDeclaration)
|
2016-11-23 02:26:20 +03:00
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
|
|
// We forward the cycle collection interfaces to Rule(), which is
|
|
|
|
// never null (in fact, we're part of that object!)
|
|
|
|
if (aIID.Equals(NS_GET_IID(nsCycleCollectionISupports)) ||
|
|
|
|
aIID.Equals(NS_GET_IID(nsXPCOMCycleCollectionParticipant))) {
|
|
|
|
return Rule()->QueryInterface(aIID, aInstancePtr);
|
|
|
|
}
|
|
|
|
NS_INTERFACE_MAP_END_INHERITING(nsDOMCSSDeclaration)
|
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
NS_IMPL_ADDREF_USING_AGGREGATOR(CSSStyleRuleDeclaration, Rule())
|
|
|
|
NS_IMPL_RELEASE_USING_AGGREGATOR(CSSStyleRuleDeclaration, Rule())
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
/* nsDOMCSSDeclaration implementation */
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
css::Rule* CSSStyleRuleDeclaration::GetParentRule() { return Rule(); }
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2021-03-23 00:15:34 +03:00
|
|
|
nsINode* CSSStyleRuleDeclaration::GetAssociatedNode() const {
|
|
|
|
return Rule()->GetAssociatedDocumentOrShadowRoot();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsISupports* CSSStyleRuleDeclaration::GetParentObject() const {
|
2018-12-20 22:33:09 +03:00
|
|
|
return Rule()->GetParentObject();
|
|
|
|
}
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
DeclarationBlock* CSSStyleRuleDeclaration::GetOrCreateCSSDeclaration(
|
|
|
|
Operation aOperation, DeclarationBlock** aCreated) {
|
2021-07-20 16:17:02 +03:00
|
|
|
if (aOperation != Operation::Read) {
|
|
|
|
if (StyleSheet* sheet = Rule()->GetStyleSheet()) {
|
|
|
|
sheet->WillDirty();
|
|
|
|
}
|
|
|
|
}
|
2018-12-20 22:33:09 +03:00
|
|
|
return mDecls;
|
|
|
|
}
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2021-07-20 16:17:02 +03:00
|
|
|
void CSSStyleRule::SetRawAfterClone(RefPtr<RawServoStyleRule> aRaw) {
|
|
|
|
mRawRule = std::move(aRaw);
|
|
|
|
mDecls.SetRawAfterClone(Servo_StyleRule_GetStyle(mRawRule).Consume());
|
|
|
|
}
|
|
|
|
|
2021-08-07 12:47:15 +03:00
|
|
|
void CSSStyleRuleDeclaration::SetRawAfterClone(
|
|
|
|
RefPtr<RawServoDeclarationBlock> aRaw) {
|
2021-07-20 16:17:02 +03:00
|
|
|
RefPtr<DeclarationBlock> block = new DeclarationBlock(aRaw.forget());
|
|
|
|
mDecls->SetOwningRule(nullptr);
|
|
|
|
mDecls = std::move(block);
|
|
|
|
mDecls->SetOwningRule(Rule());
|
|
|
|
}
|
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
nsresult CSSStyleRuleDeclaration::SetCSSDeclaration(
|
|
|
|
DeclarationBlock* aDecl, MutationClosureData* aClosureData) {
|
|
|
|
CSSStyleRule* rule = Rule();
|
2019-04-29 08:34:06 +03:00
|
|
|
|
2021-07-20 16:17:02 +03:00
|
|
|
if (StyleSheet* sheet = rule->GetStyleSheet()) {
|
2018-12-20 22:33:09 +03:00
|
|
|
if (aDecl != mDecls) {
|
|
|
|
mDecls->SetOwningRule(nullptr);
|
|
|
|
RefPtr<DeclarationBlock> decls = aDecl;
|
|
|
|
Servo_StyleRule_SetStyle(rule->Raw(), decls->Raw());
|
2020-02-13 17:38:48 +03:00
|
|
|
mDecls = std::move(decls);
|
2018-12-20 22:33:09 +03:00
|
|
|
mDecls->SetOwningRule(rule);
|
2016-11-23 02:26:20 +03:00
|
|
|
}
|
2020-08-10 21:00:44 +03:00
|
|
|
sheet->RuleChanged(rule, StyleRuleChangeKind::StyleRuleDeclarations);
|
2016-11-23 02:26:20 +03:00
|
|
|
}
|
2018-12-20 22:33:09 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
Document* CSSStyleRuleDeclaration::DocToUpdate() { return nullptr; }
|
2017-04-04 09:09:20 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
nsDOMCSSDeclaration::ParsingEnvironment
|
|
|
|
CSSStyleRuleDeclaration::GetParsingEnvironment(
|
|
|
|
nsIPrincipal* aSubjectPrincipal) const {
|
2021-09-08 14:18:32 +03:00
|
|
|
return GetParsingEnvironmentForRule(Rule(), StyleCssRuleType::Style);
|
2018-12-20 22:33:09 +03:00
|
|
|
}
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
// -- CSSStyleRule --------------------------------------------------
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
CSSStyleRule::CSSStyleRule(already_AddRefed<RawServoStyleRule> aRawRule,
|
|
|
|
StyleSheet* aSheet, css::Rule* aParentRule,
|
|
|
|
uint32_t aLine, uint32_t aColumn)
|
|
|
|
: BindingStyleRule(aSheet, aParentRule, aLine, aColumn),
|
|
|
|
mRawRule(aRawRule),
|
|
|
|
mDecls(Servo_StyleRule_GetStyle(mRawRule).Consume()) {}
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(CSSStyleRule, css::Rule)
|
2016-12-01 02:18:14 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(CSSStyleRule)
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(CSSStyleRule, css::Rule)
|
|
|
|
// Keep this in sync with IsCCLeaf.
|
2016-12-01 02:18:14 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
// Trace the wrapper for our declaration. This just expands out
|
|
|
|
// NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER which we can't use
|
|
|
|
// directly because the wrapper is on the declaration, not on us.
|
|
|
|
tmp->mDecls.TraceWrapper(aCallbacks, aClosure);
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2019-07-22 21:33:29 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CSSStyleRule)
|
2018-12-20 22:33:09 +03:00
|
|
|
// Keep this in sync with IsCCLeaf.
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2019-07-22 22:27:28 +03:00
|
|
|
// Unlink the wrapper for our declaration.
|
2019-07-22 21:33:29 +03:00
|
|
|
//
|
|
|
|
// Note that this has to happen before unlinking css::Rule.
|
|
|
|
tmp->UnlinkDeclarationWrapper(tmp->mDecls);
|
2020-02-25 22:44:39 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_WEAK_PTR
|
2019-07-22 21:33:29 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED(css::Rule)
|
2016-12-01 02:18:14 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(CSSStyleRule, css::Rule)
|
|
|
|
// Keep this in sync with IsCCLeaf.
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
2016-12-01 02:18:14 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
bool CSSStyleRule::IsCCLeaf() const {
|
|
|
|
if (!Rule::IsCCLeaf()) {
|
|
|
|
return false;
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2017-04-06 05:22:36 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
return !mDecls.PreservingWrapper();
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t CSSStyleRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
|
|
|
|
size_t n = aMallocSizeOf(this);
|
2017-04-06 05:22:36 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
// Measurement of the following members may be added later if DMD finds it
|
|
|
|
// is worthwhile:
|
|
|
|
// - mRawRule
|
|
|
|
// - mDecls
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
return n;
|
|
|
|
}
|
2016-11-23 02:26:20 +03:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2018-12-20 22:33:09 +03:00
|
|
|
void CSSStyleRule::List(FILE* out, int32_t aIndent) const {
|
|
|
|
nsAutoCString str;
|
|
|
|
for (int32_t i = 0; i < aIndent; i++) {
|
|
|
|
str.AppendLiteral(" ");
|
2016-11-23 02:26:20 +03:00
|
|
|
}
|
2018-12-20 22:33:09 +03:00
|
|
|
Servo_StyleRule_Debug(mRawRule, &str);
|
|
|
|
fprintf_stderr(out, "%s\n", str.get());
|
|
|
|
}
|
2016-11-23 02:26:20 +03:00
|
|
|
#endif
|
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
/* CSSRule implementation */
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2021-09-08 14:18:32 +03:00
|
|
|
StyleCssRuleType CSSStyleRule::Type() const { return StyleCssRuleType::Style; }
|
|
|
|
|
2020-12-17 17:04:35 +03:00
|
|
|
void CSSStyleRule::GetCssText(nsACString& aCssText) const {
|
2018-12-20 22:33:09 +03:00
|
|
|
Servo_StyleRule_GetCssText(mRawRule, &aCssText);
|
|
|
|
}
|
2017-01-13 18:41:03 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
nsICSSDeclaration* CSSStyleRule::Style() { return &mDecls; }
|
2017-01-13 18:41:03 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
/* CSSStyleRule implementation */
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2020-12-17 17:04:35 +03:00
|
|
|
void CSSStyleRule::GetSelectorText(nsACString& aSelectorText) {
|
2018-12-20 22:33:09 +03:00
|
|
|
Servo_StyleRule_GetSelectorText(mRawRule, &aSelectorText);
|
|
|
|
}
|
|
|
|
|
2020-12-17 17:04:35 +03:00
|
|
|
void CSSStyleRule::SetSelectorText(const nsACString& aSelectorText) {
|
2019-04-29 08:34:06 +03:00
|
|
|
if (IsReadOnly()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-07-20 16:17:02 +03:00
|
|
|
if (StyleSheet* sheet = GetStyleSheet()) {
|
2018-12-20 22:33:09 +03:00
|
|
|
sheet->WillDirty();
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2020-08-10 21:00:44 +03:00
|
|
|
// TODO(emilio): May actually be more efficient to handle this as rule
|
|
|
|
// removal + addition, from the point of view of invalidation...
|
2018-12-20 22:33:09 +03:00
|
|
|
const RawServoStyleSheetContents* contents = sheet->RawContents();
|
|
|
|
if (Servo_StyleRule_SetSelectorText(contents, mRawRule, &aSelectorText)) {
|
2020-08-10 21:00:44 +03:00
|
|
|
sheet->RuleChanged(this, StyleRuleChangeKind::Generic);
|
2018-04-14 19:05:44 +03:00
|
|
|
}
|
|
|
|
}
|
2018-12-20 22:33:09 +03:00
|
|
|
}
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
uint32_t CSSStyleRule::GetSelectorCount() {
|
|
|
|
uint32_t aCount;
|
|
|
|
Servo_StyleRule_GetSelectorCount(mRawRule, &aCount);
|
|
|
|
return aCount;
|
|
|
|
}
|
2017-06-07 18:48:49 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
nsresult CSSStyleRule::GetSelectorText(uint32_t aSelectorIndex,
|
2020-12-17 17:04:35 +03:00
|
|
|
nsACString& aText) {
|
2018-12-20 22:33:09 +03:00
|
|
|
Servo_StyleRule_GetSelectorTextAtIndex(mRawRule, aSelectorIndex, &aText);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2017-06-07 18:48:49 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
nsresult CSSStyleRule::GetSpecificity(uint32_t aSelectorIndex,
|
|
|
|
uint64_t* aSpecificity) {
|
|
|
|
Servo_StyleRule_GetSpecificityAtIndex(mRawRule, aSelectorIndex, aSpecificity);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2017-06-07 18:48:49 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
nsresult CSSStyleRule::SelectorMatchesElement(Element* aElement,
|
|
|
|
uint32_t aSelectorIndex,
|
|
|
|
const nsAString& aPseudo,
|
2019-09-14 01:12:12 +03:00
|
|
|
bool aRelevantLinkVisited,
|
2018-12-20 22:33:09 +03:00
|
|
|
bool* aMatches) {
|
2021-08-07 12:47:15 +03:00
|
|
|
Maybe<PseudoStyleType> pseudoType = nsCSSPseudoElements::GetPseudoType(
|
|
|
|
aPseudo, CSSEnabledState::IgnoreEnabledState);
|
|
|
|
if (!pseudoType) {
|
|
|
|
*aMatches = false;
|
|
|
|
return NS_OK;
|
2018-12-20 22:33:09 +03:00
|
|
|
}
|
2017-08-14 13:28:58 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
*aMatches = Servo_StyleRule_SelectorMatchesElement(
|
2021-08-07 12:47:15 +03:00
|
|
|
mRawRule, aElement, aSelectorIndex, *pseudoType, aRelevantLinkVisited);
|
2018-12-20 22:33:09 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2017-06-07 18:48:49 +03:00
|
|
|
|
2018-12-20 22:33:09 +03:00
|
|
|
NotNull<DeclarationBlock*> CSSStyleRule::GetDeclarationBlock() const {
|
|
|
|
return WrapNotNull(mDecls.mDecls);
|
|
|
|
}
|
2017-10-19 10:55:42 +03:00
|
|
|
|
2021-09-08 14:18:32 +03:00
|
|
|
} // namespace mozilla::dom
|