Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGLengthContext.cpp

Issue 2445463002: Fix null-check in SVGLengthContext::convertValueFromCHSToUserUnits (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698