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

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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::startOffset() const
61 { 61 {
62 return toSVGTextPathElement(node())->startOffset()->currentValue()->valueAsP ercentage(); 62 float textPathStartOffset = toSVGTextPathElement(node())->startOffset()->cur rentValue()->valueAsPercentage();
63 if (isPercentageForStartOffset()) {
64 if (textPathStartOffset > 0 && textPathStartOffset <= 1)
fs 2016/01/28 14:00:20 This condition does not do anything useful. The sp
65 textPathStartOffset *= layoutPath().length();
fs 2016/01/28 14:00:20 We don't want to call layoutPath() again here - an
66 }
67 return textPathStartOffset;
68 }
69
70 bool LayoutSVGTextPath::isPercentageForStartOffset() const
fs 2016/01/28 14:00:20 Don't need this method - just inline this check in
71 {
72 return toSVGTextPathElement(node())->startOffset()->currentValue()->isPercen tage();
63 } 73 }
64 74
65 } // namespace blink 75 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698