| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2007 Apple Inc. 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 * |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 inline SVGSVGElement::SVGSVGElement(Document& doc) | 72 inline SVGSVGElement::SVGSVGElement(Document& doc) |
| 73 : SVGGraphicsElement(SVGNames::svgTag, doc) | 73 : SVGGraphicsElement(SVGNames::svgTag, doc) |
| 74 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) | 74 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) |
| 75 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) | 75 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) |
| 76 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) | 76 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) |
| 77 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) | 77 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) |
| 78 , m_viewBox(SVGAnimatedRect::create(this, SVGNames::viewBoxAttr)) | 78 , m_viewBox(SVGAnimatedRect::create(this, SVGNames::viewBoxAttr)) |
| 79 , m_useCurrentView(false) | 79 , m_useCurrentView(false) |
| 80 , m_zoomAndPan(SVGZoomAndPanMagnify) | 80 , m_zoomAndPan(SVGZoomAndPanMagnify) |
| 81 , m_timeContainer(SMILTimeContainer::create(this)) | 81 , m_timeContainer(SMILTimeContainer::create(this)) |
| 82 , m_translation(SVGPoint::create()) |
| 82 , m_weakFactory(this) | 83 , m_weakFactory(this) |
| 83 { | 84 { |
| 84 ScriptWrappable::init(this); | 85 ScriptWrappable::init(this); |
| 85 | 86 |
| 86 m_width->setDefaultValueAsString("100%"); | 87 m_width->setDefaultValueAsString("100%"); |
| 87 m_height->setDefaultValueAsString("100%"); | 88 m_height->setDefaultValueAsString("100%"); |
| 88 | 89 |
| 89 addToPropertyMap(m_x); | 90 addToPropertyMap(m_x); |
| 90 addToPropertyMap(m_y); | 91 addToPropertyMap(m_y); |
| 91 addToPropertyMap(m_width); | 92 addToPropertyMap(m_width); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 199 |
| 199 // The behaviour of setCurrentScale() is undefined, when we're dealing with
non-standalone SVG documents. | 200 // The behaviour of setCurrentScale() is undefined, when we're dealing with
non-standalone SVG documents. |
| 200 // We choose the ignore this call, it's pretty useless to support calling se
tCurrentScale() from within | 201 // We choose the ignore this call, it's pretty useless to support calling se
tCurrentScale() from within |
| 201 // an embedded SVG document, for the same reasons as in currentScale() - nee
ds resolution by SVG WG. | 202 // an embedded SVG document, for the same reasons as in currentScale() - nee
ds resolution by SVG WG. |
| 202 if (frameTree.parent()) | 203 if (frameTree.parent()) |
| 203 return; | 204 return; |
| 204 | 205 |
| 205 frame->setPageZoomFactor(scale); | 206 frame->setPageZoomFactor(scale); |
| 206 } | 207 } |
| 207 | 208 |
| 208 void SVGSVGElement::setCurrentTranslate(const FloatPoint& translation) | 209 class SVGCurrentTranslateTearOff : public SVGPointTearOff { |
| 210 public: |
| 211 static PassRefPtr<SVGCurrentTranslateTearOff> create(SVGSVGElement* contextE
lement) |
| 212 { |
| 213 return adoptRef(new SVGCurrentTranslateTearOff(contextElement)); |
| 214 } |
| 215 |
| 216 virtual void commitChange() |
| 217 { |
| 218 ASSERT(contextElement()); |
| 219 toSVGSVGElement(contextElement())->updateCurrentTranslate(); |
| 220 } |
| 221 |
| 222 private: |
| 223 SVGCurrentTranslateTearOff(SVGSVGElement* contextElement) |
| 224 : SVGPointTearOff(contextElement->m_translation, contextElement, Propert
yIsNotAnimVal) |
| 225 { |
| 226 } |
| 227 }; |
| 228 |
| 229 PassRefPtr<SVGPointTearOff> SVGSVGElement::currentTranslateFromJavascript() |
| 209 { | 230 { |
| 210 m_translation = translation; | 231 return SVGCurrentTranslateTearOff::create(this); |
| 232 } |
| 233 |
| 234 void SVGSVGElement::setCurrentTranslate(const FloatPoint& point) |
| 235 { |
| 236 m_translation->setValue(point); |
| 211 updateCurrentTranslate(); | 237 updateCurrentTranslate(); |
| 212 } | 238 } |
| 213 | 239 |
| 214 void SVGSVGElement::updateCurrentTranslate() | 240 void SVGSVGElement::updateCurrentTranslate() |
| 215 { | 241 { |
| 216 if (RenderObject* object = renderer()) | 242 if (RenderObject* object = renderer()) |
| 217 object->setNeedsLayout(); | 243 object->setNeedsLayout(); |
| 218 | 244 |
| 219 if (parentNode() == document() && document().renderer()) | 245 if (parentNode() == document() && document().renderer()) |
| 220 document().renderer()->repaint(); | 246 document().renderer()->repaint(); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 PassRefPtr<SVGLengthTearOff> SVGSVGElement::createSVGLength() | 412 PassRefPtr<SVGLengthTearOff> SVGSVGElement::createSVGLength() |
| 387 { | 413 { |
| 388 return SVGLengthTearOff::create(SVGLength::create(), 0, PropertyIsNotAnimVal
); | 414 return SVGLengthTearOff::create(SVGLength::create(), 0, PropertyIsNotAnimVal
); |
| 389 } | 415 } |
| 390 | 416 |
| 391 SVGAngle SVGSVGElement::createSVGAngle() | 417 SVGAngle SVGSVGElement::createSVGAngle() |
| 392 { | 418 { |
| 393 return SVGAngle(); | 419 return SVGAngle(); |
| 394 } | 420 } |
| 395 | 421 |
| 396 SVGPoint SVGSVGElement::createSVGPoint() | 422 PassRefPtr<SVGPointTearOff> SVGSVGElement::createSVGPoint() |
| 397 { | 423 { |
| 398 return SVGPoint(); | 424 return SVGPointTearOff::create(SVGPoint::create(), 0, PropertyIsNotAnimVal); |
| 399 } | 425 } |
| 400 | 426 |
| 401 SVGMatrix SVGSVGElement::createSVGMatrix() | 427 SVGMatrix SVGSVGElement::createSVGMatrix() |
| 402 { | 428 { |
| 403 return SVGMatrix(); | 429 return SVGMatrix(); |
| 404 } | 430 } |
| 405 | 431 |
| 406 PassRefPtr<SVGRectTearOff> SVGSVGElement::createSVGRect() | 432 PassRefPtr<SVGRectTearOff> SVGSVGElement::createSVGRect() |
| 407 { | 433 { |
| 408 return SVGRectTearOff::create(SVGRect::create(), 0, PropertyIsNotAnimVal); | 434 return SVGRectTearOff::create(SVGRect::create(), 0, PropertyIsNotAnimVal); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 continue; | 797 continue; |
| 772 | 798 |
| 773 Element* element = toElement(node); | 799 Element* element = toElement(node); |
| 774 if (element->getIdAttribute() == id) | 800 if (element->getIdAttribute() == id) |
| 775 return element; | 801 return element; |
| 776 } | 802 } |
| 777 return 0; | 803 return 0; |
| 778 } | 804 } |
| 779 | 805 |
| 780 } | 806 } |
| OLD | NEW |