2015-05-03 22:32:37 +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: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2004-01-26 22:22:05 +03:00
|
|
|
|
2006-03-31 12:00:42 +04:00
|
|
|
/*
|
|
|
|
* A unique per-element set of attributes that is used as an
|
|
|
|
* nsIStyleRule; used to implement presentational attributes.
|
|
|
|
*/
|
|
|
|
|
2004-01-26 22:22:05 +03:00
|
|
|
#include "nsMappedAttributes.h"
|
2004-04-13 01:56:09 +04:00
|
|
|
#include "nsHTMLStyleSheet.h"
|
2017-01-20 02:56:53 +03:00
|
|
|
#include "nsRuleData.h"
|
2017-01-27 00:39:13 +03:00
|
|
|
#include "nsRuleWalker.h"
|
|
|
|
#include "mozilla/GenericSpecifiedValues.h"
|
2012-03-13 02:53:18 +04:00
|
|
|
#include "mozilla/HashFunctions.h"
|
2013-06-23 16:03:39 +04:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2017-01-20 02:56:53 +03:00
|
|
|
#include "mozilla/ServoDeclarationBlock.h"
|
2017-02-13 03:02:29 +03:00
|
|
|
#include "mozilla/ServoSpecifiedValues.h"
|
2012-03-13 02:53:18 +04:00
|
|
|
|
|
|
|
using namespace mozilla;
|
2004-01-26 22:22:05 +03:00
|
|
|
|
2017-04-07 19:21:48 +03:00
|
|
|
bool
|
|
|
|
nsMappedAttributes::sShuttingDown = false;
|
|
|
|
nsTArray<void*>*
|
|
|
|
nsMappedAttributes::sCachedMappedAttributeAllocations = nullptr;
|
|
|
|
|
|
|
|
void
|
|
|
|
nsMappedAttributes::Shutdown()
|
|
|
|
{
|
|
|
|
sShuttingDown = true;
|
|
|
|
if (sCachedMappedAttributeAllocations) {
|
|
|
|
for (uint32_t i = 0; i < sCachedMappedAttributeAllocations->Length(); ++i) {
|
|
|
|
void* cachedValue = (*sCachedMappedAttributeAllocations)[i];
|
|
|
|
::operator delete(cachedValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
delete sCachedMappedAttributeAllocations;
|
|
|
|
sCachedMappedAttributeAllocations = nullptr;
|
|
|
|
}
|
|
|
|
|
2004-04-13 01:56:09 +04:00
|
|
|
nsMappedAttributes::nsMappedAttributes(nsHTMLStyleSheet* aSheet,
|
2004-01-26 22:22:05 +03:00
|
|
|
nsMapRuleToAttributesFunc aMapRuleFunc)
|
2004-02-10 16:17:48 +03:00
|
|
|
: mAttrCount(0),
|
|
|
|
mSheet(aSheet),
|
2017-01-20 02:56:53 +03:00
|
|
|
mRuleMapper(aMapRuleFunc),
|
|
|
|
mServoStyle(nullptr)
|
2004-01-26 22:22:05 +03:00
|
|
|
{
|
2017-04-07 19:21:48 +03:00
|
|
|
MOZ_ASSERT(mRefCnt == 0); // Ensure caching works as expected.
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsMappedAttributes::nsMappedAttributes(const nsMappedAttributes& aCopy)
|
2004-02-10 16:17:48 +03:00
|
|
|
: mAttrCount(aCopy.mAttrCount),
|
|
|
|
mSheet(aCopy.mSheet),
|
2017-01-20 02:56:53 +03:00
|
|
|
mRuleMapper(aCopy.mRuleMapper),
|
|
|
|
// This is only called by ::Clone, which is used to create independent
|
|
|
|
// nsMappedAttributes objects which should not share a ServoDeclarationBlock
|
|
|
|
mServoStyle(nullptr)
|
2004-01-26 22:22:05 +03:00
|
|
|
{
|
2004-01-31 01:08:23 +03:00
|
|
|
NS_ASSERTION(mBufferSize >= aCopy.mAttrCount, "can't fit attributes");
|
2017-04-07 19:21:48 +03:00
|
|
|
MOZ_ASSERT(mRefCnt == 0); // Ensure caching works as expected.
|
2004-01-26 22:22:05 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t i;
|
2004-01-26 22:22:05 +03:00
|
|
|
for (i = 0; i < mAttrCount; ++i) {
|
2004-01-31 01:08:23 +03:00
|
|
|
new (&Attrs()[i]) InternalAttr(aCopy.Attrs()[i]);
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsMappedAttributes::~nsMappedAttributes()
|
|
|
|
{
|
2004-01-31 01:08:23 +03:00
|
|
|
if (mSheet) {
|
|
|
|
mSheet->DropMappedAttributes(this);
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t i;
|
2004-01-26 22:22:05 +03:00
|
|
|
for (i = 0; i < mAttrCount; ++i) {
|
2004-01-31 01:08:23 +03:00
|
|
|
Attrs()[i].~InternalAttr();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsMappedAttributes*
|
2011-09-29 10:19:26 +04:00
|
|
|
nsMappedAttributes::Clone(bool aWillAddAttr)
|
2004-01-31 01:08:23 +03:00
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t extra = aWillAddAttr ? 1 : 0;
|
2004-01-31 01:08:23 +03:00
|
|
|
|
|
|
|
// This will call the overridden operator new
|
|
|
|
return new (mAttrCount + extra) nsMappedAttributes(*this);
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void* nsMappedAttributes::operator new(size_t aSize, uint32_t aAttrCount) CPP_THROW_NEW
|
2004-01-31 01:08:23 +03:00
|
|
|
{
|
2017-03-29 22:10:00 +03:00
|
|
|
|
|
|
|
size_t size = aSize + aAttrCount * sizeof(InternalAttr);
|
2004-01-31 01:08:23 +03:00
|
|
|
|
|
|
|
// aSize will include the mAttrs buffer so subtract that.
|
2017-03-29 22:10:00 +03:00
|
|
|
// We don't want to under-allocate, however, so do not subtract
|
|
|
|
// if we have zero attributes. The zero attribute case only happens
|
|
|
|
// for <body>'s mapped attributes
|
|
|
|
if (aAttrCount != 0) {
|
|
|
|
size -= sizeof(void*[1]);
|
|
|
|
}
|
|
|
|
|
2017-04-07 19:21:48 +03:00
|
|
|
if (sCachedMappedAttributeAllocations) {
|
|
|
|
void* cached =
|
|
|
|
sCachedMappedAttributeAllocations->SafeElementAt(aAttrCount);
|
|
|
|
if (cached) {
|
|
|
|
(*sCachedMappedAttributeAllocations)[aAttrCount] = nullptr;
|
|
|
|
return cached;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-29 22:10:00 +03:00
|
|
|
void* newAttrs = ::operator new(size);
|
2004-01-31 01:08:23 +03:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2012-08-04 11:44:01 +04:00
|
|
|
static_cast<nsMappedAttributes*>(newAttrs)->mBufferSize = aAttrCount;
|
2004-01-31 01:08:23 +03:00
|
|
|
#endif
|
|
|
|
return newAttrs;
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
|
2017-04-07 19:21:48 +03:00
|
|
|
void
|
|
|
|
nsMappedAttributes::LastRelease()
|
|
|
|
{
|
|
|
|
if (!sShuttingDown) {
|
|
|
|
if (!sCachedMappedAttributeAllocations) {
|
|
|
|
sCachedMappedAttributeAllocations = new nsTArray<void*>();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ensure the cache array is at least mAttrCount + 1 long and
|
|
|
|
// that each item is either null or pointing to a cached item.
|
|
|
|
// The size of the array is capped because mapped attributes are defined
|
|
|
|
// statically in element implementations.
|
|
|
|
sCachedMappedAttributeAllocations->SetCapacity(mAttrCount + 1);
|
|
|
|
for (uint32_t i = sCachedMappedAttributeAllocations->Length();
|
|
|
|
i < (uint32_t(mAttrCount) + 1); ++i) {
|
|
|
|
sCachedMappedAttributeAllocations->AppendElement(nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(*sCachedMappedAttributeAllocations)[mAttrCount]) {
|
|
|
|
void* memoryToCache = this;
|
|
|
|
this->~nsMappedAttributes();
|
|
|
|
(*sCachedMappedAttributeAllocations)[mAttrCount] = memoryToCache;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF(nsMappedAttributes)
|
|
|
|
NS_IMPL_RELEASE_WITH_DESTROY(nsMappedAttributes, LastRelease())
|
|
|
|
|
|
|
|
NS_IMPL_QUERY_INTERFACE(nsMappedAttributes,
|
|
|
|
nsIStyleRule)
|
2004-01-26 22:22:05 +03:00
|
|
|
|
2012-09-06 11:14:49 +04:00
|
|
|
void
|
2017-05-19 00:09:01 +03:00
|
|
|
nsMappedAttributes::SetAndSwapAttr(nsIAtom* aAttrName, nsAttrValue& aValue,
|
|
|
|
bool* aValueWasSet)
|
2004-01-26 22:22:05 +03:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(aAttrName, "null name");
|
2017-05-19 00:09:01 +03:00
|
|
|
*aValueWasSet = false;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t i;
|
2004-01-31 01:08:23 +03:00
|
|
|
for (i = 0; i < mAttrCount && !Attrs()[i].mName.IsSmaller(aAttrName); ++i) {
|
|
|
|
if (Attrs()[i].mName.Equals(aAttrName)) {
|
|
|
|
Attrs()[i].mValue.SwapValueWith(aValue);
|
2017-05-19 00:09:01 +03:00
|
|
|
*aValueWasSet = true;
|
2012-09-06 11:14:49 +04:00
|
|
|
return;
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-31 01:08:23 +03:00
|
|
|
NS_ASSERTION(mBufferSize >= mAttrCount + 1, "can't fit attributes");
|
2004-01-26 22:22:05 +03:00
|
|
|
|
|
|
|
if (mAttrCount != i) {
|
2004-01-31 01:08:23 +03:00
|
|
|
memmove(&Attrs()[i + 1], &Attrs()[i], (mAttrCount - i) * sizeof(InternalAttr));
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
|
2004-01-31 01:08:23 +03:00
|
|
|
new (&Attrs()[i].mName) nsAttrName(aAttrName);
|
|
|
|
new (&Attrs()[i].mValue) nsAttrValue();
|
|
|
|
Attrs()[i].mValue.SwapValueWith(aValue);
|
2004-01-26 22:22:05 +03:00
|
|
|
++mAttrCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsAttrValue*
|
|
|
|
nsMappedAttributes::GetAttr(nsIAtom* aAttrName) const
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(aAttrName, "null name");
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
for (uint32_t i = 0; i < mAttrCount; ++i) {
|
2012-07-14 03:29:14 +04:00
|
|
|
if (Attrs()[i].mName.Equals(aAttrName)) {
|
|
|
|
return &Attrs()[i].mValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2012-07-14 03:29:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
const nsAttrValue*
|
|
|
|
nsMappedAttributes::GetAttr(const nsAString& aAttrName) const
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
for (uint32_t i = 0; i < mAttrCount; ++i) {
|
2012-07-14 03:29:14 +04:00
|
|
|
if (Attrs()[i].mName.Atom()->Equals(aAttrName)) {
|
|
|
|
return &Attrs()[i].mValue;
|
|
|
|
}
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2004-01-26 22:22:05 +03:00
|
|
|
nsMappedAttributes::Equals(const nsMappedAttributes* aOther) const
|
|
|
|
{
|
|
|
|
if (this == aOther) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (mRuleMapper != aOther->mRuleMapper || mAttrCount != aOther->mAttrCount) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t i;
|
2004-01-26 22:22:05 +03:00
|
|
|
for (i = 0; i < mAttrCount; ++i) {
|
2004-01-31 01:08:23 +03:00
|
|
|
if (!Attrs()[i].mName.Equals(aOther->Attrs()[i].mName) ||
|
2004-02-03 01:00:36 +03:00
|
|
|
!Attrs()[i].mValue.Equals(aOther->Attrs()[i].mValue)) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t
|
2004-01-26 22:22:05 +03:00
|
|
|
nsMappedAttributes::HashValue() const
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t hash = HashGeneric(mRuleMapper);
|
2004-01-26 22:22:05 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t i;
|
2004-01-26 22:22:05 +03:00
|
|
|
for (i = 0; i < mAttrCount; ++i) {
|
2012-03-13 02:53:18 +04:00
|
|
|
hash = AddToHash(hash,
|
|
|
|
Attrs()[i].mName.HashValue(),
|
|
|
|
Attrs()[i].mValue.HashValue());
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
|
2012-03-13 02:53:18 +04:00
|
|
|
return hash;
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-13 01:56:09 +04:00
|
|
|
nsMappedAttributes::SetStyleSheet(nsHTMLStyleSheet* aSheet)
|
2004-01-26 22:22:05 +03:00
|
|
|
{
|
|
|
|
if (mSheet) {
|
|
|
|
mSheet->DropMappedAttributes(this);
|
|
|
|
}
|
|
|
|
mSheet = aSheet; // not ref counted
|
|
|
|
}
|
|
|
|
|
2010-05-20 06:28:00 +04:00
|
|
|
/* virtual */ void
|
2004-01-26 22:22:05 +03:00
|
|
|
nsMappedAttributes::MapRuleInfoInto(nsRuleData* aRuleData)
|
|
|
|
{
|
|
|
|
if (mRuleMapper) {
|
|
|
|
(*mRuleMapper)(this, aRuleData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-17 07:09:55 +03:00
|
|
|
/* virtual */ bool
|
|
|
|
nsMappedAttributes::MightMapInheritedStyleData()
|
|
|
|
{
|
|
|
|
// Just assume that we do, rather than adding checks to all of the different
|
|
|
|
// kinds of attribute mapping functions we have.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-08-16 08:29:21 +03:00
|
|
|
/* virtual */ bool
|
2016-08-17 04:37:48 +03:00
|
|
|
nsMappedAttributes::GetDiscretelyAnimatedCSSValue(nsCSSPropertyID aProperty,
|
2016-08-16 08:29:21 +03:00
|
|
|
nsCSSValue* aValue)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(false, "GetDiscretelyAnimatedCSSValue is not implemented yet");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2004-01-26 22:22:05 +03:00
|
|
|
#ifdef DEBUG
|
2010-05-20 06:28:00 +04:00
|
|
|
/* virtual */ void
|
2012-08-22 19:56:38 +04:00
|
|
|
nsMappedAttributes::List(FILE* out, int32_t aIndent) const
|
2004-01-26 22:22:05 +03:00
|
|
|
{
|
2014-11-27 09:29:44 +03:00
|
|
|
nsAutoCString str;
|
|
|
|
nsAutoString tmp;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t i;
|
2004-01-26 22:22:05 +03:00
|
|
|
|
|
|
|
for (i = 0; i < mAttrCount; ++i) {
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t indent;
|
2014-11-27 09:29:44 +03:00
|
|
|
for (indent = aIndent; indent > 0; --indent) {
|
2014-11-27 09:29:44 +03:00
|
|
|
str.AppendLiteral(" ");
|
2014-11-27 09:29:44 +03:00
|
|
|
}
|
2004-01-26 22:22:05 +03:00
|
|
|
|
2014-11-27 09:29:44 +03:00
|
|
|
Attrs()[i].mName.GetQualifiedName(tmp);
|
|
|
|
LossyAppendUTF16toASCII(tmp, str);
|
2004-01-26 22:22:05 +03:00
|
|
|
|
2014-11-27 09:29:44 +03:00
|
|
|
Attrs()[i].mValue.ToString(tmp);
|
|
|
|
LossyAppendUTF16toASCII(tmp, str);
|
|
|
|
str.Append('\n');
|
|
|
|
fprintf_stderr(out, "%s", str.get());
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
2012-08-22 19:56:38 +04:00
|
|
|
nsMappedAttributes::RemoveAttrAt(uint32_t aPos, nsAttrValue& aValue)
|
2004-01-26 22:22:05 +03:00
|
|
|
{
|
2006-11-11 03:04:46 +03:00
|
|
|
Attrs()[aPos].mValue.SwapValueWith(aValue);
|
2004-01-31 01:08:23 +03:00
|
|
|
Attrs()[aPos].~InternalAttr();
|
|
|
|
memmove(&Attrs()[aPos], &Attrs()[aPos + 1],
|
2004-01-26 22:22:05 +03:00
|
|
|
(mAttrCount - aPos - 1) * sizeof(InternalAttr));
|
|
|
|
mAttrCount--;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsAttrName*
|
2010-03-08 18:45:00 +03:00
|
|
|
nsMappedAttributes::GetExistingAttrNameFromQName(const nsAString& aName) const
|
2004-01-26 22:22:05 +03:00
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t i;
|
2004-01-26 22:22:05 +03:00
|
|
|
for (i = 0; i < mAttrCount; ++i) {
|
2004-01-31 01:08:23 +03:00
|
|
|
if (Attrs()[i].mName.IsAtom()) {
|
2010-03-08 18:45:00 +03:00
|
|
|
if (Attrs()[i].mName.Atom()->Equals(aName)) {
|
2004-01-31 01:08:23 +03:00
|
|
|
return &Attrs()[i].mName;
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2004-01-31 01:08:23 +03:00
|
|
|
if (Attrs()[i].mName.NodeInfo()->QualifiedNameEquals(aName)) {
|
|
|
|
return &Attrs()[i].mName;
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t
|
2012-07-14 03:29:14 +04:00
|
|
|
nsMappedAttributes::IndexOfAttr(nsIAtom* aLocalName) const
|
2004-01-26 22:22:05 +03:00
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t i;
|
2012-07-14 03:29:14 +04:00
|
|
|
for (i = 0; i < mAttrCount; ++i) {
|
|
|
|
if (Attrs()[i].mName.Equals(aLocalName)) {
|
|
|
|
return i;
|
2004-01-26 22:22:05 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2011-08-11 02:54:19 +04:00
|
|
|
|
2012-02-02 01:58:01 +04:00
|
|
|
size_t
|
2013-06-23 16:03:39 +04:00
|
|
|
nsMappedAttributes::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
2011-08-11 02:54:19 +04:00
|
|
|
{
|
|
|
|
NS_ASSERTION(mAttrCount == mBufferSize,
|
|
|
|
"mBufferSize and mAttrCount are expected to be the same.");
|
|
|
|
|
2012-02-02 01:58:01 +04:00
|
|
|
size_t n = aMallocSizeOf(this);
|
2012-08-22 19:56:38 +04:00
|
|
|
for (uint16_t i = 0; i < mAttrCount; ++i) {
|
2012-02-02 01:58:01 +04:00
|
|
|
n += Attrs()[i].mValue.SizeOfExcludingThis(aMallocSizeOf);
|
2011-08-11 02:54:19 +04:00
|
|
|
}
|
2012-02-02 01:58:01 +04:00
|
|
|
return n;
|
2011-08-11 02:54:19 +04:00
|
|
|
}
|
|
|
|
|
2017-01-20 02:56:53 +03:00
|
|
|
void
|
2017-02-13 03:02:29 +03:00
|
|
|
nsMappedAttributes::LazilyResolveServoDeclaration(nsPresContext* aContext)
|
2017-01-20 02:56:53 +03:00
|
|
|
{
|
|
|
|
|
|
|
|
MOZ_ASSERT(!mServoStyle,
|
|
|
|
"LazilyResolveServoDeclaration should not be called if mServoStyle is already set");
|
2017-02-13 03:02:29 +03:00
|
|
|
if (mRuleMapper) {
|
|
|
|
mServoStyle = Servo_DeclarationBlock_CreateEmpty().Consume();
|
|
|
|
ServoSpecifiedValues servo = ServoSpecifiedValues(aContext, mServoStyle.get());
|
|
|
|
(*mRuleMapper)(this, &servo);
|
2017-01-20 02:56:53 +03:00
|
|
|
}
|
|
|
|
}
|