Bug 1420117 - Part 3: Add a ServoCSSParser::ParseCounterStyleDescriptor method. r=xidorn

MozReview-Commit-ID: LHBZ4j1Ji9R

--HG--
extra : rebase_source : 800a6271bd524403a9f4dbfb9c9a07dc4e85db8d
This commit is contained in:
Cameron McCormack 2017-11-24 17:26:41 +08:00
parent 5e6e7b03ee
commit bb4a39a577
4 changed files with 33 additions and 0 deletions

View File

@ -757,6 +757,11 @@ SERVO_BINDING_FUNC(Servo_ParseTransformIntoMatrix, bool,
RawGeckoGfxMatrix4x4* result);
SERVO_BINDING_FUNC(Servo_ParseCounterStyleName, nsAtom*,
const nsACString* value);
SERVO_BINDING_FUNC(Servo_ParseCounterStyleDescriptor, bool,
nsCSSCounterDesc aDescriptor,
const nsACString* aValue,
RawGeckoURLExtraData* aURLExtraData,
nsCSSValue* aResult);
// AddRef / Release functions
#define SERVO_ARC_TYPE(name_, type_) \

View File

@ -517,6 +517,7 @@ structs-types = [
"StyleShapeSource",
"StyleTransition",
"gfxFontFeatureValueSet",
"nsCSSCounterDesc",
"nsCSSCounterStyleRule",
"nsCSSFontFaceRule",
"nsCSSKeyword",

View File

@ -40,3 +40,14 @@ ServoCSSParser::ParseCounterStyleName(const nsAString& aValue)
nsAtom* atom = Servo_ParseCounterStyleName(&value);
return already_AddRefed<nsAtom>(atom);
}
/* static */ bool
ServoCSSParser::ParseCounterStyleDescriptor(nsCSSCounterDesc aDescriptor,
const nsAString& aValue,
URLExtraData* aURLExtraData,
nsCSSValue& aResult)
{
NS_ConvertUTF16toUTF8 value(aValue);
return Servo_ParseCounterStyleDescriptor(aDescriptor, &value, aURLExtraData,
&aResult);
}

View File

@ -58,6 +58,22 @@ public:
* or nullptr if parsing failed or if the name was invalid (like "inherit").
*/
static already_AddRefed<nsAtom> ParseCounterStyleName(const nsAString& aValue);
/**
* Parses a @counter-style descriptor.
*
* @param aDescriptor The descriptor to parse.
* @param aValue The value of the descriptor.
* @param aURLExtraData URL data for parsing. This would be used for
* image value URL resolution.
* @param aResult The nsCSSValue to store the result in.
* @return Whether parsing succeeded.
*/
static bool
ParseCounterStyleDescriptor(nsCSSCounterDesc aDescriptor,
const nsAString& aValue,
URLExtraData* aURLExtraData,
nsCSSValue& aResult);
};
} // namespace mozilla