mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 09:18:42 +09:00
Issue #1345 - Implement non-standard legacy CSSStyleSheet rules
This commit is contained in:
parent
10fff089dc
commit
13aff00f59
3 changed files with 37 additions and 0 deletions
|
|
@ -259,6 +259,32 @@ StyleSheet::DeleteRule(uint32_t aIndex,
|
|||
FORWARD_INTERNAL(DeleteRuleInternal, (aIndex, aRv))
|
||||
}
|
||||
|
||||
int32_t
|
||||
StyleSheet::AddRule(const nsAString& aSelector, const nsAString& aBlock,
|
||||
const Optional<uint32_t>& aIndex,
|
||||
nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv)
|
||||
{
|
||||
if (!AreRulesAvailable(aSubjectPrincipal, aRv)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
nsAutoString rule;
|
||||
rule.Append(aSelector);
|
||||
rule.AppendLiteral(" { ");
|
||||
if (!aBlock.IsEmpty()) {
|
||||
rule.Append(aBlock);
|
||||
rule.Append(' ');
|
||||
}
|
||||
rule.Append('}');
|
||||
|
||||
auto index =
|
||||
aIndex.WasPassed() ? aIndex.Value() : GetCssRules(aSubjectPrincipal, aRv)->Length();
|
||||
|
||||
FORWARD_INTERNAL(InsertRuleInternal, (rule, index, aRv));
|
||||
// As per Microsoft documentation, always return -1.
|
||||
return -1;
|
||||
}
|
||||
|
||||
#undef FORWARD_INTERNAL
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue