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

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

Issue 1580293008: Fix incorrect handling of small non-percentage value for 'startOffset' on <textPath> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 // Spec: The transform attribute on the referenced 'path' element represent s a 51 // Spec: The transform attribute on the referenced 'path' element represent s a
52 // supplemental transformation relative to the current user coordinate syste m for 52 // supplemental transformation relative to the current user coordinate syste m for
53 // the current 'text' element, including any adjustments to the current user coordinate 53 // the current 'text' element, including any adjustments to the current user coordinate
54 // system due to a possible transform attribute on the current 'text' elemen t. 54 // system due to a possible transform attribute on the current 'text' elemen t.
55 // http://www.w3.org/TR/SVG/text.html#TextPathElement 55 // http://www.w3.org/TR/SVG/text.html#TextPathElement
56 pathData.transform(pathElement.calculateAnimatedLocalTransform()); 56 pathData.transform(pathElement.calculateAnimatedLocalTransform());
57 return pathData; 57 return pathData;
58 } 58 }
59 59
60 float LayoutSVGTextPath::startOffset() const 60 float LayoutSVGTextPath::calculateStartOffset(float pathLength) const
61 { 61 {
62 return toSVGTextPathElement(node())->startOffset()->currentValue()->valueAsP ercentage(); 62 const SVGLength& startOffset = *toSVGTextPathElement(node())->startOffset()- >currentValue();
63 float textPathStartOffset = startOffset.valueAsPercentage();
64 if (startOffset.typeWithCalcResolved() == CSSPrimitiveValue::UnitType::Perce ntage)
65 textPathStartOffset *= pathLength;
66
67 return textPathStartOffset;
63 } 68 }
64 69
65 } // namespace blink 70 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698