MCPcopy Create free account
hub / github.com/Snapchat/Valdi / nthChildMatchesIndex

Function nthChildMatchesIndex

valdi/src/valdi/runtime/CSS/CSSNode.cpp:179–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179inline 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
190void CSSNode::insertDeclarations(const CSSDocument& cssDocument,
191 const CSSProcessedRuleIndex& ruleIndex,

Callers 1

insertDeclarationsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected