| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org> | 4 * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org> |
| 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 6 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "core/svg/SVGMaskElement.h" | 26 #include "core/svg/SVGMaskElement.h" |
| 27 | 27 |
| 28 #include "core/rendering/svg/RenderSVGResourceMasker.h" | 28 #include "core/rendering/svg/RenderSVGResourceMasker.h" |
| 29 #include "core/svg/SVGElementInstance.h" | 29 #include "core/svg/SVGElementInstance.h" |
| 30 | 30 |
| 31 namespace WebCore { | 31 namespace WebCore { |
| 32 | 32 |
| 33 inline SVGMaskElement::SVGMaskElement(Document& document) | 33 inline SVGMaskElement::SVGMaskElement(Document& document) |
| 34 : SVGElement(SVGNames::maskTag, document) | 34 : SVGElement(SVGNames::maskTag, document) |
| 35 , SVGTests(this) | 35 , SVGTests(this) |
| 36 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) | 36 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth), AllowNegativeLengths)) |
| 37 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) | 37 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight), AllowNegativeLengths)) |
| 38 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) | 38 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth), ForbidNegativeLengths)) |
| 39 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) | 39 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight), ForbidNegativeLengths)) |
| 40 , m_maskUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create(this
, SVGNames::maskUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)) | 40 , m_maskUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create(this
, SVGNames::maskUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)) |
| 41 , m_maskContentUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::crea
te(this, SVGNames::maskContentUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEON
USE)) | 41 , m_maskContentUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::crea
te(this, SVGNames::maskContentUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEON
USE)) |
| 42 { | 42 { |
| 43 ScriptWrappable::init(this); | 43 ScriptWrappable::init(this); |
| 44 | 44 |
| 45 // Spec: If the x/y attribute is not specified, the effect is as if a value
of "-10%" were specified. | 45 // Spec: If the x/y attribute is not specified, the effect is as if a value
of "-10%" were specified. |
| 46 m_x->setDefaultValueAsString("-10%"); | 46 m_x->setDefaultValueAsString("-10%"); |
| 47 m_y->setDefaultValueAsString("-10%"); | 47 m_y->setDefaultValueAsString("-10%"); |
| 48 | 48 |
| 49 // Spec: If the width/height attribute is not specified, the effect is as if
a value of "120%" were specified. | 49 // Spec: If the width/height attribute is not specified, the effect is as if
a value of "120%" were specified. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 { | 82 { |
| 83 SVGParsingError parseError = NoError; | 83 SVGParsingError parseError = NoError; |
| 84 | 84 |
| 85 if (!isSupportedAttribute(name)) | 85 if (!isSupportedAttribute(name)) |
| 86 SVGElement::parseAttribute(name, value); | 86 SVGElement::parseAttribute(name, value); |
| 87 else if (name == SVGNames::maskUnitsAttr) | 87 else if (name == SVGNames::maskUnitsAttr) |
| 88 m_maskUnits->setBaseValueAsString(value, parseError); | 88 m_maskUnits->setBaseValueAsString(value, parseError); |
| 89 else if (name == SVGNames::maskContentUnitsAttr) | 89 else if (name == SVGNames::maskContentUnitsAttr) |
| 90 m_maskContentUnits->setBaseValueAsString(value, parseError); | 90 m_maskContentUnits->setBaseValueAsString(value, parseError); |
| 91 else if (name == SVGNames::xAttr) | 91 else if (name == SVGNames::xAttr) |
| 92 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 92 m_x->setBaseValueAsString(value, parseError); |
| 93 else if (name == SVGNames::yAttr) | 93 else if (name == SVGNames::yAttr) |
| 94 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 94 m_y->setBaseValueAsString(value, parseError); |
| 95 else if (name == SVGNames::widthAttr) | 95 else if (name == SVGNames::widthAttr) |
| 96 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); | 96 m_width->setBaseValueAsString(value, parseError); |
| 97 else if (name == SVGNames::heightAttr) | 97 else if (name == SVGNames::heightAttr) |
| 98 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError)
; | 98 m_height->setBaseValueAsString(value, parseError); |
| 99 else if (SVGTests::parseAttribute(name, value)) { | 99 else if (SVGTests::parseAttribute(name, value)) { |
| 100 } else | 100 } else |
| 101 ASSERT_NOT_REACHED(); | 101 ASSERT_NOT_REACHED(); |
| 102 | 102 |
| 103 reportAttributeParsingError(parseError, name, value); | 103 reportAttributeParsingError(parseError, name, value); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) | 106 void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) |
| 107 { | 107 { |
| 108 if (!isSupportedAttribute(attrName)) { | 108 if (!isSupportedAttribute(attrName)) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 bool SVGMaskElement::selfHasRelativeLengths() const | 142 bool SVGMaskElement::selfHasRelativeLengths() const |
| 143 { | 143 { |
| 144 return m_x->currentValue()->isRelative() | 144 return m_x->currentValue()->isRelative() |
| 145 || m_y->currentValue()->isRelative() | 145 || m_y->currentValue()->isRelative() |
| 146 || m_width->currentValue()->isRelative() | 146 || m_width->currentValue()->isRelative() |
| 147 || m_height->currentValue()->isRelative(); | 147 || m_height->currentValue()->isRelative(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } | 150 } |
| OLD | NEW |