Changeset 176721 in webkit
- Timestamp:
- Dec 3, 2014, 6:46:15 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
css/CSSPropertyNames.in (modified) (3 diffs)
-
css/DeprecatedStyleBuilder.cpp (modified) (2 diffs)
-
css/StyleBuilderCustom.h (modified) (4 diffs)
-
css/makeprop.pl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r176719 r176721 1 2014-12-03 Chris Dumez <cdumez@apple.com> 2 3 Move 'display' CSS property to the new StyleBuilder 4 https://bugs.webkit.org/show_bug.cgi?id=139218 5 6 Reviewed by Antti Koivisto. 7 8 Move 'display' CSS property to the new StyleBuilder. 9 10 No new tests, no behavior change. 11 12 * css/CSSPropertyNames.in: 13 * css/DeprecatedStyleBuilder.cpp: 14 (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder): 15 (WebCore::ApplyPropertyDisplay::isValidDisplayValue): Deleted. 16 (WebCore::ApplyPropertyDisplay::applyInheritValue): Deleted. 17 (WebCore::ApplyPropertyDisplay::applyInitialValue): Deleted. 18 (WebCore::ApplyPropertyDisplay::applyValue): Deleted. 19 (WebCore::ApplyPropertyDisplay::createHandler): Deleted. 20 * css/StyleBuilderCustom.h: 21 (WebCore::StyleBuilderCustom::isValidDisplayValue): 22 (WebCore::StyleBuilderCustom::applyInheritDisplay): 23 (WebCore::StyleBuilderCustom::applyValueDisplay): 24 * css/makeprop.pl: 25 Add support for passing multiple values for Custom option, e.g.: 26 'Custom=Inherit|Value'. This was useful as we did not need custom 27 code for display's initial value. 28 1 29 2014-12-03 Chris Dumez <cdumez@apple.com> 2 30 -
trunk/Source/WebCore/css/CSSPropertyNames.in
r176657 r176721 45 45 // css/StyleBuilderConverter.h should be used. 46 46 // 47 // * Custom=[Value|All]: 47 // * Custom=[Initial|Value|Inherit|All]: 48 // Custom=Initial option is used to indicate that the CSS property requires 49 // special handling to set its initial value. 50 // Custom=Inherit option is used to indicate that the CSS property requires 51 // special handling to set its inherit value. 48 52 // Custom=Value option is used to indicate that the CSS property requires special 49 53 // handling to set its value, and a regular Converter helper cannot be … … 51 55 // css/StyleBuilderCustom.h and named applyValue[CSSPropertyName](). 52 56 // If special handling is also needed to apply inherit or initial value, use 53 // Custom=All. 57 // Custom=All. Alternatively, several '|'-separated options can be passed: 58 // e.g. 'Custom=Inherit|Value". 54 59 55 60 … … 58 63 color [Inherited, LegacyStyleBuilder] 59 64 direction [Inherited, Custom=Value] 60 display [ LegacyStyleBuilder]65 display [Custom=Inherit|Value] 61 66 font [Inherited, LegacyStyleBuilder] 62 67 font-family [Inherited, Custom=All] -
trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp
r176657 r176721 968 968 }; 969 969 970 class ApplyPropertyDisplay {971 private:972 static inline bool isValidDisplayValue(StyleResolver* styleResolver, EDisplay displayPropertyValue)973 {974 if (styleResolver->element() && styleResolver->element()->isSVGElement() && styleResolver->style()->styleType() == NOPSEUDO)975 return (displayPropertyValue == INLINE || displayPropertyValue == BLOCK || displayPropertyValue == NONE);976 return true;977 }978 public:979 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)980 {981 EDisplay display = styleResolver->parentStyle()->display();982 if (!isValidDisplayValue(styleResolver, display))983 return;984 styleResolver->style()->setDisplay(display);985 }986 987 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)988 {989 styleResolver->style()->setDisplay(RenderStyle::initialDisplay());990 }991 992 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)993 {994 if (!is<CSSPrimitiveValue>(*value))995 return;996 997 EDisplay display = downcast<CSSPrimitiveValue>(*value);998 999 if (!isValidDisplayValue(styleResolver, display))1000 return;1001 1002 styleResolver->style()->setDisplay(display);1003 }1004 1005 static PropertyHandler createHandler()1006 {1007 return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);1008 }1009 };1010 1011 970 const DeprecatedStyleBuilder& DeprecatedStyleBuilder::sharedStyleBuilder() 1012 971 { … … 1040 999 setPropertyHandler(CSSPropertyCounterReset, ApplyPropertyCounter<Reset>::createHandler()); 1041 1000 setPropertyHandler(CSSPropertyCursor, ApplyPropertyCursor::createHandler()); 1042 setPropertyHandler(CSSPropertyDisplay, ApplyPropertyDisplay::createHandler());1043 1001 setPropertyHandler(CSSPropertyFontSize, ApplyPropertyFontSize::createHandler()); 1044 1002 setPropertyHandler(CSSPropertyFontStyle, ApplyPropertyFont<FontItalic, &FontDescription::italic, &FontDescription::setItalic, FontItalicOff>::createHandler()); -
trunk/Source/WebCore/css/StyleBuilderCustom.h
r176657 r176721 36 36 #include "LocaleToScriptMapping.h" 37 37 #include "Rect.h" 38 #include "SVGElement.h" 38 39 #include "StyleFontSizeFunctions.h" 39 40 #include "StyleResolver.h" … … 122 123 static void applyValueFontFamily(StyleResolver&, CSSValue&); 123 124 125 static void applyInheritDisplay(StyleResolver&); 126 static void applyValueDisplay(StyleResolver&, CSSValue&); 127 124 128 private: 125 129 static void resetEffectiveZoom(StyleResolver&); … … 133 137 template <CSSPropertyID id> 134 138 static void applyTextOrBoxShadowValue(StyleResolver&, CSSValue&); 139 static bool isValidDisplayValue(StyleResolver&, EDisplay); 135 140 }; 136 141 … … 981 986 } 982 987 988 inline bool StyleBuilderCustom::isValidDisplayValue(StyleResolver& styleResolver, EDisplay display) 989 { 990 if (is<SVGElement>(styleResolver.element()) && styleResolver.style()->styleType() == NOPSEUDO) 991 return display == INLINE || display == BLOCK || display == NONE; 992 return true; 993 } 994 995 inline void StyleBuilderCustom::applyInheritDisplay(StyleResolver& styleResolver) 996 { 997 EDisplay display = styleResolver.parentStyle()->display(); 998 if (isValidDisplayValue(styleResolver, display)) 999 styleResolver.style()->setDisplay(display); 1000 } 1001 1002 inline void StyleBuilderCustom::applyValueDisplay(StyleResolver& styleResolver, CSSValue& value) 1003 { 1004 EDisplay display = downcast<CSSPrimitiveValue>(value); 1005 if (isValidDisplayValue(styleResolver, display)) 1006 styleResolver.style()->setDisplay(display); 1007 } 1008 983 1009 } // namespace WebCore 984 1010 -
trunk/Source/WebCore/css/makeprop.pl
r176593 r176721 331 331 # 332 332 333 sub getScopeForFunction { 334 my $name = shift; 335 my $builderFunction = shift; 336 337 return $propertiesWithStyleBuilderOptions{$name}{"Custom"}{$builderFunction} ? "StyleBuilderCustom" : "StyleBuilderFunctions"; 338 } 339 333 340 foreach my $name (@names) { 334 341 # Skip properties still using the legacy style builder. … … 354 361 } 355 362 if (!exists($propertiesWithStyleBuilderOptions{$name}{"Custom"})) { 356 $propertiesWithStyleBuilderOptions{$name}{"Custom"} = "None"; 357 } 363 $propertiesWithStyleBuilderOptions{$name}{"Custom"} = ""; 364 } elsif ($propertiesWithStyleBuilderOptions{$name}{"Custom"} eq "All") { 365 $propertiesWithStyleBuilderOptions{$name}{"Custom"} = "Initial|Inherit|Value"; 366 } 367 my %customValues = map { $_ => 1 } split(/\|/, $propertiesWithStyleBuilderOptions{$name}{"Custom"}); 368 $propertiesWithStyleBuilderOptions{$name}{"Custom"} = \%customValues; 358 369 } 359 370 … … 381 392 next unless exists($propertiesWithStyleBuilderOptions{$name}); 382 393 383 next if $propertiesWithStyleBuilderOptions{$name}{"Custom"} eq "All";384 385 394 my $setValue = "styleResolver.style()->" . $propertiesWithStyleBuilderOptions{$name}{"Setter"}; 386 print STYLEBUILDER " inline void applyInitial" . $nameToId{$name} . "(StyleResolver& styleResolver)\n"; 387 print STYLEBUILDER " {\n"; 388 print STYLEBUILDER " " . $setValue . "(RenderStyle::" . $propertiesWithStyleBuilderOptions{$name}{"Initial"} . "());\n"; 389 print STYLEBUILDER " }\n"; 390 print STYLEBUILDER " inline void applyInherit" . $nameToId{$name} . "(StyleResolver& styleResolver)\n"; 391 print STYLEBUILDER " {\n"; 392 print STYLEBUILDER " " . $setValue . "(styleResolver.parentStyle()->" . $propertiesWithStyleBuilderOptions{$name}{"Getter"} . "());\n"; 393 print STYLEBUILDER " }\n"; 394 if ($propertiesWithStyleBuilderOptions{$name}{"Custom"} ne "Value") { 395 if (!$propertiesWithStyleBuilderOptions{$name}{"Custom"}{"Initial"}) { 396 print STYLEBUILDER " inline void applyInitial" . $nameToId{$name} . "(StyleResolver& styleResolver)\n"; 397 print STYLEBUILDER " {\n"; 398 print STYLEBUILDER " " . $setValue . "(RenderStyle::" . $propertiesWithStyleBuilderOptions{$name}{"Initial"} . "());\n"; 399 print STYLEBUILDER " }\n"; 400 } 401 if (!$propertiesWithStyleBuilderOptions{$name}{"Custom"}{"Inherit"}) { 402 print STYLEBUILDER " inline void applyInherit" . $nameToId{$name} . "(StyleResolver& styleResolver)\n"; 403 print STYLEBUILDER " {\n"; 404 print STYLEBUILDER " " . $setValue . "(styleResolver.parentStyle()->" . $propertiesWithStyleBuilderOptions{$name}{"Getter"} . "());\n"; 405 print STYLEBUILDER " }\n"; 406 } 407 if (!$propertiesWithStyleBuilderOptions{$name}{"Custom"}{"Value"}) { 395 408 print STYLEBUILDER " inline void applyValue" . $nameToId{$name} . "(StyleResolver& styleResolver, CSSValue& value)\n"; 396 409 print STYLEBUILDER " {\n"; … … 418 431 next unless exists($propertiesWithStyleBuilderOptions{$name}); 419 432 420 my $scope = $propertiesWithStyleBuilderOptions{$name}{"Custom"} eq "All" ? "StyleBuilderCustom" : "StyleBuilderFunctions";421 my $valueScope = $propertiesWithStyleBuilderOptions{$name}{"Custom"} eq "Value" ? "StyleBuilderCustom" : $scope;422 423 433 print STYLEBUILDER " case CSSProperty" . $nameToId{$name} . ":\n"; 424 434 print STYLEBUILDER " if (isInitial)\n"; 425 print STYLEBUILDER " " . $scope. "::applyInitial" . $nameToId{$name} . "(styleResolver);\n";435 print STYLEBUILDER " " . getScopeForFunction($name, "Initial") . "::applyInitial" . $nameToId{$name} . "(styleResolver);\n"; 426 436 print STYLEBUILDER " else if (isInherit)\n"; 427 print STYLEBUILDER " " . $scope. "::applyInherit" . $nameToId{$name} . "(styleResolver);\n";437 print STYLEBUILDER " " . getScopeForFunction($name, "Inherit") . "::applyInherit" . $nameToId{$name} . "(styleResolver);\n"; 428 438 print STYLEBUILDER " else\n"; 429 print STYLEBUILDER " " . $valueScope. "::applyValue" . $nameToId{$name} . "(styleResolver, value);\n";439 print STYLEBUILDER " " . getScopeForFunction($name, "Value") . "::applyValue" . $nameToId{$name} . "(styleResolver, value);\n"; 430 440 print STYLEBUILDER " return true;\n"; 431 441 }
Note:
See TracChangeset
for help on using the changeset viewer.