mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 09:19:28 +00:00
Bug 984760 part 1: Rename nsCSSValueGridTemplateAreas to css::GridTemplateAreasValue. r=dholbert
This commit is contained in:
parent
58006b1242
commit
98db16b1af
@ -1022,8 +1022,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue,
|
||||
// which isn't a value that the shorthand can express. Bail.
|
||||
return;
|
||||
}
|
||||
const nsCSSValueGridTemplateAreas& areas =
|
||||
areasValue.GetGridTemplateAreas();
|
||||
const GridTemplateAreasValue& areas = areasValue.GetGridTemplateAreas();
|
||||
const nsCSSValueList* rowsItem = rowsValue.GetListValue();
|
||||
uint32_t nRowItems = 0;
|
||||
while (rowsItem) {
|
||||
|
@ -673,7 +673,7 @@ protected:
|
||||
// |aAreaIndices| is a lookup table to help us parse faster,
|
||||
// mapping area names to indices in |aResult.mNamedAreas|.
|
||||
bool ParseGridTemplateAreasLine(const nsAutoString& aInput,
|
||||
nsCSSValueGridTemplateAreas& aResult,
|
||||
css::GridTemplateAreasValue& aResult,
|
||||
nsDataHashtable<nsStringHashKey, uint32_t>& aAreaIndices);
|
||||
bool ParseGridTemplateAreas();
|
||||
bool ParseGridTemplate();
|
||||
@ -7156,14 +7156,14 @@ CSSParserImpl::ParseGridTemplateColumnsRows(nsCSSProperty aPropID)
|
||||
|
||||
bool
|
||||
CSSParserImpl::ParseGridTemplateAreasLine(const nsAutoString& aInput,
|
||||
nsCSSValueGridTemplateAreas& aAreas,
|
||||
css::GridTemplateAreasValue& aAreas,
|
||||
nsDataHashtable<nsStringHashKey, uint32_t>& aAreaIndices)
|
||||
{
|
||||
aAreas.mTemplates.AppendElement(mToken.mIdent);
|
||||
|
||||
nsCSSGridTemplateAreaScanner scanner(aInput);
|
||||
nsCSSGridTemplateAreaToken token;
|
||||
nsCSSGridNamedArea* currentArea = nullptr;
|
||||
css::GridNamedArea* currentArea = nullptr;
|
||||
uint32_t row = aAreas.NRows();
|
||||
uint32_t column;
|
||||
for (column = 1; scanner.Next(token); column++) {
|
||||
@ -7246,7 +7246,7 @@ CSSParserImpl::ParseGridTemplateAreas()
|
||||
return true;
|
||||
}
|
||||
|
||||
nsCSSValueGridTemplateAreas& areas = value.SetGridTemplateAreas();
|
||||
css::GridTemplateAreasValue& areas = value.SetGridTemplateAreas();
|
||||
nsDataHashtable<nsStringHashKey, uint32_t> areaIndices;
|
||||
for (;;) {
|
||||
if (!GetToken(true)) {
|
||||
@ -7368,7 +7368,7 @@ CSSParserImpl::ParseGridTemplateAfterString(const nsCSSValue& aFirstLineNames)
|
||||
|
||||
nsCSSValue areasValue;
|
||||
nsCSSValue rowsValue;
|
||||
nsCSSValueGridTemplateAreas& areas = areasValue.SetGridTemplateAreas();
|
||||
css::GridTemplateAreasValue& areas = areasValue.SetGridTemplateAreas();
|
||||
nsDataHashtable<nsStringHashKey, uint32_t> areaIndices;
|
||||
nsCSSValueList* rowsItem = rowsValue.SetListValue();
|
||||
rowsItem->mValue = aFirstLineNames;
|
||||
|
@ -596,11 +596,11 @@ void nsCSSValue::SetDependentPairListValue(nsCSSValuePairList* aList)
|
||||
}
|
||||
}
|
||||
|
||||
nsCSSValueGridTemplateAreas& nsCSSValue::SetGridTemplateAreas()
|
||||
mozilla::css::GridTemplateAreasValue& nsCSSValue::SetGridTemplateAreas()
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_GridTemplateAreas;
|
||||
mValue.mGridTemplateAreas = new nsCSSValueGridTemplateAreas;
|
||||
mValue.mGridTemplateAreas = new mozilla::css::GridTemplateAreasValue;
|
||||
mValue.mGridTemplateAreas->AddRef();
|
||||
return *mValue.mGridTemplateAreas;
|
||||
}
|
||||
@ -1345,7 +1345,14 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult,
|
||||
break;
|
||||
}
|
||||
} else if (eCSSUnit_GridTemplateAreas == unit) {
|
||||
GetGridTemplateAreas().AppendToString(aProperty, aResult, aSerialization);
|
||||
const mozilla::css::GridTemplateAreasValue& areas = GetGridTemplateAreas();
|
||||
MOZ_ASSERT(!areas.mTemplates.IsEmpty(),
|
||||
"Unexpected empty array in GridTemplateAreasValue");
|
||||
nsStyleUtil::AppendEscapedCSSString(areas.mTemplates[0], aResult);
|
||||
for (uint32_t i = 1; i < areas.mTemplates.Length(); i++) {
|
||||
aResult.Append(char16_t(' '));
|
||||
nsStyleUtil::AppendEscapedCSSString(areas.mTemplates[i], aResult);
|
||||
}
|
||||
}
|
||||
|
||||
switch (unit) {
|
||||
@ -2381,25 +2388,8 @@ nsCSSCornerSizes::corners[4] = {
|
||||
&nsCSSCornerSizes::mBottomLeft,
|
||||
};
|
||||
|
||||
void
|
||||
nsCSSValueGridTemplateAreas::AppendToString(nsCSSProperty aProperty,
|
||||
nsAString& aResult,
|
||||
nsCSSValue::Serialization aValueSerialization) const
|
||||
{
|
||||
uint32_t length = mTemplates.Length();
|
||||
if (length == 0) {
|
||||
aResult.AppendLiteral("none");
|
||||
} else {
|
||||
nsStyleUtil::AppendEscapedCSSString(mTemplates[0], aResult);
|
||||
for (uint32_t i = 1; i < length; i++) {
|
||||
aResult.Append(char16_t(' '));
|
||||
nsStyleUtil::AppendEscapedCSSString(mTemplates[i], aResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSValueGridTemplateAreas::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
mozilla::css::GridTemplateAreasValue::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
size_t n = mNamedAreas.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mTemplates.SizeOfIncludingThis(aMallocSizeOf);
|
||||
|
@ -136,6 +136,60 @@ struct ImageValue : public URLValue {
|
||||
NS_INLINE_DECL_REFCOUNTING(ImageValue)
|
||||
};
|
||||
|
||||
struct GridNamedArea {
|
||||
nsString mName;
|
||||
uint32_t mColumnStart;
|
||||
uint32_t mColumnEnd;
|
||||
uint32_t mRowStart;
|
||||
uint32_t mRowEnd;
|
||||
};
|
||||
|
||||
struct GridTemplateAreasValue {
|
||||
// Parsed value
|
||||
nsTArray<GridNamedArea> mNamedAreas;
|
||||
|
||||
// Original <string> values. Length gives the number of rows,
|
||||
// content makes serialization easier.
|
||||
nsTArray<nsString> mTemplates;
|
||||
|
||||
// How many columns grid-template-areas contributes to the explicit grid.
|
||||
// http://dev.w3.org/csswg/css-grid/#explicit-grid
|
||||
uint32_t mNColumns;
|
||||
|
||||
// How many rows grid-template-areas contributes to the explicit grid.
|
||||
// http://dev.w3.org/csswg/css-grid/#explicit-grid
|
||||
uint32_t NRows() const {
|
||||
return mTemplates.Length();
|
||||
}
|
||||
|
||||
GridTemplateAreasValue()
|
||||
: mNColumns(0)
|
||||
// Default constructors for mNamedAreas and mTemplates: empty arrays.
|
||||
{
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
mNamedAreas.Clear();
|
||||
mTemplates.Clear();
|
||||
mNColumns = 0;
|
||||
}
|
||||
|
||||
bool operator==(const GridTemplateAreasValue& aOther) const
|
||||
{
|
||||
return mTemplates == aOther.mTemplates;
|
||||
}
|
||||
|
||||
bool operator!=(const GridTemplateAreasValue& aOther) const
|
||||
{
|
||||
return !(*this == aOther);
|
||||
}
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(GridTemplateAreasValue)
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +260,7 @@ enum nsCSSUnit {
|
||||
eCSSUnit_PairListDep = 57, // (nsCSSValuePairList*) same as PairList
|
||||
// but does not own the list
|
||||
|
||||
eCSSUnit_GridTemplateAreas = 60, // (nsCSSValueGridTemplateAreas*) for grid-template-areas
|
||||
eCSSUnit_GridTemplateAreas = 60, // (GridTemplateAreasValue*) for grid-template-areas
|
||||
|
||||
eCSSUnit_Integer = 70, // (int) simple value
|
||||
eCSSUnit_Enumerated = 71, // (int) value has enumerated meaning
|
||||
@ -279,7 +333,6 @@ struct nsCSSValuePairList;
|
||||
struct nsCSSValuePairList_heap;
|
||||
struct nsCSSValueTriplet;
|
||||
struct nsCSSValueTriplet_heap;
|
||||
struct nsCSSValueGridTemplateAreas;
|
||||
class nsCSSValueFloatColor;
|
||||
|
||||
class nsCSSValue {
|
||||
@ -500,8 +553,8 @@ public:
|
||||
inline nsCSSValueTriplet& GetTripletValue();
|
||||
inline const nsCSSValueTriplet& GetTripletValue() const;
|
||||
|
||||
inline nsCSSValueGridTemplateAreas& GetGridTemplateAreas();
|
||||
inline const nsCSSValueGridTemplateAreas& GetGridTemplateAreas() const;
|
||||
inline mozilla::css::GridTemplateAreasValue& GetGridTemplateAreas();
|
||||
inline const mozilla::css::GridTemplateAreasValue& GetGridTemplateAreas() const;
|
||||
|
||||
mozilla::css::URLValue* GetURLStructValue() const
|
||||
{
|
||||
@ -581,7 +634,7 @@ public:
|
||||
nsCSSRect& SetRectValue();
|
||||
nsCSSValueList* SetListValue();
|
||||
nsCSSValuePairList* SetPairListValue();
|
||||
nsCSSValueGridTemplateAreas& SetGridTemplateAreas();
|
||||
mozilla::css::GridTemplateAreasValue& SetGridTemplateAreas();
|
||||
|
||||
void StartImageLoad(nsIDocument* aDocument) const; // Only pretend const
|
||||
|
||||
@ -614,6 +667,7 @@ protected:
|
||||
Array* mArray;
|
||||
mozilla::css::URLValue* mURL;
|
||||
mozilla::css::ImageValue* mImage;
|
||||
mozilla::css::GridTemplateAreasValue* mGridTemplateAreas;
|
||||
nsCSSValueGradient* mGradient;
|
||||
nsCSSValueTokenStream* mTokenStream;
|
||||
nsCSSValuePair_heap* mPair;
|
||||
@ -624,7 +678,6 @@ protected:
|
||||
nsCSSValueSharedList* mSharedList;
|
||||
nsCSSValuePairList_heap* mPairList;
|
||||
nsCSSValuePairList* mPairListDependent;
|
||||
nsCSSValueGridTemplateAreas* mGridTemplateAreas;
|
||||
nsCSSValueFloatColor* mFloatColor;
|
||||
} mValue;
|
||||
};
|
||||
@ -1193,7 +1246,7 @@ nsCSSValue::GetPairListValue() const
|
||||
}
|
||||
}
|
||||
|
||||
inline nsCSSValueGridTemplateAreas&
|
||||
inline mozilla::css::GridTemplateAreasValue&
|
||||
nsCSSValue::GetGridTemplateAreas()
|
||||
{
|
||||
NS_ABORT_IF_FALSE (mUnit == eCSSUnit_GridTemplateAreas,
|
||||
@ -1201,7 +1254,7 @@ nsCSSValue::GetGridTemplateAreas()
|
||||
return *mValue.mGridTemplateAreas;
|
||||
}
|
||||
|
||||
inline const nsCSSValueGridTemplateAreas&
|
||||
inline const mozilla::css::GridTemplateAreasValue&
|
||||
nsCSSValue::GetGridTemplateAreas() const
|
||||
{
|
||||
NS_ABORT_IF_FALSE (mUnit == eCSSUnit_GridTemplateAreas,
|
||||
@ -1506,62 +1559,5 @@ protected:
|
||||
static const corner_type corners[4];
|
||||
};
|
||||
|
||||
struct nsCSSGridNamedArea {
|
||||
nsString mName;
|
||||
uint32_t mColumnStart;
|
||||
uint32_t mColumnEnd;
|
||||
uint32_t mRowStart;
|
||||
uint32_t mRowEnd;
|
||||
};
|
||||
|
||||
struct nsCSSValueGridTemplateAreas {
|
||||
// Parsed value
|
||||
nsTArray<nsCSSGridNamedArea> mNamedAreas;
|
||||
|
||||
// Original <string> values. Length gives the number of rows,
|
||||
// content makes serialization easier.
|
||||
nsTArray<nsString> mTemplates;
|
||||
|
||||
// How many columns grid-template-areas contributes to the explicit grid.
|
||||
// http://dev.w3.org/csswg/css-grid/#explicit-grid
|
||||
uint32_t mNColumns;
|
||||
|
||||
// How many rows grid-template-areas contributes to the explicit grid.
|
||||
// http://dev.w3.org/csswg/css-grid/#explicit-grid
|
||||
uint32_t NRows() const {
|
||||
return mTemplates.Length();
|
||||
}
|
||||
|
||||
nsCSSValueGridTemplateAreas()
|
||||
: mNColumns(0)
|
||||
// Default constructors for mNamedAreas and mTemplates: empty arrays.
|
||||
{
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
mNamedAreas.Clear();
|
||||
mTemplates.Clear();
|
||||
mNColumns = 0;
|
||||
}
|
||||
|
||||
void AppendToString(nsCSSProperty aProperty, nsAString& aResult,
|
||||
nsCSSValue::Serialization aValueSerialization) const;
|
||||
|
||||
bool operator==(const nsCSSValueGridTemplateAreas& aOther) const
|
||||
{
|
||||
return mTemplates == aOther.mTemplates;
|
||||
}
|
||||
|
||||
bool operator!=(const nsCSSValueGridTemplateAreas& aOther) const
|
||||
{
|
||||
return !(*this == aOther);
|
||||
}
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(nsCSSValueGridTemplateAreas)
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
};
|
||||
|
||||
#endif /* nsCSSValue_h___ */
|
||||
|
||||
|
@ -7234,8 +7234,8 @@ SetGridTrackList(const nsCSSValue& aValue,
|
||||
|
||||
static void
|
||||
SetGridTemplateAreas(const nsCSSValue& aValue,
|
||||
nsCSSValueGridTemplateAreas& aResult,
|
||||
const nsCSSValueGridTemplateAreas& aParentValue,
|
||||
css::GridTemplateAreasValue& aResult,
|
||||
const css::GridTemplateAreasValue& aParentValue,
|
||||
bool& aCanStoreInRuleTree)
|
||||
{
|
||||
switch (aValue.GetUnit()) {
|
||||
|
@ -1300,7 +1300,7 @@ struct nsStylePosition {
|
||||
// in nsStyleStruct.cpp
|
||||
nsStyleGridTrackList mGridTemplateColumns;
|
||||
nsStyleGridTrackList mGridTemplateRows;
|
||||
nsCSSValueGridTemplateAreas mGridTemplateAreas;
|
||||
mozilla::css::GridTemplateAreasValue mGridTemplateAreas;
|
||||
|
||||
// We represent the "grid-auto-position" property in two parts:
|
||||
nsStyleGridLine mGridAutoPositionColumn;
|
||||
|
Loading…
x
Reference in New Issue
Block a user