Bug 1909346: Implement `CSSPositionTryRule` interface. r=firefox-style-system-reviewers,webidl,emilio

Differential Revision: https://phabricator.services.mozilla.com/D217627
This commit is contained in:
David Shin 2024-08-06 16:59:27 +00:00
Родитель 04b99ad553
Коммит b3b50c0377
17 изменённых файлов: 399 добавлений и 9 удалений

Просмотреть файл

@ -174,6 +174,11 @@ DOMInterfaces = {
'nativeType': 'mozilla::StyleSheet',
},
'CSSPositionTryDescriptors': {
'nativeType': 'mozilla::dom::CSSPositionTryRuleDeclaration',
'headerFile': 'mozilla/dom/CSSPositionTryRule.h',
},
'CustomElementRegistry': {
'implicitJSContext': ['define', 'getName'],
},
@ -2043,4 +2048,14 @@ TemplatedAttributes = {
},
],
'CSSPositionTryDescriptors': [
{
'template': 'CSSPositionTryDescriptor',
'getter': 'GetPropertyValue',
'setter': 'SetPropertyValue',
'argument': ('nsCSSPropertyID', 'id'),
'attrName': 'nsCSSProps::PropertyIDLName(id)',
},
],
}

Просмотреть файл

@ -18,7 +18,7 @@ def generateLine(propName, extendedAttrs):
)
def generate(output, dataFile, ruleType, interfaceName, bindingTemplate):
def generate(output, dataFile, ruleType, interfaceName, bindingTemplate, pref=None):
propsData = runpy.run_path(dataFile)["data"]
output.write(
"""/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT */
@ -29,12 +29,16 @@ def generate(output, dataFile, ruleType, interfaceName, bindingTemplate):
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
[Exposed=Window]
[Exposed=Window"""
)
if pref:
output.write(', Pref="' + pref + '"')
output.write(
"""]
interface """
+ interfaceName
+ " : CSSStyleDeclaration {\n"
)
for p in propsData.values():
# Skip properties which aren't valid in style rules.
if ruleType not in p.rules:
@ -129,3 +133,14 @@ def generateCSSPageDescriptors(output, dataFile):
"CSSPageDescriptors",
"CSSPageDescriptor",
)
def generateCSSPositionTryDescriptors(output, dataFile):
generate(
output,
dataFile,
"PositionTry",
"CSSPositionTryDescriptors",
"CSSPositionTryDescriptor",
"layout.css.anchor-positioning.enabled",
)

Просмотреть файл

@ -207,3 +207,9 @@ if CONFIG["COMPILE_ENVIRONMENT"]:
entry_point="generateCSSPageDescriptors",
inputs=["!/layout/style/ServoCSSPropList.py"],
)
GeneratedFile(
"CSSPositionTryDescriptors.webidl",
script="GenerateCSSPropListWebIDL.py",
entry_point="generateCSSPositionTryDescriptors",
inputs=["!/layout/style/ServoCSSPropList.py"],
)

Просмотреть файл

@ -0,0 +1,14 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-anchor-position-1/#om-position-try
*/
[Exposed=Window, Pref="layout.css.anchor-positioning.enabled"]
interface CSSPositionTryRule : CSSRule {
readonly attribute UTF8String name;
[SameObject, PutForwards=cssText] readonly attribute CSSPositionTryDescriptors style;
};

Просмотреть файл

@ -397,6 +397,7 @@ with Files("WebTransport*"):
GENERATED_WEBIDL_FILES = [
"CSS2Properties.webidl",
"CSSPageDescriptors.webidl",
"CSSPositionTryDescriptors.webidl",
]
PREPROCESSED_WEBIDL_FILES = [
@ -500,6 +501,7 @@ WEBIDL_FILES = [
"CSSMozDocumentRule.webidl",
"CSSNamespaceRule.webidl",
"CSSPageRule.webidl",
"CSSPositionTryRule.webidl",
"CSSPropertyRule.webidl",
"CSSPseudoElement.webidl",
"CSSRule.webidl",

Просмотреть файл

@ -473,6 +473,7 @@ static uint32_t CollectAtRules(ServoCSSRuleList& aRuleList,
case StyleCssRuleType::FontPaletteValues:
case StyleCssRuleType::Scope:
case StyleCssRuleType::StartingStyle:
case StyleCssRuleType::PositionTry:
break;
}

Просмотреть файл

@ -88,7 +88,8 @@ void ServoStyleRuleMap::RuleRemoved(StyleSheet& aStyleSheet,
case StyleCssRuleType::Container:
case StyleCssRuleType::Document:
case StyleCssRuleType::Scope:
case StyleCssRuleType::StartingStyle: {
case StyleCssRuleType::StartingStyle:
case StyleCssRuleType::PositionTry: {
// See the comment in SheetRemoved.
mTable.Clear();
break;
@ -151,6 +152,7 @@ void ServoStyleRuleMap::FillTableFromRule(css::Rule& aRule) {
case StyleCssRuleType::CounterStyle:
case StyleCssRuleType::FontFeatureValues:
case StyleCssRuleType::FontPaletteValues:
case StyleCssRuleType::PositionTry:
break;
}
}

Просмотреть файл

@ -0,0 +1,189 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/dom/CSSPositionTryRule.h"
#include "mozilla/dom/CSSPositionTryRuleBinding.h"
#include "mozilla/dom/CSSPositionTryDescriptorsBinding.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/DeclarationBlock.h"
namespace mozilla::dom {
CSSPositionTryRule* CSSPositionTryRuleDeclaration::Rule() {
return reinterpret_cast<CSSPositionTryRule*>(
reinterpret_cast<uint8_t*>(this) - offsetof(CSSPositionTryRule, mDecls));
}
const CSSPositionTryRule* CSSPositionTryRuleDeclaration::Rule() const {
return reinterpret_cast<const CSSPositionTryRule*>(
reinterpret_cast<const uint8_t*>(this) -
offsetof(CSSPositionTryRule, mDecls));
}
CSSPositionTryRuleDeclaration::CSSPositionTryRuleDeclaration(
already_AddRefed<StyleLockedDeclarationBlock> aDecls)
: mDecls(new DeclarationBlock(std::move(aDecls))) {
mDecls->SetOwningRule(Rule());
}
CSSPositionTryRuleDeclaration::~CSSPositionTryRuleDeclaration() {
mDecls->SetOwningRule(nullptr);
}
NS_INTERFACE_MAP_BEGIN(CSSPositionTryRuleDeclaration)
NS_WRAPPERCACHE_INTERFACE_TABLE_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)
NS_IMPL_ADDREF_USING_AGGREGATOR(CSSPositionTryRuleDeclaration, Rule())
NS_IMPL_RELEASE_USING_AGGREGATOR(CSSPositionTryRuleDeclaration, Rule())
css::Rule* CSSPositionTryRuleDeclaration::GetParentRule() { return Rule(); }
nsINode* CSSPositionTryRuleDeclaration::GetAssociatedNode() const {
return Rule()->GetAssociatedDocumentOrShadowRoot();
}
nsISupports* CSSPositionTryRuleDeclaration::GetParentObject() const {
return Rule()->GetParentObject();
}
JSObject* CSSPositionTryRuleDeclaration::WrapObject(
JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
return CSSPositionTryDescriptors_Binding::Wrap(aCx, this, aGivenProto);
}
DeclarationBlock* CSSPositionTryRuleDeclaration::GetOrCreateCSSDeclaration(
Operation aOperation, DeclarationBlock** aCreated) {
if (aOperation != Operation::Read) {
if (StyleSheet* sheet = Rule()->GetStyleSheet()) {
sheet->WillDirty();
}
}
return mDecls;
}
void CSSPositionTryRuleDeclaration::SetRawAfterClone(
RefPtr<StyleLockedDeclarationBlock> aDeclarationBlock) {
mDecls->SetOwningRule(nullptr);
mDecls = new DeclarationBlock(aDeclarationBlock.forget());
mDecls->SetOwningRule(Rule());
}
nsresult CSSPositionTryRuleDeclaration::SetCSSDeclaration(
DeclarationBlock* aDecl, MutationClosureData* aClosureData) {
MOZ_ASSERT(aDecl, "must be non-null");
CSSPositionTryRule* rule = Rule();
if (aDecl != mDecls) {
mDecls->SetOwningRule(nullptr);
Servo_PositionTryRule_SetStyle(rule->Raw(), aDecl->Raw());
mDecls = aDecl;
mDecls->SetOwningRule(rule);
}
return NS_OK;
}
nsDOMCSSDeclaration::ParsingEnvironment
CSSPositionTryRuleDeclaration::GetParsingEnvironment(
nsIPrincipal* aSubjectPrincipal) const {
return GetParsingEnvironmentForRule(Rule(), StyleCssRuleType::PositionTry);
}
CSSPositionTryRule::CSSPositionTryRule(
RefPtr<StyleLockedPositionTryRule> aRawRule, StyleSheet* aSheet,
css::Rule* aParentRule, uint32_t aLine, uint32_t aColumn)
: css::Rule(aSheet, aParentRule, aLine, aColumn),
mRawRule(std::move(aRawRule)),
mDecls(Servo_PositionTryRule_GetStyle(mRawRule).Consume()) {}
NS_IMPL_ADDREF_INHERITED(CSSPositionTryRule, css::Rule)
NS_IMPL_RELEASE_INHERITED(CSSPositionTryRule, css::Rule)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CSSPositionTryRule)
NS_INTERFACE_MAP_END_INHERITING(css::Rule)
NS_IMPL_CYCLE_COLLECTION_CLASS(CSSPositionTryRule)
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(CSSPositionTryRule, css::Rule)
// Keep this in sync with IsCCLeaf.
// 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
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CSSPositionTryRule)
// Keep this in sync with IsCCLeaf.
// Unlink the wrapper for our declaration.
//
// Note that this has to happen before unlinking css::Rule.
tmp->UnlinkDeclarationWrapper(tmp->mDecls);
tmp->mDecls.mDecls->SetOwningRule(nullptr);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED(css::Rule)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(CSSPositionTryRule, css::Rule)
// Keep this in sync with IsCCLeaf.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
bool CSSPositionTryRule::IsCCLeaf() const {
if (!Rule::IsCCLeaf()) {
return false;
}
return !mDecls.PreservingWrapper();
}
void CSSPositionTryRule::SetRawAfterClone(
RefPtr<StyleLockedPositionTryRule> aRaw) {
mRawRule = std::move(aRaw);
mDecls.SetRawAfterClone(
Servo_PositionTryRule_GetStyle(mRawRule.get()).Consume());
}
StyleCssRuleType CSSPositionTryRule::Type() const {
return StyleCssRuleType::PositionTry;
}
size_t CSSPositionTryRule::SizeOfIncludingThis(
MallocSizeOf aMallocSizeOf) const {
// TODO(dshin)
return aMallocSizeOf(this);
}
#ifdef DEBUG
void CSSPositionTryRule::List(FILE* out, int32_t aIndent) const {
nsAutoCString str;
for (int32_t i = 0; i < aIndent; i++) {
str.AppendLiteral(" ");
}
Servo_PositionTryRule_Debug(mRawRule, &str);
fprintf_stderr(out, "%s\n", str.get());
}
#endif
void CSSPositionTryRule::GetName(nsACString& aName) {
Servo_PositionTryRule_GetName(mRawRule, &aName);
}
void CSSPositionTryRule::GetCssText(nsACString& aCssText) const {
Servo_PositionTryRule_GetCssText(mRawRule, &aCssText);
}
JSObject* CSSPositionTryRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return CSSPositionTryRule_Binding::Wrap(aCx, this, aGivenProto);
}
} // namespace mozilla::dom

Просмотреть файл

@ -0,0 +1,97 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#ifndef mozilla_dom_CSSPositionTryRule_h
#define mozilla_dom_CSSPositionTryRule_h
#include "mozilla/css/Rule.h"
#include "mozilla/ServoBindingTypes.h"
#include "nsDOMCSSDeclaration.h"
#include "nsICSSDeclaration.h"
namespace mozilla {
class DeclarationBlock;
namespace dom {
class CSSPositionTryRule;
class CSSPositionTryRuleDeclaration final : public nsDOMCSSDeclaration {
public:
NS_DECL_ISUPPORTS_INHERITED
css::Rule* GetParentRule() final;
nsINode* GetAssociatedNode() const final;
nsISupports* GetParentObject() const final;
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
protected:
DeclarationBlock* GetOrCreateCSSDeclaration(
Operation aOperation, DeclarationBlock** aCreated) final;
nsresult SetCSSDeclaration(DeclarationBlock* aDecl,
MutationClosureData* aClosureData) final;
nsDOMCSSDeclaration::ParsingEnvironment GetParsingEnvironment(
nsIPrincipal* aSubjectPrincipal) const final;
private:
// For accessing the constructor.
friend class CSSPositionTryRule;
explicit CSSPositionTryRuleDeclaration(
already_AddRefed<StyleLockedDeclarationBlock> aDecls);
void SetRawAfterClone(RefPtr<StyleLockedDeclarationBlock>);
~CSSPositionTryRuleDeclaration();
inline CSSPositionTryRule* Rule();
inline const CSSPositionTryRule* Rule() const;
RefPtr<DeclarationBlock> mDecls;
};
class CSSPositionTryRule final : public css::Rule {
public:
CSSPositionTryRule(RefPtr<StyleLockedPositionTryRule> aRawRule,
StyleSheet* aSheet, css::Rule* aParentRule, uint32_t aLine,
uint32_t aColumn);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(CSSPositionTryRule,
css::Rule)
bool IsCCLeaf() const final;
StyleLockedPositionTryRule* Raw() const { return mRawRule; }
void SetRawAfterClone(RefPtr<StyleLockedPositionTryRule>);
// WebIDL interfaces
StyleCssRuleType Type() const final;
void GetCssText(nsACString& aCssText) const final;
CSSPositionTryRuleDeclaration* Style() { return &mDecls; }
void GetName(nsACString& aName);
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final;
#ifdef DEBUG
void List(FILE* out = stdout, int32_t aIndent = 0) const final;
#endif
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
private:
~CSSPositionTryRule() = default;
// For computing the offset of mDecls.
friend class CSSPositionTryRuleDeclaration;
RefPtr<StyleLockedPositionTryRule> mRawRule;
CSSPositionTryRuleDeclaration mDecls;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_CSSPositionTryRule_h

Просмотреть файл

@ -90,6 +90,7 @@ BASIC_RULE_FUNCS_LOCKED(CounterStyle)
GROUP_RULE_FUNCS_UNLOCKED(Container)
GROUP_RULE_FUNCS_UNLOCKED(Scope)
GROUP_RULE_FUNCS_UNLOCKED(StartingStyle)
BASIC_RULE_FUNCS_LOCKED(PositionTry)
#undef GROUP_RULE_FUNCS_LOCKED
#undef GROUP_RULE_FUNCS_UNLOCKED

Просмотреть файл

@ -27,6 +27,7 @@
#include "mozilla/dom/CSSStartingStyleRule.h"
#include "mozilla/dom/CSSStyleRule.h"
#include "mozilla/dom/CSSSupportsRule.h"
#include "mozilla/dom/CSSPositionTryRule.h"
#include "mozilla/IntegerRange.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/StyleSheet.h"
@ -104,6 +105,7 @@ css::Rule* ServoCSSRuleList::GetRule(uint32_t aIndex) {
CASE_RULE_UNLOCKED(Container, Container)
CASE_RULE_UNLOCKED(Scope, Scope)
CASE_RULE_UNLOCKED(StartingStyle, StartingStyle)
CASE_RULE_LOCKED(PositionTry, PositionTry)
#undef CASE_RULE_LOCKED
#undef CASE_RULE_UNLOCKED
#undef CASE_RULE_WITH_PREFIX
@ -291,6 +293,7 @@ void ServoCSSRuleList::SetRawContents(RefPtr<StyleLockedCssRules> aNewRules,
RULE_CASE_UNLOCKED(Container, Container)
RULE_CASE_UNLOCKED(Scope, Scope)
RULE_CASE_UNLOCKED(StartingStyle, StartingStyle)
RULE_CASE_LOCKED(PositionTry, PositionTry)
case StyleCssRuleType::Keyframe:
MOZ_ASSERT_UNREACHABLE("keyframe rule cannot be here");
break;

Просмотреть файл

@ -24,3 +24,4 @@ SERVO_LOCKED_ARC_TYPE(MediaList)
SERVO_LOCKED_ARC_TYPE(PageRule)
SERVO_LOCKED_ARC_TYPE(FontFaceRule)
SERVO_LOCKED_ARC_TYPE(CounterStyleRule)
SERVO_LOCKED_ARC_TYPE(PositionTryRule)

Просмотреть файл

@ -56,6 +56,7 @@ template struct StyleStrong<StyleLockedCounterStyleRule>;
template struct StyleStrong<StyleContainerRule>;
template struct StyleStrong<StyleScopeRule>;
template struct StyleStrong<StyleStartingStyleRule>;
template struct StyleStrong<StyleLockedPositionTryRule>;
template <typename T>
inline void StyleOwnedSlice<T>::Clear() {

Просмотреть файл

@ -1019,6 +1019,7 @@ void ServoStyleSet::RuleChangedInternal(StyleSheet& aSheet, css::Rule& aRule,
CASE_FOR(Container, Container)
CASE_FOR(Scope, Scope)
CASE_FOR(StartingStyle, StartingStyle)
CASE_FOR(PositionTry, PositionTry)
// @namespace can only be inserted / removed when there are only other
// @namespace and @import rules, and can't be mutated.
case StyleCssRuleType::Namespace:

Просмотреть файл

@ -143,6 +143,7 @@ EXPORTS.mozilla.dom += [
"CSSMozDocumentRule.h",
"CSSNamespaceRule.h",
"CSSPageRule.h",
"CSSPositionTryRule.h",
"CSSPropertyRule.h",
"CSSRuleList.h",
"CSSScopeRule.h",
@ -197,6 +198,7 @@ UNIFIED_SOURCES += [
"CSSMozDocumentRule.cpp",
"CSSNamespaceRule.cpp",
"CSSPageRule.cpp",
"CSSPositionTryRule.cpp",
"CSSPropertyRule.cpp",
"CSSRuleList.cpp",
"CSSScopeRule.cpp",

Просмотреть файл

@ -16,8 +16,8 @@ use crate::stylesheets::keyframes_rule::Keyframe;
use crate::stylesheets::{
ContainerRule, CounterStyleRule, CssRules, DocumentRule, FontFaceRule, FontFeatureValuesRule,
FontPaletteValuesRule, ImportRule, KeyframesRule, LayerBlockRule, LayerStatementRule,
MarginRule, MediaRule, NamespaceRule, PageRule, PropertyRule, ScopeRule, StartingStyleRule,
StyleRule, StylesheetContents, SupportsRule,
MarginRule, MediaRule, NamespaceRule, PageRule, PositionTryRule, PropertyRule, ScopeRule,
StartingStyleRule, StyleRule, StylesheetContents, SupportsRule,
};
use servo_arc::Arc;
@ -181,3 +181,10 @@ impl_simple_arc_ffi!(
Servo_StartingStyleRule_AddRef,
Servo_StartingStyleRule_Release
);
impl_locked_arc_ffi!(
PositionTryRule,
LockedPositionTryRule,
Servo_PositionTryRule_AddRef,
Servo_PositionTryRule_Release
);

Просмотреть файл

@ -37,7 +37,7 @@ use style::font_face::{self, FontFaceSourceFormat, FontFaceSourceListComponent,
use style::gecko::arc_types::{
LockedCounterStyleRule, LockedCssRules, LockedDeclarationBlock, LockedFontFaceRule,
LockedImportRule, LockedKeyframe, LockedKeyframesRule, LockedMediaList, LockedPageRule,
LockedStyleRule,
LockedPositionTryRule, LockedStyleRule,
};
use style::gecko::data::{
AuthorStyles, GeckoStyleSheet, PerDocumentStyleData, PerDocumentStyleDataImpl,
@ -136,8 +136,9 @@ use style::stylesheets::{
CssRules, CssRulesHelpers, DocumentRule, FontFaceRule, FontFeatureValuesRule,
FontPaletteValuesRule, ImportRule, KeyframesRule, LayerBlockRule, LayerStatementRule,
MarginRule, MediaRule, NamespaceRule, Origin, OriginSet, PagePseudoClassFlags, PageRule,
PropertyRule, SanitizationData, SanitizationKind, ScopeRule, StartingStyleRule, StyleRule,
StylesheetContents, StylesheetLoader as StyleStylesheetLoader, SupportsRule, UrlExtraData,
PositionTryRule, PropertyRule, SanitizationData, SanitizationKind, ScopeRule,
StartingStyleRule, StyleRule, StylesheetContents, StylesheetLoader as StyleStylesheetLoader,
SupportsRule, UrlExtraData,
};
use style::stylist::{add_size_of_ua_cache, AuthorStylesEnabled, RuleInclusion, Stylist};
use style::thread_state;
@ -2572,6 +2573,13 @@ impl_group_rule_funcs! { (StartingStyle, StartingStyleRule, StartingStyleRule),
changed: Servo_StyleSet_StartingStyleRuleChanged,
}
impl_basic_rule_funcs! { (PositionTry, PositionTryRule, Locked<PositionTryRule>),
getter: Servo_CssRules_GetPositionTryRuleAt,
debug: Servo_PositionTryRule_Debug,
to_css: Servo_PositionTryRule_GetCssText,
changed: Servo_StyleSet_PositionTryRuleChanged,
}
#[no_mangle]
pub extern "C" fn Servo_StyleRule_GetStyle(
rule: &LockedStyleRule,
@ -4037,6 +4045,31 @@ counter_style_descriptors! {
]
}
#[no_mangle]
pub unsafe extern "C" fn Servo_PositionTryRule_GetName(
rule: &LockedPositionTryRule,
result: &mut nsACString,
) {
read_locked_arc(rule, |rule: &PositionTryRule| rule.name.to_css(&mut CssWriter::new(result)).unwrap());
}
#[no_mangle]
pub extern "C" fn Servo_PositionTryRule_GetStyle(
rule: &LockedPositionTryRule,
) -> Strong<LockedDeclarationBlock> {
read_locked_arc(rule, |rule: &PositionTryRule| rule.block.clone().into())
}
#[no_mangle]
pub extern "C" fn Servo_PositionTryRule_SetStyle(
rule: &LockedPositionTryRule,
declarations: &LockedDeclarationBlock,
) {
write_locked_arc(rule, |rule: &mut PositionTryRule| {
rule.block = unsafe { Arc::from_raw_addrefed(declarations) };
})
}
#[no_mangle]
pub unsafe extern "C" fn Servo_ComputedValues_GetForPageContent(
raw_data: &PerDocumentStyleData,