mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1336891 - stylo: Implement custom property value getter. r=emilio
MozReview-Commit-ID: AfAJtNJyCSO --HG-- extra : rebase_source : 04a5fa6f2fb7b86f67c225156d08b1bf56348ea3
This commit is contained in:
parent
9cd0a83e9f
commit
8306874bfd
@ -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; \
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user