bool ParseTransformOrigin(bool aPerspective) { var position = new nsCSSValuePair(); if (!ParseBoxPositionValues(ref position, true)) return false; nsCSSProperty prop = nsCSSProperty.TransformOrigin; if (aPerspective) { if (!ExpectEndProperty()) { return false; } prop = nsCSSProperty.PerspectiveOrigin; } // Unlike many other uses of pairs, this position should always be stored // as a pair, even if the values are the same, so it always serializes as // a pair, and to keep the computation code simple. if (position.mXValue.GetUnit() == nsCSSUnit.Inherit || position.mXValue.GetUnit() == nsCSSUnit.Initial) { Debug.Assert(position.mXValue == position.mYValue, "inherit/initial only half?"); AppendValue(prop, position.mXValue); } else { var value = new nsCSSValue(); if (aPerspective) { value.SetPairValue(position.mXValue, position.mYValue); } else { var depth = new nsCSSValue(); if (!nsLayoutUtils.Are3DTransformsEnabled() || // only try parsing if 3-D transforms are enabled !ParseVariant(ref depth, VARIANT_LENGTH | VARIANT_CALC, null)) { depth.SetFloatValue(0.0f, nsCSSUnit.Pixel); } value.SetTripletValue(position.mXValue, position.mYValue, depth); } AppendValue(prop, value); } return true; }