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

Side by Side Diff: sky/engine/core/css/PropertySetCSSStyleDeclaration.cpp

Issue 860423004: Remove css !important (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 4 * Copyright (C) 2011 Research In Motion Limited. 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 *
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 160
161 String AbstractPropertySetCSSStyleDeclaration::getPropertyValue(const String &pr opertyName) 161 String AbstractPropertySetCSSStyleDeclaration::getPropertyValue(const String &pr opertyName)
162 { 162 {
163 CSSPropertyID propertyID = cssPropertyID(propertyName); 163 CSSPropertyID propertyID = cssPropertyID(propertyName);
164 if (!propertyID) 164 if (!propertyID)
165 return String(); 165 return String();
166 return propertySet().getPropertyValue(propertyID); 166 return propertySet().getPropertyValue(propertyID);
167 } 167 }
168 168
169 String AbstractPropertySetCSSStyleDeclaration::getPropertyPriority(const String& propertyName)
170 {
171 CSSPropertyID propertyID = cssPropertyID(propertyName);
172 if (!propertyID)
173 return String();
174 return propertySet().propertyIsImportant(propertyID) ? "important" : "";
175 }
176
177 String AbstractPropertySetCSSStyleDeclaration::getPropertyShorthand(const String & propertyName) 169 String AbstractPropertySetCSSStyleDeclaration::getPropertyShorthand(const String & propertyName)
178 { 170 {
179 CSSPropertyID propertyID = cssPropertyID(propertyName); 171 CSSPropertyID propertyID = cssPropertyID(propertyName);
180 if (!propertyID) 172 if (!propertyID)
181 return String(); 173 return String();
182 CSSPropertyID shorthandID = propertySet().getPropertyShorthand(propertyID); 174 CSSPropertyID shorthandID = propertySet().getPropertyShorthand(propertyID);
183 if (!shorthandID) 175 if (!shorthandID)
184 return String(); 176 return String();
185 return getPropertyNameString(shorthandID); 177 return getPropertyNameString(shorthandID);
186 } 178 }
187 179
188 bool AbstractPropertySetCSSStyleDeclaration::isPropertyImplicit(const String& pr opertyName) 180 bool AbstractPropertySetCSSStyleDeclaration::isPropertyImplicit(const String& pr opertyName)
189 { 181 {
190 CSSPropertyID propertyID = cssPropertyID(propertyName); 182 CSSPropertyID propertyID = cssPropertyID(propertyName);
191 if (!propertyID) 183 if (!propertyID)
192 return false; 184 return false;
193 return propertySet().isPropertyImplicit(propertyID); 185 return propertySet().isPropertyImplicit(propertyID);
194 } 186 }
195 187
196 void AbstractPropertySetCSSStyleDeclaration::setProperty(const String& propertyN ame, const String& value, const String& priority, ExceptionState& exceptionState ) 188 void AbstractPropertySetCSSStyleDeclaration::setProperty(const String& propertyN ame, const String& value, const String& priority, ExceptionState& exceptionState )
197 { 189 {
198 CSSPropertyID propertyID = cssPropertyID(propertyName); 190 CSSPropertyID propertyID = cssPropertyID(propertyName);
199 if (!propertyID) 191 if (!propertyID)
200 return; 192 return;
201 193
202 bool important = equalIgnoringCase(priority, "important"); 194 setPropertyInternal(propertyID, value, exceptionState);
203 if (!important && !priority.isEmpty())
204 return;
205
206 setPropertyInternal(propertyID, value, important, exceptionState);
207 } 195 }
208 196
209 String AbstractPropertySetCSSStyleDeclaration::removeProperty(const String& prop ertyName, ExceptionState& exceptionState) 197 String AbstractPropertySetCSSStyleDeclaration::removeProperty(const String& prop ertyName, ExceptionState& exceptionState)
210 { 198 {
211 StyleAttributeMutationScope mutationScope(this); 199 StyleAttributeMutationScope mutationScope(this);
212 CSSPropertyID propertyID = cssPropertyID(propertyName); 200 CSSPropertyID propertyID = cssPropertyID(propertyName);
213 if (!propertyID) 201 if (!propertyID)
214 return String(); 202 return String();
215 203
216 willMutate(); 204 willMutate();
(...skipping 11 matching lines...) Expand all
228 PassRefPtr<CSSValue> AbstractPropertySetCSSStyleDeclaration::getPropertyCSSValue Internal(CSSPropertyID propertyID) 216 PassRefPtr<CSSValue> AbstractPropertySetCSSStyleDeclaration::getPropertyCSSValue Internal(CSSPropertyID propertyID)
229 { 217 {
230 return propertySet().getPropertyCSSValue(propertyID); 218 return propertySet().getPropertyCSSValue(propertyID);
231 } 219 }
232 220
233 String AbstractPropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPrope rtyID propertyID) 221 String AbstractPropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPrope rtyID propertyID)
234 { 222 {
235 return propertySet().getPropertyValue(propertyID); 223 return propertySet().getPropertyValue(propertyID);
236 } 224 }
237 225
238 void AbstractPropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID p ropertyID, const String& value, bool important, ExceptionState&) 226 void AbstractPropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID p ropertyID, const String& value, ExceptionState&)
239 { 227 {
240 StyleAttributeMutationScope mutationScope(this); 228 StyleAttributeMutationScope mutationScope(this);
241 willMutate(); 229 willMutate();
242 230
243 bool changed = propertySet().setProperty(propertyID, value, important, conte xtStyleSheet()); 231 bool changed = propertySet().setProperty(propertyID, value, contextStyleShee t());
244 232
245 didMutate(changed ? PropertyChanged : NoChanges); 233 didMutate(changed ? PropertyChanged : NoChanges);
246 234
247 if (changed) 235 if (changed)
248 mutationScope.enqueueMutationRecord(); 236 mutationScope.enqueueMutationRecord();
249 } 237 }
250 238
251 CSSValue* AbstractPropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM(CSSValue * internalValue) 239 CSSValue* AbstractPropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM(CSSValue * internalValue)
252 { 240 {
253 if (!internalValue) 241 if (!internalValue)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 m_parentElement->ref(); 300 m_parentElement->ref();
313 } 301 }
314 302
315 void InlineCSSStyleDeclaration::deref() 303 void InlineCSSStyleDeclaration::deref()
316 { 304 {
317 m_parentElement->deref(); 305 m_parentElement->deref();
318 } 306 }
319 #endif 307 #endif
320 308
321 } // namespace blink 309 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/PropertySetCSSStyleDeclaration.h ('k') | sky/engine/core/css/StylePropertySerializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698