Length StyleBuilderConverter::convertLengthOrAuto(StyleResolverState& state, CSSValue* value) { CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); Length result = primitiveValue->convertToLength<FixedConversion | PercentConversion | AutoConversion>(state.cssToLengthConversionData()); result.setQuirk(primitiveValue->isQuirkValue()); return result; }
virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); if (noneEnabled && primitiveValue->getIdent() == CSSValueNone) if (noneUndefined) setValue(selector->style(), Length(undefinedLength, Fixed)); else setValue(selector->style(), Length()); else if (intrinsicEnabled && primitiveValue->getIdent() == CSSValueIntrinsic) setValue(selector->style(), Length(Intrinsic)); else if (minIntrinsicEnabled && primitiveValue->getIdent() == CSSValueMinIntrinsic) setValue(selector->style(), Length(MinIntrinsic)); else if (autoEnabled && primitiveValue->getIdent() == CSSValueAuto) setValue(selector->style(), Length()); else { int type = primitiveValue->primitiveType(); if (CSSPrimitiveValue::isUnitTypeLength(type)) setValue(selector->style(), Length(primitiveValue->computeLengthIntForLength(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()), Fixed, primitiveValue->isQuirkValue())); else if (type == CSSPrimitiveValue::CSS_PERCENTAGE) setValue(selector->style(), Length(primitiveValue->getDoubleValue(), Percent)); } }