| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2009 Google, Inc. All rights reserved. | 4 * Copyright (C) 2009 Google, Inc. All rights reserved. |
| 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 if (styleUpdateStrategy == AllowStyleUpdate) | 80 if (styleUpdateStrategy == AllowStyleUpdate) |
| 81 element->document()->updateLayoutIgnorePendingStylesheets(); | 81 element->document()->updateLayoutIgnorePendingStylesheets(); |
| 82 | 82 |
| 83 AffineTransform ctm; | 83 AffineTransform ctm; |
| 84 | 84 |
| 85 SVGElement* stopAtElement = mode == NearestViewportScope ? nearestViewportEl
ement(element) : 0; | 85 SVGElement* stopAtElement = mode == NearestViewportScope ? nearestViewportEl
ement(element) : 0; |
| 86 for (Element* currentElement = element; currentElement; currentElement = cur
rentElement->parentOrShadowHostElement()) { | 86 for (Element* currentElement = element; currentElement; currentElement = cur
rentElement->parentOrShadowHostElement()) { |
| 87 if (!currentElement->isSVGElement()) | 87 if (!currentElement->isSVGElement()) |
| 88 break; | 88 break; |
| 89 | 89 |
| 90 if (toSVGElement(currentElement)->isSVGStyledElement()) | 90 ctm = toSVGElement(currentElement)->localCoordinateSpaceTransform(mode).
multiply(ctm); |
| 91 ctm = toSVGStyledElement(currentElement)->localCoordinateSpaceTransf
orm(mode).multiply(ctm); | |
| 92 | 91 |
| 93 // For getCTM() computation, stop at the nearest viewport element | 92 // For getCTM() computation, stop at the nearest viewport element |
| 94 if (currentElement == stopAtElement) | 93 if (currentElement == stopAtElement) |
| 95 break; | 94 break; |
| 96 } | 95 } |
| 97 | 96 |
| 98 return ctm; | 97 return ctm; |
| 99 } | 98 } |
| 100 | 99 |
| 101 AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, Exceptio
nCode& ec, StyleUpdateStrategy styleUpdateStrategy) | 100 AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, Exceptio
nCode& ec, StyleUpdateStrategy styleUpdateStrategy) |
| 102 { | 101 { |
| 103 AffineTransform ctm = getCTM(styleUpdateStrategy); | 102 AffineTransform ctm = getCTM(styleUpdateStrategy); |
| 104 | 103 |
| 105 if (target && target->isSVGGraphicsElement()) { | 104 if (target && target->isSVGGraphicsElement()) { |
| 106 AffineTransform targetCTM = toSVGGraphicsElement(target)->getCTM(styleUp
dateStrategy); | 105 AffineTransform targetCTM = toSVGGraphicsElement(target)->getCTM(styleUp
dateStrategy); |
| 107 if (!targetCTM.isInvertible()) { | 106 if (!targetCTM.isInvertible()) { |
| 108 ec = InvalidStateError; | 107 ec = InvalidStateError; |
| 109 return ctm; | 108 return ctm; |
| 110 } | 109 } |
| 111 ctm = targetCTM.inverse() * ctm; | 110 ctm = targetCTM.inverse() * ctm; |
| 112 } | 111 } |
| 113 | 112 |
| 114 return ctm; | 113 return ctm; |
| 115 } | 114 } |
| 116 | 115 |
| 117 } | 116 } |
| OLD | NEW |