Changeset 175467 in webkit
- Timestamp:
- Nov 3, 2014 3:08:33 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r175466 r175467 1 2014-11-03 Chris Dumez <cdumez@apple.com> 2 3 Move 'zoom' CSS property to the new StyleBuilder 4 https://bugs.webkit.org/show_bug.cgi?id=138297 5 6 Reviewed by Antti Koivisto. 7 8 Move 'zoom' CSS property from DeprecatedStyleBuilder to the new 9 StyleBuilder by using custom code as it requires special handling. 10 11 No new tests, no behavior change. 12 13 * css/makeprop.pl: 14 Add support for Custom=All StyleBuilder option to indicate 15 that the property requires custom code to set the initial, 16 inherit and current values. 17 1 18 2014-11-03 Sungmann Cho <sungmann.cho@navercorp.com> 2 19 -
trunk/Source/WebCore/css/CSSPropertyNames.in
r175464 r175467 45 45 // css/StyleBuilderConverter.h should be used. 46 46 // 47 // * Custom= Value:48 // Thisoption is used to indicate that the CSS property requires special47 // * Custom=[Value|All]: 48 // Custom=Value option is used to indicate that the CSS property requires special 49 49 // handling to set its value, and a regular Converter helper cannot be 50 50 // used. The Custom code for the property should be located in 51 51 // css/StyleBuilderCustom.h and named applyValue[CSSPropertyName](). 52 // If special handling is also needed to apply inherit or initial value, use 53 // Custom=All. 52 54 53 55 … … 76 78 -webkit-writing-mode [Inherited] 77 79 -epub-writing-mode = -webkit-writing-mode 78 zoom 80 zoom [NewStyleBuilder, Custom=All] 79 81 80 82 // line height needs to be right after the above high-priority properties -
trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp
r175464 r175467 1701 1701 styleResolver->style()->setAspectRatioDenominator(aspectRatioValue.denominatorValue()); 1702 1702 styleResolver->style()->setAspectRatioNumerator(aspectRatioValue.numeratorValue()); 1703 }1704 1705 static PropertyHandler createHandler()1706 {1707 return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);1708 }1709 };1710 1711 class ApplyPropertyZoom {1712 private:1713 static void resetEffectiveZoom(StyleResolver* styleResolver)1714 {1715 // Reset the zoom in effect. This allows the setZoom method to accurately compute a new zoom in effect.1716 styleResolver->setEffectiveZoom(styleResolver->parentStyle() ? styleResolver->parentStyle()->effectiveZoom() : RenderStyle::initialZoom());1717 }1718 1719 public:1720 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)1721 {1722 resetEffectiveZoom(styleResolver);1723 styleResolver->setZoom(styleResolver->parentStyle()->zoom());1724 }1725 1726 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)1727 {1728 resetEffectiveZoom(styleResolver);1729 styleResolver->setZoom(RenderStyle::initialZoom());1730 }1731 1732 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)1733 {1734 CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);1735 1736 if (primitiveValue.getValueID() == CSSValueNormal) {1737 resetEffectiveZoom(styleResolver);1738 styleResolver->setZoom(RenderStyle::initialZoom());1739 } else if (primitiveValue.getValueID() == CSSValueReset) {1740 styleResolver->setEffectiveZoom(RenderStyle::initialZoom());1741 styleResolver->setZoom(RenderStyle::initialZoom());1742 } else if (primitiveValue.getValueID() == CSSValueDocument) {1743 float docZoom = styleResolver->rootElementStyle() ? styleResolver->rootElementStyle()->zoom() : RenderStyle::initialZoom();1744 styleResolver->setEffectiveZoom(docZoom);1745 styleResolver->setZoom(docZoom);1746 } else if (primitiveValue.isPercentage()) {1747 resetEffectiveZoom(styleResolver);1748 if (float percent = primitiveValue.getFloatValue())1749 styleResolver->setZoom(percent / 100.0f);1750 } else if (primitiveValue.isNumber()) {1751 resetEffectiveZoom(styleResolver);1752 if (float number = primitiveValue.getFloatValue())1753 styleResolver->setZoom(number);1754 }1755 1703 } 1756 1704 … … 2130 2078 2131 2079 setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex>::createHandler()); 2132 setPropertyHandler(CSSPropertyZoom, ApplyPropertyZoom::createHandler());2133 2080 } 2134 2081 -
trunk/Source/WebCore/css/StyleBuilderCustom.h
r175458 r175467 67 67 } 68 68 69 static inline void resetEffectiveZoom(StyleResolver& styleResolver) 70 { 71 // Reset the zoom in effect. This allows the setZoom method to accurately compute a new zoom in effect. 72 styleResolver.setEffectiveZoom(styleResolver.parentStyle() ? styleResolver.parentStyle()->effectiveZoom() : RenderStyle::initialZoom()); 73 } 74 75 inline void applyInitialZoom(StyleResolver& styleResolver) 76 { 77 resetEffectiveZoom(styleResolver); 78 styleResolver.setZoom(RenderStyle::initialZoom()); 79 } 80 81 inline void applyInheritZoom(StyleResolver& styleResolver) 82 { 83 resetEffectiveZoom(styleResolver); 84 styleResolver.setZoom(styleResolver.parentStyle()->zoom()); 85 } 86 87 inline void applyValueZoom(StyleResolver& styleResolver, CSSValue& value) 88 { 89 auto& primitiveValue = downcast<CSSPrimitiveValue>(value); 90 91 if (primitiveValue.getValueID() == CSSValueNormal) { 92 resetEffectiveZoom(styleResolver); 93 styleResolver.setZoom(RenderStyle::initialZoom()); 94 } else if (primitiveValue.getValueID() == CSSValueReset) { 95 styleResolver.setEffectiveZoom(RenderStyle::initialZoom()); 96 styleResolver.setZoom(RenderStyle::initialZoom()); 97 } else if (primitiveValue.getValueID() == CSSValueDocument) { 98 float docZoom = styleResolver.rootElementStyle() ? styleResolver.rootElementStyle()->zoom() : RenderStyle::initialZoom(); 99 styleResolver.setEffectiveZoom(docZoom); 100 styleResolver.setZoom(docZoom); 101 } else if (primitiveValue.isPercentage()) { 102 resetEffectiveZoom(styleResolver); 103 if (float percent = primitiveValue.getFloatValue()) 104 styleResolver.setZoom(percent / 100.0f); 105 } else if (primitiveValue.isNumber()) { 106 resetEffectiveZoom(styleResolver); 107 if (float number = primitiveValue.getFloatValue()) 108 styleResolver.setZoom(number); 109 } 110 } 111 69 112 } // namespace StyleBuilderFunctions 70 113 -
trunk/Source/WebCore/css/makeprop.pl
r175267 r175467 380 380 next unless exists($propertiesUsingNewStyleBuilder{$name}); 381 381 382 next if $propertiesUsingNewStyleBuilder{$name}{"Custom"} eq "All"; 383 382 384 my $setValue = "styleResolver.style()->" . $propertiesUsingNewStyleBuilder{$name}{"Setter"}; 383 385 print STYLEBUILDER " inline void applyInitial" . $nameToId{$name} . "(StyleResolver& styleResolver)\n";
Note: See TracChangeset
for help on using the changeset viewer.