mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 05:45:37 +00:00
cb56e2c9f3
Now that BeginUpdate is useless for the UPDATE_STYLE case, we don't need the update mechanism at all. Just ensure that ApplicableStylesChanged is called on the pres shell via the relevant RuleChanged, etc. notifications. There's a big hidden gotcha here. nsIDocument::BeginUpdate does put a script blocker on the stack for these updates. However it's not needed, since no script can run during these notifications (only the stylesheet events we post for devtools, but those use AsyncEventDispatcher and PostDOMEvents, so they don't try to run immediately). nsIDocument::BeginUpdate also does XBL binding attached queue stuff, but we can't change bindings during these notifications anyway, so it also doesn't matter. MozReview-Commit-ID: HJvK6zQfloh
103 lines
3.1 KiB
C++
103 lines
3.1 KiB
C++
/* -*- 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/ServoCounterStyleRule.h"
|
|
|
|
#include "mozAutoDocUpdate.h"
|
|
#include "mozilla/dom/CSSCounterStyleRuleBinding.h"
|
|
#include "mozilla/ServoBindings.h"
|
|
#include "nsStyleUtil.h"
|
|
|
|
namespace mozilla {
|
|
|
|
bool
|
|
ServoCounterStyleRule::IsCCLeaf() const
|
|
{
|
|
return Rule::IsCCLeaf();
|
|
}
|
|
|
|
#ifdef DEBUG
|
|
void
|
|
ServoCounterStyleRule::List(FILE* out, int32_t aIndent) const
|
|
{
|
|
nsAutoCString str;
|
|
for (int32_t i = 0; i < aIndent; i++) {
|
|
str.AppendLiteral(" ");
|
|
}
|
|
Servo_CounterStyleRule_Debug(mRawRule, &str);
|
|
fprintf_stderr(out, "%s\n", str.get());
|
|
}
|
|
#endif
|
|
|
|
uint16_t
|
|
ServoCounterStyleRule::Type() const
|
|
{
|
|
return CSSRuleBinding::COUNTER_STYLE_RULE;
|
|
}
|
|
|
|
void
|
|
ServoCounterStyleRule::GetCssText(nsAString& aCssText) const
|
|
{
|
|
Servo_CounterStyleRule_GetCssText(mRawRule, &aCssText);
|
|
}
|
|
|
|
void
|
|
ServoCounterStyleRule::GetName(nsAString& aName)
|
|
{
|
|
aName.Truncate();
|
|
nsAtom* name = Servo_CounterStyleRule_GetName(mRawRule);
|
|
nsDependentAtomString nameStr(name);
|
|
nsStyleUtil::AppendEscapedCSSIdent(nameStr, aName);
|
|
}
|
|
|
|
void
|
|
ServoCounterStyleRule::SetName(const nsAString& aName)
|
|
{
|
|
NS_ConvertUTF16toUTF8 name(aName);
|
|
if (Servo_CounterStyleRule_SetName(mRawRule, &name)) {
|
|
if (StyleSheet* sheet = GetStyleSheet()) {
|
|
sheet->RuleChanged(this);
|
|
}
|
|
}
|
|
}
|
|
|
|
#define CSS_COUNTER_DESC(name_, method_) \
|
|
void \
|
|
ServoCounterStyleRule::Get##method_(nsAString& aValue) \
|
|
{ \
|
|
aValue.Truncate(); \
|
|
Servo_CounterStyleRule_GetDescriptorCssText( \
|
|
mRawRule, eCSSCounterDesc_##method_, &aValue); \
|
|
} \
|
|
void \
|
|
ServoCounterStyleRule::Set##method_(const nsAString& aValue) \
|
|
{ \
|
|
NS_ConvertUTF16toUTF8 value(aValue); \
|
|
if (Servo_CounterStyleRule_SetDescriptor( \
|
|
mRawRule, eCSSCounterDesc_##method_, &value)) { \
|
|
if (StyleSheet* sheet = GetStyleSheet()) { \
|
|
sheet->RuleChanged(this); \
|
|
} \
|
|
} \
|
|
}
|
|
#include "nsCSSCounterDescList.h"
|
|
#undef CSS_COUNTER_DESC
|
|
|
|
/* virtual */ size_t
|
|
ServoCounterStyleRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
return aMallocSizeOf(this);
|
|
}
|
|
|
|
/* virtual */ JSObject*
|
|
ServoCounterStyleRule::WrapObject(JSContext* aCx,
|
|
JS::Handle<JSObject*> aGivenProto)
|
|
{
|
|
return CSSCounterStyleRuleBinding::Wrap(aCx, this, aGivenProto);
|
|
}
|
|
|
|
} // namespace mozilla
|