Bug 1336891 - stylo: Implement custom property value getter. r=emilio

MozReview-Commit-ID: AfAJtNJyCSO

--HG--
extra : rebase_source : 04a5fa6f2fb7b86f67c225156d08b1bf56348ea3
This commit is contained in:
Fernando Jimenez Moreno 2017-06-22 20:06:57 +02:00
parent 9cd0a83e9f
commit 8306874bfd
2 changed files with 10 additions and 3 deletions

View File

@ -545,6 +545,11 @@ SERVO_BINDING_FUNC(Servo_SerializeFontValueForCanvas, void,
RawServoDeclarationBlockBorrowed declarations,
nsAString* buffer)
// Get custom property value.
SERVO_BINDING_FUNC(Servo_GetCustomProperty, bool,
ServoComputedValuesBorrowed computed_values,
const nsAString* name, nsAString* value)
// Style-struct management.
#define STYLE_STRUCT(name, checkdata_cb) \
struct nsStyle##name; \

View File

@ -6913,12 +6913,14 @@ nsComputedDOMStyle::DoGetCustomProperty(const nsAString& aPropertyName)
{
MOZ_ASSERT(nsCSSProps::IsCustomPropertyName(aPropertyName));
const nsStyleVariables* variables = StyleVariables();
nsString variableValue;
const nsAString& name = Substring(aPropertyName,
CSS_CUSTOM_NAME_PREFIX_LENGTH);
if (!variables->mVariables.Get(name, variableValue)) {
bool present = mStyleContext->IsServo()
? Servo_GetCustomProperty(mStyleContext->ComputedValues(),
&name, &variableValue)
: StyleVariables()->mVariables.Get(name, variableValue);
if (!present) {
return nullptr;
}