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

Side by Side Diff: Source/core/svg/SVGForeignObjectElement.cpp

Issue 218403009: Map width/height to style for foreignObject (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added SVG DOM change to test Created 6 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 | « Source/core/svg/SVGForeignObjectElement.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) 2006 Apple Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@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,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 else if (name == SVGNames::widthAttr) 75 else if (name == SVGNames::widthAttr)
76 m_width->setBaseValueAsString(value, parseError); 76 m_width->setBaseValueAsString(value, parseError);
77 else if (name == SVGNames::heightAttr) 77 else if (name == SVGNames::heightAttr)
78 m_height->setBaseValueAsString(value, parseError); 78 m_height->setBaseValueAsString(value, parseError);
79 else 79 else
80 ASSERT_NOT_REACHED(); 80 ASSERT_NOT_REACHED();
81 81
82 reportAttributeParsingError(parseError, name, value); 82 reportAttributeParsingError(parseError, name, value);
83 } 83 }
84 84
85 bool SVGForeignObjectElement::isPresentationAttribute(const QualifiedName& name) const
86 {
87 if (name == SVGNames::widthAttr || name == SVGNames::heightAttr)
88 return true;
89 return SVGGraphicsElement::isPresentationAttribute(name);
90 }
91
92 void SVGForeignObjectElement::collectStyleForPresentationAttribute(const Qualifi edName& name, const AtomicString& value, MutableStylePropertySet* style)
93 {
94 if (name == SVGNames::widthAttr || name == SVGNames::heightAttr) {
fs 2014/04/02 11:00:41 It seems unnecessary to check these twice (for no
davve 2014/04/02 11:17:48 Thanks. Was remains from earlier versions.
95 if (name == SVGNames::widthAttr)
96 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, m_w idth->currentValue()->valueAsString());
fs 2014/04/02 11:00:41 Why not just pass |value| as the value? (IIUC, if
davve 2014/04/02 11:17:48 I specifically added a test that fails when using
fs 2014/04/02 11:55:00 Ok. I figured that's what the change in svgAttribu
davve 2014/04/02 12:43:56 It is. But it only triggers the recomputation, doe
97 else if (name == SVGNames::heightAttr)
98 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, m_ height->currentValue()->valueAsString());
99 } else {
100 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle);
101 }
102 }
103
85 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) 104 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName)
86 { 105 {
87 if (!isSupportedAttribute(attrName)) { 106 if (!isSupportedAttribute(attrName)) {
88 SVGGraphicsElement::svgAttributeChanged(attrName); 107 SVGGraphicsElement::svgAttributeChanged(attrName);
89 return; 108 return;
90 } 109 }
91 110
111 if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) {
112 invalidateSVGPresentationAttributeStyle();
113 setNeedsStyleRecalc(LocalStyleChange);
114 }
115
92 SVGElementInstance::InvalidationGuard invalidationGuard(this); 116 SVGElementInstance::InvalidationGuard invalidationGuard(this);
93 117
94 bool isLengthAttribute = attrName == SVGNames::xAttr 118 bool isLengthAttribute = attrName == SVGNames::xAttr
95 || attrName == SVGNames::yAttr 119 || attrName == SVGNames::yAttr
96 || attrName == SVGNames::widthAttr 120 || attrName == SVGNames::widthAttr
97 || attrName == SVGNames::heightAttr; 121 || attrName == SVGNames::heightAttr;
98 122
99 if (isLengthAttribute) 123 if (isLengthAttribute)
100 updateRelativeLengthsInformation(); 124 updateRelativeLengthsInformation();
101 125
(...skipping 26 matching lines...) Expand all
128 152
129 bool SVGForeignObjectElement::selfHasRelativeLengths() const 153 bool SVGForeignObjectElement::selfHasRelativeLengths() const
130 { 154 {
131 return m_x->currentValue()->isRelative() 155 return m_x->currentValue()->isRelative()
132 || m_y->currentValue()->isRelative() 156 || m_y->currentValue()->isRelative()
133 || m_width->currentValue()->isRelative() 157 || m_width->currentValue()->isRelative()
134 || m_height->currentValue()->isRelative(); 158 || m_height->currentValue()->isRelative();
135 } 159 }
136 160
137 } 161 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGForeignObjectElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698