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

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

Issue 2708923011: Avoid duplicating the CSS property mapping for SVG pres. attrs. (Closed)
Patch Set: Created 3 years, 9 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) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #include "core/svg/SVGPathElement.h" 21 #include "core/svg/SVGPathElement.h"
22 22
23 #include "core/css/CSSIdentifierValue.h"
24 #include "core/dom/StyleChangeReason.h" 23 #include "core/dom/StyleChangeReason.h"
25 #include "core/layout/svg/LayoutSVGPath.h" 24 #include "core/layout/svg/LayoutSVGPath.h"
26 #include "core/svg/SVGMPathElement.h" 25 #include "core/svg/SVGMPathElement.h"
27 #include "core/svg/SVGPathQuery.h" 26 #include "core/svg/SVGPathQuery.h"
28 #include "core/svg/SVGPathUtilities.h" 27 #include "core/svg/SVGPathUtilities.h"
29 #include "core/svg/SVGPointTearOff.h" 28 #include "core/svg/SVGPointTearOff.h"
30 29
31 namespace blink { 30 namespace blink {
32 31
33 inline SVGPathElement::SVGPathElement(Document& document) 32 inline SVGPathElement::SVGPathElement(Document& document)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 const QualifiedName& name, 112 const QualifiedName& name,
114 const AtomicString& value, 113 const AtomicString& value,
115 MutableStylePropertySet* style) { 114 MutableStylePropertySet* style) {
116 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); 115 SVGAnimatedPropertyBase* property = propertyFromAttribute(name);
117 if (property == m_path) { 116 if (property == m_path) {
118 SVGAnimatedPath* path = this->path(); 117 SVGAnimatedPath* path = this->path();
119 // If this is a <use> instance, return the referenced path to maximize 118 // If this is a <use> instance, return the referenced path to maximize
120 // geometry sharing. 119 // geometry sharing.
121 if (const SVGElement* element = correspondingElement()) 120 if (const SVGElement* element = correspondingElement())
122 path = toSVGPathElement(element)->path(); 121 path = toSVGPathElement(element)->path();
123 122 addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(),
124 CSSPathValue* pathValue = path->currentValue()->pathValue(); 123 path->cssValue());
125 if (pathValue->stylePath()->byteStream().isEmpty()) {
126 addPropertyToPresentationAttributeStyle(
127 style, CSSPropertyD, CSSIdentifierValue::create(CSSValueNone));
128 return;
129 }
130 addPropertyToPresentationAttributeStyle(style, CSSPropertyD, pathValue);
131 return; 124 return;
132 } 125 }
133 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, style); 126 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, style);
134 } 127 }
135 128
136 void SVGPathElement::invalidateMPathDependencies() { 129 void SVGPathElement::invalidateMPathDependencies() {
137 // <mpath> can only reference <path> but this dependency is not handled in 130 // <mpath> can only reference <path> but this dependency is not handled in
138 // markForLayoutAndParentResourceInvalidation so we update any mpath 131 // markForLayoutAndParentResourceInvalidation so we update any mpath
139 // dependencies manually. 132 // dependencies manually.
140 if (SVGElementSet* dependencies = setOfIncomingReferences()) { 133 if (SVGElementSet* dependencies = setOfIncomingReferences()) {
(...skipping 17 matching lines...) Expand all
158 } 151 }
159 152
160 FloatRect SVGPathElement::getBBox() { 153 FloatRect SVGPathElement::getBBox() {
161 document().updateStyleAndLayoutIgnorePendingStylesheets(); 154 document().updateStyleAndLayoutIgnorePendingStylesheets();
162 155
163 // We want the exact bounds. 156 // We want the exact bounds.
164 return SVGPathElement::asPath().boundingRect(Path::BoundsType::Exact); 157 return SVGPathElement::asPath().boundingRect(Path::BoundsType::Exact);
165 } 158 }
166 159
167 } // namespace blink 160 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGMaskElement.cpp ('k') | third_party/WebKit/Source/core/svg/SVGRectElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698