| 143 | } |
| 144 | |
| 145 | Result<Ref<CSSDocument>> CSSDocument::parse(const ResourceId& resourceId, |
| 146 | const Byte* data, |
| 147 | size_t len, |
| 148 | AttributeIds& attributeIds) { |
| 149 | Valdi::StyleNode styleNodeRoot; |
| 150 | |
| 151 | bool parsed = styleNodeRoot.ParseFromArray(data, static_cast<int>(len)); |
| 152 | if (!parsed) { |
| 153 | return Error("Failed to parse CSS document"); |
| 154 | } |
| 155 | |
| 156 | return Valdi::makeShared<CSSDocument>(resourceId, styleNodeRoot, attributeIds); |
| 157 | } |
| 158 | |
| 159 | VALDI_CLASS_IMPL(CSSDocument) |
| 160 |