зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1261754 - Part 3: Move quotes from nsStyleQuotes to nsStyleList and delete nsStyleQuotes. r=dholbert
This commit is contained in:
Родитель
d340c36d57
Коммит
6883fc4b42
|
@ -7663,7 +7663,7 @@ nsLayoutUtils::Shutdown()
|
|||
nsComputedDOMStyle::UnregisterPrefChangeCallbacks();
|
||||
|
||||
// so the cached initial quotes array doesn't appear to be a leak
|
||||
nsStyleQuotes::Shutdown();
|
||||
nsStyleList::Shutdown();
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -38,7 +38,7 @@ nsQuoteNode::Text()
|
|||
mType == eStyleContentType_CloseQuote,
|
||||
"should only be called when mText should be non-null");
|
||||
const nsStyleQuoteValues::QuotePairArray& quotePairs =
|
||||
mPseudoFrame->StyleQuotes()->GetQuotePairs();
|
||||
mPseudoFrame->StyleList()->GetQuotePairs();
|
||||
int32_t quotesCount = quotePairs.Length(); // 0 if 'quotes:none'
|
||||
int32_t quoteDepth = Depth();
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ STYLE_STRUCTS = [("INHERITED",) + x for x in [
|
|||
("List", "nullptr", NORMAL_DEP + LENGTH_DEP),
|
||||
("Text", "CheckTextCallback", NORMAL_DEP + LENGTH_DEP + COLOR_DEP),
|
||||
("Visibility", "nullptr", NORMAL_DEP),
|
||||
("Quotes", "nullptr", NORMAL_DEP),
|
||||
("UserInterface", "nullptr", NORMAL_DEP),
|
||||
("TableBorder", "nullptr", NORMAL_DEP + LENGTH_DEP),
|
||||
("SVG", "nullptr", NORMAL_DEP + LENGTH_DEP + COLOR_DEP),
|
||||
|
|
|
@ -143,7 +143,6 @@
|
|||
#define CSS_PROP_DISPLAY(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, stylestructoffset_, animtype_) CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, Display, stylestructoffset_, animtype_)
|
||||
#define CSS_PROP_VISIBILITY(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, stylestructoffset_, animtype_) CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, Visibility, stylestructoffset_, animtype_)
|
||||
#define CSS_PROP_CONTENT(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, stylestructoffset_, animtype_) CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, Content, stylestructoffset_, animtype_)
|
||||
#define CSS_PROP_QUOTES(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, stylestructoffset_, animtype_) CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, Quotes, stylestructoffset_, animtype_)
|
||||
#define CSS_PROP_USERINTERFACE(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, stylestructoffset_, animtype_) CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, UserInterface, stylestructoffset_, animtype_)
|
||||
#define CSS_PROP_UIRESET(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, stylestructoffset_, animtype_) CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, UIReset, stylestructoffset_, animtype_)
|
||||
#define CSS_PROP_TABLE(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, stylestructoffset_, animtype_) CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, Table, stylestructoffset_, animtype_)
|
||||
|
@ -228,10 +227,6 @@
|
|||
#define CSS_PROP_CONTENT(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, stylestructoffset_, animtype_) /* nothing */
|
||||
#define DEFINED_CSS_PROP_CONTENT
|
||||
#endif
|
||||
#ifndef CSS_PROP_QUOTES
|
||||
#define CSS_PROP_QUOTES(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, stylestructoffset_, animtype_) /* nothing */
|
||||
#define DEFINED_CSS_PROP_QUOTES
|
||||
#endif
|
||||
#ifndef CSS_PROP_USERINTERFACE
|
||||
#define CSS_PROP_USERINTERFACE(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, stylestructoffset_, animtype_) /* nothing */
|
||||
#define DEFINED_CSS_PROP_USERINTERFACE
|
||||
|
@ -3065,7 +3060,7 @@ CSS_PROP_DISPLAY(
|
|||
kPositionKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_None)
|
||||
CSS_PROP_QUOTES(
|
||||
CSS_PROP_LIST(
|
||||
quotes,
|
||||
quotes,
|
||||
Quotes,
|
||||
|
@ -4455,7 +4450,6 @@ CSS_PROP_FONT(
|
|||
#undef CSS_PROP_DISPLAY
|
||||
#undef CSS_PROP_VISIBILITY
|
||||
#undef CSS_PROP_CONTENT
|
||||
#undef CSS_PROP_QUOTES
|
||||
#undef CSS_PROP_USERINTERFACE
|
||||
#undef CSS_PROP_UIRESET
|
||||
#undef CSS_PROP_TABLE
|
||||
|
@ -4512,10 +4506,6 @@ CSS_PROP_FONT(
|
|||
#undef CSS_PROP_CONTENT
|
||||
#undef DEFINED_CSS_PROP_CONTENT
|
||||
#endif
|
||||
#ifdef DEFINED_CSS_PROP_QUOTES
|
||||
#undef CSS_PROP_QUOTES
|
||||
#undef DEFINED_CSS_PROP_QUOTES
|
||||
#endif
|
||||
#ifdef DEFINED_CSS_PROP_USERINTERFACE
|
||||
#undef CSS_PROP_USERINTERFACE
|
||||
#undef DEFINED_CSS_PROP_USERINTERFACE
|
||||
|
|
|
@ -3145,13 +3145,6 @@ enum ContentCheckCounter {
|
|||
ePropertyCount_for_Content
|
||||
};
|
||||
|
||||
enum QuotesCheckCounter {
|
||||
#define CSS_PROP_QUOTES ENUM_DATA_FOR_PROPERTY
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_QUOTES
|
||||
ePropertyCount_for_Quotes
|
||||
};
|
||||
|
||||
enum TextCheckCounter {
|
||||
#define CSS_PROP_TEXT ENUM_DATA_FOR_PROPERTY
|
||||
#include "nsCSSPropList.h"
|
||||
|
|
|
@ -1471,7 +1471,7 @@ nsComputedDOMStyle::DoGetCounterReset()
|
|||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetQuotes()
|
||||
{
|
||||
const auto& quotePairs = StyleQuotes()->GetQuotePairs();
|
||||
const auto& quotePairs = StyleList()->GetQuotePairs();
|
||||
|
||||
if (quotePairs.IsEmpty()) {
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
|
|
|
@ -1916,12 +1916,6 @@ static const uint32_t gContentFlags[] = {
|
|||
#undef CSS_PROP_CONTENT
|
||||
};
|
||||
|
||||
static const uint32_t gQuotesFlags[] = {
|
||||
#define CSS_PROP_QUOTES FLAG_DATA_FOR_PROPERTY
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_QUOTES
|
||||
};
|
||||
|
||||
static const uint32_t gTextFlags[] = {
|
||||
#define CSS_PROP_TEXT FLAG_DATA_FOR_PROPERTY
|
||||
#include "nsCSSPropList.h"
|
||||
|
@ -2539,12 +2533,6 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
|||
aContext->SetStyle(eStyleStruct_Content, content);
|
||||
return content;
|
||||
}
|
||||
case eStyleStruct_Quotes:
|
||||
{
|
||||
nsStyleQuotes* quotes = new (mPresContext) nsStyleQuotes(mPresContext);
|
||||
aContext->SetStyle(eStyleStruct_Quotes, quotes);
|
||||
return quotes;
|
||||
}
|
||||
case eStyleStruct_UserInterface:
|
||||
{
|
||||
nsStyleUserInterface* ui = new (mPresContext) nsStyleUserInterface(mPresContext);
|
||||
|
@ -7685,6 +7673,47 @@ nsRuleNode::ComputeListData(void* aStartStruct,
|
|||
{
|
||||
COMPUTE_START_INHERITED(List, list, parentList)
|
||||
|
||||
// quotes: inherit, initial, none, [string string]+
|
||||
const nsCSSValue* quotesValue = aRuleData->ValueForQuotes();
|
||||
switch (quotesValue->GetUnit()) {
|
||||
case eCSSUnit_Null:
|
||||
break;
|
||||
case eCSSUnit_Inherit:
|
||||
case eCSSUnit_Unset:
|
||||
conditions.SetUncacheable();
|
||||
list->SetQuotesInherit(parentList);
|
||||
break;
|
||||
case eCSSUnit_Initial:
|
||||
list->SetQuotesInitial();
|
||||
break;
|
||||
case eCSSUnit_None:
|
||||
list->SetQuotesNone();
|
||||
break;
|
||||
case eCSSUnit_PairList:
|
||||
case eCSSUnit_PairListDep: {
|
||||
const nsCSSValuePairList* ourQuotes = quotesValue->GetPairListValue();
|
||||
|
||||
nsStyleQuoteValues::QuotePairArray quotePairs;
|
||||
quotePairs.SetLength(ListLength(ourQuotes));
|
||||
|
||||
size_t index = 0;
|
||||
nsAutoString buffer;
|
||||
while (ourQuotes) {
|
||||
MOZ_ASSERT(ourQuotes->mXValue.GetUnit() == eCSSUnit_String &&
|
||||
ourQuotes->mYValue.GetUnit() == eCSSUnit_String,
|
||||
"improper list contents for quotes");
|
||||
quotePairs[index].first = ourQuotes->mXValue.GetStringValue(buffer);
|
||||
quotePairs[index].second = ourQuotes->mYValue.GetStringValue(buffer);
|
||||
++index;
|
||||
ourQuotes = ourQuotes->mNext;
|
||||
}
|
||||
list->SetQuotes(Move(quotePairs));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
MOZ_ASSERT(false, "unexpected value unit");
|
||||
}
|
||||
|
||||
// list-style-type: string, none, inherit, initial
|
||||
const nsCSSValue* typeValue = aRuleData->ValueForListStyleType();
|
||||
switch (typeValue->GetUnit()) {
|
||||
|
@ -8836,60 +8865,6 @@ nsRuleNode::ComputeContentData(void* aStartStruct,
|
|||
COMPUTE_END_RESET(Content, content)
|
||||
}
|
||||
|
||||
const void*
|
||||
nsRuleNode::ComputeQuotesData(void* aStartStruct,
|
||||
const nsRuleData* aRuleData,
|
||||
nsStyleContext* aContext,
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail aRuleDetail,
|
||||
const RuleNodeCacheConditions aConditions)
|
||||
{
|
||||
COMPUTE_START_INHERITED(Quotes, quotes, parentQuotes)
|
||||
|
||||
// quotes: inherit, initial, none, [string string]+
|
||||
const nsCSSValue* quotesValue = aRuleData->ValueForQuotes();
|
||||
switch (quotesValue->GetUnit()) {
|
||||
case eCSSUnit_Null:
|
||||
break;
|
||||
case eCSSUnit_Inherit:
|
||||
case eCSSUnit_Unset:
|
||||
conditions.SetUncacheable();
|
||||
quotes->SetQuotesInherit(parentQuotes);
|
||||
break;
|
||||
case eCSSUnit_Initial:
|
||||
quotes->SetQuotesInitial();
|
||||
break;
|
||||
case eCSSUnit_None:
|
||||
quotes->SetQuotesNone();
|
||||
break;
|
||||
case eCSSUnit_PairList:
|
||||
case eCSSUnit_PairListDep: {
|
||||
const nsCSSValuePairList* ourQuotes = quotesValue->GetPairListValue();
|
||||
|
||||
nsStyleQuoteValues::QuotePairArray quotePairs;
|
||||
quotePairs.SetLength(ListLength(ourQuotes));
|
||||
|
||||
size_t index = 0;
|
||||
nsAutoString buffer;
|
||||
while (ourQuotes) {
|
||||
MOZ_ASSERT(ourQuotes->mXValue.GetUnit() == eCSSUnit_String &&
|
||||
ourQuotes->mYValue.GetUnit() == eCSSUnit_String,
|
||||
"improper list contents for quotes");
|
||||
quotePairs[index].first = ourQuotes->mXValue.GetStringValue(buffer);
|
||||
quotePairs[index].second = ourQuotes->mYValue.GetStringValue(buffer);
|
||||
++index;
|
||||
ourQuotes = ourQuotes->mNext;
|
||||
}
|
||||
quotes->SetQuotes(Move(quotePairs));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
MOZ_ASSERT(false, "unexpected value unit");
|
||||
}
|
||||
|
||||
COMPUTE_END_INHERITED(Quotes, quotes)
|
||||
}
|
||||
|
||||
const void*
|
||||
nsRuleNode::ComputeXULData(void* aStartStruct,
|
||||
const nsRuleData* aRuleData,
|
||||
|
|
|
@ -682,13 +682,6 @@ protected:
|
|||
RuleDetail aRuleDetail,
|
||||
const mozilla::RuleNodeCacheConditions aConditions);
|
||||
|
||||
const void*
|
||||
ComputeQuotesData(void* aStartStruct,
|
||||
const nsRuleData* aRuleData,
|
||||
nsStyleContext* aContext, nsRuleNode* aHighestNode,
|
||||
RuleDetail aRuleDetail,
|
||||
const mozilla::RuleNodeCacheConditions aConditions);
|
||||
|
||||
const void*
|
||||
ComputeTextData(void* aStartStruct,
|
||||
const nsRuleData* aRuleData,
|
||||
|
|
|
@ -966,7 +966,6 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
|
|||
DO_STRUCT_DIFFERENCE(UIReset);
|
||||
DO_STRUCT_DIFFERENCE(Text);
|
||||
DO_STRUCT_DIFFERENCE(List);
|
||||
DO_STRUCT_DIFFERENCE(Quotes);
|
||||
DO_STRUCT_DIFFERENCE(SVGReset);
|
||||
DO_STRUCT_DIFFERENCE(SVG);
|
||||
#undef EXTRA_DIFF_ARGS
|
||||
|
|
|
@ -681,6 +681,7 @@ nsStyleList::nsStyleList(StyleStructContext aContext)
|
|||
mCounterStyle(aContext.BuildCounterStyle(mListStyleType))
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsStyleList);
|
||||
SetQuotesInitial();
|
||||
}
|
||||
|
||||
nsStyleList::~nsStyleList()
|
||||
|
@ -692,14 +693,74 @@ nsStyleList::nsStyleList(const nsStyleList& aSource)
|
|||
: mListStylePosition(aSource.mListStylePosition),
|
||||
mListStyleType(aSource.mListStyleType),
|
||||
mCounterStyle(aSource.mCounterStyle),
|
||||
mQuotes(aSource.mQuotes),
|
||||
mImageRegion(aSource.mImageRegion)
|
||||
{
|
||||
SetListStyleImage(aSource.GetListStyleImage());
|
||||
MOZ_COUNT_CTOR(nsStyleList);
|
||||
}
|
||||
|
||||
nsChangeHint nsStyleList::CalcDifference(const nsStyleList& aOther) const
|
||||
void
|
||||
nsStyleList::SetQuotesInherit(const nsStyleList* aOther)
|
||||
{
|
||||
mQuotes = aOther->mQuotes;
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleList::SetQuotesInitial()
|
||||
{
|
||||
if (!sInitialQuotes) {
|
||||
// The initial value for quotes is the en-US typographic convention:
|
||||
// outermost are LEFT and RIGHT DOUBLE QUOTATION MARK, alternating
|
||||
// with LEFT and RIGHT SINGLE QUOTATION MARK.
|
||||
static const char16_t initialQuotes[8] = {
|
||||
0x201C, 0, 0x201D, 0, 0x2018, 0, 0x2019, 0
|
||||
};
|
||||
|
||||
sInitialQuotes = new nsStyleQuoteValues;
|
||||
sInitialQuotes->mQuotePairs.AppendElement(
|
||||
std::make_pair(nsDependentString(&initialQuotes[0], 1),
|
||||
nsDependentString(&initialQuotes[2], 1)));
|
||||
sInitialQuotes->mQuotePairs.AppendElement(
|
||||
std::make_pair(nsDependentString(&initialQuotes[4], 1),
|
||||
nsDependentString(&initialQuotes[6], 1)));
|
||||
}
|
||||
|
||||
mQuotes = sInitialQuotes;
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleList::SetQuotesNone()
|
||||
{
|
||||
if (!sNoneQuotes) {
|
||||
sNoneQuotes = new nsStyleQuoteValues;
|
||||
}
|
||||
mQuotes = sNoneQuotes;
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleList::SetQuotes(nsStyleQuoteValues::QuotePairArray&& aValues)
|
||||
{
|
||||
mQuotes = new nsStyleQuoteValues;
|
||||
mQuotes->mQuotePairs = Move(aValues);
|
||||
}
|
||||
|
||||
const nsStyleQuoteValues::QuotePairArray&
|
||||
nsStyleList::GetQuotePairs() const
|
||||
{
|
||||
return mQuotes->mQuotePairs;
|
||||
}
|
||||
|
||||
nsChangeHint
|
||||
nsStyleList::CalcDifference(const nsStyleList& aOther) const
|
||||
{
|
||||
// If the quotes implementation is ever going to change we might not need
|
||||
// a framechange here and a reflow should be sufficient. See bug 35768.
|
||||
if (mQuotes != aOther.mQuotes &&
|
||||
(mQuotes || aOther.mQuotes) &&
|
||||
GetQuotePairs() != aOther.GetQuotePairs()) {
|
||||
return NS_STYLE_HINT_FRAMECHANGE;
|
||||
}
|
||||
if (mListStylePosition != aOther.mListStylePosition)
|
||||
return NS_STYLE_HINT_FRAMECHANGE;
|
||||
if (EqualImages(mListStyleImage, aOther.mListStyleImage) &&
|
||||
|
@ -716,6 +777,13 @@ nsChangeHint nsStyleList::CalcDifference(const nsStyleList& aOther) const
|
|||
return NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
|
||||
StaticRefPtr<nsStyleQuoteValues>
|
||||
nsStyleList::sInitialQuotes;
|
||||
|
||||
StaticRefPtr<nsStyleQuoteValues>
|
||||
nsStyleList::sNoneQuotes;
|
||||
|
||||
|
||||
// --------------------
|
||||
// nsStyleXUL
|
||||
//
|
||||
|
@ -3492,97 +3560,6 @@ nsresult nsStyleContent::AllocateContents(uint32_t aCount)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// ---------------------
|
||||
// nsStyleQuotes
|
||||
//
|
||||
|
||||
nsStyleQuotes::nsStyleQuotes(StyleStructContext aContext)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsStyleQuotes);
|
||||
SetQuotesInitial();
|
||||
}
|
||||
|
||||
nsStyleQuotes::~nsStyleQuotes()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsStyleQuotes);
|
||||
}
|
||||
|
||||
nsStyleQuotes::nsStyleQuotes(const nsStyleQuotes& aSource)
|
||||
: mQuotes(aSource.mQuotes)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsStyleQuotes);
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleQuotes::SetQuotesInherit(const nsStyleQuotes* aOther)
|
||||
{
|
||||
mQuotes = aOther->mQuotes;
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleQuotes::SetQuotesInitial()
|
||||
{
|
||||
if (!sInitialQuotes) {
|
||||
// The initial value for quotes is the en-US typographic convention:
|
||||
// outermost are LEFT and RIGHT DOUBLE QUOTATION MARK, alternating
|
||||
// with LEFT and RIGHT SINGLE QUOTATION MARK.
|
||||
static const char16_t initialQuotes[8] = {
|
||||
0x201C, 0, 0x201D, 0, 0x2018, 0, 0x2019, 0
|
||||
};
|
||||
|
||||
sInitialQuotes = new nsStyleQuoteValues;
|
||||
sInitialQuotes->mQuotePairs.AppendElement(
|
||||
std::make_pair(nsDependentString(&initialQuotes[0], 1),
|
||||
nsDependentString(&initialQuotes[2], 1)));
|
||||
sInitialQuotes->mQuotePairs.AppendElement(
|
||||
std::make_pair(nsDependentString(&initialQuotes[4], 1),
|
||||
nsDependentString(&initialQuotes[6], 1)));
|
||||
}
|
||||
|
||||
mQuotes = sInitialQuotes;
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleQuotes::SetQuotesNone()
|
||||
{
|
||||
if (!sNoneQuotes) {
|
||||
sNoneQuotes = new nsStyleQuoteValues;
|
||||
}
|
||||
mQuotes = sNoneQuotes;
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleQuotes::SetQuotes(nsStyleQuoteValues::QuotePairArray&& aValues)
|
||||
{
|
||||
mQuotes = new nsStyleQuoteValues;
|
||||
mQuotes->mQuotePairs = Move(aValues);
|
||||
}
|
||||
|
||||
const nsStyleQuoteValues::QuotePairArray&
|
||||
nsStyleQuotes::GetQuotePairs() const
|
||||
{
|
||||
return mQuotes->mQuotePairs;
|
||||
}
|
||||
|
||||
nsChangeHint
|
||||
nsStyleQuotes::CalcDifference(const nsStyleQuotes& aOther) const
|
||||
{
|
||||
// If the quotes implementation is ever going to change we might not need
|
||||
// a framechange here and a reflow should be sufficient. See bug 35768.
|
||||
if (mQuotes != aOther.mQuotes &&
|
||||
mQuotes->mQuotePairs != aOther.mQuotes->mQuotePairs) {
|
||||
return NS_STYLE_HINT_FRAMECHANGE;
|
||||
}
|
||||
|
||||
return NS_STYLE_HINT_NONE;
|
||||
}
|
||||
|
||||
StaticRefPtr<nsStyleQuoteValues>
|
||||
nsStyleQuotes::sInitialQuotes;
|
||||
|
||||
StaticRefPtr<nsStyleQuoteValues>
|
||||
nsStyleQuotes::sNoneQuotes;
|
||||
|
||||
|
||||
// --------------------
|
||||
// nsStyleTextReset
|
||||
|
|
|
@ -48,7 +48,7 @@ struct nsStyleVisibility;
|
|||
|
||||
// Bits for each struct.
|
||||
// NS_STYLE_INHERIT_BIT defined in nsStyleStructFwd.h
|
||||
#define NS_STYLE_INHERIT_MASK 0x000ffffff
|
||||
#define NS_STYLE_INHERIT_MASK 0x0007fffff
|
||||
|
||||
// Bits for inherited structs.
|
||||
#define NS_STYLE_INHERITED_STRUCT_MASK \
|
||||
|
@ -59,6 +59,7 @@ struct nsStyleVisibility;
|
|||
<< nsStyleStructID_Inherited_Count)
|
||||
|
||||
// Additional bits for nsStyleContext's mBits:
|
||||
// Free bit 0x000800000
|
||||
// See nsStyleContext::HasTextDecorationLines
|
||||
#define NS_STYLE_HAS_TEXT_DECORATION_LINES 0x001000000
|
||||
// See nsStyleContext::HasPseudoElementData.
|
||||
|
@ -86,8 +87,9 @@ struct nsStyleVisibility;
|
|||
#define NS_STYLE_CONTEXT_TYPE_SHIFT 35
|
||||
|
||||
// Additional bits for nsRuleNode's mDependentBits:
|
||||
// Free bit 0x00800000
|
||||
#define NS_RULE_NODE_IS_ANIMATION_RULE 0x01000000
|
||||
// Free bit here!
|
||||
// Free bit 0x02000000
|
||||
#define NS_RULE_NODE_USED_DIRECTLY 0x04000000
|
||||
#define NS_RULE_NODE_IS_IMPORTANT 0x08000000
|
||||
#define NS_RULE_NODE_LEVEL_MASK 0xf0000000
|
||||
|
@ -1352,6 +1354,22 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* An object that allows sharing of arrays that store 'quotes' property
|
||||
* values. This is particularly important for inheritance, where we want
|
||||
* to share the same 'quotes' value with a parent style context.
|
||||
*/
|
||||
class nsStyleQuoteValues
|
||||
{
|
||||
public:
|
||||
typedef nsTArray<std::pair<nsString, nsString>> QuotePairArray;
|
||||
NS_INLINE_DECL_REFCOUNTING(nsStyleQuoteValues);
|
||||
QuotePairArray mQuotePairs;
|
||||
|
||||
private:
|
||||
~nsStyleQuoteValues() {}
|
||||
};
|
||||
|
||||
struct nsStyleList
|
||||
{
|
||||
explicit nsStyleList(StyleStructContext aContext);
|
||||
|
@ -1382,6 +1400,11 @@ struct nsStyleList
|
|||
nsChangeHint_ClearAncestorIntrinsics;
|
||||
}
|
||||
|
||||
static void Shutdown() {
|
||||
sInitialQuotes = nullptr;
|
||||
sNoneQuotes = nullptr;
|
||||
}
|
||||
|
||||
imgRequestProxy* GetListStyleImage() const { return mListStyleImage; }
|
||||
void SetListStyleImage(imgRequestProxy* aReq)
|
||||
{
|
||||
|
@ -1410,14 +1433,27 @@ struct nsStyleList
|
|||
CounterStyleManager()->BuildCounterStyle(aType));
|
||||
}
|
||||
|
||||
const nsStyleQuoteValues::QuotePairArray& GetQuotePairs() const;
|
||||
|
||||
void SetQuotesInherit(const nsStyleList* aOther);
|
||||
void SetQuotesInitial();
|
||||
void SetQuotesNone();
|
||||
void SetQuotes(nsStyleQuoteValues::QuotePairArray&& aValues);
|
||||
|
||||
uint8_t mListStylePosition; // [inherited]
|
||||
private:
|
||||
nsString mListStyleType; // [inherited]
|
||||
RefPtr<mozilla::CounterStyle> mCounterStyle; // [inherited]
|
||||
RefPtr<imgRequestProxy> mListStyleImage; // [inherited]
|
||||
RefPtr<nsStyleQuoteValues> mQuotes; // [inherited]
|
||||
nsStyleList& operator=(const nsStyleList& aOther) = delete;
|
||||
public:
|
||||
nsRect mImageRegion; // [inherited] the rect to use within an image
|
||||
|
||||
private:
|
||||
// nsStyleQuoteValues objects representing two common values, for sharing.
|
||||
static mozilla::StaticRefPtr<nsStyleQuoteValues> sInitialQuotes;
|
||||
static mozilla::StaticRefPtr<nsStyleQuoteValues> sNoneQuotes;
|
||||
};
|
||||
|
||||
struct nsStyleGridLine
|
||||
|
@ -2798,70 +2834,6 @@ struct nsStyleCounterData
|
|||
|
||||
#define DELETE_ARRAY_IF(array) if (array) { delete[] array; array = nullptr; }
|
||||
|
||||
/**
|
||||
* An object that allows sharing of arrays that store 'quotes' property
|
||||
* values. This is particularly important for inheritance, where we want
|
||||
* to share the same 'quotes' value with a parent style context.
|
||||
*/
|
||||
class nsStyleQuoteValues
|
||||
{
|
||||
public:
|
||||
typedef nsTArray<std::pair<nsString, nsString>> QuotePairArray;
|
||||
NS_INLINE_DECL_REFCOUNTING(nsStyleQuoteValues);
|
||||
QuotePairArray mQuotePairs;
|
||||
|
||||
private:
|
||||
~nsStyleQuoteValues() {}
|
||||
};
|
||||
|
||||
struct nsStyleQuotes
|
||||
{
|
||||
explicit nsStyleQuotes(StyleStructContext aContext);
|
||||
nsStyleQuotes(const nsStyleQuotes& aQuotes);
|
||||
~nsStyleQuotes();
|
||||
|
||||
void* operator new(size_t sz, nsStyleQuotes* aSelf) CPP_THROW_NEW { return aSelf; }
|
||||
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
||||
return aContext->PresShell()->
|
||||
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleQuotes, sz);
|
||||
}
|
||||
void Destroy(nsPresContext* aContext) {
|
||||
this->~nsStyleQuotes();
|
||||
aContext->PresShell()->
|
||||
FreeByObjectID(mozilla::eArenaObjectID_nsStyleQuotes, this);
|
||||
}
|
||||
nsChangeHint CalcDifference(const nsStyleQuotes& aOther) const;
|
||||
static nsChangeHint MaxDifference() {
|
||||
return NS_STYLE_HINT_FRAMECHANGE;
|
||||
}
|
||||
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
||||
// CalcDifference never returns the reflow hints that are sometimes
|
||||
// handled for descendants as hints not handled for descendants.
|
||||
return nsChangeHint_NeedReflow |
|
||||
nsChangeHint_ReflowChangesSizeOrPosition |
|
||||
nsChangeHint_ClearAncestorIntrinsics;
|
||||
}
|
||||
|
||||
static void Shutdown() {
|
||||
sInitialQuotes = nullptr;
|
||||
sNoneQuotes = nullptr;
|
||||
}
|
||||
|
||||
const nsStyleQuoteValues::QuotePairArray& GetQuotePairs() const;
|
||||
|
||||
void SetQuotesInherit(const nsStyleQuotes* aOther);
|
||||
void SetQuotesInitial();
|
||||
void SetQuotesNone();
|
||||
void SetQuotes(nsStyleQuoteValues::QuotePairArray&& aValues);
|
||||
|
||||
private:
|
||||
RefPtr<nsStyleQuoteValues> mQuotes; // [inherited]
|
||||
|
||||
// nsStyleQuoteValues objects representing two common values, for sharing.
|
||||
static mozilla::StaticRefPtr<nsStyleQuoteValues> sInitialQuotes;
|
||||
static mozilla::StaticRefPtr<nsStyleQuoteValues> sNoneQuotes;
|
||||
};
|
||||
|
||||
struct nsStyleContent
|
||||
{
|
||||
explicit nsStyleContent(StyleStructContext aContext);
|
||||
|
|
Загрузка…
Ссылка в новой задаче