--- a/dom/base/nsAttrValue.cpp
+++ b/dom/base/nsAttrValue.cpp
@@ -80,17 +80,17 @@ MiscContainer::Cache()
MOZ_ASSERT(!mValue.mCached);
nsHTMLCSSStyleSheet* sheet;
switch (mType) {
case nsAttrValue::eGeckoCSSDeclaration:
sheet = mValue.mGeckoCSSDeclaration->GetHTMLCSSStyleSheet();
break;
case nsAttrValue::eServoCSSDeclaration:
- sheet = Servo_GetDeclarationBlockCache(mValue.mServoCSSDeclaration);
+ sheet = Servo_DeclarationBlock_GetCache(mValue.mServoCSSDeclaration);
break;
default:
MOZ_ASSERT_UNREACHABLE("unexpected cached nsAttrValue type");
sheet = nullptr;
break;
}
if (!sheet) {
@@ -107,17 +107,17 @@ MiscContainer::Cache()
mValue.mCached = 1;
// This has to be immutable once it goes into the cache.
switch (mType) {
case nsAttrValue::eGeckoCSSDeclaration:
mValue.mGeckoCSSDeclaration->SetImmutable();
break;
case nsAttrValue::eServoCSSDeclaration:
- Servo_SetDeclarationBlockImmutable(mValue.mServoCSSDeclaration);
+ Servo_DeclarationBlock_SetImmutable(mValue.mServoCSSDeclaration);
break;
default:
MOZ_ASSERT_UNREACHABLE("unexpected cached nsAttrValue type");
break;
}
}
void
@@ -134,17 +134,17 @@ MiscContainer::Evict()
}
nsHTMLCSSStyleSheet* sheet;
switch (mType) {
case nsAttrValue::eGeckoCSSDeclaration:
sheet = mValue.mGeckoCSSDeclaration->GetHTMLCSSStyleSheet();
break;
case nsAttrValue::eServoCSSDeclaration:
- sheet = Servo_GetDeclarationBlockCache(mValue.mServoCSSDeclaration);
+ sheet = Servo_DeclarationBlock_GetCache(mValue.mServoCSSDeclaration);
break;
default:
MOZ_ASSERT_UNREACHABLE("unexpected cached nsAttrValue type");
sheet = nullptr;
break;
}
MOZ_ASSERT(sheet);
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -51,25 +51,25 @@ class nsIPrincipal;
class nsIURI;
class nsNodeSupportsWeakRefTearoff;
class nsNodeWeakReference;
class nsDOMMutationObserver;
// We declare the bare minimum infrastructure here to allow us to have a
// UniquePtr<ServoNodeData> on nsINode.
struct ServoNodeData;
-extern "C" void Servo_DropNodeData(ServoNodeData*);
+extern "C" void Servo_NodeData_Drop(ServoNodeData*);
namespace mozilla {
template<>
class DefaultDelete<ServoNodeData>
{
public:
void operator()(ServoNodeData* aPtr) const
{
- Servo_DropNodeData(aPtr);
+ Servo_NodeData_Drop(aPtr);
}
};
} // namespace mozilla
namespace mozilla {
class EventListenerManager;
namespace dom {
/**
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -74,17 +74,17 @@ ServoRestyleManager::RecreateStyleContex
if (!primaryFrame && !aContent->IsDirtyForServo()) {
// This happens when, for example, a display: none child of a
// HAS_DIRTY_DESCENDANTS content is reached as part of the traversal.
return;
}
if (aContent->IsDirtyForServo()) {
RefPtr<ServoComputedValues> computedValues =
- Servo_GetComputedValues(aContent).Consume();
+ Servo_ComputedValues_Get(aContent).Consume();
MOZ_ASSERT(computedValues);
nsChangeHint changeHint = nsChangeHint(0);
// NB: Change hint processing only applies to elements, at least until we
// support display: contents.
if (aContent->IsElement()) {
Element* element = aContent->AsElement();
--- a/layout/style/ServoBindingHelpers.h
+++ b/layout/style/ServoBindingHelpers.h
@@ -8,56 +8,41 @@
#define mozilla_ServoBindingHelpers_h
#include "mozilla/RefPtr.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/UniquePtr.h"
namespace mozilla {
-template<>
-struct RefPtrTraits<RawServoStyleSheet>
-{
- static void AddRef(RawServoStyleSheet* aPtr) {
- Servo_AddRefStyleSheet(aPtr);
+#define DEFINE_REFPTR_TRAITS(name_, type_) \
+ template<> \
+ struct RefPtrTraits<type_> \
+ { \
+ static void AddRef(type_* aPtr) \
+ { \
+ Servo_##name_##_AddRef(aPtr); \
+ } \
+ static void Release(type_* aPtr) \
+ { \
+ Servo_##name_##_Release(aPtr); \
+ } \
}
- static void Release(RawServoStyleSheet* aPtr) {
- Servo_ReleaseStyleSheet(aPtr);
- }
-};
-template<>
-struct RefPtrTraits<ServoComputedValues>
-{
- static void AddRef(ServoComputedValues* aPtr) {
- Servo_AddRefComputedValues(aPtr);
- }
- static void Release(ServoComputedValues* aPtr) {
- Servo_ReleaseComputedValues(aPtr);
- }
-};
+DEFINE_REFPTR_TRAITS(StyleSheet, RawServoStyleSheet);
+DEFINE_REFPTR_TRAITS(ComputedValues, ServoComputedValues);
+DEFINE_REFPTR_TRAITS(DeclarationBlock, ServoDeclarationBlock);
+
+#undef DEFINE_REFPTR_TRAITS
template<>
class DefaultDelete<RawServoStyleSet>
{
public:
void operator()(RawServoStyleSet* aPtr) const
{
- Servo_DropStyleSet(aPtr);
- }
-};
-
-template<>
-struct RefPtrTraits<ServoDeclarationBlock>
-{
- static void AddRef(ServoDeclarationBlock* aPtr)
- {
- Servo_DeclarationBlock_AddRef(aPtr);
- }
- static void Release(ServoDeclarationBlock* aPtr)
- {
- Servo_DeclarationBlock_Release(aPtr);
+ Servo_StyleSet_Drop(aPtr);
}
};
} // namespace mozilla
#endif // mozilla_ServoBindingHelpers_h
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -14,34 +14,34 @@
* and the parameter list of the function.
*
* Users of this list should define a macro
* SERVO_BINDING_FUNC(name_, return_, ...)
* before including this file.
*/
// Node data
-SERVO_BINDING_FUNC(Servo_DropNodeData, void, ServoNodeData* data)
+SERVO_BINDING_FUNC(Servo_NodeData_Drop, void, ServoNodeData* data)
// Styleset and Stylesheet management
-SERVO_BINDING_FUNC(Servo_StylesheetFromUTF8Bytes, RawServoStyleSheetStrong,
+SERVO_BINDING_FUNC(Servo_StyleSheet_FromUTF8Bytes, RawServoStyleSheetStrong,
const uint8_t* bytes, uint32_t length,
mozilla::css::SheetParsingMode parsing_mode,
const uint8_t* base_bytes, uint32_t base_length,
ThreadSafeURIHolder* base,
ThreadSafeURIHolder* referrer,
ThreadSafePrincipalHolder* principal)
-SERVO_BINDING_FUNC(Servo_AddRefStyleSheet, void,
+SERVO_BINDING_FUNC(Servo_StyleSheet_AddRef, void,
RawServoStyleSheetBorrowed sheet)
-SERVO_BINDING_FUNC(Servo_ReleaseStyleSheet, void,
+SERVO_BINDING_FUNC(Servo_StyleSheet_Release, void,
RawServoStyleSheetBorrowed sheet)
-SERVO_BINDING_FUNC(Servo_StyleSheetHasRules, bool,
+SERVO_BINDING_FUNC(Servo_StyleSheet_HasRules, bool,
RawServoStyleSheetBorrowed sheet)
-SERVO_BINDING_FUNC(Servo_InitStyleSet, RawServoStyleSet*)
-SERVO_BINDING_FUNC(Servo_DropStyleSet, void, RawServoStyleSet* set)
+SERVO_BINDING_FUNC(Servo_StyleSet_Init, RawServoStyleSet*)
+SERVO_BINDING_FUNC(Servo_StyleSet_Drop, void, RawServoStyleSet* set)
SERVO_BINDING_FUNC(Servo_StyleSet_AppendStyleSheet, void,
RawServoStyleSet* set, RawServoStyleSheetBorrowed sheet)
SERVO_BINDING_FUNC(Servo_StyleSet_PrependStyleSheet, void,
RawServoStyleSet* set, RawServoStyleSheetBorrowed sheet)
SERVO_BINDING_FUNC(Servo_StyleSet_RemoveStyleSheet, void,
RawServoStyleSet* set, RawServoStyleSheetBorrowed sheet)
SERVO_BINDING_FUNC(Servo_StyleSet_InsertStyleSheetBefore, void,
RawServoStyleSet* set, RawServoStyleSheetBorrowed sheet,
@@ -50,58 +50,58 @@ SERVO_BINDING_FUNC(Servo_StyleSet_Insert
// Style attribute
SERVO_BINDING_FUNC(Servo_ParseStyleAttribute, ServoDeclarationBlockStrong,
const uint8_t* bytes, uint32_t length,
nsHTMLCSSStyleSheet* cache)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_AddRef, void,
ServoDeclarationBlockBorrowed declarations)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_Release, void,
ServoDeclarationBlockBorrowed declarations)
-SERVO_BINDING_FUNC(Servo_GetDeclarationBlockCache, nsHTMLCSSStyleSheet*,
+SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetCache, nsHTMLCSSStyleSheet*,
ServoDeclarationBlockBorrowed declarations)
-SERVO_BINDING_FUNC(Servo_SetDeclarationBlockImmutable, void,
+SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetImmutable, void,
ServoDeclarationBlockBorrowed declarations)
-SERVO_BINDING_FUNC(Servo_ClearDeclarationBlockCachePointer, void,
+SERVO_BINDING_FUNC(Servo_DeclarationBlock_ClearCachePointer, void,
ServoDeclarationBlockBorrowed declarations)
// CSS supports()
SERVO_BINDING_FUNC(Servo_CSSSupports, bool,
const uint8_t* name, uint32_t name_length,
const uint8_t* value, uint32_t value_length)
// Computed style data
-SERVO_BINDING_FUNC(Servo_GetComputedValues, ServoComputedValuesStrong,
+SERVO_BINDING_FUNC(Servo_ComputedValues_Get, ServoComputedValuesStrong,
RawGeckoNode* node)
-SERVO_BINDING_FUNC(Servo_GetComputedValuesForAnonymousBox,
+SERVO_BINDING_FUNC(Servo_ComputedValues_GetForAnonymousBox,
ServoComputedValuesStrong,
ServoComputedValuesBorrowed parent_style_or_null,
nsIAtom* pseudoTag, RawServoStyleSet* set)
-SERVO_BINDING_FUNC(Servo_GetComputedValuesForPseudoElement,
+SERVO_BINDING_FUNC(Servo_ComputedValues_GetForPseudoElement,
ServoComputedValuesStrong,
ServoComputedValuesBorrowed parent_style,
RawGeckoElement* match_element, nsIAtom* pseudo_tag,
RawServoStyleSet* set, bool is_probe)
-SERVO_BINDING_FUNC(Servo_InheritComputedValues, ServoComputedValuesStrong,
+SERVO_BINDING_FUNC(Servo_ComputedValues_Inherit, ServoComputedValuesStrong,
ServoComputedValuesBorrowed parent_style)
-SERVO_BINDING_FUNC(Servo_AddRefComputedValues, void,
+SERVO_BINDING_FUNC(Servo_ComputedValues_AddRef, void,
ServoComputedValuesBorrowed computed_values)
-SERVO_BINDING_FUNC(Servo_ReleaseComputedValues, void,
+SERVO_BINDING_FUNC(Servo_ComputedValues_Release, void,
ServoComputedValuesBorrowed computed_values)
// Initialize Servo components. Should be called exactly once at startup.
SERVO_BINDING_FUNC(Servo_Initialize, void)
// Shut down Servo components. Should be called exactly once at shutdown.
SERVO_BINDING_FUNC(Servo_Shutdown, void)
// Restyle hints
SERVO_BINDING_FUNC(Servo_ComputeRestyleHint, nsRestyleHint,
RawGeckoElement* element, ServoElementSnapshot* snapshot,
RawServoStyleSet* set)
- // Restyle the given document or subtree
+// Restyle the given document or subtree
SERVO_BINDING_FUNC(Servo_RestyleDocument, void,
RawGeckoDocument* doc, RawServoStyleSet* set)
SERVO_BINDING_FUNC(Servo_RestyleSubtree, void,
RawGeckoNode* node, RawServoStyleSet* set)
// Style-struct management.
#define STYLE_STRUCT(name, checkdata_cb) \
struct nsStyle##name; \
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -14,17 +14,17 @@
#include "nsStyleContext.h"
#include "nsStyleSet.h"
using namespace mozilla;
using namespace mozilla::dom;
ServoStyleSet::ServoStyleSet()
: mPresContext(nullptr)
- , mRawSet(Servo_InitStyleSet())
+ , mRawSet(Servo_StyleSet_Init())
, mBatching(0)
, mStylingStarted(false)
{
}
void
ServoStyleSet::Init(nsPresContext* aPresContext)
{
@@ -92,17 +92,17 @@ ServoStyleSet::ResolveStyleFor(Element*
already_AddRefed<nsStyleContext>
ServoStyleSet::GetContext(nsIContent* aContent,
nsStyleContext* aParentContext,
nsIAtom* aPseudoTag,
CSSPseudoElementType aPseudoType)
{
RefPtr<ServoComputedValues> computedValues =
- Servo_GetComputedValues(aContent).Consume();
+ Servo_ComputedValues_Get(aContent).Consume();
MOZ_ASSERT(computedValues);
return GetContext(computedValues.forget(), aParentContext, aPseudoTag, aPseudoType);
}
already_AddRefed<nsStyleContext>
ServoStyleSet::GetContext(already_AddRefed<ServoComputedValues> aComputedValues,
nsStyleContext* aParentContext,
nsIAtom* aPseudoTag,
@@ -156,34 +156,34 @@ ServoStyleSet::ResolveStyleForText(nsICo
RefPtr<ServoComputedValues> computedValues;
if (parent->IsRootOfAnonymousSubtree() &&
(parentName == nsGkAtoms::mozgeneratedcontentbefore ||
parentName == nsGkAtoms::mozgeneratedcontentafter)) {
MOZ_ASSERT(aParentContext);
ServoComputedValues* parentComputedValues =
aParentContext->StyleSource().AsServoComputedValues();
computedValues =
- Servo_InheritComputedValues(parentComputedValues).Consume();
+ Servo_ComputedValues_Inherit(parentComputedValues).Consume();
} else {
- computedValues = Servo_GetComputedValues(aTextNode).Consume();
+ computedValues = Servo_ComputedValues_Get(aTextNode).Consume();
}
return GetContext(computedValues.forget(), aParentContext,
nsCSSAnonBoxes::mozText, CSSPseudoElementType::AnonBox);
}
already_AddRefed<nsStyleContext>
ServoStyleSet::ResolveStyleForOtherNonElement(nsStyleContext* aParentContext)
{
// The parent context can be null if the non-element share a style context
// with the root of an anonymous subtree.
ServoComputedValues* parent =
aParentContext ? aParentContext->StyleSource().AsServoComputedValues() : nullptr;
RefPtr<ServoComputedValues> computedValues =
- Servo_InheritComputedValues(parent).Consume();
+ Servo_ComputedValues_Inherit(parent).Consume();
MOZ_ASSERT(computedValues);
return GetContext(computedValues.forget(), aParentContext,
nsCSSAnonBoxes::mozOtherNonElement,
CSSPseudoElementType::AnonBox);
}
already_AddRefed<nsStyleContext>
@@ -195,17 +195,17 @@ ServoStyleSet::ResolvePseudoElementStyle
if (aPseudoElement) {
NS_ERROR("stylo: We don't support CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE yet");
}
MOZ_ASSERT(aParentContext);
MOZ_ASSERT(aType < CSSPseudoElementType::Count);
nsIAtom* pseudoTag = nsCSSPseudoElements::GetPseudoAtom(aType);
RefPtr<ServoComputedValues> computedValues =
- Servo_GetComputedValuesForPseudoElement(
+ Servo_ComputedValues_GetForPseudoElement(
aParentContext->StyleSource().AsServoComputedValues(),
aParentElement, pseudoTag, mRawSet.get(), /* is_probe = */ false).Consume();
MOZ_ASSERT(computedValues);
return GetContext(computedValues.forget(), aParentContext, pseudoTag, aType);
}
// aFlags is an nsStyleSet flags bitfield
@@ -219,18 +219,18 @@ ServoStyleSet::ResolveAnonymousBoxStyle(
MOZ_ASSERT(aFlags == 0 ||
aFlags == nsStyleSet::eSkipParentDisplayBasedStyleFixup);
bool skipFixup = aFlags & nsStyleSet::eSkipParentDisplayBasedStyleFixup;
ServoComputedValues* parentStyle =
aParentContext ? aParentContext->StyleSource().AsServoComputedValues()
: nullptr;
RefPtr<ServoComputedValues> computedValues =
- Servo_GetComputedValuesForAnonymousBox(parentStyle, aPseudoTag,
- mRawSet.get()).Consume();
+ Servo_ComputedValues_GetForAnonymousBox(parentStyle, aPseudoTag,
+ mRawSet.get()).Consume();
#ifdef DEBUG
if (!computedValues) {
nsString pseudo;
aPseudoTag->ToString(pseudo);
NS_ERROR(nsPrintfCString("stylo: could not get anon-box: %s",
NS_ConvertUTF16toUTF8(pseudo).get()).get());
MOZ_CRASH();
}
@@ -390,17 +390,17 @@ ServoStyleSet::ProbePseudoElementStyle(E
CSSPseudoElementType aType,
nsStyleContext* aParentContext)
{
MOZ_ASSERT(aParentContext);
MOZ_ASSERT(aType < CSSPseudoElementType::Count);
nsIAtom* pseudoTag = nsCSSPseudoElements::GetPseudoAtom(aType);
RefPtr<ServoComputedValues> computedValues =
- Servo_GetComputedValuesForPseudoElement(
+ Servo_ComputedValues_GetForPseudoElement(
aParentContext->StyleSource().AsServoComputedValues(),
aParentElement, pseudoTag, mRawSet.get(), /* is_probe = */ true).Consume();
if (!computedValues) {
return nullptr;
}
// For :before and :after pseudo-elements, having display: none or no
--- a/layout/style/ServoStyleSheet.cpp
+++ b/layout/style/ServoStyleSheet.cpp
@@ -27,17 +27,17 @@ bool
ServoStyleSheet::IsApplicable() const
{
return !mDisabled && mComplete;
}
bool
ServoStyleSheet::HasRules() const
{
- return Servo_StyleSheetHasRules(RawSheet());
+ return Servo_StyleSheet_HasRules(RawSheet());
}
nsIDocument*
ServoStyleSheet::GetOwningDocument() const
{
return mDocument;
}
@@ -81,17 +81,17 @@ ServoStyleSheet::ParseSheet(const nsAStr
RefPtr<ThreadSafeURIHolder> referrer = new ThreadSafeURIHolder(aSheetURI);
RefPtr<ThreadSafePrincipalHolder> principal =
new ThreadSafePrincipalHolder(aSheetPrincipal);
nsCString baseString;
aBaseURI->GetSpec(baseString);
NS_ConvertUTF16toUTF8 input(aInput);
- mSheet = Servo_StylesheetFromUTF8Bytes(
+ mSheet = Servo_StyleSheet_FromUTF8Bytes(
reinterpret_cast<const uint8_t*>(input.get()), input.Length(),
mParsingMode,
reinterpret_cast<const uint8_t*>(baseString.get()), baseString.Length(),
base, referrer, principal).Consume();
}
void
ServoStyleSheet::DropSheet()
--- a/layout/style/nsHTMLCSSStyleSheet.cpp
+++ b/layout/style/nsHTMLCSSStyleSheet.cpp
@@ -42,17 +42,17 @@ nsHTMLCSSStyleSheet::~nsHTMLCSSStyleShee
case nsAttrValue::eGeckoCSSDeclaration: {
css::Declaration* declaration = value->mValue.mGeckoCSSDeclaration;
declaration->SetHTMLCSSStyleSheet(nullptr);
break;
}
case nsAttrValue::eServoCSSDeclaration: {
ServoDeclarationBlock* declarations =
value->mValue.mServoCSSDeclaration;
- Servo_ClearDeclarationBlockCachePointer(declarations);
+ Servo_DeclarationBlock_ClearCachePointer(declarations);
break;
}
default:
MOZ_ASSERT_UNREACHABLE("unexpected cached nsAttrValue type");
break;
}
value->mValue.mCached = 0;