| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 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) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #include "config.h" | 22 #include "config.h" |
| 23 #include "core/svg/SVGPatternElement.h" | 23 #include "core/svg/SVGPatternElement.h" |
| 24 | 24 |
| 25 #include "core/XLinkNames.h" | 25 #include "core/XLinkNames.h" |
| 26 #include "core/dom/ElementTraversal.h" | 26 #include "core/dom/ElementTraversal.h" |
| 27 #include "core/rendering/svg/RenderSVGResourcePattern.h" | 27 #include "core/layout/svg/LayoutSVGResourcePattern.h" |
| 28 #include "core/svg/PatternAttributes.h" | 28 #include "core/svg/PatternAttributes.h" |
| 29 #include "platform/transforms/AffineTransform.h" | 29 #include "platform/transforms/AffineTransform.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 inline SVGPatternElement::SVGPatternElement(Document& document) | 33 inline SVGPatternElement::SVGPatternElement(Document& document) |
| 34 : SVGElement(SVGNames::patternTag, document) | 34 : SVGElement(SVGNames::patternTag, document) |
| 35 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth), AllowNegativeLengths)) | 35 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth), AllowNegativeLengths)) |
| 36 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight), AllowNegativeLengths)) | 36 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight), AllowNegativeLengths)) |
| 37 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth), ForbidNegativeLengths)) | 37 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth), ForbidNegativeLengths)) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 | 102 |
| 103 SVGElement::InvalidationGuard invalidationGuard(this); | 103 SVGElement::InvalidationGuard invalidationGuard(this); |
| 104 | 104 |
| 105 if (attrName == SVGNames::xAttr | 105 if (attrName == SVGNames::xAttr |
| 106 || attrName == SVGNames::yAttr | 106 || attrName == SVGNames::yAttr |
| 107 || attrName == SVGNames::widthAttr | 107 || attrName == SVGNames::widthAttr |
| 108 || attrName == SVGNames::heightAttr) | 108 || attrName == SVGNames::heightAttr) |
| 109 updateRelativeLengthsInformation(); | 109 updateRelativeLengthsInformation(); |
| 110 | 110 |
| 111 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re
nderer()); | 111 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->re
nderer()); |
| 112 if (renderer) | 112 if (renderer) |
| 113 renderer->invalidateCacheAndMarkForLayout(); | 113 renderer->invalidateCacheAndMarkForLayout(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void SVGPatternElement::childrenChanged(const ChildrenChange& change) | 116 void SVGPatternElement::childrenChanged(const ChildrenChange& change) |
| 117 { | 117 { |
| 118 SVGElement::childrenChanged(change); | 118 SVGElement::childrenChanged(change); |
| 119 | 119 |
| 120 if (change.byParser) | 120 if (change.byParser) |
| 121 return; | 121 return; |
| 122 | 122 |
| 123 if (LayoutObject* object = renderer()) | 123 if (LayoutObject* object = renderer()) |
| 124 object->setNeedsLayoutAndFullPaintInvalidation(); | 124 object->setNeedsLayoutAndFullPaintInvalidation(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 LayoutObject* SVGPatternElement::createRenderer(const LayoutStyle&) | 127 LayoutObject* SVGPatternElement::createRenderer(const LayoutStyle&) |
| 128 { | 128 { |
| 129 return new RenderSVGResourcePattern(this); | 129 return new LayoutSVGResourcePattern(this); |
| 130 } | 130 } |
| 131 | 131 |
| 132 static void setPatternAttributes(const SVGPatternElement* element, PatternAttrib
utes& attributes) | 132 static void setPatternAttributes(const SVGPatternElement* element, PatternAttrib
utes& attributes) |
| 133 { | 133 { |
| 134 if (!attributes.hasX() && element->x()->isSpecified()) | 134 if (!attributes.hasX() && element->x()->isSpecified()) |
| 135 attributes.setX(element->x()->currentValue()); | 135 attributes.setX(element->x()->currentValue()); |
| 136 | 136 |
| 137 if (!attributes.hasY() && element->y()->isSpecified()) | 137 if (!attributes.hasY() && element->y()->isSpecified()) |
| 138 attributes.setY(element->y()->currentValue()); | 138 attributes.setY(element->y()->currentValue()); |
| 139 | 139 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 bool SVGPatternElement::selfHasRelativeLengths() const | 200 bool SVGPatternElement::selfHasRelativeLengths() const |
| 201 { | 201 { |
| 202 return m_x->currentValue()->isRelative() | 202 return m_x->currentValue()->isRelative() |
| 203 || m_y->currentValue()->isRelative() | 203 || m_y->currentValue()->isRelative() |
| 204 || m_width->currentValue()->isRelative() | 204 || m_width->currentValue()->isRelative() |
| 205 || m_height->currentValue()->isRelative(); | 205 || m_height->currentValue()->isRelative(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace blink | 208 } // namespace blink |
| OLD | NEW |