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

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

Issue 1914133002: Out-of-line some methods on LayoutSVGResourceMarker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceMarker.h ('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, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2009-2010. 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 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 */ 20 */
21 21
22 #include "core/layout/svg/LayoutSVGResourceMarker.h" 22 #include "core/layout/svg/LayoutSVGResourceMarker.h"
23 23
24 #include "core/layout/svg/LayoutSVGContainer.h"
25 #include "core/layout/svg/SVGLayoutSupport.h"
26 #include "wtf/TemporaryChange.h" 24 #include "wtf/TemporaryChange.h"
27 25
28 namespace blink { 26 namespace blink {
29 27
30 LayoutSVGResourceMarker::LayoutSVGResourceMarker(SVGMarkerElement* node) 28 LayoutSVGResourceMarker::LayoutSVGResourceMarker(SVGMarkerElement* node)
31 : LayoutSVGResourceContainer(node) 29 : LayoutSVGResourceContainer(node)
32 { 30 {
33 } 31 }
34 32
35 LayoutSVGResourceMarker::~LayoutSVGResourceMarker() 33 LayoutSVGResourceMarker::~LayoutSVGResourceMarker()
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 { 83 {
86 SVGMarkerElement* marker = toSVGMarkerElement(element()); 84 SVGMarkerElement* marker = toSVGMarkerElement(element());
87 ASSERT(marker); 85 ASSERT(marker);
88 86
89 SVGLengthContext lengthContext(marker); 87 SVGLengthContext lengthContext(marker);
90 return FloatPoint(marker->refX()->currentValue()->value(lengthContext), mark er->refY()->currentValue()->value(lengthContext)); 88 return FloatPoint(marker->refX()->currentValue()->value(lengthContext), mark er->refY()->currentValue()->value(lengthContext));
91 } 89 }
92 90
93 float LayoutSVGResourceMarker::angle() const 91 float LayoutSVGResourceMarker::angle() const
94 { 92 {
95 SVGMarkerElement* marker = toSVGMarkerElement(element()); 93 ASSERT(element());
96 ASSERT(marker);
97 94
98 float angle = -1; 95 float angle = -1;
99 if (marker->orientType()->currentValue()->enumValue() == SVGMarkerOrientAngl e) 96 if (orientType() == SVGMarkerOrientAngle)
100 angle = marker->orientAngle()->currentValue()->value(); 97 angle = toSVGMarkerElement(*element()).orientAngle()->currentValue()->va lue();
101 98
102 return angle; 99 return angle;
103 } 100 }
104 101
102 SVGMarkerUnitsType LayoutSVGResourceMarker::markerUnits() const
103 {
104 return toSVGMarkerElement(element())->markerUnits()->currentValue()->enumVal ue();
105 }
106
107 SVGMarkerOrientType LayoutSVGResourceMarker::orientType() const
108 {
109 return toSVGMarkerElement(element())->orientType()->currentValue()->enumValu e();
110 }
111
105 AffineTransform LayoutSVGResourceMarker::markerTransformation(const FloatPoint& origin, float autoAngle, float strokeWidth) const 112 AffineTransform LayoutSVGResourceMarker::markerTransformation(const FloatPoint& origin, float autoAngle, float strokeWidth) const
106 { 113 {
107 SVGMarkerElement* marker = toSVGMarkerElement(element());
108 ASSERT(marker);
109
110 float markerAngle = angle(); 114 float markerAngle = angle();
111 bool useStrokeWidth = marker->markerUnits()->currentValue()->enumValue() == SVGMarkerUnitsStrokeWidth; 115 bool useStrokeWidth = markerUnits() == SVGMarkerUnitsStrokeWidth;
112 116
113 AffineTransform transform; 117 AffineTransform transform;
114 transform.translate(origin.x(), origin.y()); 118 transform.translate(origin.x(), origin.y());
115 transform.rotate(markerAngle == -1 ? autoAngle : markerAngle); 119 transform.rotate(markerAngle == -1 ? autoAngle : markerAngle);
116 transform = markerContentTransformation(transform, referencePoint(), useStro keWidth ? strokeWidth : -1); 120 transform = markerContentTransformation(transform, referencePoint(), useStro keWidth ? strokeWidth : -1);
117 return transform; 121 return transform;
118 } 122 }
119 123
120 AffineTransform LayoutSVGResourceMarker::markerContentTransformation(const Affin eTransform& contentTransformation, const FloatPoint& origin, float strokeWidth) const 124 AffineTransform LayoutSVGResourceMarker::markerContentTransformation(const Affin eTransform& contentTransformation, const FloatPoint& origin, float strokeWidth) const
121 { 125 {
(...skipping 24 matching lines...) Expand all
146 SVGMarkerElement* marker = toSVGMarkerElement(element()); 150 SVGMarkerElement* marker = toSVGMarkerElement(element());
147 ASSERT(marker); 151 ASSERT(marker);
148 152
149 SVGLengthContext lengthContext(marker); 153 SVGLengthContext lengthContext(marker);
150 float w = marker->markerWidth()->currentValue()->value(lengthContext); 154 float w = marker->markerWidth()->currentValue()->value(lengthContext);
151 float h = marker->markerHeight()->currentValue()->value(lengthContext); 155 float h = marker->markerHeight()->currentValue()->value(lengthContext);
152 m_viewport = FloatRect(0, 0, w, h); 156 m_viewport = FloatRect(0, 0, w, h);
153 } 157 }
154 158
155 } // namespace blink 159 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceMarker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698