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

Side by Side Diff: Source/core/rendering/svg/RenderSVGTextPath.cpp

Issue 143263011: Convert SVG <text> and descendants to use RenderObject::isChildAllowed (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #include "config.h" 20 #include "config.h"
21 21
22 #include "core/rendering/svg/RenderSVGTextPath.h" 22 #include "core/rendering/svg/RenderSVGTextPath.h"
23 23
24 #include "SVGNames.h" 24 #include "SVGNames.h"
25 #include "core/rendering/svg/SVGPathData.h" 25 #include "core/rendering/svg/SVGPathData.h"
26 #include "core/rendering/svg/SVGRenderSupport.h"
26 #include "core/svg/SVGPathElement.h" 27 #include "core/svg/SVGPathElement.h"
27 #include "core/svg/SVGTextPathElement.h" 28 #include "core/svg/SVGTextPathElement.h"
28 29
29 namespace WebCore { 30 namespace WebCore {
30 31
31 RenderSVGTextPath::RenderSVGTextPath(Element* element) 32 RenderSVGTextPath::RenderSVGTextPath(Element* element)
32 : RenderSVGInline(element) 33 : RenderSVGInline(element)
33 { 34 {
34 } 35 }
35 36
37 bool RenderSVGTextPath::isChildAllowed(RenderObject* child, RenderStyle*) const
38 {
39 if (child->isText())
40 return !SVGRenderSupport::isEmptySVGInlineText(child);
41
42 #if ENABLE(SVG_FONTS)
43 // 'altGlyph' is supported by the content model for 'textPath', but...
44 if (child->node()->hasTagName(SVGNames::altGlyphTag))
45 return false;
46 #endif
47
48 return child->isSVGInline() && !child->isSVGTextPath();
49 }
50
36 Path RenderSVGTextPath::layoutPath() const 51 Path RenderSVGTextPath::layoutPath() const
37 { 52 {
38 SVGTextPathElement* textPathElement = toSVGTextPathElement(node()); 53 SVGTextPathElement* textPathElement = toSVGTextPathElement(node());
39 Element* targetElement = SVGURIReference::targetElementFromIRIString(textPat hElement->hrefCurrentValue(), textPathElement->document()); 54 Element* targetElement = SVGURIReference::targetElementFromIRIString(textPat hElement->hrefCurrentValue(), textPathElement->document());
40 if (!targetElement || !targetElement->hasTagName(SVGNames::pathTag)) 55 if (!targetElement || !targetElement->hasTagName(SVGNames::pathTag))
41 return Path(); 56 return Path();
42 57
43 SVGPathElement* pathElement = toSVGPathElement(targetElement); 58 SVGPathElement* pathElement = toSVGPathElement(targetElement);
44 59
45 Path pathData; 60 Path pathData;
46 updatePathFromGraphicsElement(pathElement, pathData); 61 updatePathFromGraphicsElement(pathElement, pathData);
47 62
48 // Spec: The transform attribute on the referenced 'path' element represent s a 63 // Spec: The transform attribute on the referenced 'path' element represent s a
49 // supplemental transformation relative to the current user coordinate syste m for 64 // supplemental transformation relative to the current user coordinate syste m for
50 // the current 'text' element, including any adjustments to the current user coordinate 65 // the current 'text' element, including any adjustments to the current user coordinate
51 // system due to a possible transform attribute on the current 'text' elemen t. 66 // system due to a possible transform attribute on the current 'text' elemen t.
52 // http://www.w3.org/TR/SVG/text.html#TextPathElement 67 // http://www.w3.org/TR/SVG/text.html#TextPathElement
53 pathData.transform(pathElement->animatedLocalTransform()); 68 pathData.transform(pathElement->animatedLocalTransform());
54 return pathData; 69 return pathData;
55 } 70 }
56 71
57 float RenderSVGTextPath::startOffset() const 72 float RenderSVGTextPath::startOffset() const
58 { 73 {
59 return toSVGTextPathElement(node())->startOffset()->currentValue()->valueAsP ercentage(); 74 return toSVGTextPathElement(node())->startOffset()->currentValue()->valueAsP ercentage();
60 } 75 }
61 76
62 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698