| 130 | } |
| 131 | |
| 132 | Result<Ref<CSSAttributes>> CSSDocument::getAttributesForClass(const StringBox& className) const { |
| 133 | const auto& it = _rootNode.ruleIndex->classRules.find(className); |
| 134 | if (it == _rootNode.ruleIndex->classRules.end()) { |
| 135 | return Error(STRING_FORMAT("Could not find CSS rule '{}'", className)); |
| 136 | } |
| 137 | |
| 138 | return Valdi::makeShared<CSSAttributes>(it->second.styles); |
| 139 | } |
| 140 | |
| 141 | const ResourceId& CSSDocument::getResourceId() const { |
| 142 | return _resourceId; |