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

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

Issue 2478233002: Make 'transform' a presentation attribute on SVG elements (Closed)
Patch Set: Rebase Created 4 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
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 SVGPathElement& pathElement = toSVGPathElement(*targetElement); 71 SVGPathElement& pathElement = toSVGPathElement(*targetElement);
72 Path pathData = pathElement.asPath(); 72 Path pathData = pathElement.asPath();
73 if (pathData.isEmpty()) 73 if (pathData.isEmpty())
74 return nullptr; 74 return nullptr;
75 75
76 // Spec: The transform attribute on the referenced 'path' element represents 76 // Spec: The transform attribute on the referenced 'path' element represents
77 // a supplemental transformation relative to the current user coordinate 77 // a supplemental transformation relative to the current user coordinate
78 // system for the current 'text' element, including any adjustments to the 78 // system for the current 'text' element, including any adjustments to the
79 // current user coordinate system due to a possible transform attribute on the 79 // current user coordinate system due to a possible transform attribute on the
80 // current 'text' element. http://www.w3.org/TR/SVG/text.html#TextPathElement 80 // current 'text' element. http://www.w3.org/TR/SVG/text.html#TextPathElement
81 pathData.transform(pathElement.calculateAnimatedLocalTransform()); 81 pathData.transform(
82 pathElement.calculateTransform(SVGElement::IncludeMotionTransform));
82 83
83 return PathPositionMapper::create(pathData); 84 return PathPositionMapper::create(pathData);
84 } 85 }
85 86
86 float LayoutSVGTextPath::calculateStartOffset(float pathLength) const { 87 float LayoutSVGTextPath::calculateStartOffset(float pathLength) const {
87 const SVGLength& startOffset = 88 const SVGLength& startOffset =
88 *toSVGTextPathElement(node())->startOffset()->currentValue(); 89 *toSVGTextPathElement(node())->startOffset()->currentValue();
89 float textPathStartOffset = startOffset.valueAsPercentage(); 90 float textPathStartOffset = startOffset.valueAsPercentage();
90 if (startOffset.typeWithCalcResolved() == 91 if (startOffset.typeWithCalcResolved() ==
91 CSSPrimitiveValue::UnitType::Percentage) 92 CSSPrimitiveValue::UnitType::Percentage)
92 textPathStartOffset *= pathLength; 93 textPathStartOffset *= pathLength;
93 94
94 return textPathStartOffset; 95 return textPathStartOffset;
95 } 96 }
96 97
97 } // namespace blink 98 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698