| 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 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2011. 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 static float convertValueFromPercentageToUserUnits(const SVGLength& value, const
FloatSize& viewportSize) | 51 static float convertValueFromPercentageToUserUnits(const SVGLength& value, const
FloatSize& viewportSize) |
| 52 { | 52 { |
| 53 return CSSPrimitiveValue::clampToCSSLengthRange(value.scaleByPercentage(dime
nsionForLengthMode(value.unitMode(), viewportSize))); | 53 return CSSPrimitiveValue::clampToCSSLengthRange(value.scaleByPercentage(dime
nsionForLengthMode(value.unitMode(), viewportSize))); |
| 54 } | 54 } |
| 55 | 55 |
| 56 static const ComputedStyle* computedStyleForLengthResolving(const SVGElement* co
ntext) | 56 static const ComputedStyle* computedStyleForLengthResolving(const SVGElement* co
ntext) |
| 57 { | 57 { |
| 58 if (!context) | 58 if (!context) |
| 59 return 0; | 59 return nullptr; |
| 60 | 60 |
| 61 const ContainerNode* currentContext = context; | 61 const ContainerNode* currentContext = context; |
| 62 do { | 62 do { |
| 63 if (currentContext->layoutObject()) | 63 if (currentContext->layoutObject()) |
| 64 return currentContext->layoutObject()->style(); | 64 return currentContext->layoutObject()->style(); |
| 65 currentContext = currentContext->parentNode(); | 65 currentContext = currentContext->parentNode(); |
| 66 } while (currentContext); | 66 } while (currentContext); |
| 67 | 67 |
| 68 // There must be at least a LayoutSVGRoot layoutObject, carrying a style. | 68 // There must be at least a LayoutSVGRoot layoutObject, carrying a style. |
| 69 ASSERT_NOT_REACHED(); | 69 ASSERT_NOT_REACHED(); |
| 70 return 0; | 70 return nullptr; |
| 71 } | 71 } |
| 72 | 72 |
| 73 static const ComputedStyle* rootElementStyle(const Node* context) | 73 static const ComputedStyle* rootElementStyle(const Node* context) |
| 74 { | 74 { |
| 75 if (!context) | 75 if (!context) |
| 76 return 0; | 76 return nullptr; |
| 77 | 77 |
| 78 const Document& document = context->document(); | 78 const Document& document = context->document(); |
| 79 Node* documentElement = document.documentElement(); | 79 Node* documentElement = document.documentElement(); |
| 80 const ComputedStyle* documentStyle = document.computedStyle(); | 80 const ComputedStyle* documentStyle = document.computedStyle(); |
| 81 const ComputedStyle* style = documentElement && context != documentElement ?
documentElement->computedStyle() : documentStyle; | 81 const ComputedStyle* style = documentElement && context != documentElement ?
documentElement->computedStyle() : documentStyle; |
| 82 if (!style) | 82 if (!style) |
| 83 style = documentStyle; | 83 style = documentStyle; |
| 84 return style; | 84 return style; |
| 85 } | 85 } |
| 86 | 86 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 | 345 |
| 346 const SVGSVGElement& svg = toSVGSVGElement(*viewportElement); | 346 const SVGSVGElement& svg = toSVGSVGElement(*viewportElement); |
| 347 viewportSize = svg.currentViewBoxRect().size(); | 347 viewportSize = svg.currentViewBoxRect().size(); |
| 348 if (viewportSize.isEmpty()) | 348 if (viewportSize.isEmpty()) |
| 349 viewportSize = svg.currentViewportSize(); | 349 viewportSize = svg.currentViewportSize(); |
| 350 | 350 |
| 351 return true; | 351 return true; |
| 352 } | 352 } |
| 353 | 353 |
| 354 } | 354 } |
| OLD | NEW |