| 105 | } |
| 106 | |
| 107 | std::optional<PercentValue> ValueConverter::parsePercent(AttributeParser& parser) { |
| 108 | auto d = parser.parseDimension(); |
| 109 | if (!d) { |
| 110 | return std::nullopt; |
| 111 | } |
| 112 | |
| 113 | if (d.value().unit == Dimension::Unit::Percent) { |
| 114 | return PercentValue(d.value().value, true); |
| 115 | } else { |
| 116 | return PercentValue(d.value().value, false); |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | Result<PercentValue> ValueConverter::toPercent(const Value& value) { |
| 121 | if (value.isNumber()) { |
nothing calls this directly
no test coverage detected