Bug 1363596 part 2 - Add support for symbols() function. r=heycam

MozReview-Commit-ID: IuFnhkdWG3C

--HG--
extra : source : 7eccc8ee6a73c9756c58989dd1e408361dedf74f
This commit is contained in:
Xidorn Quan 2017-05-27 23:33:25 +10:00
Родитель 118e3a973d
Коммит 96c6933bd7
7 изменённых файлов: 42 добавлений и 10 удалений

Просмотреть файл

@ -147,6 +147,7 @@ function treatAsSafeArgument(entry, varName, csuName)
// an attribute or a naming convention.
["Gecko_CopyFontFamilyFrom", "dst", null],
["Gecko_SetCounterStyleToName", "aPtr", null],
["Gecko_SetCounterStyleToSymbols", "aPtr", null],
["Gecko_CopyCounterStyle", "aDst", null],
["Gecko_SetMozBinding", "aDisplay", null],
[/ClassOrClassList/, /aClass/, null],

Просмотреть файл

@ -31,5 +31,5 @@ fails-if(webrender) == dependent-builtin.html dependent-builtin-ref.ht
== redefine-builtin.html redefine-builtin-ref.html
== redefine-attr-mapping.html redefine-attr-mapping-ref.html
== disclosure-styles.html disclosure-styles-ref.html
fails-if(styloVsGecko||stylo) == symbols-function.html symbols-function-ref.html
== symbols-function.html symbols-function-ref.html
== symbols-function-invalid.html symbols-function-invalid-ref.html

Просмотреть файл

@ -1701,16 +1701,31 @@ AnonymousCounterStyle::AnonymousCounterStyle(const nsSubstring& aContent)
mSymbols.AppendElement(aContent);
}
static nsTArray<nsString>
CollectSymbolsFromCSSValueList(const nsCSSValueList* aList)
{
nsTArray<nsString> symbols;
for (const nsCSSValueList* item = aList; item; item = item->mNext) {
item->mValue.GetStringValue(*symbols.AppendElement());
}
symbols.Compact();
return symbols;
}
AnonymousCounterStyle::AnonymousCounterStyle(const nsCSSValue::Array* aParams)
: AnonymousCounterStyle(
aParams->Item(0).GetIntValue(),
CollectSymbolsFromCSSValueList(aParams->Item(1).GetListValue()))
{
}
AnonymousCounterStyle::AnonymousCounterStyle(uint8_t aSystem,
nsTArray<nsString> aSymbols)
: CounterStyle(NS_STYLE_LIST_STYLE_CUSTOM)
, mSingleString(false)
, mSystem(aParams->Item(0).GetIntValue())
, mSystem(aSystem)
, mSymbols(Move(aSymbols))
{
for (const nsCSSValueList* item = aParams->Item(1).GetListValue();
item; item = item->mNext) {
item->mValue.GetStringValue(*mSymbols.AppendElement());
}
mSymbols.Compact();
}
/* virtual */ void

Просмотреть файл

@ -104,6 +104,7 @@ class AnonymousCounterStyle final : public CounterStyle
{
public:
explicit AnonymousCounterStyle(const nsSubstring& aContent);
AnonymousCounterStyle(uint8_t aSystem, nsTArray<nsString> aSymbols);
explicit AnonymousCounterStyle(const nsCSSValue::Array* aValue);
virtual void GetStyleName(nsAString& aResult) override;

Просмотреть файл

@ -1164,6 +1164,18 @@ Gecko_SetCounterStyleToName(CounterStylePtr* aPtr, nsIAtom* aName)
*aPtr = already_AddRefed<nsIAtom>(aName);
}
void
Gecko_SetCounterStyleToSymbols(CounterStylePtr* aPtr, uint8_t aSymbolsType,
nsACString const* const* aSymbols,
uint32_t aSymbolsCount)
{
nsTArray<nsString> symbols(aSymbolsCount);
for (uint32_t i = 0; i < aSymbolsCount; i++) {
symbols.AppendElement(NS_ConvertUTF8toUTF16(*aSymbols[i]));
}
*aPtr = new AnonymousCounterStyle(aSymbolsType, Move(symbols));
}
void
Gecko_CopyCounterStyle(CounterStylePtr* aDst, const CounterStylePtr* aSrc)
{

Просмотреть файл

@ -276,6 +276,10 @@ void Gecko_CopyImageOrientationFrom(nsStyleVisibility* aDst,
// Counter style.
// This function takes an already addrefed nsIAtom
void Gecko_SetCounterStyleToName(mozilla::CounterStylePtr* ptr, nsIAtom* name);
void Gecko_SetCounterStyleToSymbols(mozilla::CounterStylePtr* ptr,
uint8_t symbols_type,
nsACString const* const* symbols,
uint32_t symbols_count);
void Gecko_CopyCounterStyle(mozilla::CounterStylePtr* dst,
const mozilla::CounterStylePtr* src);

Просмотреть файл

@ -53,9 +53,8 @@ to mochitest command.
* test_transitions_and_reframes.html `pseudo-element`: bug 1366422 [4]
* Events:
* test_animations_event_order.html [2]
* symbols() function and string value on list-style-type bug 1363596
* test_value_storage.html `symbols(` [30]
* ... `list-style-type` [8]
* string value on list-style-type bug 1363596
* test_value_storage.html `list-style-type` [8]
* ... `'list-style'` [18]
* Unimplemented \@font-face descriptors:
* test_font_face_parser.html `font-language-override`: bug 1355364 [8]