Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | |
michael@0 | 2 | /* |
michael@0 | 3 | * Copyright 2006 The Android Open Source Project |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | |
michael@0 | 10 | #include "SkSVGElements.h" |
michael@0 | 11 | #include "SkSVGParser.h" |
michael@0 | 12 | |
michael@0 | 13 | SkSVGBase::~SkSVGBase() { |
michael@0 | 14 | } |
michael@0 | 15 | |
michael@0 | 16 | void SkSVGBase::addAttribute(SkSVGParser& parser, int attrIndex, |
michael@0 | 17 | const char* attrValue, size_t attrLength) { |
michael@0 | 18 | SkString* first = (SkString*) ((char*) this + sizeof(SkSVGElement)); |
michael@0 | 19 | first += attrIndex; |
michael@0 | 20 | first->set(attrValue, attrLength); |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | |
michael@0 | 24 | SkSVGElement::SkSVGElement() : fParent(NULL), fIsDef(false), fIsNotDef(true) { |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | SkSVGElement::~SkSVGElement() { |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | SkSVGElement* SkSVGElement::getGradient() { |
michael@0 | 31 | return NULL; |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | bool SkSVGElement::isGroupParent() { |
michael@0 | 35 | SkSVGElement* parent = fParent; |
michael@0 | 36 | while (parent) { |
michael@0 | 37 | if (parent->getType() != SkSVGType_G) |
michael@0 | 38 | return false; |
michael@0 | 39 | parent = parent->fParent; |
michael@0 | 40 | } |
michael@0 | 41 | return true; |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | bool SkSVGElement::isDef() { |
michael@0 | 45 | return isGroupParent() == false ? fParent->isDef() : fIsDef; |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | bool SkSVGElement::isFlushable() { |
michael@0 | 49 | return true; |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | bool SkSVGElement::isGroup() { |
michael@0 | 53 | return false; |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | bool SkSVGElement::isNotDef() { |
michael@0 | 57 | return isGroupParent() == false ? fParent->isNotDef() : fIsNotDef; |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | bool SkSVGElement::onEndElement(SkSVGParser& parser) { |
michael@0 | 61 | if (f_id.size() > 0) |
michael@0 | 62 | parser.getIDs().set(f_id.c_str(), f_id.size(), this); |
michael@0 | 63 | return false; |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | bool SkSVGElement::onStartElement(SkSVGElement* child) { |
michael@0 | 67 | *fChildren.append() = child; |
michael@0 | 68 | return false; |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | void SkSVGElement::translate(SkSVGParser& parser, bool) { |
michael@0 | 72 | if (f_id.size() > 0) |
michael@0 | 73 | SVG_ADD_ATTRIBUTE(id); |
michael@0 | 74 | } |
michael@0 | 75 | |
michael@0 | 76 | void SkSVGElement::setIsDef() { |
michael@0 | 77 | fIsDef = isDef(); |
michael@0 | 78 | } |
michael@0 | 79 | |
michael@0 | 80 | //void SkSVGElement::setIsNotDef() { |
michael@0 | 81 | // fIsNotDef = isNotDef(); |
michael@0 | 82 | //} |
michael@0 | 83 | |
michael@0 | 84 | void SkSVGElement::write(SkSVGParser& , SkString& ) { |
michael@0 | 85 | SkASSERT(0); |
michael@0 | 86 | } |