| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "core/svg/SVGLength.h" | 23 #include "core/svg/SVGLength.h" |
| 24 #include "core/svg/SVGPreserveAspectRatio.h" | 24 #include "core/svg/SVGPreserveAspectRatio.h" |
| 25 #include "platform/transforms/AffineTransform.h" | 25 #include "platform/transforms/AffineTransform.h" |
| 26 | 26 |
| 27 namespace WebCore { | 27 namespace WebCore { |
| 28 | 28 |
| 29 class SVGPatternElement; | 29 class SVGPatternElement; |
| 30 | 30 |
| 31 struct PatternAttributes { | 31 struct PatternAttributes { |
| 32 PatternAttributes() | 32 PatternAttributes() |
| 33 : m_x() | 33 : m_x(SVGLength::create(LengthModeWidth)) |
| 34 , m_y() | 34 , m_y(SVGLength::create(LengthModeHeight)) |
| 35 , m_width() | 35 , m_width(SVGLength::create(LengthModeWidth)) |
| 36 , m_height() | 36 , m_height(SVGLength::create(LengthModeHeight)) |
| 37 , m_viewBox() | 37 , m_viewBox() |
| 38 , m_preserveAspectRatio() | 38 , m_preserveAspectRatio() |
| 39 , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) | 39 , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) |
| 40 , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) | 40 , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) |
| 41 , m_patternContentElement(0) | 41 , m_patternContentElement(0) |
| 42 , m_xSet(false) | 42 , m_xSet(false) |
| 43 , m_ySet(false) | 43 , m_ySet(false) |
| 44 , m_widthSet(false) | 44 , m_widthSet(false) |
| 45 , m_heightSet(false) | 45 , m_heightSet(false) |
| 46 , m_viewBoxSet(false) | 46 , m_viewBoxSet(false) |
| 47 , m_preserveAspectRatioSet(false) | 47 , m_preserveAspectRatioSet(false) |
| 48 , m_patternUnitsSet(false) | 48 , m_patternUnitsSet(false) |
| 49 , m_patternContentUnitsSet(false) | 49 , m_patternContentUnitsSet(false) |
| 50 , m_patternTransformSet(false) | 50 , m_patternTransformSet(false) |
| 51 , m_patternContentElementSet(false) | 51 , m_patternContentElementSet(false) |
| 52 { | 52 { |
| 53 } | 53 } |
| 54 | 54 |
| 55 SVGLength x() const { return m_x; } | 55 SVGLength* x() const { return m_x.get(); } |
| 56 SVGLength y() const { return m_y; } | 56 SVGLength* y() const { return m_y.get(); } |
| 57 SVGLength width() const { return m_width; } | 57 SVGLength* width() const { return m_width.get(); } |
| 58 SVGLength height() const { return m_height; } | 58 SVGLength* height() const { return m_height.get(); } |
| 59 FloatRect viewBox() const { return m_viewBox; } | 59 FloatRect viewBox() const { return m_viewBox; } |
| 60 SVGPreserveAspectRatio preserveAspectRatio() const { return m_preserveAspect
Ratio; } | 60 SVGPreserveAspectRatio preserveAspectRatio() const { return m_preserveAspect
Ratio; } |
| 61 SVGUnitTypes::SVGUnitType patternUnits() const { return m_patternUnits; } | 61 SVGUnitTypes::SVGUnitType patternUnits() const { return m_patternUnits; } |
| 62 SVGUnitTypes::SVGUnitType patternContentUnits() const { return m_patternCont
entUnits; } | 62 SVGUnitTypes::SVGUnitType patternContentUnits() const { return m_patternCont
entUnits; } |
| 63 AffineTransform patternTransform() const { return m_patternTransform; } | 63 AffineTransform patternTransform() const { return m_patternTransform; } |
| 64 const SVGPatternElement* patternContentElement() const { return m_patternCon
tentElement; } | 64 const SVGPatternElement* patternContentElement() const { return m_patternCon
tentElement; } |
| 65 | 65 |
| 66 void setX(const SVGLength& value) | 66 void setX(PassRefPtr<SVGLength> value) |
| 67 { | 67 { |
| 68 m_x = value; | 68 m_x = value; |
| 69 m_xSet = true; | 69 m_xSet = true; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void setY(const SVGLength& value) | 72 void setY(PassRefPtr<SVGLength> value) |
| 73 { | 73 { |
| 74 m_y = value; | 74 m_y = value; |
| 75 m_ySet = true; | 75 m_ySet = true; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void setWidth(const SVGLength& value) | 78 void setWidth(PassRefPtr<SVGLength> value) |
| 79 { | 79 { |
| 80 m_width = value; | 80 m_width = value; |
| 81 m_widthSet = true; | 81 m_widthSet = true; |
| 82 } | 82 } |
| 83 | 83 |
| 84 void setHeight(const SVGLength& value) | 84 void setHeight(PassRefPtr<SVGLength> value) |
| 85 { | 85 { |
| 86 m_height = value; | 86 m_height = value; |
| 87 m_heightSet = true; | 87 m_heightSet = true; |
| 88 } | 88 } |
| 89 | 89 |
| 90 void setViewBox(const FloatRect& value) | 90 void setViewBox(const FloatRect& value) |
| 91 { | 91 { |
| 92 m_viewBox = value; | 92 m_viewBox = value; |
| 93 m_viewBoxSet = true; | 93 m_viewBoxSet = true; |
| 94 } | 94 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 bool hasHeight() const { return m_heightSet; } | 129 bool hasHeight() const { return m_heightSet; } |
| 130 bool hasViewBox() const { return m_viewBoxSet; } | 130 bool hasViewBox() const { return m_viewBoxSet; } |
| 131 bool hasPreserveAspectRatio() const { return m_preserveAspectRatioSet; } | 131 bool hasPreserveAspectRatio() const { return m_preserveAspectRatioSet; } |
| 132 bool hasPatternUnits() const { return m_patternUnitsSet; } | 132 bool hasPatternUnits() const { return m_patternUnitsSet; } |
| 133 bool hasPatternContentUnits() const { return m_patternContentUnitsSet; } | 133 bool hasPatternContentUnits() const { return m_patternContentUnitsSet; } |
| 134 bool hasPatternTransform() const { return m_patternTransformSet; } | 134 bool hasPatternTransform() const { return m_patternTransformSet; } |
| 135 bool hasPatternContentElement() const { return m_patternContentElementSet; } | 135 bool hasPatternContentElement() const { return m_patternContentElementSet; } |
| 136 | 136 |
| 137 private: | 137 private: |
| 138 // Properties | 138 // Properties |
| 139 SVGLength m_x; | 139 RefPtr<SVGLength> m_x; |
| 140 SVGLength m_y; | 140 RefPtr<SVGLength> m_y; |
| 141 SVGLength m_width; | 141 RefPtr<SVGLength> m_width; |
| 142 SVGLength m_height; | 142 RefPtr<SVGLength> m_height; |
| 143 FloatRect m_viewBox; | 143 FloatRect m_viewBox; |
| 144 SVGPreserveAspectRatio m_preserveAspectRatio; | 144 SVGPreserveAspectRatio m_preserveAspectRatio; |
| 145 SVGUnitTypes::SVGUnitType m_patternUnits; | 145 SVGUnitTypes::SVGUnitType m_patternUnits; |
| 146 SVGUnitTypes::SVGUnitType m_patternContentUnits; | 146 SVGUnitTypes::SVGUnitType m_patternContentUnits; |
| 147 AffineTransform m_patternTransform; | 147 AffineTransform m_patternTransform; |
| 148 const SVGPatternElement* m_patternContentElement; | 148 const SVGPatternElement* m_patternContentElement; |
| 149 | 149 |
| 150 // Property states | 150 // Property states |
| 151 bool m_xSet : 1; | 151 bool m_xSet : 1; |
| 152 bool m_ySet : 1; | 152 bool m_ySet : 1; |
| 153 bool m_widthSet : 1; | 153 bool m_widthSet : 1; |
| 154 bool m_heightSet : 1; | 154 bool m_heightSet : 1; |
| 155 bool m_viewBoxSet : 1; | 155 bool m_viewBoxSet : 1; |
| 156 bool m_preserveAspectRatioSet : 1; | 156 bool m_preserveAspectRatioSet : 1; |
| 157 bool m_patternUnitsSet : 1; | 157 bool m_patternUnitsSet : 1; |
| 158 bool m_patternContentUnitsSet : 1; | 158 bool m_patternContentUnitsSet : 1; |
| 159 bool m_patternTransformSet : 1; | 159 bool m_patternTransformSet : 1; |
| 160 bool m_patternContentElementSet : 1; | 160 bool m_patternContentElementSet : 1; |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 } // namespace WebCore | 163 } // namespace WebCore |
| 164 | 164 |
| 165 #endif | 165 #endif |
| OLD | NEW |