| 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. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 "core/StylePropertyShorthand.h" | 26 #include "core/StylePropertyShorthand.h" |
| 27 #include "core/css/CSSPropertyMetadata.h" | 27 #include "core/css/CSSPropertyMetadata.h" |
| 28 #include "core/css/CSSValuePool.h" | 28 #include "core/css/CSSValuePool.h" |
| 29 #include "core/css/StylePropertySerializer.h" | 29 #include "core/css/StylePropertySerializer.h" |
| 30 #include "core/css/StyleSheetContents.h" | 30 #include "core/css/StyleSheetContents.h" |
| 31 #include "core/css/parser/BisonCSSParser.h" | 31 #include "core/css/parser/CSSParser.h" |
| 32 #include "core/frame/UseCounter.h" | 32 #include "core/frame/UseCounter.h" |
| 33 #include "platform/RuntimeEnabledFeatures.h" | 33 #include "platform/RuntimeEnabledFeatures.h" |
| 34 #include "wtf/text/StringBuilder.h" | 34 #include "wtf/text/StringBuilder.h" |
| 35 | 35 |
| 36 #ifndef NDEBUG | 36 #ifndef NDEBUG |
| 37 #include "wtf/text/CString.h" | 37 #include "wtf/text/CString.h" |
| 38 #include <stdio.h> | 38 #include <stdio.h> |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 258 |
| 259 bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, const String
& value, bool important, StyleSheetContents* contextStyleSheet) | 259 bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, const String
& value, bool important, StyleSheetContents* contextStyleSheet) |
| 260 { | 260 { |
| 261 // Setting the value to an empty string just removes the property in both IE
and Gecko. | 261 // Setting the value to an empty string just removes the property in both IE
and Gecko. |
| 262 // Setting it to null seems to produce less consistent results, but we treat
it just the same. | 262 // Setting it to null seems to produce less consistent results, but we treat
it just the same. |
| 263 if (value.isEmpty()) | 263 if (value.isEmpty()) |
| 264 return removeProperty(propertyID); | 264 return removeProperty(propertyID); |
| 265 | 265 |
| 266 // When replacing an existing property value, this moves the property to the
end of the list. | 266 // When replacing an existing property value, this moves the property to the
end of the list. |
| 267 // Firefox preserves the position, and MSIE moves the property to the beginn
ing. | 267 // Firefox preserves the position, and MSIE moves the property to the beginn
ing. |
| 268 return BisonCSSParser::parseValue(this, propertyID, value, important, cssPar
serMode(), contextStyleSheet); | 268 return CSSParser::parseValue(this, propertyID, value, important, cssParserMo
de(), contextStyleSheet); |
| 269 } | 269 } |
| 270 | 270 |
| 271 void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtrWi
llBeRawPtr<CSSValue> prpValue, bool important) | 271 void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtrWi
llBeRawPtr<CSSValue> prpValue, bool important) |
| 272 { | 272 { |
| 273 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); | 273 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); |
| 274 if (!shorthand.length()) { | 274 if (!shorthand.length()) { |
| 275 setProperty(CSSProperty(propertyID, prpValue, important)); | 275 setProperty(CSSProperty(propertyID, prpValue, important)); |
| 276 return; | 276 return; |
| 277 } | 277 } |
| 278 | 278 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 void MutableStylePropertySet::parseDeclaration(const String& styleDeclaration, S
tyleSheetContents* contextStyleSheet) | 334 void MutableStylePropertySet::parseDeclaration(const String& styleDeclaration, S
tyleSheetContents* contextStyleSheet) |
| 335 { | 335 { |
| 336 m_propertyVector.clear(); | 336 m_propertyVector.clear(); |
| 337 | 337 |
| 338 CSSParserContext context(cssParserMode(), UseCounter::getFrom(contextStyleSh
eet)); | 338 CSSParserContext context(cssParserMode(), UseCounter::getFrom(contextStyleSh
eet)); |
| 339 if (contextStyleSheet) { | 339 if (contextStyleSheet) { |
| 340 context = contextStyleSheet->parserContext(); | 340 context = contextStyleSheet->parserContext(); |
| 341 context.setMode(cssParserMode()); | 341 context.setMode(cssParserMode()); |
| 342 } | 342 } |
| 343 | 343 |
| 344 BisonCSSParser parser(context); | 344 CSSParser parser(context); |
| 345 parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet); | 345 parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void MutableStylePropertySet::addParsedProperties(const WillBeHeapVector<CSSProp
erty, 256>& properties) | 348 void MutableStylePropertySet::addParsedProperties(const WillBeHeapVector<CSSProp
erty, 256>& properties) |
| 349 { | 349 { |
| 350 m_propertyVector.reserveCapacity(m_propertyVector.size() + properties.size()
); | 350 m_propertyVector.reserveCapacity(m_propertyVector.size() + properties.size()
); |
| 351 for (unsigned i = 0; i < properties.size(); ++i) | 351 for (unsigned i = 0; i < properties.size(); ++i) |
| 352 addParsedProperty(properties[i]); | 352 addParsedProperty(properties[i]); |
| 353 } | 353 } |
| 354 | 354 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 result.appendLiteral(": "); | 605 result.appendLiteral(": "); |
| 606 result.append(propertyValue()->cssText()); | 606 result.append(propertyValue()->cssText()); |
| 607 if (isImportant()) | 607 if (isImportant()) |
| 608 result.appendLiteral(" !important"); | 608 result.appendLiteral(" !important"); |
| 609 result.append(';'); | 609 result.append(';'); |
| 610 return result.toString(); | 610 return result.toString(); |
| 611 } | 611 } |
| 612 | 612 |
| 613 | 613 |
| 614 } // namespace blink | 614 } // namespace blink |
| OLD | NEW |