Lines Matching refs:Node
15 bool SkXMLParser::parse(const SkDOM& dom, const SkDOMNode* node) {
16 const char* elemName = dom.getName(node);
22 SkDOM::AttrIter iter(dom, node);
31 if ((node = dom.getFirstChild(node)) != nullptr) {
33 if (!this->parse(dom, node)) {
36 } while ((node = dom.getNextSibling(node)) != nullptr);
74 const SkDOM::Node* SkDOM::getRootNode() const {
78 const SkDOM::Node* SkDOM::getFirstChild(const Node* node, const char name[]) const {
79 SkASSERT(node);
80 const Node* child = node->fFirstChild;
92 const SkDOM::Node* SkDOM::getNextSibling(const Node* node, const char name[]) const {
93 SkASSERT(node);
94 const Node* sibling = node->fNextSibling;
105 SkDOM::Type SkDOM::getType(const Node* node) const {
106 SkASSERT(node);
107 return (Type)node->fType;
110 const char* SkDOM::getName(const Node* node) const {
111 SkASSERT(node);
112 return node->fName;
115 const char* SkDOM::findAttr(const Node* node, const char name[]) const {
116 SkASSERT(node);
117 const Attr* attr = node->attrs();
118 const Attr* stop = attr + node->fAttrCount;
131 const SkDOM::Attr* SkDOM::getFirstAttr(const Node* node) const {
132 return node->fAttrCount ? node->attrs() : nullptr;
135 const SkDOM::Attr* SkDOM::getNextAttr(const Node* node, const Attr* attr) const {
136 SkASSERT(node);
140 return (attr - node->attrs() + 1) < node->fAttrCount ? attr + 1 : nullptr;
143 const char* SkDOM::getAttrName(const Node* node, const Attr* attr) const {
144 SkASSERT(node);
149 const char* SkDOM::getAttrValue(const Node* node, const Attr* attr) const {
150 SkASSERT(node);
157 SkDOM::AttrIter::AttrIter(const SkDOM&, const SkDOM::Node* node) {
158 SkASSERT(node);
159 fAttr = node->attrs();
160 fStop = fAttr + node->fAttrCount;
196 SkDOM::Node* getRoot() const { return fRoot; }
206 SkDOM::Node* node = fAlloc->make<SkDOM::Node>();
208 node->fName = fElemName;
209 node->fFirstChild = nullptr;
210 node->fAttrCount = SkToU16(attrCount);
211 node->fAttrs = attrs;
212 node->fType = fElemType;
215 node->fNextSibling = nullptr;
216 fRoot = node;
218 SkDOM::Node* parent = fParentStack.top();
220 node->fNextSibling = parent->fFirstChild;
221 parent->fFirstChild = node;
223 *fParentStack.push() = node;
225 sk_careful_memcpy(node->attrs(), fAttrs.begin(), attrCount * sizeof(SkDOM::Attr));
248 SkDOM::Node* parent;
252 SkDOM::Node* child = parent->fFirstChild;
253 SkDOM::Node* prev = nullptr;
255 SkDOM::Node* next = child->fNextSibling;
283 SkTDArray<SkDOM::Node*> fParentStack;
285 SkDOM::Node* fRoot;
295 const SkDOM::Node* SkDOM::build(SkStream& docStream) {
310 static void walk_dom(const SkDOM& dom, const SkDOM::Node* node, SkXMLParser* parser) {
311 const char* elem = dom.getName(node);
312 if (dom.getType(node) == SkDOM::kText_Type) {
313 SkASSERT(dom.countChildren(node) == 0);
320 SkDOM::AttrIter iter(dom, node);
326 node = dom.getFirstChild(node, nullptr);
327 while (node)
329 walk_dom(dom, node, parser);
330 node = dom.getNextSibling(node, nullptr);
336 const SkDOM::Node* SkDOM::copy(const SkDOM& dom, const SkDOM::Node* node) {
339 walk_dom(dom, node, &parser);
352 const SkDOM::Node* SkDOM::finishParsing() {
362 int SkDOM::countChildren(const Node* node, const char elem[]) const {
365 node = this->getFirstChild(node, elem);
366 while (node) {
368 node = this->getNextSibling(node, elem);
377 bool SkDOM::findS32(const Node* node, const char name[], int32_t* value) const {
378 const char* vstr = this->findAttr(node, name);
382 bool SkDOM::findScalars(const Node* node, const char name[], SkScalar value[], int count) const {
383 const char* vstr = this->findAttr(node, name);
387 bool SkDOM::findHex(const Node* node, const char name[], uint32_t* value) const {
388 const char* vstr = this->findAttr(node, name);
392 bool SkDOM::findBool(const Node* node, const char name[], bool* value) const {
393 const char* vstr = this->findAttr(node, name);
397 int SkDOM::findList(const Node* node, const char name[], const char list[]) const {
398 const char* vstr = this->findAttr(node, name);
402 bool SkDOM::hasAttr(const Node* node, const char name[], const char value[]) const {
403 const char* vstr = this->findAttr(node, name);
407 bool SkDOM::hasS32(const Node* node, const char name[], int32_t target) const {
408 const char* vstr = this->findAttr(node, name);
413 bool SkDOM::hasScalar(const Node* node, const char name[], SkScalar target) const {
414 const char* vstr = this->findAttr(node, name);
419 bool SkDOM::hasHex(const Node* node, const char name[], uint32_t target) const {
420 const char* vstr = this->findAttr(node, name);
425 bool SkDOM::hasBool(const Node* node, const char name[], bool target) const {
426 const char* vstr = this->findAttr(node, name);