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

Side by Side Diff: Source/core/svg/SVGSVGElement.cpp

Issue 87453003: Less magic numbers in converting CSS lengths of cm/mm/pc/pt types. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 years 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 | « Source/core/svg/SVGLengthContext.cpp ('k') | 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, 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 SVGRect SVGSVGElement::viewport() const 139 SVGRect SVGSVGElement::viewport() const
140 { 140 {
141 // FIXME: This method doesn't follow the spec and is basically untested. Par ent documents are not considered here. 141 // FIXME: This method doesn't follow the spec and is basically untested. Par ent documents are not considered here.
142 // As we have no test coverage for this, we're going to disable it completly for now. 142 // As we have no test coverage for this, we're going to disable it completly for now.
143 return SVGRect(); 143 return SVGRect();
144 } 144 }
145 145
146 float SVGSVGElement::pixelUnitToMillimeterX() const 146 float SVGSVGElement::pixelUnitToMillimeterX() const
147 { 147 {
148 // 2.54 / cssPixelsPerInch gives CM. 148 return 1 / cssPixelsPerMillimeter;
149 return (2.54f / cssPixelsPerInch) * 10.0f;
150 } 149 }
151 150
152 float SVGSVGElement::pixelUnitToMillimeterY() const 151 float SVGSVGElement::pixelUnitToMillimeterY() const
153 { 152 {
154 // 2.54 / cssPixelsPerInch gives CM. 153 return 1 / cssPixelsPerMillimeter;
155 return (2.54f / cssPixelsPerInch) * 10.0f;
156 } 154 }
157 155
158 float SVGSVGElement::screenPixelToMillimeterX() const 156 float SVGSVGElement::screenPixelToMillimeterX() const
159 { 157 {
160 return pixelUnitToMillimeterX(); 158 return pixelUnitToMillimeterX();
161 } 159 }
162 160
163 float SVGSVGElement::screenPixelToMillimeterY() const 161 float SVGSVGElement::screenPixelToMillimeterY() const
164 { 162 {
165 return pixelUnitToMillimeterY(); 163 return pixelUnitToMillimeterY();
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 continue; 773 continue;
776 774
777 Element* element = toElement(node); 775 Element* element = toElement(node);
778 if (element->getIdAttribute() == id) 776 if (element->getIdAttribute() == id)
779 return element; 777 return element;
780 } 778 }
781 return 0; 779 return 0;
782 } 780 }
783 781
784 } 782 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGLengthContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698