| OLD | NEW |
| 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, 2013 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
| 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
| 5 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 5 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| 11 * | 11 * |
| 12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
| 16 * | 16 * |
| 17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
| 18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include "config.h" | 23 #include "config.h" |
| 24 #include "core/css/StylePropertySet.h" | 24 #include "core/css/StylePropertySet.h" |
| 25 | 25 |
| 26 #include "RuntimeEnabledFeatures.h" | 26 #include "RuntimeEnabledFeatures.h" |
| 27 #include "StylePropertyShorthand.h" | 27 #include "StylePropertyShorthand.h" |
| 28 #include "core/css/CSSParser.h" | 28 #include "core/css/parser/BisonCSSParser.h" |
| 29 #include "core/css/CSSValuePool.h" | 29 #include "core/css/CSSValuePool.h" |
| 30 #include "core/css/CSSVariableValue.h" | 30 #include "core/css/CSSVariableValue.h" |
| 31 #include "core/css/RuntimeCSSEnabled.h" | 31 #include "core/css/RuntimeCSSEnabled.h" |
| 32 #include "core/css/StylePropertySerializer.h" | 32 #include "core/css/StylePropertySerializer.h" |
| 33 #include "core/css/StyleSheetContents.h" | 33 #include "core/css/StyleSheetContents.h" |
| 34 #include "core/css/VariablesIterator.h" | 34 #include "core/css/VariablesIterator.h" |
| 35 #include "core/frame/UseCounter.h" | 35 #include "core/frame/UseCounter.h" |
| 36 #include "wtf/text/StringBuilder.h" | 36 #include "wtf/text/StringBuilder.h" |
| 37 | 37 |
| 38 #ifndef NDEBUG | 38 #ifndef NDEBUG |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, const String
& value, bool important, StyleSheetContents* contextStyleSheet) | 238 bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, const String
& value, bool important, StyleSheetContents* contextStyleSheet) |
| 239 { | 239 { |
| 240 // Setting the value to an empty string just removes the property in both IE
and Gecko. | 240 // Setting the value to an empty string just removes the property in both IE
and Gecko. |
| 241 // Setting it to null seems to produce less consistent results, but we treat
it just the same. | 241 // Setting it to null seems to produce less consistent results, but we treat
it just the same. |
| 242 if (value.isEmpty()) | 242 if (value.isEmpty()) |
| 243 return removeProperty(propertyID); | 243 return removeProperty(propertyID); |
| 244 | 244 |
| 245 // When replacing an existing property value, this moves the property to the
end of the list. | 245 // When replacing an existing property value, this moves the property to the
end of the list. |
| 246 // Firefox preserves the position, and MSIE moves the property to the beginn
ing. | 246 // Firefox preserves the position, and MSIE moves the property to the beginn
ing. |
| 247 return CSSParser::parseValue(this, propertyID, value, important, cssParserMo
de(), contextStyleSheet); | 247 return BisonCSSParser::parseValue(this, propertyID, value, important, cssPar
serMode(), contextStyleSheet); |
| 248 } | 248 } |
| 249 | 249 |
| 250 void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtr<C
SSValue> prpValue, bool important) | 250 void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtr<C
SSValue> prpValue, bool important) |
| 251 { | 251 { |
| 252 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); | 252 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); |
| 253 if (!shorthand.length()) { | 253 if (!shorthand.length()) { |
| 254 setProperty(CSSProperty(propertyID, prpValue, important)); | 254 setProperty(CSSProperty(propertyID, prpValue, important)); |
| 255 return; | 255 return; |
| 256 } | 256 } |
| 257 | 257 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 void MutableStylePropertySet::parseDeclaration(const String& styleDeclaration, S
tyleSheetContents* contextStyleSheet) | 341 void MutableStylePropertySet::parseDeclaration(const String& styleDeclaration, S
tyleSheetContents* contextStyleSheet) |
| 342 { | 342 { |
| 343 m_propertyVector.clear(); | 343 m_propertyVector.clear(); |
| 344 | 344 |
| 345 CSSParserContext context(cssParserMode()); | 345 CSSParserContext context(cssParserMode()); |
| 346 if (contextStyleSheet) { | 346 if (contextStyleSheet) { |
| 347 context = contextStyleSheet->parserContext(); | 347 context = contextStyleSheet->parserContext(); |
| 348 context.setMode(cssParserMode()); | 348 context.setMode(cssParserMode()); |
| 349 } | 349 } |
| 350 | 350 |
| 351 CSSParser parser(context, UseCounter::getFrom(contextStyleSheet)); | 351 BisonCSSParser parser(context, UseCounter::getFrom(contextStyleSheet)); |
| 352 parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet); | 352 parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet); |
| 353 } | 353 } |
| 354 | 354 |
| 355 void MutableStylePropertySet::addParsedProperties(const Vector<CSSProperty, 256>
& properties) | 355 void MutableStylePropertySet::addParsedProperties(const Vector<CSSProperty, 256>
& properties) |
| 356 { | 356 { |
| 357 m_propertyVector.reserveCapacity(m_propertyVector.size() + properties.size()
); | 357 m_propertyVector.reserveCapacity(m_propertyVector.size() + properties.size()
); |
| 358 for (unsigned i = 0; i < properties.size(); ++i) | 358 for (unsigned i = 0; i < properties.size(); ++i) |
| 359 addParsedProperty(properties[i]); | 359 addParsedProperty(properties[i]); |
| 360 } | 360 } |
| 361 | 361 |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 result.appendLiteral(": "); | 647 result.appendLiteral(": "); |
| 648 result.append(propertyValue()->cssText()); | 648 result.append(propertyValue()->cssText()); |
| 649 if (isImportant()) | 649 if (isImportant()) |
| 650 result.appendLiteral(" !important"); | 650 result.appendLiteral(" !important"); |
| 651 result.append(';'); | 651 result.append(';'); |
| 652 return result.toString(); | 652 return result.toString(); |
| 653 } | 653 } |
| 654 | 654 |
| 655 | 655 |
| 656 } // namespace WebCore | 656 } // namespace WebCore |
| OLD | NEW |