| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkDOM.h" | 10 #include "SkDOM.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 } | 233 } |
| 234 else // this adds siblings in reverse order. gets corrected in onEndE
lement() | 234 else // this adds siblings in reverse order. gets corrected in onEndE
lement() |
| 235 { | 235 { |
| 236 SkDOM::Node* parent = fParentStack.top(); | 236 SkDOM::Node* parent = fParentStack.top(); |
| 237 SkASSERT(fRoot && parent); | 237 SkASSERT(fRoot && parent); |
| 238 node->fNextSibling = parent->fFirstChild; | 238 node->fNextSibling = parent->fFirstChild; |
| 239 parent->fFirstChild = node; | 239 parent->fFirstChild = node; |
| 240 } | 240 } |
| 241 *fParentStack.push() = node; | 241 *fParentStack.push() = node; |
| 242 | 242 |
| 243 memcpy(node->attrs(), fAttrs.begin(), attrCount * sizeof(SkDOM::Attr)); | 243 sk_careful_memcpy(node->attrs(), fAttrs.begin(), attrCount * sizeof(SkDO
M::Attr)); |
| 244 fAttrs.reset(); | 244 fAttrs.reset(); |
| 245 | 245 |
| 246 } | 246 } |
| 247 | 247 |
| 248 bool onStartElement(const char elem[]) override { | 248 bool onStartElement(const char elem[]) override { |
| 249 this->startCommon(elem, SkDOM::kElement_Type); | 249 this->startCommon(elem, SkDOM::kElement_Type); |
| 250 return false; | 250 return false; |
| 251 } | 251 } |
| 252 | 252 |
| 253 bool onAddAttribute(const char name[], const char value[]) override { | 253 bool onAddAttribute(const char name[], const char value[]) override { |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 SkASSERT(v == nullptr); | 506 SkASSERT(v == nullptr); |
| 507 | 507 |
| 508 SkASSERT(dom.getFirstChild(root, "elem1")); | 508 SkASSERT(dom.getFirstChild(root, "elem1")); |
| 509 SkASSERT(!dom.getFirstChild(root, "subelem1")); | 509 SkASSERT(!dom.getFirstChild(root, "subelem1")); |
| 510 | 510 |
| 511 dom.dump(); | 511 dom.dump(); |
| 512 #endif | 512 #endif |
| 513 } | 513 } |
| 514 | 514 |
| 515 #endif | 515 #endif |
| OLD | NEW |