Title: [175123] trunk/Source/WebCore
Revision
175123
Author
[email protected]
Date
2014-10-23 09:14:25 -0700 (Thu, 23 Oct 2014)

Log Message

Move Length-type CSS properties from DeprecatedStyleBuilder to the new Style Builder
https://bugs.webkit.org/show_bug.cgi?id=138000

Reviewed by Andreas Kling.

Move most Length-type CSS properties from DeprecatedStyleBuilder to the
new Style Builder so that they are now generated. This patch adds
support for a "Converter" option in CSSPropertyNames.in that can be
used to specify a type converter function in
css/StyleBuilderConverter.h. This patch adds support for Length and
LengthOrAuto converters so that most Length-type properties can now be
generated.

Another converter (likely called "LengthSizing") will be needed to
generate the remaining Length-type properties. This will be taken care
of in a follow-up patch.

This patch is inspired by the following Blink revision by
<[email protected]>:
https://src.chromium.org/viewvc/blink?view=rev&revision=150500

No new tests, no behavior change.

* WebCore.xcodeproj/project.pbxproj:
* css/CSSPropertyNames.in:
* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
* css/SVGCSSPropertyNames.in:
* css/StyleBuilder.h:
* css/StyleBuilderConverter.h: Added.
(WebCore::StyleBuilderConverter::convertLength):
(WebCore::StyleBuilderConverter::convertLengthOrAuto):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):
* css/makeprop.pl:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (175122 => 175123)


--- trunk/Source/WebCore/ChangeLog	2014-10-23 16:09:46 UTC (rev 175122)
+++ trunk/Source/WebCore/ChangeLog	2014-10-23 16:14:25 UTC (rev 175123)
@@ -1,3 +1,41 @@
+2014-10-23  Chris Dumez  <[email protected]>
+
+        Move Length-type CSS properties from DeprecatedStyleBuilder to the new Style Builder
+        https://bugs.webkit.org/show_bug.cgi?id=138000
+
+        Reviewed by Andreas Kling.
+
+        Move most Length-type CSS properties from DeprecatedStyleBuilder to the
+        new Style Builder so that they are now generated. This patch adds
+        support for a "Converter" option in CSSPropertyNames.in that can be
+        used to specify a type converter function in
+        css/StyleBuilderConverter.h. This patch adds support for Length and
+        LengthOrAuto converters so that most Length-type properties can now be
+        generated.
+
+        Another converter (likely called "LengthSizing") will be needed to
+        generate the remaining Length-type properties. This will be taken care
+        of in a follow-up patch.
+
+        This patch is inspired by the following Blink revision by
+        <[email protected]>:
+        https://src.chromium.org/viewvc/blink?view=rev&revision=150500
+
+        No new tests, no behavior change.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSPropertyNames.in:
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
+        * css/SVGCSSPropertyNames.in:
+        * css/StyleBuilder.h:
+        * css/StyleBuilderConverter.h: Added.
+        (WebCore::StyleBuilderConverter::convertLength):
+        (WebCore::StyleBuilderConverter::convertLengthOrAuto):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::applyProperty):
+        * css/makeprop.pl:
+
 2014-10-23  Zan Dobersek  <[email protected]>
 
         Const-ify static s_resourceType members in RenderSVGResource* classes

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (175122 => 175123)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-10-23 16:09:46 UTC (rev 175122)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-10-23 16:14:25 UTC (rev 175123)
@@ -2503,6 +2503,7 @@
 		836FBCEC178C117F00B21A15 /* SVGAnimatedProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */; };
 		8386A96D19F61B2E00E1EC4A /* StyleBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8386A96C19F61B2E00E1EC4A /* StyleBuilder.h */; };
 		8386A97019F61E4F00E1EC4A /* StyleBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */; };
+		83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */; };
 		83C1D425178D5AB400141E68 /* SVGPathSegArcAbs.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C1D413178D5AB400141E68 /* SVGPathSegArcAbs.h */; };
 		83C1D426178D5AB400141E68 /* SVGPathSegArcRel.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C1D414178D5AB400141E68 /* SVGPathSegArcRel.h */; };
 		83C1D427178D5AB400141E68 /* SVGPathSegCurvetoCubicAbs.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C1D415178D5AB400141E68 /* SVGPathSegCurvetoCubicAbs.h */; };
@@ -9683,7 +9684,8 @@
 		836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedTypeAnimator.cpp; sourceTree = "<group>"; };
 		836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedProperty.cpp; sourceTree = "<group>"; };
 		8386A96C19F61B2E00E1EC4A /* StyleBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilder.h; sourceTree = "<group>"; };
-		8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StyleBuilder.cpp; path = StyleBuilder.cpp; sourceTree = "<group>"; };
+		8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleBuilder.cpp; sourceTree = "<group>"; };
+		83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderConverter.h; sourceTree = "<group>"; };
 		83C1D413178D5AB400141E68 /* SVGPathSegArcAbs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegArcAbs.h; sourceTree = "<group>"; };
 		83C1D414178D5AB400141E68 /* SVGPathSegArcRel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegArcRel.h; sourceTree = "<group>"; };
 		83C1D415178D5AB400141E68 /* SVGPathSegCurvetoCubicAbs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegCurvetoCubicAbs.h; sourceTree = "<group>"; };
@@ -20565,7 +20567,7 @@
 				A8FA6E5C0E4CFDED00D5CF49 /* Pattern.cpp */,
 				A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */,
 				0562F9601573F88F0031CA16 /* PlatformLayer.h */,
-                                CEEFCD7B19DB33DC003876D7 /* PlatformMediaResourceLoader.h */,
+				CEEFCD7B19DB33DC003876D7 /* PlatformMediaResourceLoader.h */,
 				072847E216EBC5B00043CFA4 /* PlatformTextTrack.h */,
 				072847E316EBC5B00043CFA4 /* PlatformTextTrackMenu.h */,
 				074E82B818A69F0E007EF54C /* PlatformTimeRanges.cpp */,
@@ -22218,6 +22220,8 @@
 				43107BE118CC19DE00CC18E8 /* SelectorPseudoTypeMap.h */,
 				536D5A24193F40FC00CE4CAB /* SourceSizeList.cpp */,
 				536D5A26193F410B00CE4CAB /* SourceSizeList.h */,
+				8386A96C19F61B2E00E1EC4A /* StyleBuilder.h */,
+				83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */,
 				E47A97CE163059FC005DCD99 /* StyleInvalidationAnalysis.cpp */,
 				E47A97CF163059FC005DCD99 /* StyleInvalidationAnalysis.h */,
 				0FF5026E102BA9660066F39A /* StyleMedia.cpp */,
@@ -22272,7 +22276,6 @@
 				3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */,
 				3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */,
 				3F2B33E3165ABD3500E3987C /* WebKitCSSViewportRule.idl */,
-				8386A96C19F61B2E00E1EC4A /* StyleBuilder.h */,
 			);
 			path = css;
 			sourceTree = "<group>";
@@ -24444,7 +24447,6 @@
 				FD3160A112B026F700C1A359 /* HRTFPanner.h in Headers */,
 				BC97E23A109144950010D361 /* HTMLAllCollection.h in Headers */,
 				A8CFF7AB0A156978000A4234 /* HTMLAnchorElement.h in Headers */,
-				07BC67F419F8201D00E0E3D9 /* URLRegistry.h in Headers */,
 				A871D45D0A127CBC00B12A68 /* HTMLAppletElement.h in Headers */,
 				A8EA7D2E0A19385500A8EF5F /* HTMLAreaElement.h in Headers */,
 				E44613A20CD6331000FADA75 /* HTMLAudioElement.h in Headers */,
@@ -25589,7 +25591,7 @@
 				935C476809AC4D4300A6AAB4 /* PlatformKeyboardEvent.h in Headers */,
 				0562F9611573F88F0031CA16 /* PlatformLayer.h in Headers */,
 				F544F78915CFB2A800AF33A8 /* PlatformLocale.h in Headers */,
-                                CEEFCD7C19DB33DC003876D7 /* PlatformMediaResourceLoader.h in Headers */,
+				CEEFCD7C19DB33DC003876D7 /* PlatformMediaResourceLoader.h in Headers */,
 				932871C00B20DEB70049035A /* PlatformMenuDescription.h in Headers */,
 				41BF70100FE86F61005E8DEC /* PlatformMessagePortChannel.h in Headers */,
 				935C476909AC4D4300A6AAB4 /* PlatformMouseEvent.h in Headers */,
@@ -25930,6 +25932,7 @@
 				BC8B853E0E7C7F1100AB6984 /* ScrollbarThemeMac.h in Headers */,
 				0FE71406142170B800DB33BA /* ScrollbarThemeMock.h in Headers */,
 				5D925B680F64D4DD00B847F0 /* ScrollBehavior.h in Headers */,
+				83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */,
 				1AA84F05143BA7BD0051D153 /* ScrollElasticityController.h in Headers */,
 				0F605AED15F94848004DF0C0 /* ScrollingConstraints.h in Headers */,
 				1AF62EE814DA22A70041556C /* ScrollingCoordinator.h in Headers */,

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (175122 => 175123)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2014-10-23 16:09:46 UTC (rev 175122)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2014-10-23 16:14:25 UTC (rev 175123)
@@ -93,7 +93,7 @@
 border-top-style [NewStyleBuilder, TypeName=EBorderStyle, Initial=initialBorderStyle]
 border-top-width
 border-width
-bottom
+bottom [NewStyleBuilder, Initial=initialOffset, Converter=LengthOrAuto]
 box-shadow
 box-sizing [NewStyleBuilder]
 // -webkit-box-sizing worked in Safari 4 and earlier.
@@ -121,17 +121,17 @@
 #if defined(ENABLE_CSS_IMAGE_RESOLUTION) && ENABLE_CSS_IMAGE_RESOLUTION
 image-resolution [Inherited]
 #endif
-left
+left [NewStyleBuilder, Initial=initialOffset, Converter=LengthOrAuto]
 letter-spacing [Inherited]
 list-style [Inherited]
 list-style-image [Inherited]
 list-style-position [Inherited, NewStyleBuilder]
 list-style-type [Inherited, NewStyleBuilder]
 margin
-margin-bottom
-margin-left
-margin-right
-margin-top
+margin-bottom [NewStyleBuilder, Initial=initialMargin, Converter=LengthOrAuto]
+margin-left [NewStyleBuilder, Initial=initialMargin, Converter=LengthOrAuto]
+margin-right [NewStyleBuilder, Initial=initialMargin, Converter=LengthOrAuto]
+margin-top [NewStyleBuilder, Initial=initialMargin, Converter=LengthOrAuto]
 max-height
 max-width
 min-height
@@ -152,10 +152,10 @@
 overflow-x [NewStyleBuilder, TypeName=EOverflow]
 overflow-y [NewStyleBuilder, TypeName=EOverflow]
 padding
-padding-bottom
-padding-left
-padding-right
-padding-top
+padding-bottom [NewStyleBuilder, Initial=initialPadding, Converter=Length]
+padding-left [NewStyleBuilder, Initial=initialPadding, Converter=Length]
+padding-right [NewStyleBuilder, Initial=initialPadding, Converter=Length]
+padding-top [NewStyleBuilder, Initial=initialPadding, Converter=Length]
 page
 page-break-after [NewStyleBuilder, TypeName=EPageBreak, Initial=initialPageBreak]
 page-break-before [NewStyleBuilder, TypeName=EPageBreak, Initial=initialPageBreak]
@@ -165,7 +165,7 @@
 position [NewStyleBuilder]
 quotes [Inherited]
 resize [Inherited]
-right
+right [NewStyleBuilder, Initial=initialOffset, Converter=LengthOrAuto]
 size
 src
 speak [Inherited, NewStyleBuilder]
@@ -193,7 +193,7 @@
 text-underline-mode
 text-underline-style
 text-underline-width
-top
+top [NewStyleBuilder, Initial=initialOffset, Converter=LengthOrAuto]
 transition
 transition-delay
 transition-duration
@@ -301,7 +301,7 @@
 -webkit-align-self = align-self
 flex
 -webkit-flex = flex
-flex-basis
+flex-basis [NewStyleBuilder, Converter=LengthOrAuto]
 -webkit-flex-basis = flex-basis
 flex-direction [NewStyleBuilder]
 -webkit-flex-direction = flex-direction
@@ -396,8 +396,8 @@
 -webkit-padding-start
 -webkit-perspective
 -webkit-perspective-origin
--webkit-perspective-origin-x
--webkit-perspective-origin-y
+-webkit-perspective-origin-x [NewStyleBuilder, Converter=Length]
+-webkit-perspective-origin-y [NewStyleBuilder, Converter=Length]
 -webkit-print-color-adjust [Inherited, NewStyleBuilder, TypeName=PrintColorAdjust]
 -webkit-rtl-ordering [Inherited, NewStyleBuilder, TypeName=Order, Setter=setRTLOrdering, Initial=initialRTLOrdering]
 #if defined(ENABLE_CSS_SCROLL_SNAP)
@@ -438,8 +438,8 @@
 -webkit-text-stroke-width [Inherited]
 -webkit-transform
 -webkit-transform-origin
--webkit-transform-origin-x
--webkit-transform-origin-y
+-webkit-transform-origin-x [NewStyleBuilder, Converter=Length]
+-webkit-transform-origin-y [NewStyleBuilder, Converter=Length]
 -webkit-transform-origin-z
 -webkit-transform-style [NewStyleBuilder, TypeName=ETransformStyle3D, NameForMethods=TransformStyle3D]
 -webkit-transition
@@ -460,7 +460,7 @@
 #endif
 #if defined(ENABLE_CSS_SHAPES) && ENABLE_CSS_SHAPES
 -webkit-shape-outside
--webkit-shape-margin
+-webkit-shape-margin [NewStyleBuilder, Converter=Length]
 -webkit-shape-image-threshold
 #endif
 #if defined(ENABLE_CSS_DEVICE_ADAPTATION) && ENABLE_CSS_DEVICE_ADAPTATION

Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (175122 => 175123)


--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-10-23 16:09:46 UTC (rev 175122)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-10-23 16:14:25 UTC (rev 175123)
@@ -2372,7 +2372,6 @@
     setPropertyHandler(CSSPropertyBorderTopLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
     setPropertyHandler(CSSPropertyBorderTopRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
     setPropertyHandler(CSSPropertyBorderTopWidth, ApplyPropertyComputeLength<float, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
-    setPropertyHandler(CSSPropertyBottom, ApplyPropertyLength<&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
     setPropertyHandler(CSSPropertyClip, ApplyPropertyClip::createHandler());
     setPropertyHandler(CSSPropertyColor, ApplyPropertyColor<InheritFromParent, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::setVisitedLinkColor, &RenderStyle::invalidColor, RenderStyle::initialColor>::createHandler());
     setPropertyHandler(CSSPropertyCounterIncrement, ApplyPropertyCounter<Increment>::createHandler());
@@ -2389,7 +2388,6 @@
 #if ENABLE(CSS_IMAGE_RESOLUTION)
     setPropertyHandler(CSSPropertyImageResolution, ApplyPropertyImageResolution::createHandler());
 #endif
-    setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
     setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength<float, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
 
 #if ENABLE(IOS_TEXT_AUTOSIZING)
@@ -2398,10 +2396,6 @@
     setPropertyHandler(CSSPropertyLineHeight, ApplyPropertyLineHeight::createHandler());
 #endif
     setPropertyHandler(CSSPropertyListStyleImage, ApplyPropertyStyleImage<&RenderStyle::listStyleImage, &RenderStyle::setListStyleImage, &RenderStyle::initialListStyleImage, CSSPropertyListStyleImage>::createHandler());
-    setPropertyHandler(CSSPropertyMarginBottom, ApplyPropertyLength<&RenderStyle::marginBottom, &RenderStyle::setMarginBottom, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
-    setPropertyHandler(CSSPropertyMarginLeft, ApplyPropertyLength<&RenderStyle::marginLeft, &RenderStyle::setMarginLeft, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
-    setPropertyHandler(CSSPropertyMarginRight, ApplyPropertyLength<&RenderStyle::marginRight, &RenderStyle::setMarginRight, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
-    setPropertyHandler(CSSPropertyMarginTop, ApplyPropertyLength<&RenderStyle::marginTop, &RenderStyle::setMarginTop, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
     setPropertyHandler(CSSPropertyMaxHeight, ApplyPropertyLength<&RenderStyle::maxHeight, &RenderStyle::setMaxHeight, &RenderStyle::initialMaxSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicDisabled, NoneEnabled, UndefinedEnabled>::createHandler());
     setPropertyHandler(CSSPropertyMaxWidth, ApplyPropertyLength<&RenderStyle::maxWidth, &RenderStyle::setMaxWidth, &RenderStyle::initialMaxSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneEnabled, UndefinedEnabled>::createHandler());
     setPropertyHandler(CSSPropertyMinHeight, ApplyPropertyLength<&RenderStyle::minHeight, &RenderStyle::setMinHeight, &RenderStyle::initialMinSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicDisabled>::createHandler());
@@ -2411,12 +2405,7 @@
     setPropertyHandler(CSSPropertyOutlineOffset, ApplyPropertyComputeLength<int, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset, &RenderStyle::initialOutlineOffset>::createHandler());
     setPropertyHandler(CSSPropertyOutlineStyle, ApplyPropertyOutlineStyle::createHandler());
     setPropertyHandler(CSSPropertyOutlineWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth, &RenderStyle::initialOutlineWidth, NormalDisabled, ThicknessEnabled>::createHandler());
-    setPropertyHandler(CSSPropertyPaddingBottom, ApplyPropertyLength<&RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom, &RenderStyle::initialPadding>::createHandler());
-    setPropertyHandler(CSSPropertyPaddingLeft, ApplyPropertyLength<&RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft, &RenderStyle::initialPadding>::createHandler());
-    setPropertyHandler(CSSPropertyPaddingRight, ApplyPropertyLength<&RenderStyle::paddingRight, &RenderStyle::setPaddingRight, &RenderStyle::initialPadding>::createHandler());
-    setPropertyHandler(CSSPropertyPaddingTop, ApplyPropertyLength<&RenderStyle::paddingTop, &RenderStyle::setPaddingTop, &RenderStyle::initialPadding>::createHandler());
     setPropertyHandler(CSSPropertyResize, ApplyPropertyResize::createHandler());
-    setPropertyHandler(CSSPropertyRight, ApplyPropertyLength<&RenderStyle::right, &RenderStyle::setRight, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
     setPropertyHandler(CSSPropertySize, ApplyPropertyPageSize::createHandler());
     setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler());
     setPropertyHandler(CSSPropertyTextDecoration, ApplyPropertyTextDecoration::createHandler());
@@ -2426,7 +2415,6 @@
     setPropertyHandler(CSSPropertyWebkitTextUnderlinePosition, ApplyPropertyTextUnderlinePosition::createHandler());
     setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyTextIndent::createHandler());
     setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont<TextRenderingMode, &FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering>::createHandler());
-    setPropertyHandler(CSSPropertyTop, ApplyPropertyLength<&RenderStyle::top, &RenderStyle::setTop, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
     setPropertyHandler(CSSPropertyVerticalAlign, ApplyPropertyVerticalAlign::createHandler());
     setPropertyHandler(CSSPropertyWebkitAnimationDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
     setPropertyHandler(CSSPropertyWebkitAnimationDirection, ApplyPropertyAnimation<Animation::AnimationDirection, &Animation::direction, &Animation::setDirection, &Animation::isDirectionSet, &Animation::clearDirection, &Animation::initialAnimationDirection, &CSSToStyleMap::mapAnimationDirection, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
@@ -2449,7 +2437,6 @@
     setPropertyHandler(CSSPropertyWebkitColumnRuleColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor, &RenderStyle::color>::createHandler());
     setPropertyHandler(CSSPropertyWebkitColumnRuleWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth, &RenderStyle::initialColumnRuleWidth, NormalDisabled, ThicknessEnabled>::createHandler());
     setPropertyHandler(CSSPropertyWebkitColumnWidth, ApplyPropertyAuto<float, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth, ComputeLength>::createHandler());
-    setPropertyHandler(CSSPropertyFlexBasis, ApplyPropertyLength<&RenderStyle::flexBasis, &RenderStyle::setFlexBasis, &RenderStyle::initialFlexBasis, AutoEnabled>::createHandler());
 #if ENABLE(CSS_REGIONS)
     setPropertyHandler(CSSPropertyWebkitFlowFrom, ApplyPropertyString<MapNoneToNull, &RenderStyle::regionThread, &RenderStyle::setRegionThread, &RenderStyle::initialRegionThread>::createHandler());
     setPropertyHandler(CSSPropertyWebkitFlowInto, ApplyPropertyString<MapNoneToNull, &RenderStyle::flowThread, &RenderStyle::setFlowThread, &RenderStyle::initialFlowThread>::createHandler());
@@ -2482,15 +2469,11 @@
     setPropertyHandler(CSSPropertyWebkitMaskSize, ApplyPropertyFillLayer<FillSize, CSSPropertyWebkitMaskSize, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSToStyleMap::mapFillSize>::createHandler());
     setPropertyHandler(CSSPropertyWebkitMaskSourceType, ApplyPropertyFillLayer<EMaskSourceType, CSSPropertyWebkitMaskSourceType, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isMaskSourceTypeSet, &FillLayer::maskSourceType, &FillLayer::setMaskSourceType, &FillLayer::clearMaskSourceType, &FillLayer::initialMaskSourceType, &CSSToStyleMap::mapFillMaskSourceType>::createHandler());
     setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitPerspectiveOriginX, CSSPropertyWebkitPerspectiveOriginY>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitPerspectiveOriginX, ApplyPropertyLength<&RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX, &RenderStyle::initialPerspectiveOriginX>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitPerspectiveOriginY, ApplyPropertyLength<&RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOriginY, &RenderStyle::initialPerspectiveOriginY>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::setVisitedLinkTextEmphasisColor, &RenderStyle::color>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextEmphasisPosition, ApplyPropertyTextEmphasisPosition::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextEmphasisStyle, ApplyPropertyTextEmphasisStyle::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextFillColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::setVisitedLinkTextFillColor, &RenderStyle::color>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextStrokeColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::setVisitedLinkTextStrokeColor, &RenderStyle::color>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitTransformOriginX, ApplyPropertyLength<&RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX, &RenderStyle::initialTransformOriginX>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitTransformOriginY, ApplyPropertyLength<&RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY, &RenderStyle::initialTransformOriginY>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTransformOriginZ, ApplyPropertyComputeLength<float, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ, &RenderStyle::initialTransformOriginZ>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTransitionDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTransitionDuration, ApplyPropertyAnimation<double, &Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &CSSToStyleMap::mapAnimationDuration, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
@@ -2498,22 +2481,12 @@
     setPropertyHandler(CSSPropertyWebkitTransitionTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSToStyleMap::mapAnimationTimingFunction, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
     setPropertyHandler(CSSPropertyWebkitClipPath, ApplyPropertyClipPath<&RenderStyle::clipPath, &RenderStyle::setClipPath, &RenderStyle::initialClipPath>::createHandler());
 #if ENABLE(CSS_SHAPES)
-    setPropertyHandler(CSSPropertyWebkitShapeMargin, ApplyPropertyLength<&RenderStyle::shapeMargin, &RenderStyle::setShapeMargin, &RenderStyle::initialShapeMargin>::createHandler());
     setPropertyHandler(CSSPropertyWebkitShapeImageThreshold, ApplyPropertyNumber<float, &RenderStyle::shapeImageThreshold, &RenderStyle::setShapeImageThreshold, &RenderStyle::initialShapeImageThreshold>::createHandler());
     setPropertyHandler(CSSPropertyWebkitShapeOutside, ApplyPropertyShape<&RenderStyle::shapeOutside, &RenderStyle::setShapeOutside, &RenderStyle::initialShapeOutside>::createHandler());
 #endif
     setPropertyHandler(CSSPropertyWidows, ApplyPropertyAuto<short, &RenderStyle::widows, &RenderStyle::setWidows, &RenderStyle::hasAutoWidows, &RenderStyle::setHasAutoWidows>::createHandler());
     setPropertyHandler(CSSPropertyWidth, ApplyPropertyLength<&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneDisabled, UndefinedDisabled>::createHandler());
     setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyWordSpacing::createHandler());
-    setPropertyHandler(CSSPropertyCx, ApplyPropertyLength<&RenderStyle::cx, &RenderStyle::setCx, &RenderStyle::initialZeroLength>::createHandler());
-    setPropertyHandler(CSSPropertyCy, ApplyPropertyLength<&RenderStyle::cy, &RenderStyle::setCy, &RenderStyle::initialZeroLength>::createHandler());
-    setPropertyHandler(CSSPropertyR, ApplyPropertyLength<&RenderStyle::r, &RenderStyle::setR, &RenderStyle::initialZeroLength>::createHandler());
-    setPropertyHandler(CSSPropertyRx, ApplyPropertyLength<&RenderStyle::rx, &RenderStyle::setRx, &RenderStyle::initialZeroLength>::createHandler());
-    setPropertyHandler(CSSPropertyRy, ApplyPropertyLength<&RenderStyle::ry, &RenderStyle::setRy, &RenderStyle::initialZeroLength>::createHandler());
-    setPropertyHandler(CSSPropertyStrokeWidth, ApplyPropertyLength<&RenderStyle::strokeWidth, &RenderStyle::setStrokeWidth, &RenderStyle::initialOneLength>::createHandler());
-    setPropertyHandler(CSSPropertyStrokeDashoffset, ApplyPropertyLength<&RenderStyle::strokeDashOffset, &RenderStyle::setStrokeDashOffset, &RenderStyle::initialZeroLength>::createHandler());
-    setPropertyHandler(CSSPropertyX, ApplyPropertyLength<&RenderStyle::x, &RenderStyle::setX, &RenderStyle::initialZeroLength>::createHandler());
-    setPropertyHandler(CSSPropertyY, ApplyPropertyLength<&RenderStyle::y, &RenderStyle::setY, &RenderStyle::initialZeroLength>::createHandler());
 
     setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex>::createHandler());
     setPropertyHandler(CSSPropertyZoom, ApplyPropertyZoom::createHandler());

Modified: trunk/Source/WebCore/css/SVGCSSPropertyNames.in (175122 => 175123)


--- trunk/Source/WebCore/css/SVGCSSPropertyNames.in	2014-10-23 16:09:46 UTC (rev 175122)
+++ trunk/Source/WebCore/css/SVGCSSPropertyNames.in	2014-10-23 16:14:25 UTC (rev 175123)
@@ -33,12 +33,12 @@
 shape-rendering [Inherited]
 stroke [Inherited]
 stroke-dasharray [Inherited]
-stroke-dashoffset [Inherited]
+stroke-dashoffset [Inherited, NewStyleBuilder, NameForMethods=StrokeDashOffset, Initial=initialZeroLength, Converter=Length]
 stroke-linecap [Inherited]
 stroke-linejoin [Inherited]
 stroke-miterlimit [Inherited]
 stroke-opacity [Inherited]
-stroke-width [Inherited]
+stroke-width [Inherited, NewStyleBuilder, Initial=initialOneLength, Converter=Length]
 // text-rendering
 alignment-baseline
 baseline-shift
@@ -52,11 +52,11 @@
 
 -webkit-svg-shadow
 
-cx
-cy
-r
-rx
-ry
-x
-y
+cx [NewStyleBuilder, Initial=initialZeroLength, Converter=Length]
+cy [NewStyleBuilder, Initial=initialZeroLength, Converter=Length]
+r [NewStyleBuilder, Initial=initialZeroLength, Converter=Length]
+rx [NewStyleBuilder, Initial=initialZeroLength, Converter=Length]
+ry [NewStyleBuilder, Initial=initialZeroLength, Converter=Length]
+x [NewStyleBuilder, Initial=initialZeroLength, Converter=Length]
+y [NewStyleBuilder, Initial=initialZeroLength, Converter=Length]
 

Modified: trunk/Source/WebCore/css/StyleBuilder.h (175122 => 175123)


--- trunk/Source/WebCore/css/StyleBuilder.h	2014-10-23 16:09:46 UTC (rev 175122)
+++ trunk/Source/WebCore/css/StyleBuilder.h	2014-10-23 16:14:25 UTC (rev 175123)
@@ -36,7 +36,7 @@
 
 class StyleBuilder {
 public:
-    static bool applyProperty(CSSPropertyID, StyleResolver&, CSSValue*, bool isInitial, bool isInherit);
+    static bool applyProperty(CSSPropertyID, StyleResolver&, CSSValue&, bool isInitial, bool isInherit);
 };
 
 } // namespace WebCore

Added: trunk/Source/WebCore/css/StyleBuilderConverter.h (0 => 175123)


--- trunk/Source/WebCore/css/StyleBuilderConverter.h	                        (rev 0)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h	2014-10-23 16:14:25 UTC (rev 175123)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StyleBuilderConverter_h
+#define StyleBuilderConverter_h
+
+#include "CSSCalculationValue.h"
+#include "CSSPrimitiveValue.h"
+#include "Length.h"
+#include "StyleResolver.h"
+
+namespace WebCore {
+
+class StyleBuilderConverter {
+public:
+    static Length convertLength(StyleResolver&, CSSValue&);
+    static Length convertLengthOrAuto(StyleResolver&, CSSValue&);
+};
+
+inline Length StyleBuilderConverter::convertLength(StyleResolver& styleResolver, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+    CSSToLengthConversionData conversionData = styleResolver.useSVGZoomRulesForLength() ?
+        styleResolver.state().cssToLengthConversionData().copyWithAdjustedZoom(1.0f)
+        : styleResolver.state().cssToLengthConversionData();
+
+    if (primitiveValue.isLength()) {
+        Length length = primitiveValue.computeLength<Length>(conversionData);
+        length.setHasQuirk(primitiveValue.isQuirkValue());
+        return length;
+    }
+
+    if (primitiveValue.isPercentage())
+        return Length(primitiveValue.getDoubleValue(), Percent);
+
+    if (primitiveValue.isCalculatedPercentageWithLength())
+        return Length(primitiveValue.cssCalcValue()->createCalculationValue(conversionData));
+
+    ASSERT_NOT_REACHED();
+    return Length(0, Fixed);
+}
+
+inline Length StyleBuilderConverter::convertLengthOrAuto(StyleResolver& styleResolver, CSSValue& value)
+{
+    if (downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueAuto)
+        return Length(Auto);
+    return convertLength(styleResolver, value);
+}
+
+} // namespace WebCore
+
+#endif // StyleBuilderConverter_h

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (175122 => 175123)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2014-10-23 16:09:46 UTC (rev 175122)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2014-10-23 16:14:25 UTC (rev 175123)
@@ -2129,7 +2129,7 @@
     }
 
     // Use the new StyleBuilder.
-    if (StyleBuilder::applyProperty(id, *this, value, isInitial, isInherit))
+    if (StyleBuilder::applyProperty(id, *this, *value, isInitial, isInherit))
         return;
 
     CSSPrimitiveValue* primitiveValue = is<CSSPrimitiveValue>(*value) ? downcast<CSSPrimitiveValue>(value) : nullptr;

Modified: trunk/Source/WebCore/css/makeprop.pl (175122 => 175123)


--- trunk/Source/WebCore/css/makeprop.pl	2014-10-23 16:09:46 UTC (rev 175122)
+++ trunk/Source/WebCore/css/makeprop.pl	2014-10-23 16:14:25 UTC (rev 175123)
@@ -45,6 +45,7 @@
 # variable should go away.
 my %propertiesUsingNewStyleBuilder;
 my %newStyleBuilderOptions = (
+  Converter => 1, # Defined in Source/WebCore/css/StyleBuilderConverter.h
   Getter => 1,
   Initial => 1,
   NameForMethods => 1,
@@ -361,6 +362,7 @@
 #include "CSSPrimitiveValueMappings.h"
 #include "CSSProperty.h"
 #include "RenderStyle.h"
+#include "StyleBuilderConverter.h"
 #include "StyleResolver.h"
 
 namespace WebCore {
@@ -384,14 +386,20 @@
   print STYLEBUILDER "    }\n";
   print STYLEBUILDER "    static void applyValue" . $nameToId{$name} . "(StyleResolver& styleResolver, CSSValue& value)\n";
   print STYLEBUILDER "    {\n";
-  print STYLEBUILDER "        " . $setValue . "(static_cast<" . $propertiesUsingNewStyleBuilder{$name}{"TypeName"} . ">(static_cast<CSSPrimitiveValue&>(value)));\n";
+  my $convertedValue;
+  if (exists($propertiesUsingNewStyleBuilder{$name}{"Converter"})) {
+    $convertedValue = "StyleBuilderConverter::convert" . $propertiesUsingNewStyleBuilder{$name}{"Converter"} . "(styleResolver, value)";
+  } else {
+    $convertedValue = "static_cast<" . $propertiesUsingNewStyleBuilder{$name}{"TypeName"} . ">(downcast<CSSPrimitiveValue>(value))";
+  }
+  print STYLEBUILDER "        " . $setValue . "(" . $convertedValue . ");\n";
   print STYLEBUILDER "    }\n";
 }
 
 print STYLEBUILDER << "EOF";
 };
 
-bool StyleBuilder::applyProperty(CSSPropertyID property, StyleResolver& styleResolver, CSSValue* value, bool isInitial, bool isInherit)
+bool StyleBuilder::applyProperty(CSSPropertyID property, StyleResolver& styleResolver, CSSValue& value, bool isInitial, bool isInherit)
 {
     switch (property) {
 EOF
@@ -406,7 +414,7 @@
   print STYLEBUILDER "        else if (isInherit)\n";
   print STYLEBUILDER "            StyleBuilderFunctions::applyInherit" . $nameToId{$name} . "(styleResolver);\n";
   print STYLEBUILDER "        else\n";
-  print STYLEBUILDER "            StyleBuilderFunctions::applyValue" . $nameToId{$name} . "(styleResolver, *value);\n";
+  print STYLEBUILDER "            StyleBuilderFunctions::applyValue" . $nameToId{$name} . "(styleResolver, value);\n";
   print STYLEBUILDER "        return true;\n";
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to