Diff
Modified: trunk/Source/WebCore/ChangeLog (152843 => 152844)
--- trunk/Source/WebCore/ChangeLog 2013-07-18 14:03:57 UTC (rev 152843)
+++ trunk/Source/WebCore/ChangeLog 2013-07-18 14:24:52 UTC (rev 152844)
@@ -1,3 +1,45 @@
+2013-07-18 Christophe Dumez <[email protected]>
+
+ Use [ImplementedAs] instead of special casing in the bindings generators
+ https://bugs.webkit.org/show_bug.cgi?id=118848
+
+ Reviewed by Kentaro Hara.
+
+ In several instances, special casing were used in the bindings generator to avoid
+ name clashes in the implementation. The [ImplementedBy] IDL extended attribute is
+ meant to solve this issue so we now use it instead.
+
+ No new tests, no behavior change.
+
+ * bindings/scripts/CodeGenerator.pm:
+ (WK_ucfirst):
+ (AttributeNameForGetterAndSetter):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateImplementation):
+ (NativeToJSValue):
+ * bindings/scripts/CodeGeneratorObjC.pm:
+ (GenerateHeader):
+ (GenerateImplementation):
+ * svg/SVGAElement.idl:
+ * svg/SVGFECompositeElement.cpp:
+ (WebCore::SVGFECompositeElement::SVGFECompositeElement):
+ (WebCore::SVGFECompositeElement::parseAttribute):
+ (WebCore::SVGFECompositeElement::setFilterEffectAttribute):
+ (WebCore::SVGFECompositeElement::build):
+ * svg/SVGFECompositeElement.h:
+ * svg/SVGFECompositeElement.idl:
+ * svg/SVGFEMorphologyElement.cpp:
+ (WebCore::SVGFEMorphologyElement::SVGFEMorphologyElement):
+ (WebCore::SVGFEMorphologyElement::parseAttribute):
+ (WebCore::SVGFEMorphologyElement::setFilterEffectAttribute):
+ (WebCore::SVGFEMorphologyElement::build):
+ * svg/SVGFEMorphologyElement.h:
+ * svg/SVGFEMorphologyElement.idl:
+ * svg/SVGTransform.cpp:
+ (WebCore::SVGTransform::updateSVGMatrix):
+ * svg/SVGTransform.h:
+ * svg/SVGTransform.idl:
+
2013-07-18 Zalan Bujtas <[email protected]>
Incorrect calculated width for mspace.
Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (152843 => 152844)
--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2013-07-18 14:03:57 UTC (rev 152843)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2013-07-18 14:24:52 UTC (rev 152844)
@@ -466,6 +466,7 @@
my ($object, $param) = @_;
my $ret = ucfirst($param);
$ret =~ s/Xml/XML/ if $ret =~ /^Xml[^a-z]/;
+ $ret =~ s/Svg/SVG/ if $ret =~ /^Svg/;
return $ret;
}
@@ -525,13 +526,6 @@
}
my $attributeType = $attribute->signature->type;
- # Avoid clash with C++ keyword.
- $attributeName = "_operator" if $attributeName eq "operator";
-
- # SVGAElement defines a non-virtual "String& target() const" method which clashes with "virtual String target() const" in Element.
- # To solve this issue the SVGAElement method was renamed to "svgTarget", take care of that when calling this method.
- $attributeName = "svgTarget" if $attributeName eq "target" and $attributeType eq "SVGAnimatedString";
-
# SVG animated types need to use a special attribute name.
# The rest of the special casing for SVG animated types is handled in the language-specific code generators.
$attributeName .= "Animated" if $generator->IsSVGAnimatedType($attributeType);
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (152843 => 152844)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2013-07-18 14:03:57 UTC (rev 152843)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2013-07-18 14:24:52 UTC (rev 152844)
@@ -1994,7 +1994,7 @@
my $isNullable = $attribute->signature->isNullable;
$codeGenerator->AssertNotSequenceType($type);
my $getFunctionName = GetAttributeGetterName($interfaceName, $className, $attribute);
- my $implGetterFunctionName = $codeGenerator->WK_lcfirst($name);
+ my $implGetterFunctionName = $codeGenerator->WK_lcfirst($attribute->signature->extendedAttributes->{"ImplementedAs"} || $name);
my $attributeConditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
push(@implContent, "#if ${attributeConditionalString}\n") if $attributeConditionalString;
@@ -3641,12 +3641,6 @@
AddToImplIncludes("SVGStaticPropertyWithParentTearOff.h", $conditional);
$tearOffType =~ s/SVGPropertyTearOff</SVGStaticPropertyWithParentTearOff<$interfaceName, /;
- if ($value =~ /matrix/ and $interfaceName eq "SVGTransform") {
- # SVGTransform offers a matrix() method for internal usage that returns an AffineTransform
- # and a svgMatrix() method returning a SVGMatrix, used for the bindings.
- $value =~ s/matrix/svgMatrix/;
- }
-
$value = "${tearOffType}::create(castedThis->impl(), $value, $updateMethod)";
} else {
AddToImplIncludes("SVGStaticPropertyTearOff.h", $conditional);
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm (152843 => 152844)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm 2013-07-18 14:03:57 UTC (rev 152843)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm 2013-07-18 14:24:52 UTC (rev 152844)
@@ -844,8 +844,6 @@
my $attributeType = GetObjCType($attribute->signature->type);
my $property = "\@property" . GetPropertyAttributes($attribute->signature->type, $attribute->isReadOnly);
- # Some SVGFE*Element.idl use 'operator' as attribute name, rewrite as '_operator' to avoid clashes with C/C++
- $attributeName =~ s/operator/_operator/ if ($attributeName =~ /operator/);
$property .= " " . $attributeType . ($attributeType =~ /\*$/ ? "" : " ") . $attributeName;
my $publicInterfaceKey = $property . ";";
@@ -1228,9 +1226,6 @@
} elsif ($attributeName eq "frame") {
# Special case attribute frame to be frameBorders.
$attributeInterfaceName .= "Borders";
- } elsif ($attributeName eq "operator") {
- # Avoid clash with C++ keyword.
- $attributeInterfaceName = "_operator";
}
$attributeNames{$attributeInterfaceName} = 1;
@@ -1330,12 +1325,6 @@
$getter =~ s/\(//;
my $updateMethod = "&${implClassNameWithNamespace}::update" . $codeGenerator->WK_ucfirst($getter);
- if ($getterContentHead =~ /matrix/ and $implClassName eq "SVGTransform") {
- # SVGTransform offers a matrix() method for internal usage that returns an AffineTransform
- # and a svgMatrix() method returning a SVGMatrix, used for the bindings.
- $getterContentHead =~ s/matrix/svgMatrix/;
- }
-
$getterContentHead = "${tearOffType}::create(IMPL, $getterContentHead$getterContentTail, $updateMethod)";
$getterContentHead = "kit(WTF::getPtr($getterContentHead";
Modified: trunk/Source/WebCore/svg/SVGAElement.idl (152843 => 152844)
--- trunk/Source/WebCore/svg/SVGAElement.idl 2013-07-18 14:03:57 UTC (rev 152843)
+++ trunk/Source/WebCore/svg/SVGAElement.idl 2013-07-18 14:24:52 UTC (rev 152844)
@@ -26,7 +26,7 @@
[
Conditional=SVG
] interface SVGAElement : SVGGraphicsElement {
- readonly attribute SVGAnimatedString target;
+ [ImplementedAs=svgTarget] readonly attribute SVGAnimatedString target;
};
SVGAElement implements SVGExternalResourcesRequired;
Modified: trunk/Source/WebCore/svg/SVGFECompositeElement.cpp (152843 => 152844)
--- trunk/Source/WebCore/svg/SVGFECompositeElement.cpp 2013-07-18 14:03:57 UTC (rev 152843)
+++ trunk/Source/WebCore/svg/SVGFECompositeElement.cpp 2013-07-18 14:24:52 UTC (rev 152844)
@@ -34,7 +34,7 @@
// Animated property definitions
DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::inAttr, In1, in1)
DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::in2Attr, In2, in2)
-DEFINE_ANIMATED_ENUMERATION(SVGFECompositeElement, SVGNames::operatorAttr, _operator, _operator, CompositeOperationType)
+DEFINE_ANIMATED_ENUMERATION(SVGFECompositeElement, SVGNames::operatorAttr, SVGOperator, svgOperator, CompositeOperationType)
DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k1Attr, K1, k1)
DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k2Attr, K2, k2)
DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k3Attr, K3, k3)
@@ -43,7 +43,7 @@
BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFECompositeElement)
REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
REGISTER_LOCAL_ANIMATED_PROPERTY(in2)
- REGISTER_LOCAL_ANIMATED_PROPERTY(_operator)
+ REGISTER_LOCAL_ANIMATED_PROPERTY(svgOperator)
REGISTER_LOCAL_ANIMATED_PROPERTY(k1)
REGISTER_LOCAL_ANIMATED_PROPERTY(k2)
REGISTER_LOCAL_ANIMATED_PROPERTY(k3)
@@ -53,7 +53,7 @@
inline SVGFECompositeElement::SVGFECompositeElement(const QualifiedName& tagName, Document* document)
: SVGFilterPrimitiveStandardAttributes(tagName, document)
- , m__operator(FECOMPOSITE_OPERATOR_OVER)
+ , m_svgOperator(FECOMPOSITE_OPERATOR_OVER)
{
ASSERT(hasTagName(SVGNames::feCompositeTag));
registerAnimatedPropertiesForSVGFECompositeElement();
@@ -89,7 +89,7 @@
if (name == SVGNames::operatorAttr) {
CompositeOperationType propertyValue = SVGPropertyTraits<CompositeOperationType>::fromString(value);
if (propertyValue > 0)
- set_operatorBaseValue(propertyValue);
+ setSVGOperatorBaseValue(propertyValue);
return;
}
@@ -130,7 +130,7 @@
{
FEComposite* composite = static_cast<FEComposite*>(effect);
if (attrName == SVGNames::operatorAttr)
- return composite->setOperation(_operator());
+ return composite->setOperation(svgOperator());
if (attrName == SVGNames::k1Attr)
return composite->setK1(k1());
if (attrName == SVGNames::k2Attr)
@@ -179,7 +179,7 @@
if (!input1 || !input2)
return 0;
- RefPtr<FilterEffect> effect = FEComposite::create(filter, _operator(), k1(), k2(), k3(), k4());
+ RefPtr<FilterEffect> effect = FEComposite::create(filter, svgOperator(), k1(), k2(), k3(), k4());
FilterEffectVector& inputEffects = effect->inputEffects();
inputEffects.reserveCapacity(2);
inputEffects.append(input1);
Modified: trunk/Source/WebCore/svg/SVGFECompositeElement.h (152843 => 152844)
--- trunk/Source/WebCore/svg/SVGFECompositeElement.h 2013-07-18 14:03:57 UTC (rev 152843)
+++ trunk/Source/WebCore/svg/SVGFECompositeElement.h 2013-07-18 14:24:52 UTC (rev 152844)
@@ -90,7 +90,7 @@
BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFECompositeElement)
DECLARE_ANIMATED_STRING(In1, in1)
DECLARE_ANIMATED_STRING(In2, in2)
- DECLARE_ANIMATED_ENUMERATION(_operator, _operator, CompositeOperationType)
+ DECLARE_ANIMATED_ENUMERATION(SVGOperator, svgOperator, CompositeOperationType)
DECLARE_ANIMATED_NUMBER(K1, k1)
DECLARE_ANIMATED_NUMBER(K2, k2)
DECLARE_ANIMATED_NUMBER(K3, k3)
Modified: trunk/Source/WebCore/svg/SVGFECompositeElement.idl (152843 => 152844)
--- trunk/Source/WebCore/svg/SVGFECompositeElement.idl 2013-07-18 14:03:57 UTC (rev 152843)
+++ trunk/Source/WebCore/svg/SVGFECompositeElement.idl 2013-07-18 14:24:52 UTC (rev 152844)
@@ -38,7 +38,7 @@
readonly attribute SVGAnimatedString in1;
readonly attribute SVGAnimatedString in2;
- readonly attribute SVGAnimatedEnumeration operator;
+ [ImplementedAs=svgOperator] readonly attribute SVGAnimatedEnumeration operator;
readonly attribute SVGAnimatedNumber k1;
readonly attribute SVGAnimatedNumber k2;
readonly attribute SVGAnimatedNumber k3;
Modified: trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp (152843 => 152844)
--- trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp 2013-07-18 14:03:57 UTC (rev 152843)
+++ trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp 2013-07-18 14:24:52 UTC (rev 152844)
@@ -33,13 +33,13 @@
// Animated property definitions
DEFINE_ANIMATED_STRING(SVGFEMorphologyElement, SVGNames::inAttr, In1, in1)
-DEFINE_ANIMATED_ENUMERATION(SVGFEMorphologyElement, SVGNames::operatorAttr, _operator, _operator, MorphologyOperatorType)
+DEFINE_ANIMATED_ENUMERATION(SVGFEMorphologyElement, SVGNames::operatorAttr, SVGOperator, svgOperator, MorphologyOperatorType)
DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusXIdentifier(), RadiusX, radiusX)
DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusYIdentifier(), RadiusY, radiusY)
BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEMorphologyElement)
REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
- REGISTER_LOCAL_ANIMATED_PROPERTY(_operator)
+ REGISTER_LOCAL_ANIMATED_PROPERTY(svgOperator)
REGISTER_LOCAL_ANIMATED_PROPERTY(radiusX)
REGISTER_LOCAL_ANIMATED_PROPERTY(radiusY)
REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
@@ -47,7 +47,7 @@
inline SVGFEMorphologyElement::SVGFEMorphologyElement(const QualifiedName& tagName, Document* document)
: SVGFilterPrimitiveStandardAttributes(tagName, document)
- , m__operator(FEMORPHOLOGY_OPERATOR_ERODE)
+ , m_svgOperator(FEMORPHOLOGY_OPERATOR_ERODE)
{
ASSERT(hasTagName(SVGNames::feMorphologyTag));
registerAnimatedPropertiesForSVGFEMorphologyElement();
@@ -98,7 +98,7 @@
if (name == SVGNames::operatorAttr) {
MorphologyOperatorType propertyValue = SVGPropertyTraits<MorphologyOperatorType>::fromString(value);
if (propertyValue > 0)
- set_operatorBaseValue(propertyValue);
+ setSVGOperatorBaseValue(propertyValue);
return;
}
@@ -123,7 +123,7 @@
{
FEMorphology* morphology = static_cast<FEMorphology*>(effect);
if (attrName == SVGNames::operatorAttr)
- return morphology->setMorphologyOperator(_operator());
+ return morphology->setMorphologyOperator(svgOperator());
if (attrName == SVGNames::radiusAttr) {
// Both setRadius functions should be evaluated separately.
bool isRadiusXChanged = morphology->setRadiusX(radiusX());
@@ -169,7 +169,7 @@
if (xRadius < 0 || yRadius < 0)
return 0;
- RefPtr<FilterEffect> effect = FEMorphology::create(filter, _operator(), xRadius, yRadius);
+ RefPtr<FilterEffect> effect = FEMorphology::create(filter, svgOperator(), xRadius, yRadius);
effect->inputEffects().append(input1);
return effect.release();
}
Modified: trunk/Source/WebCore/svg/SVGFEMorphologyElement.h (152843 => 152844)
--- trunk/Source/WebCore/svg/SVGFEMorphologyElement.h 2013-07-18 14:03:57 UTC (rev 152843)
+++ trunk/Source/WebCore/svg/SVGFEMorphologyElement.h 2013-07-18 14:24:52 UTC (rev 152844)
@@ -77,7 +77,7 @@
BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEMorphologyElement)
DECLARE_ANIMATED_STRING(In1, in1)
- DECLARE_ANIMATED_ENUMERATION(_operator, _operator, MorphologyOperatorType)
+ DECLARE_ANIMATED_ENUMERATION(SVGOperator, svgOperator, MorphologyOperatorType)
DECLARE_ANIMATED_NUMBER(RadiusX, radiusX)
DECLARE_ANIMATED_NUMBER(RadiusY, radiusY)
END_DECLARE_ANIMATED_PROPERTIES
Modified: trunk/Source/WebCore/svg/SVGFEMorphologyElement.idl (152843 => 152844)
--- trunk/Source/WebCore/svg/SVGFEMorphologyElement.idl 2013-07-18 14:03:57 UTC (rev 152843)
+++ trunk/Source/WebCore/svg/SVGFEMorphologyElement.idl 2013-07-18 14:24:52 UTC (rev 152844)
@@ -33,7 +33,7 @@
const unsigned short SVG_MORPHOLOGY_OPERATOR_DILATE = 2;
readonly attribute SVGAnimatedString in1;
- readonly attribute SVGAnimatedEnumeration operator;
+ [ImplementedAs=svgOperator] readonly attribute SVGAnimatedEnumeration operator;
readonly attribute SVGAnimatedNumber radiusX;
readonly attribute SVGAnimatedNumber radiusY;
Modified: trunk/Source/WebCore/svg/SVGTransform.cpp (152843 => 152844)
--- trunk/Source/WebCore/svg/SVGTransform.cpp 2013-07-18 14:03:57 UTC (rev 152843)
+++ trunk/Source/WebCore/svg/SVGTransform.cpp 2013-07-18 14:24:52 UTC (rev 152844)
@@ -62,7 +62,7 @@
m_matrix = matrix;
}
-void SVGTransform::updateMatrix()
+void SVGTransform::updateSVGMatrix()
{
// The underlying matrix has been changed, alter the transformation type.
// Spec: In case the matrix object is changed directly (i.e., without using the methods on the SVGTransform interface itself)
Modified: trunk/Source/WebCore/svg/SVGTransform.h (152843 => 152844)
--- trunk/Source/WebCore/svg/SVGTransform.h 2013-07-18 14:03:57 UTC (rev 152843)
+++ trunk/Source/WebCore/svg/SVGTransform.h 2013-07-18 14:24:52 UTC (rev 152844)
@@ -54,7 +54,7 @@
SVGMatrix& svgMatrix() { return static_cast<SVGMatrix&>(m_matrix); }
AffineTransform matrix() const { return m_matrix; }
- void updateMatrix();
+ void updateSVGMatrix();
float angle() const { return m_angle; }
FloatPoint rotationCenter() const { return m_center; }
Modified: trunk/Source/WebCore/svg/SVGTransform.idl (152843 => 152844)
--- trunk/Source/WebCore/svg/SVGTransform.idl 2013-07-18 14:03:57 UTC (rev 152843)
+++ trunk/Source/WebCore/svg/SVGTransform.idl 2013-07-18 14:24:52 UTC (rev 152844)
@@ -32,7 +32,7 @@
const unsigned short SVG_TRANSFORM_SKEWY = 6;
readonly attribute unsigned short type;
- readonly attribute SVGMatrix matrix;
+ [ImplementedAs=svgMatrix] readonly attribute SVGMatrix matrix;
readonly attribute float angle;
[StrictTypeChecking] void setMatrix(SVGMatrix matrix);