| 177 | } |
| 178 | |
| 179 | inline bool nthChildMatchesIndex(const int index, const int n, const int offset) { |
| 180 | // nth-child element indexes start at one |
| 181 | auto adjustedIndex = index + 1; |
| 182 | if (n == 0) { |
| 183 | return adjustedIndex == offset; |
| 184 | } |
| 185 | |
| 186 | auto offsetIndex = adjustedIndex - offset; |
| 187 | return offsetIndex % n == 0 && offsetIndex / n >= 0; |
| 188 | } |
| 189 | |
| 190 | void CSSNode::insertDeclarations(const CSSDocument& cssDocument, |
| 191 | const CSSProcessedRuleIndex& ruleIndex, |