Bug 1420117 - Part 1: Add a ServoCSSParser::ParseCounterStyleName method. r=xidorn

MozReview-Commit-ID: DAaUi5lLrFS

--HG--
extra : rebase_source : 5b53cbfc9a1286e7ece3a62fb20b536de28a73d6
This commit is contained in:
Cameron McCormack 2017-11-24 15:52:26 +08:00
parent 1d69d9bcb9
commit aaf7ca9322
3 changed files with 19 additions and 0 deletions

View File

@ -755,6 +755,8 @@ SERVO_BINDING_FUNC(Servo_ParseTransformIntoMatrix, bool,
const nsAString* value,
bool* contains_3d_transform,
RawGeckoGfxMatrix4x4* result);
SERVO_BINDING_FUNC(Servo_ParseCounterStyleName, nsAtom*,
const nsACString* value);
// AddRef / Release functions
#define SERVO_ARC_TYPE(name_, type_) \

View File

@ -32,3 +32,11 @@ ServoCSSParser::ParseIntersectionObserverRootMargin(const nsAString& aValue,
{
return Servo_ParseIntersectionObserverRootMargin(&aValue, aResult);
}
/* static */ already_AddRefed<nsAtom>
ServoCSSParser::ParseCounterStyleName(const nsAString& aValue)
{
NS_ConvertUTF16toUTF8 value(aValue);
nsAtom* atom = Servo_ParseCounterStyleName(&value);
return already_AddRefed<nsAtom>(atom);
}

View File

@ -49,6 +49,15 @@ public:
*/
static bool ParseIntersectionObserverRootMargin(const nsAString& aValue,
nsCSSRect* aResult);
/**
* Parses a @counter-style name.
*
* @param aValue The name to parse.
* @return The name as an atom, lowercased if a built-in counter style name,
* or nullptr if parsing failed or if the name was invalid (like "inherit").
*/
static already_AddRefed<nsAtom> ParseCounterStyleName(const nsAString& aValue);
};
} // namespace mozilla