Changeset 183017 in webkit
- Timestamp:
- Apr 20, 2015, 11:31:45 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 17 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/css/set-inline-style-recalc-expected.txt (added)
-
LayoutTests/fast/css/set-inline-style-recalc.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (1 diff)
-
Source/WebCore/css/CSSParser.cpp (modified) (16 diffs)
-
Source/WebCore/css/CSSParser.h (modified) (4 diffs)
-
Source/WebCore/css/CSSProperty.h (modified) (2 diffs)
-
Source/WebCore/css/DOMWindowCSS.cpp (modified) (1 diff)
-
Source/WebCore/css/FontLoader.cpp (modified) (1 diff)
-
Source/WebCore/css/StyleProperties.cpp (modified) (5 diffs)
-
Source/WebCore/css/StyleProperties.h (modified) (2 diffs)
-
Source/WebCore/css/WebKitCSSMatrix.cpp (modified) (1 diff)
-
Source/WebCore/dom/Document.cpp (modified) (2 diffs)
-
Source/WebCore/dom/Document.h (modified) (2 diffs)
-
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (modified) (1 diff)
-
Source/WebCore/testing/Internals.cpp (modified) (1 diff)
-
Source/WebCore/testing/Internals.h (modified) (1 diff)
-
Source/WebCore/testing/Internals.idl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r183016 r183017 1 2015-04-20 Simon Fraser <simon.fraser@apple.com> 2 3 Setting inline style to the same value it already has triggers a style recalc 4 https://bugs.webkit.org/show_bug.cgi?id=143922 5 6 Reviewed by Antti Koivisto. 7 8 Test that changes inline-style (to test this bug fix), and classes (for 9 proactive testing) and counts style recalcs. 10 11 * fast/css/set-inline-style-recalc-expected.txt: Added. 12 * fast/css/set-inline-style-recalc.html: Added. 13 1 14 2015-04-20 Brady Eidson <beidson@apple.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r183016 r183017 1 2015-04-20 Simon Fraser <simon.fraser@apple.com> 2 3 Setting inline style to the same value it already has triggers a style recalc 4 https://bugs.webkit.org/show_bug.cgi?id=143922 5 6 Reviewed by Antti Koivisto. 7 8 MutableStyleProperties::setProperty() was taking the result of CSSParser::parseValue() 9 to mean "parsing changed the style", but it actually just means "parsing succeeded". 10 Add a new out param, piped through various parser functions, to indicate whether 11 parsing actually changed style, and instead return that from setProperty(). 12 13 Add internals.startTrackingStyleRecalcs() and internals.styleRecalcCount() so 14 we can write tests for style recalc. 15 16 Test: fast/css/set-inline-style-recalc.html 17 18 * WebCore.xcodeproj/project.pbxproj: Let Xcode have it's way. 19 * css/CSSParser.cpp: 20 (WebCore::parseColorValue): 21 (WebCore::parseSimpleLengthValue): 22 (WebCore::parseKeywordValue): 23 (WebCore::parseTranslateTransformValue): 24 (WebCore::CSSParser::parseFontFaceValue): 25 (WebCore::CSSParser::parseValue): 26 * css/CSSParser.h: 27 * css/CSSProperty.h: 28 (WebCore::StylePropertyMetadata::operator==): 29 (WebCore::CSSProperty::operator==): 30 * css/DOMWindowCSS.cpp: 31 (WebCore::DOMWindowCSS::supports): 32 * css/StyleProperties.cpp: 33 (WebCore::MutableStyleProperties::setProperty): 34 (WebCore::MutableStyleProperties::appendPrefixingVariantProperty): 35 (WebCore::MutableStyleProperties::addParsedProperties): 36 (WebCore::MutableStyleProperties::addParsedProperty): 37 * css/StyleProperties.h: 38 * css/WebKitCSSMatrix.cpp: 39 (WebCore::WebKitCSSMatrix::setMatrixValue): 40 * dom/Document.cpp: 41 (WebCore::Document::recalcStyle): 42 (WebCore::Document::startTrackingStyleRecalcs): 43 (WebCore::Document::styleRecalcCount): 44 * dom/Document.h: 45 * html/canvas/CanvasRenderingContext2D.cpp: 46 (WebCore::CanvasRenderingContext2D::setFont): 47 * testing/Internals.cpp: 48 (WebCore::Internals::startTrackingStyleRecalcs): 49 (WebCore::Internals::styleRecalcCount): 50 * testing/Internals.h: 51 * testing/Internals.idl: 52 1 53 2015-04-20 Brady Eidson <beidson@apple.com> 2 54 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r183009 r183017 12800 12800 BC76AC110DD7AD5C00415F34 /* ParserUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParserUtilities.h; sourceTree = "<group>"; }; 12801 12801 BC772B360C4EA91E0083285F /* CSSHelper.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSHelper.h; sourceTree = "<group>"; }; 12802 BC772B370C4EA91E0083285F /* CSSParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = CSSParser.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp;};12802 BC772B370C4EA91E0083285F /* CSSParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = CSSParser.cpp; sourceTree = "<group>"; }; 12803 12803 BC772B380C4EA91E0083285F /* CSSParser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSParser.h; sourceTree = "<group>"; }; 12804 12804 BC772C440C4EB2C60083285F /* XMLHttpRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = XMLHttpRequest.cpp; sourceTree = "<group>"; }; -
trunk/Source/WebCore/css/CSSParser.cpp
r182613 r183017 521 521 } 522 522 523 static boolparseColorValue(MutableStyleProperties* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSParserMode cssParserMode)523 static CSSParser::ParseResult parseColorValue(MutableStyleProperties* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSParserMode cssParserMode) 524 524 { 525 525 ASSERT(!string.isEmpty()); 526 526 bool strict = isStrictParserMode(cssParserMode); 527 527 if (!isColorPropertyID(propertyId)) 528 return false; 528 return CSSParser::ParseResult::Error; 529 529 530 CSSParserString cssString; 530 531 cssString.init(string); … … 532 533 if (validPrimitiveValueColor(valueID, strict)) { 533 534 RefPtr<CSSValue> value = cssValuePool().createIdentifierValue(valueID); 534 declaration->addParsedProperty(CSSProperty(propertyId, value.release(), important)); 535 return true; 535 return declaration->addParsedProperty(CSSProperty(propertyId, value.release(), important)) ? CSSParser::ParseResult::Changed : CSSParser::ParseResult::Unchanged; 536 536 } 537 537 RGBA32 color; 538 538 if (!CSSParser::fastParseColor(color, string, strict && string[0] != '#')) 539 return false; 539 return CSSParser::ParseResult::Error; 540 540 541 RefPtr<CSSValue> value = cssValuePool().createColorValue(color); 541 declaration->addParsedProperty(CSSProperty(propertyId, value.release(), important)); 542 return true; 542 return declaration->addParsedProperty(CSSProperty(propertyId, value.release(), important)) ? CSSParser::ParseResult::Changed : CSSParser::ParseResult::Unchanged; 543 543 } 544 544 … … 615 615 } 616 616 617 static boolparseSimpleLengthValue(MutableStyleProperties* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSParserMode cssParserMode)617 static CSSParser::ParseResult parseSimpleLengthValue(MutableStyleProperties* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSParserMode cssParserMode) 618 618 { 619 619 ASSERT(!string.isEmpty()); 620 620 bool acceptsNegativeNumbers; 621 621 if (!isSimpleLengthPropertyID(propertyId, acceptsNegativeNumbers)) 622 return false;622 return CSSParser::ParseResult::Error; 623 623 624 624 unsigned length = string.length(); … … 628 628 if (string.is8Bit()) { 629 629 if (!parseSimpleLength(string.characters8(), length, unit, number)) 630 return false;630 return CSSParser::ParseResult::Error; 631 631 } else { 632 632 if (!parseSimpleLength(string.characters16(), length, unit, number)) 633 return false;633 return CSSParser::ParseResult::Error; 634 634 } 635 635 636 636 if (unit == CSSPrimitiveValue::CSS_NUMBER) { 637 637 if (number && isStrictParserMode(cssParserMode)) 638 return false;638 return CSSParser::ParseResult::Error; 639 639 unit = CSSPrimitiveValue::CSS_PX; 640 640 } 641 641 if (number < 0 && !acceptsNegativeNumbers) 642 return false;642 return CSSParser::ParseResult::Error; 643 643 if (std::isinf(number)) 644 return false;644 return CSSParser::ParseResult::Error; 645 645 646 646 RefPtr<CSSValue> value = cssValuePool().createValue(number, unit); 647 declaration->addParsedProperty(CSSProperty(propertyId, value.release(), important)); 648 return true; 647 return declaration->addParsedProperty(CSSProperty(propertyId, value.release(), important)) ? CSSParser::ParseResult::Changed : CSSParser::ParseResult::Unchanged; 649 648 } 650 649 … … 1179 1178 } 1180 1179 1181 static boolparseKeywordValue(MutableStyleProperties* declaration, CSSPropertyID propertyId, const String& string, bool important, const CSSParserContext& parserContext, StyleSheetContents* styleSheetContents)1180 static CSSParser::ParseResult parseKeywordValue(MutableStyleProperties* declaration, CSSPropertyID propertyId, const String& string, bool important, const CSSParserContext& parserContext, StyleSheetContents* styleSheetContents) 1182 1181 { 1183 1182 ASSERT(!string.isEmpty()); … … 1187 1186 String lowerCaseString = string.lower(); 1188 1187 if (lowerCaseString != "initial" && lowerCaseString != "inherit") 1189 return false;1188 return CSSParser::ParseResult::Error; 1190 1189 1191 1190 // Parse initial/inherit shorthands using the CSSParser. 1192 1191 if (shorthandForProperty(propertyId).length()) 1193 return false;1192 return CSSParser::ParseResult::Error; 1194 1193 } 1195 1194 … … 1199 1198 1200 1199 if (!valueID) 1201 return false;1200 return CSSParser::ParseResult::Error; 1202 1201 1203 1202 RefPtr<CSSValue> value; … … 1209 1208 value = cssValuePool().createIdentifierValue(valueID); 1210 1209 else 1211 return false; 1212 1213 declaration->addParsedProperty(CSSProperty(propertyId, value.release(), important)); 1214 return true; 1210 return CSSParser::ParseResult::Error; 1211 1212 return declaration->addParsedProperty(CSSProperty(propertyId, value.release(), important)) ? CSSParser::ParseResult::Changed : CSSParser::ParseResult::Unchanged; 1215 1213 } 1216 1214 … … 1236 1234 } 1237 1235 1238 static boolparseTranslateTransformValue(MutableStyleProperties* properties, CSSPropertyID propertyID, const String& string, bool important)1236 static CSSParser::ParseResult parseTranslateTransformValue(MutableStyleProperties* properties, CSSPropertyID propertyID, const String& string, bool important) 1239 1237 { 1240 1238 if (propertyID != CSSPropertyTransform) 1241 return false; 1239 return CSSParser::ParseResult::Error; 1240 1242 1241 static const unsigned shortestValidTransformStringLength = 12; 1243 1242 static const unsigned likelyMultipartTransformStringLengthCutoff = 32; 1244 1243 if (string.length() < shortestValidTransformStringLength || string.length() > likelyMultipartTransformStringLengthCutoff) 1245 return false; 1244 return CSSParser::ParseResult::Error; 1245 1246 1246 if (!string.startsWith("translate", false)) 1247 return false; 1247 return CSSParser::ParseResult::Error; 1248 1248 1249 UChar c9 = toASCIILower(string[9]); 1249 1250 UChar c10 = toASCIILower(string[10]); … … 1267 1268 argumentStart = 12; 1268 1269 } else 1269 return false;1270 return CSSParser::ParseResult::Error; 1270 1271 1271 1272 RefPtr<WebKitCSSTransformValue> transformValue = WebKitCSSTransformValue::create(transformType); … … 1276 1277 success = parseTransformTranslateArguments(*transformValue, string.characters16(), string.length(), argumentStart, expectedArgumentCount); 1277 1278 if (!success) 1278 return false; 1279 return CSSParser::ParseResult::Error; 1280 1279 1281 RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); 1280 1282 result->append(transformValue.releaseNonNull()); 1281 properties->addParsedProperty(CSSProperty(CSSPropertyTransform, result.release(), important)); 1282 return true; 1283 return properties->addParsedProperty(CSSProperty(CSSPropertyTransform, result.release(), important)) ? CSSParser::ParseResult::Changed : CSSParser::ParseResult::Unchanged; 1283 1284 } 1284 1285 … … 1288 1289 return nullptr; 1289 1290 RefPtr<MutableStyleProperties> dummyStyle = MutableStyleProperties::create(); 1290 if (!parseValue(dummyStyle.get(), CSSPropertyFontFamily, string, false, CSSQuirksMode, nullptr)) 1291 1292 if (parseValue(dummyStyle.get(), CSSPropertyFontFamily, string, false, CSSQuirksMode, nullptr) == ParseResult::Error) 1291 1293 return nullptr; 1292 1294 … … 1297 1299 } 1298 1300 1299 boolCSSParser::parseValue(MutableStyleProperties* declaration, CSSPropertyID propertyID, const String& string, bool important, CSSParserMode cssParserMode, StyleSheetContents* contextStyleSheet)1301 CSSParser::ParseResult CSSParser::parseValue(MutableStyleProperties* declaration, CSSPropertyID propertyID, const String& string, bool important, CSSParserMode cssParserMode, StyleSheetContents* contextStyleSheet) 1300 1302 { 1301 1303 ASSERT(!string.isEmpty()); 1302 if (parseSimpleLengthValue(declaration, propertyID, string, important, cssParserMode)) 1303 return true; 1304 if (parseColorValue(declaration, propertyID, string, important, cssParserMode)) 1305 return true; 1304 CSSParser::ParseResult result = parseSimpleLengthValue(declaration, propertyID, string, important, cssParserMode); 1305 if (result != ParseResult::Error) 1306 return result; 1307 1308 result = parseColorValue(declaration, propertyID, string, important, cssParserMode); 1309 if (result != ParseResult::Error) 1310 return result; 1306 1311 1307 1312 CSSParserContext context(cssParserMode); … … 1311 1316 } 1312 1317 1313 if (parseKeywordValue(declaration, propertyID, string, important, context, contextStyleSheet)) 1314 return true; 1315 if (parseTranslateTransformValue(declaration, propertyID, string, important)) 1316 return true; 1318 result = parseKeywordValue(declaration, propertyID, string, important, context, contextStyleSheet); 1319 if (result != ParseResult::Error) 1320 return result; 1321 1322 result = parseTranslateTransformValue(declaration, propertyID, string, important); 1323 if (result != ParseResult::Error) 1324 return result; 1317 1325 1318 1326 CSSParser parser(context); … … 1320 1328 } 1321 1329 1322 boolCSSParser::parseValue(MutableStyleProperties* declaration, CSSPropertyID propertyID, const String& string, bool important, StyleSheetContents* contextStyleSheet)1330 CSSParser::ParseResult CSSParser::parseValue(MutableStyleProperties* declaration, CSSPropertyID propertyID, const String& string, bool important, StyleSheetContents* contextStyleSheet) 1323 1331 { 1324 1332 setStyleSheet(contextStyleSheet); … … 1333 1341 m_rule = nullptr; 1334 1342 1335 bool ok = false;1343 ParseResult result = ParseResult::Error; 1336 1344 if (m_hasFontFaceOnlyValues) 1337 1345 deleteFontFaceOnlyValues(); 1346 1338 1347 if (!m_parsedProperties.isEmpty()) { 1339 ok = true; 1340 declaration->addParsedProperties(m_parsedProperties); 1348 result = declaration->addParsedProperties(m_parsedProperties) ? ParseResult::Changed : ParseResult::Unchanged; 1341 1349 clearProperties(); 1342 1350 } 1343 1351 1344 return ok;1352 return result; 1345 1353 } 1346 1354 -
trunk/Source/WebCore/css/CSSParser.h
r182613 r183017 82 82 }; 83 83 84 enum class ParseResult { 85 Changed, 86 Unchanged, 87 Error 88 }; 89 84 90 class ValueWithCalculation { 85 91 public: … … 104 110 105 111 WEBCORE_EXPORT CSSParser(const CSSParserContext&); 106 107 112 WEBCORE_EXPORT ~CSSParser(); 108 113 … … 111 116 PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const String&); 112 117 bool parseSupportsCondition(const String&); 113 static bool parseValue(MutableStyleProperties*, CSSPropertyID, const String&, bool important, CSSParserMode, StyleSheetContents*); 118 119 static ParseResult parseValue(MutableStyleProperties*, CSSPropertyID, const String&, bool important, CSSParserMode, StyleSheetContents*); 120 114 121 static bool parseColor(RGBA32& color, const String&, bool strict = false); 115 122 static bool parseSystemColor(RGBA32& color, const String&, Document*); 116 123 static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&); 117 124 PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(CSSValueID ident, ValueWithCalculation&); 125 118 126 WEBCORE_EXPORT bool parseDeclaration(MutableStyleProperties*, const String&, PassRefPtr<CSSRuleSourceData>, StyleSheetContents* contextStyleSheet); 119 127 static Ref<ImmutableStyleProperties> parseInlineStyleDeclaration(const String&, Element*); … … 550 558 bool parseGeneratedImage(CSSParserValueList&, RefPtr<CSSValue>&); 551 559 552 boolparseValue(MutableStyleProperties*, CSSPropertyID, const String&, bool important, StyleSheetContents* contextStyleSheet);560 ParseResult parseValue(MutableStyleProperties*, CSSPropertyID, const String&, bool important, StyleSheetContents* contextStyleSheet); 553 561 Ref<ImmutableStyleProperties> parseDeclaration(const String&, StyleSheetContents* contextStyleSheet); 554 562 -
trunk/Source/WebCore/css/CSSProperty.h
r182207 r183017 45 45 46 46 CSSPropertyID shorthandID() const; 47 48 bool operator==(const StylePropertyMetadata& other) const 49 { 50 return m_propertyID == other.m_propertyID 51 && m_isSetFromShorthand == other.m_isSetFromShorthand 52 && m_indexInShorthandsVector == other.m_indexInShorthandsVector 53 && m_important == other.m_important 54 && m_implicit == other.m_implicit 55 && m_inherited == other.m_inherited; 56 } 47 57 48 58 uint16_t m_propertyID : 10; … … 76 86 77 87 const StylePropertyMetadata& metadata() const { return m_metadata; } 88 89 bool operator==(const CSSProperty& other) const 90 { 91 if (!(m_metadata == other.m_metadata)) 92 return false; 93 94 if (!m_value && !other.m_value) 95 return true; 96 97 if (!m_value || !other.m_value) 98 return false; 99 100 return m_value->equals(*other.m_value); 101 } 78 102 79 103 private: -
trunk/Source/WebCore/css/DOMWindowCSS.cpp
r177733 r183017 73 73 74 74 RefPtr<MutableStyleProperties> dummyStyle = MutableStyleProperties::create(); 75 return CSSParser::parseValue(dummyStyle.get(), propertyID, normalizedValue, false, CSSStrictMode, 0);75 return CSSParser::parseValue(dummyStyle.get(), propertyID, normalizedValue, false, CSSStrictMode, nullptr) != CSSParser::ParseResult::Error; 76 76 } 77 77 -
trunk/Source/WebCore/css/FontLoader.cpp
r182544 r183017 296 296 // Interpret fontString in the same way as the 'font' attribute of CanvasRenderingContext2D. 297 297 RefPtr<MutableStyleProperties> parsedStyle = MutableStyleProperties::create(); 298 CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, fontString, true, CSSStrictMode, 0);298 CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, fontString, true, CSSStrictMode, nullptr); 299 299 if (parsedStyle->isEmpty()) 300 300 return false; -
trunk/Source/WebCore/css/StyleProperties.cpp
r181832 r183017 682 682 // When replacing an existing property value, this moves the property to the end of the list. 683 683 // Firefox preserves the position, and MSIE moves the property to the beginning. 684 return CSSParser::parseValue(this, propertyID, value, important, cssParserMode(), contextStyleSheet) ;684 return CSSParser::parseValue(this, propertyID, value, important, cssParserMode(), contextStyleSheet) == CSSParser::ParseResult::Changed; 685 685 } 686 686 … … 700 700 } 701 701 702 voidMutableStyleProperties::setProperty(const CSSProperty& property, CSSProperty* slot)702 bool MutableStyleProperties::setProperty(const CSSProperty& property, CSSProperty* slot) 703 703 { 704 704 if (!removeShorthandProperty(property.id())) { 705 705 CSSProperty* toReplace = slot ? slot : findCSSPropertyWithID(property.id()); 706 706 if (toReplace) { 707 if (*toReplace == property) 708 return false; 709 707 710 *toReplace = property; 708 711 setPrefixingVariantProperty(property); 709 return; 710 } 711 } 712 appendPrefixingVariantProperty(property); 712 return true; 713 } 714 } 715 716 return appendPrefixingVariantProperty(property); 713 717 } 714 718 … … 722 726 } 723 727 724 voidMutableStyleProperties::appendPrefixingVariantProperty(const CSSProperty& property)728 bool MutableStyleProperties::appendPrefixingVariantProperty(const CSSProperty& property) 725 729 { 726 730 m_propertyVector.append(property); 727 731 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id()); 728 732 if (prefixingVariant == property.id()) 729 return ;733 return true; 730 734 731 735 m_propertyVector.append(CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.isSetFromShorthand(), getIndexInShorthandVectorForPrefixingVariant(property, prefixingVariant), property.metadata().m_implicit)); 736 return true; 732 737 } 733 738 … … 742 747 bool MutableStyleProperties::setProperty(CSSPropertyID propertyID, CSSValueID identifier, bool important) 743 748 { 744 setProperty(CSSProperty(propertyID, cssValuePool().createIdentifierValue(identifier), important)); 745 return true; 749 return setProperty(CSSProperty(propertyID, cssValuePool().createIdentifierValue(identifier), important)); 746 750 } 747 751 748 752 bool MutableStyleProperties::setProperty(CSSPropertyID propertyID, CSSPropertyID identifier, bool important) 749 753 { 750 setProperty(CSSProperty(propertyID, cssValuePool().createIdentifierValue(identifier), important)); 751 return true; 754 return setProperty(CSSProperty(propertyID, cssValuePool().createIdentifierValue(identifier), important)); 752 755 } 753 756 … … 765 768 } 766 769 767 void MutableStyleProperties::addParsedProperties(const Vector<CSSProperty>& properties) 768 { 770 bool MutableStyleProperties::addParsedProperties(const Vector<CSSProperty>& properties) 771 { 772 bool anyChanged = false; 769 773 m_propertyVector.reserveCapacity(m_propertyVector.size() + properties.size()); 770 for (unsigned i = 0; i < properties.size(); ++i) 771 addParsedProperty(properties[i]); 772 } 773 774 void MutableStyleProperties::addParsedProperty(const CSSProperty& property) 774 for (unsigned i = 0; i < properties.size(); ++i) { 775 if (addParsedProperty(properties[i])) 776 anyChanged = true; 777 } 778 779 return anyChanged; 780 } 781 782 bool MutableStyleProperties::addParsedProperty(const CSSProperty& property) 775 783 { 776 784 // Only add properties that have no !important counterpart present 777 785 if (!propertyIsImportant(property.id()) || property.isImportant()) 778 setProperty(property); 786 return setProperty(property); 787 788 return false; 779 789 } 780 790 -
trunk/Source/WebCore/css/StyleProperties.h
r181209 r183017 194 194 PropertySetCSSStyleDeclaration* cssStyleDeclaration(); 195 195 196 voidaddParsedProperties(const Vector<CSSProperty>&);197 voidaddParsedProperty(const CSSProperty&);196 bool addParsedProperties(const Vector<CSSProperty>&); 197 bool addParsedProperty(const CSSProperty&); 198 198 199 199 // These expand shorthand properties into multiple properties. … … 204 204 bool setProperty(CSSPropertyID, CSSValueID identifier, bool important = false); 205 205 bool setProperty(CSSPropertyID, CSSPropertyID identifier, bool important = false); 206 voidappendPrefixingVariantProperty(const CSSProperty&);206 bool appendPrefixingVariantProperty(const CSSProperty&); 207 207 void setPrefixingVariantProperty(const CSSProperty&); 208 void setProperty(const CSSProperty&, CSSProperty* slot = 0);209 210 bool removeProperty(CSSPropertyID, String* returnText = 0);208 bool setProperty(const CSSProperty&, CSSProperty* slot = nullptr); 209 210 bool removeProperty(CSSPropertyID, String* returnText = nullptr); 211 211 void removePrefixedOrUnprefixedProperty(CSSPropertyID); 212 212 void removeBlockProperties(); -
trunk/Source/WebCore/css/WebKitCSSMatrix.cpp
r181832 r183017 58 58 59 59 RefPtr<MutableStyleProperties> styleDeclaration = MutableStyleProperties::create(); 60 if (CSSParser::parseValue(styleDeclaration.get(), CSSPropertyTransform, string, true, CSSStrictMode, 0)) {60 if (CSSParser::parseValue(styleDeclaration.get(), CSSPropertyTransform, string, true, CSSStrictMode, nullptr) != CSSParser::ParseResult::Error) { 61 61 // Convert to TransformOperations. This can fail if a property 62 62 // requires style (i.e., param uses 'ems' or 'exs') -
trunk/Source/WebCore/dom/Document.cpp
r182963 r183017 1791 1791 implicitClose(); 1792 1792 } 1793 1794 ++m_styleRecalcCount; 1793 1795 1794 1796 InspectorInstrumentation::didRecalculateStyle(cookie); … … 6140 6142 } 6141 6143 6144 void Document::startTrackingStyleRecalcs() 6145 { 6146 m_styleRecalcCount = 0; 6147 } 6148 6149 unsigned Document::styleRecalcCount() const 6150 { 6151 return m_styleRecalcCount; 6152 } 6153 6142 6154 DocumentLoader* Document::loader() const 6143 6155 { -
trunk/Source/WebCore/dom/Document.h
r182963 r183017 1142 1142 WEBCORE_EXPORT unsigned touchEventHandlerCount() const; 1143 1143 1144 WEBCORE_EXPORT void startTrackingStyleRecalcs(); 1145 WEBCORE_EXPORT unsigned styleRecalcCount() const; 1146 1144 1147 void didAddTouchEventHandler(Node&); 1145 1148 void didRemoveTouchEventHandler(Node&, EventHandlerRemoval = EventHandlerRemoval::One); … … 1440 1443 // http://www.whatwg.org/specs/web-apps/current-work/#ignore-destructive-writes-counter 1441 1444 unsigned m_ignoreDestructiveWriteCount; 1445 1446 unsigned m_styleRecalcCount { 0 }; 1442 1447 1443 1448 StringWithDirection m_title; -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r182750 r183017 2076 2076 2077 2077 RefPtr<MutableStyleProperties> parsedStyle = MutableStyleProperties::create(); 2078 CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, newFont, true, strictToCSSParserMode(!m_usesCSSCompatibilityParseMode), 0);2078 CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, newFont, true, strictToCSSParserMode(!m_usesCSSCompatibilityParseMode), nullptr); 2079 2079 if (parsedStyle->isEmpty()) 2080 2080 return; -
trunk/Source/WebCore/testing/Internals.cpp
r182985 r183017 2090 2090 } 2091 2091 2092 void Internals::startTrackingStyleRecalcs(ExceptionCode& ec) 2093 { 2094 Document* document = contextDocument(); 2095 if (!document) { 2096 ec = INVALID_ACCESS_ERR; 2097 return; 2098 } 2099 document->startTrackingStyleRecalcs(); 2100 } 2101 2102 unsigned long Internals::styleRecalcCount(ExceptionCode& ec) 2103 { 2104 Document* document = contextDocument(); 2105 if (!document) { 2106 ec = INVALID_ACCESS_ERR; 2107 return 0; 2108 } 2109 2110 return document->styleRecalcCount(); 2111 } 2112 2092 2113 void Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(ExceptionCode& ec) 2093 2114 { -
trunk/Source/WebCore/testing/Internals.h
r182985 r183017 299 299 unsigned long layerFlushCount(ExceptionCode&); 300 300 301 void startTrackingStyleRecalcs(ExceptionCode&); 302 unsigned long styleRecalcCount(ExceptionCode&); 303 301 304 void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(ExceptionCode&); 302 305 void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node*, ExceptionCode&); -
trunk/Source/WebCore/testing/Internals.idl
r182985 r183017 278 278 [RaisesException] boolean isTimerThrottled(long timerHandle); 279 279 280 [RaisesException] void startTrackingStyleRecalcs(); 281 [RaisesException] unsigned long styleRecalcCount(); 282 280 283 // |node| should be Document, HTMLIFrameElement, or unspecified. 281 284 // If |node| is an HTMLIFrameElement, it assumes node.contentDocument is
Note:
See TracChangeset
for help on using the changeset viewer.