bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const
{
    if (type() != other.type())
        return false;

    switch (type()) {
    case UnitType::Unknown:
        return false;
    case UnitType::Number:
    case UnitType::Percentage:
    case UnitType::Ems:
    case UnitType::Exs:
    case UnitType::Rems:
    case UnitType::Pixels:
    case UnitType::Centimeters:
    case UnitType::DotsPerPixel:
    case UnitType::DotsPerInch:
    case UnitType::DotsPerCentimeter:
    case UnitType::Millimeters:
    case UnitType::Inches:
    case UnitType::Points:
    case UnitType::Picas:
    case UnitType::Degrees:
    case UnitType::Radians:
    case UnitType::Gradians:
    case UnitType::Milliseconds:
    case UnitType::Seconds:
    case UnitType::Hertz:
    case UnitType::Kilohertz:
    case UnitType::Turns:
    case UnitType::ViewportWidth:
    case UnitType::ViewportHeight:
    case UnitType::ViewportMin:
    case UnitType::ViewportMax:
    case UnitType::Fraction:
        return m_value.num == other.m_value.num;
    case UnitType::PropertyID:
        return m_value.propertyID == other.m_value.propertyID;
    case UnitType::ValueID:
        return m_value.valueID == other.m_value.valueID;
    case UnitType::CustomIdentifier:
    case UnitType::String:
    case UnitType::URI:
        return equal(m_value.string, other.m_value.string);
    case UnitType::RGBColor:
        return m_value.rgbcolor == other.m_value.rgbcolor;
    case UnitType::Calc:
        return m_value.calc && other.m_value.calc && m_value.calc->equals(*other.m_value.calc);
    case UnitType::Integer:
    case UnitType::Chs:
    case UnitType::CalcPercentageWithNumber:
    case UnitType::CalcPercentageWithLength:
    case UnitType::QuirkyEms:
        return false;
    }
    return false;
}