| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 SVGTransform SVGSVGElement::createSVGTransform() | 417 SVGTransform SVGSVGElement::createSVGTransform() |
| 418 { | 418 { |
| 419 return SVGTransform(SVGTransform::SVG_TRANSFORM_MATRIX); | 419 return SVGTransform(SVGTransform::SVG_TRANSFORM_MATRIX); |
| 420 } | 420 } |
| 421 | 421 |
| 422 SVGTransform SVGSVGElement::createSVGTransformFromMatrix(const SVGMatrix& matrix
) | 422 SVGTransform SVGSVGElement::createSVGTransformFromMatrix(const SVGMatrix& matrix
) |
| 423 { | 423 { |
| 424 return SVGTransform(static_cast<const AffineTransform&>(matrix)); | 424 return SVGTransform(static_cast<const AffineTransform&>(matrix)); |
| 425 } | 425 } |
| 426 | 426 |
| 427 AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMSc
ope mode) const | 427 AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGElement::CTMScop
e mode) const |
| 428 { | 428 { |
| 429 AffineTransform viewBoxTransform; | 429 AffineTransform viewBoxTransform; |
| 430 if (!hasEmptyViewBox()) { | 430 if (!hasEmptyViewBox()) { |
| 431 FloatSize size = currentViewportSize(); | 431 FloatSize size = currentViewportSize(); |
| 432 viewBoxTransform = viewBoxToViewTransform(size.width(), size.height()); | 432 viewBoxTransform = viewBoxToViewTransform(size.width(), size.height()); |
| 433 } | 433 } |
| 434 | 434 |
| 435 AffineTransform transform; | 435 AffineTransform transform; |
| 436 if (!isOutermostSVGSVGElement()) { | 436 if (!isOutermostSVGSVGElement()) { |
| 437 SVGLengthContext lengthContext(this); | 437 SVGLengthContext lengthContext(this); |
| 438 transform.translate(xCurrentValue().value(lengthContext), yCurrentValue(
).value(lengthContext)); | 438 transform.translate(xCurrentValue().value(lengthContext), yCurrentValue(
).value(lengthContext)); |
| 439 } else if (mode == SVGLocatable::ScreenScope) { | 439 } else if (mode == SVGElement::ScreenScope) { |
| 440 if (RenderObject* renderer = this->renderer()) { | 440 if (RenderObject* renderer = this->renderer()) { |
| 441 FloatPoint location; | 441 FloatPoint location; |
| 442 float zoomFactor = 1; | 442 float zoomFactor = 1; |
| 443 | 443 |
| 444 // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localT
oBorderBoxTransform | 444 // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localT
oBorderBoxTransform |
| 445 // to map an element from SVG viewport coordinates to CSS box coordi
nates. | 445 // to map an element from SVG viewport coordinates to CSS box coordi
nates. |
| 446 // RenderSVGRoot's localToAbsolute method expects CSS box coordinate
s. | 446 // RenderSVGRoot's localToAbsolute method expects CSS box coordinate
s. |
| 447 // We also need to adjust for the zoom level factored into CSS coord
inates (bug #96361). | 447 // We also need to adjust for the zoom level factored into CSS coord
inates (bug #96361). |
| 448 if (renderer->isSVGRoot()) { | 448 if (renderer->isSVGRoot()) { |
| 449 location = toRenderSVGRoot(renderer)->localToBorderBoxTransform(
).mapPoint(location); | 449 location = toRenderSVGRoot(renderer)->localToBorderBoxTransform(
).mapPoint(location); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 | 722 |
| 723 // Spec: If the SVG fragment identifier addresses a ‘view’ element within an
SVG document (e.g., MyDrawing.svg#MyView | 723 // Spec: If the SVG fragment identifier addresses a ‘view’ element within an
SVG document (e.g., MyDrawing.svg#MyView |
| 724 // or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor ‘svg’
element is displayed in the viewport. | 724 // or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor ‘svg’
element is displayed in the viewport. |
| 725 // Any view specification attributes included on the given ‘view’ element ov
erride the corresponding view specification | 725 // Any view specification attributes included on the given ‘view’ element ov
erride the corresponding view specification |
| 726 // attributes on the closest ancestor ‘svg’ element. | 726 // attributes on the closest ancestor ‘svg’ element. |
| 727 if (anchorNode && anchorNode->hasTagName(SVGNames::viewTag)) { | 727 if (anchorNode && anchorNode->hasTagName(SVGNames::viewTag)) { |
| 728 SVGViewElement* viewElement = toSVGViewElement(anchorNode); | 728 SVGViewElement* viewElement = toSVGViewElement(anchorNode); |
| 729 if (!viewElement) | 729 if (!viewElement) |
| 730 return; | 730 return; |
| 731 | 731 |
| 732 SVGElement* element = SVGLocatable::nearestViewportElement(viewElement); | 732 if (SVGSVGElement* svg = viewElement->ownerSVGElement()) { |
| 733 if (element->hasTagName(SVGNames::svgTag)) { | |
| 734 SVGSVGElement* svg = toSVGSVGElement(element); | |
| 735 svg->inheritViewAttributes(viewElement); | 733 svg->inheritViewAttributes(viewElement); |
| 736 | 734 |
| 737 if (RenderObject* renderer = svg->renderer()) | 735 if (RenderObject* renderer = svg->renderer()) |
| 738 RenderSVGResource::markForLayoutAndParentResourceInvalidation(re
nderer); | 736 RenderSVGResource::markForLayoutAndParentResourceInvalidation(re
nderer); |
| 739 } | 737 } |
| 740 } | 738 } |
| 741 | 739 |
| 742 // FIXME: We need to decide which <svg> to focus on, and zoom to it. | 740 // FIXME: We need to decide which <svg> to focus on, and zoom to it. |
| 743 // FIXME: We need to actually "highlight" the viewTarget(s). | 741 // FIXME: We need to actually "highlight" the viewTarget(s). |
| 744 } | 742 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 continue; | 777 continue; |
| 780 | 778 |
| 781 Element* element = toElement(node); | 779 Element* element = toElement(node); |
| 782 if (element->getIdAttribute() == id) | 780 if (element->getIdAttribute() == id) |
| 783 return element; | 781 return element; |
| 784 } | 782 } |
| 785 return 0; | 783 return 0; |
| 786 } | 784 } |
| 787 | 785 |
| 788 } | 786 } |
| OLD | NEW |