Modified: trunk/Source/WebCore/ChangeLog (176812 => 176813)
--- trunk/Source/WebCore/ChangeLog 2014-12-04 21:32:21 UTC (rev 176812)
+++ trunk/Source/WebCore/ChangeLog 2014-12-04 21:48:33 UTC (rev 176813)
@@ -1,3 +1,27 @@
+2014-12-04 Chris Dumez <[email protected]>
+
+ Move 'webkit-aspect-ratio' CSS property to the new StyleBuilder
+ https://bugs.webkit.org/show_bug.cgi?id=139250
+
+ Reviewed by Sam Weinig.
+
+ Move 'aspect-ratio' CSS property to the new StyleBuilder by
+ using custom code.
+
+ No new tests, no behavior change.
+
+ * css/CSSPropertyNames.in:
+ * css/DeprecatedStyleBuilder.cpp:
+ (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
+ (WebCore::ApplyPropertyAspectRatio::applyInheritValue): Deleted.
+ (WebCore::ApplyPropertyAspectRatio::applyInitialValue): Deleted.
+ (WebCore::ApplyPropertyAspectRatio::applyValue): Deleted.
+ (WebCore::ApplyPropertyAspectRatio::createHandler): Deleted.
+ * css/StyleBuilderCustom.h:
+ (WebCore::StyleBuilderCustom::applyInitialWebkitAspectRatio):
+ (WebCore::StyleBuilderCustom::applyInheritWebkitAspectRatio):
+ (WebCore::StyleBuilderCustom::applyValueWebkitAspectRatio):
+
2014-12-04 Timothy Horton <[email protected]>
Further fix the 32-bit build.
Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (176812 => 176813)
--- trunk/Source/WebCore/css/CSSPropertyNames.in 2014-12-04 21:32:21 UTC (rev 176812)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in 2014-12-04 21:48:33 UTC (rev 176813)
@@ -286,7 +286,7 @@
-webkit-animation-play-state [LegacyStyleBuilder]
-webkit-animation-timing-function [LegacyStyleBuilder]
-webkit-appearance [TypeName=ControlPart]
--webkit-aspect-ratio [Inherited, LegacyStyleBuilder]
+-webkit-aspect-ratio [Inherited, Custom=All]
-webkit-backface-visibility
-webkit-background-clip [LegacyStyleBuilder]
-webkit-background-composite [LegacyStyleBuilder]
Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (176812 => 176813)
--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2014-12-04 21:32:21 UTC (rev 176812)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2014-12-04 21:48:33 UTC (rev 176813)
@@ -919,54 +919,6 @@
static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
};
-class ApplyPropertyAspectRatio {
-public:
- static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
- {
- if (styleResolver->parentStyle()->aspectRatioType() == AspectRatioAuto)
- return;
- styleResolver->style()->setAspectRatioType(styleResolver->parentStyle()->aspectRatioType());
- styleResolver->style()->setAspectRatioDenominator(styleResolver->parentStyle()->aspectRatioDenominator());
- styleResolver->style()->setAspectRatioNumerator(styleResolver->parentStyle()->aspectRatioNumerator());
- }
-
- static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
- {
- styleResolver->style()->setAspectRatioType(RenderStyle::initialAspectRatioType());
- styleResolver->style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDenominator());
- styleResolver->style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumerator());
- }
-
- static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
- {
- if (is<CSSPrimitiveValue>(*value)) {
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
-
- if (primitiveValue.getValueID() == CSSValueAuto)
- return styleResolver->style()->setAspectRatioType(AspectRatioAuto);
- if (primitiveValue.getValueID() == CSSValueFromDimensions)
- return styleResolver->style()->setAspectRatioType(AspectRatioFromDimensions);
- if (primitiveValue.getValueID() == CSSValueFromIntrinsic)
- return styleResolver->style()->setAspectRatioType(AspectRatioFromIntrinsic);
- }
-
- if (!is<CSSAspectRatioValue>(*value)) {
- styleResolver->style()->setAspectRatioType(AspectRatioAuto);
- return;
- }
-
- CSSAspectRatioValue& aspectRatioValue = downcast<CSSAspectRatioValue>(*value);
- styleResolver->style()->setAspectRatioType(AspectRatioSpecified);
- styleResolver->style()->setAspectRatioDenominator(aspectRatioValue.denominatorValue());
- styleResolver->style()->setAspectRatioNumerator(aspectRatioValue.numeratorValue());
- }
-
- static PropertyHandler createHandler()
- {
- return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
- }
-};
-
const DeprecatedStyleBuilder& DeprecatedStyleBuilder::sharedStyleBuilder()
{
static NeverDestroyed<DeprecatedStyleBuilder> styleBuilderInstance;
@@ -1026,7 +978,6 @@
setPropertyHandler(CSSPropertyWebkitAnimationName, ApplyPropertyAnimation<const String&, &Animation::name, &Animation::setName, &Animation::isNameSet, &Animation::clearName, &Animation::initialAnimationName, &CSSToStyleMap::mapAnimationName, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
setPropertyHandler(CSSPropertyWebkitAnimationPlayState, ApplyPropertyAnimation<EAnimPlayState, &Animation::playState, &Animation::setPlayState, &Animation::isPlayStateSet, &Animation::clearPlayState, &Animation::initialAnimationPlayState, &CSSToStyleMap::mapAnimationPlayState, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
setPropertyHandler(CSSPropertyWebkitAnimationTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSToStyleMap::mapAnimationTimingFunction, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
- setPropertyHandler(CSSPropertyWebkitAspectRatio, ApplyPropertyAspectRatio::createHandler());
setPropertyHandler(CSSPropertyWebkitBackgroundClip, CSSPropertyBackgroundClip);
setPropertyHandler(CSSPropertyWebkitBackgroundComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitBackgroundComposite, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSToStyleMap::mapFillComposite>::createHandler());
setPropertyHandler(CSSPropertyWebkitBackgroundOrigin, CSSPropertyBackgroundOrigin);
Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (176812 => 176813)
--- trunk/Source/WebCore/css/StyleBuilderCustom.h 2014-12-04 21:32:21 UTC (rev 176812)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h 2014-12-04 21:48:33 UTC (rev 176813)
@@ -28,6 +28,7 @@
#define StyleBuilderCustom_h
#include "BasicShapeFunctions.h"
+#include "CSSAspectRatioValue.h"
#include "CSSImageGeneratorValue.h"
#include "CSSImageSetValue.h"
#include "CSSImageValue.h"
@@ -125,6 +126,10 @@
static void applyInheritDisplay(StyleResolver&);
static void applyValueDisplay(StyleResolver&, CSSValue&);
+ static void applyInitialWebkitAspectRatio(StyleResolver&);
+ static void applyInheritWebkitAspectRatio(StyleResolver&);
+ static void applyValueWebkitAspectRatio(StyleResolver&, CSSValue&);
+
private:
static void resetEffectiveZoom(StyleResolver&);
static CSSToLengthConversionData csstoLengthConversionDataWithTextZoomFactor(StyleResolver&);
@@ -1005,6 +1010,42 @@
styleResolver.style()->setDisplay(display);
}
+inline void StyleBuilderCustom::applyInitialWebkitAspectRatio(StyleResolver& styleResolver)
+{
+ styleResolver.style()->setAspectRatioType(RenderStyle::initialAspectRatioType());
+ styleResolver.style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDenominator());
+ styleResolver.style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumerator());
+}
+
+inline void StyleBuilderCustom::applyInheritWebkitAspectRatio(StyleResolver& styleResolver)
+{
+ if (styleResolver.parentStyle()->aspectRatioType() == AspectRatioAuto)
+ return;
+ styleResolver.style()->setAspectRatioType(styleResolver.parentStyle()->aspectRatioType());
+ styleResolver.style()->setAspectRatioDenominator(styleResolver.parentStyle()->aspectRatioDenominator());
+ styleResolver.style()->setAspectRatioNumerator(styleResolver.parentStyle()->aspectRatioNumerator());
+}
+
+inline void StyleBuilderCustom::applyValueWebkitAspectRatio(StyleResolver& styleResolver, CSSValue& value)
+{
+ if (is<CSSPrimitiveValue>(value)) {
+ auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+
+ if (primitiveValue.getValueID() == CSSValueFromDimensions)
+ return styleResolver.style()->setAspectRatioType(AspectRatioFromDimensions);
+ if (primitiveValue.getValueID() == CSSValueFromIntrinsic)
+ return styleResolver.style()->setAspectRatioType(AspectRatioFromIntrinsic);
+
+ ASSERT(primitiveValue.getValueID() == CSSValueAuto);
+ return styleResolver.style()->setAspectRatioType(AspectRatioAuto);
+ }
+
+ auto& aspectRatioValue = downcast<CSSAspectRatioValue>(value);
+ styleResolver.style()->setAspectRatioType(AspectRatioSpecified);
+ styleResolver.style()->setAspectRatioDenominator(aspectRatioValue.denominatorValue());
+ styleResolver.style()->setAspectRatioNumerator(aspectRatioValue.numeratorValue());
+}
+
} // namespace WebCore
#endif // StyleBuilderCustom_h