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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 float zeroWidth = | 380 float zeroWidth = |
381 fontData->getFontMetrics().zeroWidth() / style->effectiveZoom(); | 381 fontData->getFontMetrics().zeroWidth() / style->effectiveZoom(); |
382 if (!zeroWidth) | 382 if (!zeroWidth) |
383 return 0; | 383 return 0; |
384 | 384 |
385 return value / zeroWidth; | 385 return value / zeroWidth; |
386 } | 386 } |
387 | 387 |
388 float SVGLengthContext::convertValueFromCHSToUserUnits(float value) const { | 388 float SVGLengthContext::convertValueFromCHSToUserUnits(float value) const { |
389 const ComputedStyle* style = computedStyleForLengthResolving(m_context); | 389 const ComputedStyle* style = computedStyleForLengthResolving(m_context); |
| 390 if (!style) |
| 391 return 0; |
| 392 |
390 const SimpleFontData* fontData = style->font().primaryFont(); | 393 const SimpleFontData* fontData = style->font().primaryFont(); |
391 if (!style || !fontData) | 394 if (!fontData) |
392 return 0; | 395 return 0; |
393 | 396 |
394 return value * fontData->getFontMetrics().zeroWidth() / | 397 return value * fontData->getFontMetrics().zeroWidth() / |
395 style->effectiveZoom(); | 398 style->effectiveZoom(); |
396 } | 399 } |
397 | 400 |
398 float SVGLengthContext::convertValueFromUserUnitsToEXS(float value) const { | 401 float SVGLengthContext::convertValueFromUserUnitsToEXS(float value) const { |
399 const ComputedStyle* style = computedStyleForLengthResolving(m_context); | 402 const ComputedStyle* style = computedStyleForLengthResolving(m_context); |
400 const SimpleFontData* fontData = style->font().primaryFont(); | 403 const SimpleFontData* fontData = style->font().primaryFont(); |
401 if (!style || !fontData) | 404 if (!style || !fontData) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 const ComputedStyle* rootStyle = rootElementStyle(m_context); | 460 const ComputedStyle* rootStyle = rootElementStyle(m_context); |
458 if (!rootStyle) | 461 if (!rootStyle) |
459 return 0; | 462 return 0; |
460 | 463 |
461 CSSToLengthConversionData conversionData = CSSToLengthConversionData( | 464 CSSToLengthConversionData conversionData = CSSToLengthConversionData( |
462 style, rootStyle, m_context->document().layoutViewItem(), 1.0f); | 465 style, rootStyle, m_context->document().layoutViewItem(), 1.0f); |
463 Length length = primitiveValue.convertToLength(conversionData); | 466 Length length = primitiveValue.convertToLength(conversionData); |
464 return valueForLength(length, 1.0f, mode); | 467 return valueForLength(length, 1.0f, mode); |
465 } | 468 } |
466 } // namespace blink | 469 } // namespace blink |
OLD | NEW |