Changeset 86765 in webkit
- Timestamp:
- May 18, 2011 8:35:36 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 49 added
- 75 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r86764 r86765 1 2011-05-18 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 Reviewed by Rob Buis. 4 5 All animated SVG enum properties are now ints 6 https://bugs.webkit.org/show_bug.cgi?id=10749 7 8 Add tests for all elements using SVGAnimatedEnumeration in the SVG DOM API. 9 10 * platform/mac/svg/dynamic-updates/SVGTextElement-svgdom-lengthAdjust-prop-expected.png: Update result, progression. 11 * svg/dom/SVGAnimatedEnumeration-SVGClipPathElement-expected.txt: Added. 12 * svg/dom/SVGAnimatedEnumeration-SVGClipPathElement.html: Added. 13 * svg/dom/SVGAnimatedEnumeration-SVGComponentTransferFunctionElement-expected.txt: Added. 14 * svg/dom/SVGAnimatedEnumeration-SVGComponentTransferFunctionElement.html: Added. 15 * svg/dom/SVGAnimatedEnumeration-SVGFEBlendElement-expected.txt: Added. 16 * svg/dom/SVGAnimatedEnumeration-SVGFEBlendElement.html: Added. 17 * svg/dom/SVGAnimatedEnumeration-SVGFEColorMatrixElement-expected.txt: Added. 18 * svg/dom/SVGAnimatedEnumeration-SVGFEColorMatrixElement.html: Added. 19 * svg/dom/SVGAnimatedEnumeration-SVGFECompositeElement-expected.txt: Added. 20 * svg/dom/SVGAnimatedEnumeration-SVGFECompositeElement.html: Added. 21 * svg/dom/SVGAnimatedEnumeration-SVGFEConvolveMatrixElement-expected.txt: Added. 22 * svg/dom/SVGAnimatedEnumeration-SVGFEConvolveMatrixElement.html: Added. 23 * svg/dom/SVGAnimatedEnumeration-SVGFEDisplacementMapElement-expected.txt: Added. 24 * svg/dom/SVGAnimatedEnumeration-SVGFEDisplacementMapElement.html: Added. 25 * svg/dom/SVGAnimatedEnumeration-SVGFEMorphologyElement-expected.txt: Added. 26 * svg/dom/SVGAnimatedEnumeration-SVGFEMorphologyElement.html: Added. 27 * svg/dom/SVGAnimatedEnumeration-SVGFETurbulenceElement-expected.txt: Added. 28 * svg/dom/SVGAnimatedEnumeration-SVGFETurbulenceElement.html: Added. 29 * svg/dom/SVGAnimatedEnumeration-SVGFilterElement-expected.txt: Added. 30 * svg/dom/SVGAnimatedEnumeration-SVGFilterElement.html: Added. 31 * svg/dom/SVGAnimatedEnumeration-SVGGradientElement-expected.txt: Added. 32 * svg/dom/SVGAnimatedEnumeration-SVGGradientElement.html: Added. 33 * svg/dom/SVGAnimatedEnumeration-SVGMarkerElement-expected.txt: Added. 34 * svg/dom/SVGAnimatedEnumeration-SVGMarkerElement.html: Added. 35 * svg/dom/SVGAnimatedEnumeration-SVGMaskElement-expected.txt: Added. 36 * svg/dom/SVGAnimatedEnumeration-SVGMaskElement.html: Added. 37 * svg/dom/SVGAnimatedEnumeration-SVGPatternElement-expected.txt: Added. 38 * svg/dom/SVGAnimatedEnumeration-SVGPatternElement.html: Added. 39 * svg/dom/SVGAnimatedEnumeration-SVGTextContentElement-expected.txt: Added. 40 * svg/dom/SVGAnimatedEnumeration-SVGTextContentElement.html: Added. 41 * svg/dom/SVGAnimatedEnumeration-SVGTextPathElement-expected.txt: Added. 42 * svg/dom/SVGAnimatedEnumeration-SVGTextPathElement.html: Added. 43 * svg/dom/SVGAnimatedEnumeration-expected.txt: 44 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGClipPathElement.js: Added. 45 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGComponentTransferFunctionElement.js: Added. 46 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGFEBlendElement.js: Added. 47 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGFEColorMatrixElement.js: Added. 48 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGFECompositeElement.js: Added. 49 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGFEConvolveMatrixElement.js: Added. 50 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGFEDisplacementMapElement.js: Added. 51 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGFEMorphologyElement.js: Added. 52 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGFETurbulenceElement.js: Added. 53 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGFilterElement.js: Added. 54 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGGradientElement.js: Added. 55 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGMarkerElement.js: Added. 56 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGMaskElement.js: Added. 57 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGPatternElement.js: Added. 58 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGTextContentElement.js: Added. 59 * svg/dom/script-tests/SVGAnimatedEnumeration-SVGTextPathElement.js: Added. 60 * svg/dom/script-tests/SVGAnimatedEnumeration.js: 61 * svg/dynamic-updates/SVGTextElement-svgdom-lengthAdjust-prop-expected.txt: 62 * svg/dynamic-updates/script-tests/SVGTextElement-svgdom-lengthAdjust-prop.js: 63 (executeTest): 64 * svg/filters/feBlend-invalid-mode-expected.txt: 65 * svg/filters/feComponentTransfer-style-crash-expected.txt: 66 * svg/filters/feComponentTransfer-style-crash.xhtml: 67 * svg/filters/feDisplacementMap-crash-test-expected.txt: 68 * svg/filters/feDisplacementMap-crash-test.xhtml: 69 1 70 2011-05-18 Kinuko Yasuda <kinuko@chromium.org> 2 71 -
trunk/LayoutTests/svg/dom/SVGAnimatedEnumeration-expected.txt
r72123 r86765 11 11 12 12 Check that enumerations are static, caching value in a local variable and modifying it, should have no effect 13 PASS enumRef is SVGUnitTypes.SVG_UNIT_TYPE_ UNKNOWN13 PASS enumRef is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX 14 14 PASS clipPathElement.clipPathUnits.baseVal is SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE 15 15 16 16 Check assigning various valid and invalid values 17 FAIL clipPathElement.clipPathUnits.baseVal = 3 should throw an exception. Was 3. 17 PASS clipPathElement.clipPathUnits.baseVal = 3 threw exception Error: SVG_INVALID_VALUE_ERR: DOM SVG Exception 1. 18 PASS clipPathElement.clipPathUnits.baseVal is SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE 19 PASS clipPathElement.clipPathUnits.baseVal = -1 threw exception Error: SVG_INVALID_VALUE_ERR: DOM SVG Exception 1. 20 PASS clipPathElement.clipPathUnits.baseVal is SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE 21 PASS clipPathElement.clipPathUnits.baseVal = '1' is "1" 22 PASS clipPathElement.clipPathUnits.baseVal is SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE 23 PASS clipPathElement.clipPathUnits.baseVal = 'aString' threw exception Error: SVG_INVALID_VALUE_ERR: DOM SVG Exception 1. 24 PASS clipPathElement.clipPathUnits.baseVal is SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE 18 25 PASS clipPathElement.clipPathUnits.baseVal = 2 is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX 19 FAIL clipPathElement.clipPathUnits.baseVal = -1 should throw an exception. Was -1. 20 PASS clipPathElement.clipPathUnits.baseVal = 'aString' is 'aString' 21 PASS clipPathElement.clipPathUnits.baseVal is 0 22 PASS clipPathElement.clipPathUnits.baseVal = 2 is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX 23 PASS clipPathElement.clipPathUnits.baseVal = clipPathElement is clipPathElement 24 PASS clipPathElement.clipPathUnits.baseVal is 0 25 PASS clipPathElement.clipPathUnits.baseVal = 2 is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX 26 27 Check that the clipPathUnits value remained objectBBox 26 PASS clipPathElement.clipPathUnits.baseVal = clipPathElement threw exception Error: SVG_INVALID_VALUE_ERR: DOM SVG Exception 1. 28 27 PASS clipPathElement.clipPathUnits.baseVal is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX 29 28 PASS successfullyParsed is true -
trunk/LayoutTests/svg/dom/script-tests/SVGAnimatedEnumeration.js
r72123 r86765 12 12 debug("Check that enumerations are static, caching value in a local variable and modifying it, should have no effect"); 13 13 var enumRef = clipPathElement.clipPathUnits.baseVal; 14 enumRef = SVGUnitTypes.SVG_UNIT_TYPE_ UNKNOWN;15 shouldBe("enumRef", "SVGUnitTypes.SVG_UNIT_TYPE_ UNKNOWN");14 enumRef = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; 15 shouldBe("enumRef", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX"); 16 16 shouldBe("clipPathElement.clipPathUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE"); 17 17 18 18 debug(""); 19 19 debug("Check assigning various valid and invalid values"); 20 shouldThrow("clipPathElement.clipPathUnits.baseVal = 3"); // FIXME: Doesn't throw in WebKit, we're not clamping to the allowed range. 20 shouldThrow("clipPathElement.clipPathUnits.baseVal = 3"); 21 shouldBe("clipPathElement.clipPathUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE"); 22 shouldThrow("clipPathElement.clipPathUnits.baseVal = -1"); 23 shouldBe("clipPathElement.clipPathUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE"); 24 25 // ECMA-262, 9.7, "ToUint16" 26 shouldBeEqualToString("clipPathElement.clipPathUnits.baseVal = '1'", SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE.toString()); 27 shouldBe("clipPathElement.clipPathUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE"); 28 29 // ECMA-262, 9.7, "ToUint16" 30 shouldThrow("clipPathElement.clipPathUnits.baseVal = 'aString'"); 31 shouldBe("clipPathElement.clipPathUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE"); 32 21 33 shouldBe("clipPathElement.clipPathUnits.baseVal = 2", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX"); 22 shouldThrow("clipPathElement.clipPathUnits.baseVal = -1"); // FIXME: Doesn't throw in WebKit, we're not clamping to the allowed range. 23 // ECMA-262, 9.7, "ToUint16" 24 shouldBe("clipPathElement.clipPathUnits.baseVal = 'aString'", "'aString'"); 25 shouldBe("clipPathElement.clipPathUnits.baseVal", "0"); 26 shouldBe("clipPathElement.clipPathUnits.baseVal = 2", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX"); 27 shouldBe("clipPathElement.clipPathUnits.baseVal = clipPathElement", "clipPathElement"); 28 shouldBe("clipPathElement.clipPathUnits.baseVal", "0"); 29 shouldBe("clipPathElement.clipPathUnits.baseVal = 2", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX"); 30 31 debug(""); 32 debug("Check that the clipPathUnits value remained objectBBox"); 34 shouldThrow("clipPathElement.clipPathUnits.baseVal = clipPathElement"); 33 35 shouldBe("clipPathElement.clipPathUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX"); 34 36 -
trunk/LayoutTests/svg/dynamic-updates/SVGTextElement-svgdom-lengthAdjust-prop-expected.txt
r83710 r86765 11 11 PASS textElement.textLength.baseVal.value is 200 12 12 PASS lastLength = textElement.getComputedTextLength(); lastLength > 0 && lastLength < 200 is true 13 FAIL textElement.getAttribute('lengthAdjust') should be spacingAndGlyphs. Was 2. 13 PASS textElement.getAttribute('lengthAdjust') is "spacingAndGlyphs" 14 14 PASS textElement.lengthAdjust.baseVal is SVGTextContentElement.LENGTHADJUST_SPACINGANDGLYPHS 15 15 PASS textElement.textLength.baseVal.value is 200 -
trunk/LayoutTests/svg/dynamic-updates/script-tests/SVGTextElement-svgdom-lengthAdjust-prop.js
r83710 r86765 19 19 function executeTest() { 20 20 textElement.lengthAdjust.baseVal = SVGTextContentElement.LENGTHADJUST_SPACINGANDGLYPHS; 21 // FIXME: This currently fails, as the attribute value is "2" instead of "spacingAndGlyphs". Investigate.22 21 shouldBeEqualToString("textElement.getAttribute('lengthAdjust')", "spacingAndGlyphs"); 23 22 shouldBe("textElement.lengthAdjust.baseVal", "SVGTextContentElement.LENGTHADJUST_SPACINGANDGLYPHS"); -
trunk/LayoutTests/svg/filters/feBlend-invalid-mode-expected.txt
r70652 r86765 1 CONSOLE MESSAGE: line 14: SVG_INVALID_VALUE_ERR: DOM SVG Exception 1: An invalid value was passed to an operation or assigned to an attribute. 1 2 PASS: Invalid blend modes do not trigger a crash. -
trunk/LayoutTests/svg/filters/feComponentTransfer-style-crash-expected.txt
r82351 r86765 1 ALERT: Error: SVG_INVALID_VALUE_ERR: DOM SVG Exception 1 1 2 PASS -
trunk/LayoutTests/svg/filters/feComponentTransfer-style-crash.xhtml
r82351 r86765 9 9 window.onload = function() 10 10 { 11 document.getElementById('tgt').type.baseVal=99999; 11 try { 12 document.getElementById('tgt').type.baseVal=99999; 13 } catch (e) { 14 alert (e); 15 } 16 12 17 setTimeout(function () { 13 18 document.body.innerHTML = "PASS"; -
trunk/LayoutTests/svg/filters/feDisplacementMap-crash-test-expected.txt
r81689 r86765 1 ALERT: Error: SVG_INVALID_VALUE_ERR: DOM SVG Exception 1 1 2 PASS -
trunk/LayoutTests/svg/filters/feDisplacementMap-crash-test.xhtml
r81689 r86765 10 10 window.onload = function() 11 11 { 12 document.getElementById('d').xChannelSelector.baseVal=0x80000000; 13 document.getElementById('d').yChannelSelector.baseVal=0x40000000; 12 try { 13 document.getElementById('d').xChannelSelector.baseVal=0x80000000; 14 document.getElementById('d').yChannelSelector.baseVal=0x40000000; 15 } catch(e) { 16 alert (e); 17 } 18 14 19 setTimeout(function () { 15 20 document.body.innerHTML = "PASS"; -
trunk/Source/WebCore/ChangeLog
r86764 r86765 1 2011-05-18 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 Reviewed by Rob Buis. 4 5 All animated SVG enum properties are now ints 6 https://bugs.webkit.org/show_bug.cgi?id=10749 7 8 DECLARE/DEFINE_ANIMATED_ENUMERATION created fooBaseVal()/setFooBaseVal() methods that take int parameters, and stored all enum types as integers. 9 Modify the SVG DOM API to store real enums, and get rid of any int<->enum conversions. It's now impossible to change any enum values to undefined 10 types, which is the root of several filter security bugs in the past, that were fixed by adding workarounds. 11 (Usual workaround: svgAttributeChanged(): if fooAttr has been changed from SVG DOM, and if it's an enum, check whether the enum is in range, or fix it up.) 12 13 Using a type-safe internal representation for these enum values we can get rid of ugly int<->enum conversions. 14 A lot of parseMappedAttribute() functions duplicated the code for parsing enum values (eg. userSpaceOnUse/objectBoundingBox unit values, in pattern/filter/mask/etc..) 15 Add dozens of new SVGPropertyTraits<EnumType> specializations for all enums we expose to JS, and offer static fromString/toString conversion methods in single places. 16 Use the new SVGPropertyTraits everywhere in svg/. 17 18 This also fixes SVG DOM <-> XML DOM synchronization for SVGAnimatedEnumeration types. 19 Example: <clipPath clipPathUnits="objectBoundingBox"> 20 myClipPath.clipPathUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE; 21 alert(myClipPath.getAttribute('clipPathUnits')); <- without this patch it says "1", now it says "userSpaceOnUse" as expected, and as other browsers do. 22 We're now properly converting the enum values to strings. 23 24 Add testcases for all SVGAnimatedEnumeration objects used in the SVG DOM API. Found several small bugs: 25 - SVGFEConvolveMatrix 'edgeMode' SVG DOM <-> XML DOM synchronization was not working, because of a typo: s/operatorAttr/edgeModeAttr 26 - SVGFEConvolveMatrix was missing an synchronizeProperty() implementation, disabling SVG <-> XML DOM synchronization completly. 27 28 Tests: svg/dom/SVGAnimatedEnumeration-SVGClipPathElement.html 29 svg/dom/SVGAnimatedEnumeration-SVGComponentTransferFunctionElement.html 30 svg/dom/SVGAnimatedEnumeration-SVGFEBlendElement.html 31 svg/dom/SVGAnimatedEnumeration-SVGFEColorMatrixElement.html 32 svg/dom/SVGAnimatedEnumeration-SVGFECompositeElement.html 33 svg/dom/SVGAnimatedEnumeration-SVGFEConvolveMatrixElement.html 34 svg/dom/SVGAnimatedEnumeration-SVGFEDisplacementMapElement.html 35 svg/dom/SVGAnimatedEnumeration-SVGFEMorphologyElement.html 36 svg/dom/SVGAnimatedEnumeration-SVGFETurbulenceElement.html 37 svg/dom/SVGAnimatedEnumeration-SVGFilterElement.html 38 svg/dom/SVGAnimatedEnumeration-SVGGradientElement.html 39 svg/dom/SVGAnimatedEnumeration-SVGMarkerElement.html 40 svg/dom/SVGAnimatedEnumeration-SVGMaskElement.html 41 svg/dom/SVGAnimatedEnumeration-SVGPatternElement.html 42 svg/dom/SVGAnimatedEnumeration-SVGTextContentElement.html 43 svg/dom/SVGAnimatedEnumeration-SVGTextPathElement.html 44 45 Fixes existing svg/dynamic-update/SVGTextContentElement-svgdom-lengthAdjust-prop.html where I found the bug initially. 46 47 * GNUmakefile.list.am: Add svg/properties/SVGAnimatedEnumerationPropertyTearOff.h to build. 48 * WebCore.gypi: Ditto. 49 * WebCore.pro: Ditto. 50 * WebCore.vcproj/WebCore.vcproj: Ditto. 51 * WebCore.xcodeproj/project.pbxproj: Ditto. 52 * bindings/scripts/CodeGeneratorV8.pm: Add V8 magic, to avoid ambigious conversion warning in toV8(PassRefPtr<SVGAnimatedEnumeration>). 53 * platform/graphics/GraphicsTypes.h: Cleanup GradientSpreadMethod, as the SVG dependency is gone. 54 * platform/graphics/filters/FEBlend.cpp: 55 (WebCore::FEBlend::apply): Turn early-returns (introduce in security patches a while ago) into ASSERTs, as the underlying bug has been fixed. 56 * platform/graphics/filters/FEDisplacementMap.cpp: 57 (WebCore::FEDisplacementMap::apply): Ditto. 58 * rendering/svg/RenderSVGResourceClipper.h: Remove toUnitType() usage, the clipPathUnits() provided by SVGClipPathElement have the correct enum type now. 59 (WebCore::RenderSVGResourceClipper::clipPathUnits): 60 * rendering/svg/RenderSVGResourceFilter.h: Remove toUnitType() usage, the filterUnits()/primitiveUnits() provided by SVGFilterElement have the correct enum type now. 61 (WebCore::RenderSVGResourceFilter::filterUnits): 62 (WebCore::RenderSVGResourceFilter::primitiveUnits): 63 * rendering/svg/RenderSVGResourceGradient.cpp: Add helper method platformSpreadMethodFromSVGType() converting from SVGGradientElement::SVGSpreadMethodType to GradientSpreadMethod (platform). 64 (WebCore::RenderSVGResourceGradient::applyResource): 65 * rendering/svg/RenderSVGResourceGradient.h: Ditto. 66 * rendering/svg/RenderSVGResourceLinearGradient.cpp: 67 (WebCore::RenderSVGResourceLinearGradient::buildGradient): Use platformSpreadMethodFromSVGType(). 68 * rendering/svg/RenderSVGResourceMarker.h: Remove toUnitType() usage, the markerUnits() provided by SVGMarkerElement have the correct enum type now. 69 (WebCore::RenderSVGResourceMarker::markerUnits): 70 * rendering/svg/RenderSVGResourceMasker.h: Remove toUnitType() usage, the maskUnits()/maskContentUnits() provided by SVGMaskElement have the correct enum type now. 71 (WebCore::RenderSVGResourceMasker::maskUnits): 72 (WebCore::RenderSVGResourceMasker::maskContentUnits): 73 * rendering/svg/RenderSVGResourceRadialGradient.cpp: 74 (WebCore::RenderSVGResourceRadialGradient::buildGradient): Use platformSpreadMethodFromSVGType(). 75 * rendering/svg/SVGRenderTreeAsText.cpp: 76 (WebCore::operator<<): Use SVGPropertyTraits<SomeSVGEnumType>::toString() to convert from enum to string, remove code duplication. 77 (WebCore::writeCommonGradientProperties): 78 * rendering/svg/SVGTextChunkBuilder.cpp: 79 (WebCore::SVGTextChunkBuilder::addTextChunk): Remove int->enum casting for SVGAnimatedEnumeration types, they are enums now. 80 * rendering/svg/SVGTextLayoutEngine.cpp: 81 (WebCore::SVGTextLayoutEngine::parentDefinesTextLength): Ditto. 82 (WebCore::SVGTextLayoutEngine::beginTextPathLayout): Ditto. 83 * svg/GradientAttributes.h: Change spread method type from platform GradientSpreadMethod to SVGSpreadMethodType. 84 (WebCore::GradientAttributes::GradientAttributes): 85 (WebCore::GradientAttributes::spreadMethod): 86 (WebCore::GradientAttributes::setSpreadMethod): 87 * svg/SVGAnimatedBoolean.idl: Enable potential exception raising on baseVal setting for the primitive types. 88 * svg/SVGAnimatedEnumeration.h: Switch from generic SVGAnimatedStaticPropertyTearOff<int> to new SVGAnimatedEnumerationPropertyTearOff<EnumType>. 89 * svg/SVGAnimatedEnumeration.idl: Enable potential exception raising on baseVal setting for the primitive types. 90 Only SVGAnimatedEnumeration makes use of this if the assigned value is out of range. 91 * svg/SVGAnimatedInteger.idl: Ditto. 92 * svg/SVGAnimatedNumber.idl: Ditto. 93 * svg/SVGAnimatedString.idl: Ditto. 94 * svg/SVGClipPathElement.cpp: 95 (WebCore::SVGClipPathElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<EnumType>::fromString(attr->value()). 96 * svg/SVGClipPathElement.h: 97 * svg/SVGComponentTransferFunctionElement.cpp: 98 (WebCore::SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement): Initialize type to identity, not unknown, as per spec. 99 (WebCore::SVGComponentTransferFunctionElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<EnumType>::fromString(attr->value()). 100 (WebCore::SVGComponentTransferFunctionElement::transferFunction): Remove int->enum casting for SVGAnimatedEnumeration types, they are enums now. 101 * svg/SVGComponentTransferFunctionElement.h: Remove svgAttributeChanged() method, that verified the enum value is not out of range. 102 It's not possible anymore for these values to go out of range. 103 * svg/SVGFEBlendElement.cpp: 104 (WebCore::SVGFEBlendElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<BlendModeType>::fromString(attr->value()). 105 (WebCore::SVGFEBlendElement::setFilterEffectAttribute): Remove int->enum casting for SVGAnimatedEnumeration types, they are enums now. 106 (WebCore::SVGFEBlendElement::build): Ditto. 107 * svg/SVGFEBlendElement.h: Add SVGPropertyTraits<BlendModeType> specializations. 108 * svg/SVGFEColorMatrixElement.cpp: 109 (WebCore::SVGFEColorMatrixElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<ColorMatrixType>::fromString(attr->value()). 110 (WebCore::SVGFEColorMatrixElement::setFilterEffectAttribute): Remove int->enum casting for SVGAnimatedEnumeration types, they are enums now.. 111 (WebCore::SVGFEColorMatrixElement::build): Ditto. 112 * svg/SVGFEColorMatrixElement.h: Add SVGPropertyTraits<ColorMatrixType> specializations. 113 * svg/SVGFECompositeElement.cpp: 114 (WebCore::SVGFECompositeElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<CompositeOperationType>::fromString(attr->value()). 115 (WebCore::SVGFECompositeElement::setFilterEffectAttribute): Remove int->enum casting for SVGAnimatedEnumeration types, they are enums now. 116 (WebCore::SVGFECompositeElement::build): Ditto. 117 * svg/SVGFECompositeElement.h: Add SVGPropertyTraits<CompositeOperationType> specializations. 118 * svg/SVGFEConvolveMatrixElement.cpp: Fix typo, edgeMode needs to be associated with SVGNames::edgeModeAttr, not SVGNames::operatorAttr. 119 (WebCore::SVGFEConvolveMatrixElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<EdgeModeType>::fromString(attr->value()). 120 (WebCore::SVGFEConvolveMatrixElement::setFilterEffectAttribute): Remove int->enum casting for SVGAnimatedEnumeration types, they are enums now. 121 (WebCore::SVGFEConvolveMatrixElement::synchronizeProperty): Add missing synchronizeProperty() implementation, otherwhise SVG DOM <-> XML DOM is not in sync. 122 (WebCore::SVGFEConvolveMatrixElement::build): Remove int->enum casting for SVGAnimatedEnumeration types, they are enums now. 123 * svg/SVGFEConvolveMatrixElement.h: Add SVGPropertyTraits<EdgeModeType> specializations. 124 * svg/SVGFEDisplacementMapElement.cpp: 125 (WebCore::SVGFEDisplacementMapElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<ChannelSelectorType>::fromString(attr->value()). 126 (WebCore::SVGFEDisplacementMapElement::setFilterEffectAttribute): Remove int->enum casting for SVGAnimatedEnumeration types, they are enums now. 127 (WebCore::SVGFEDisplacementMapElement::svgAttributeChanged): Remove range validation for enum types, they are always in range now. 128 (WebCore::SVGFEDisplacementMapElement::build): Remove int->enum casting for SVGAnimatedEnumeration types, they are enums now. 129 * svg/SVGFEDisplacementMapElement.h: Add SVGPropertyTraits<ChannelSelectorType> specializations. 130 * svg/SVGFEMorphologyElement.cpp: 131 (WebCore::SVGFEMorphologyElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<MorphologyOperatorType>::fromString(attr->value()). 132 (WebCore::SVGFEMorphologyElement::setFilterEffectAttribute): Remove int->enum casting for SVGAnimatedEnumeration types, they are enums now. 133 (WebCore::SVGFEMorphologyElement::build): Ditto. 134 * svg/SVGFEMorphologyElement.h: Add SVGPropertyTraits<MorphologyOperatorType> specializations. 135 * svg/SVGFETurbulenceElement.cpp: 136 (WebCore::SVGFETurbulenceElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<SVGStitchOptions/TurbulenceType>::fromString(attr->value()). 137 (WebCore::SVGFETurbulenceElement::setFilterEffectAttribute): Remove int->enum casting for SVGAnimatedEnumeration types, they are enums now. 138 (WebCore::SVGFETurbulenceElement::build): Ditto. 139 * svg/SVGFETurbulenceElement.h: Add SVGPropertyTraits<SVGStitchOptions/TurbulenceType> specializations. 140 * svg/SVGFilterElement.cpp: 141 (WebCore::SVGFilterElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<SVGUnitType>::fromString(attr->value()). 142 * svg/SVGFilterElement.h: 143 * svg/SVGGradientElement.cpp: 144 (WebCore::SVGGradientElement::SVGGradientElement): Missing spread method default initialization: set it to 'pad' as per spec. 145 (WebCore::SVGGradientElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<SVGUnitType/SVGSpreadMethodType>::fromString(attr->value()). 146 * svg/SVGGradientElement.h: Add SVGPropertyTraits<SVGSpreadMethodType> specializations. 147 * svg/SVGLinearGradientElement.cpp: 148 (WebCore::SVGLinearGradientElement::collectGradientAttributes): Remove int->enum casting for SVGAnimatedEnumeration types, they are enums now. 149 * svg/SVGMarkerElement.cpp: 150 (WebCore::SVGMarkerElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<EnumType>::fromString(attr->value()). 151 (WebCore::SVGMarkerElement::synchronizeOrientType): Add a custom synchronization method, that handles orientType/orientAngle -> orientAttr synchronization, which is special 152 as it depends on to other SVG DOM objects (SVGAnimatedAngle and SVGAnimatedEnumeration). All covered by new tests. 153 (WebCore::SVGMarkerElement::orientTypeAnimated): Custom tear off creation method, which would usually be generated by the DECLARE_ANIMATED_... macros. 154 * svg/SVGMarkerElement.h: Add SVGPropertyTraits<SVGMarkerUnitsType/SVGMarkerOrientType> specializations. 155 (WebCore::SVGMarkerElement::orientType): Add custom property handling for the 'orientType' SVGAnimatedEnumeration object, as it has special demands, based on 'orientAngle'. 156 (WebCore::SVGMarkerElement::orientTypeBaseValue): Ditto. 157 (WebCore::SVGMarkerElement::setOrientTypeBaseValue): Ditto. 158 * svg/SVGMaskElement.cpp: 159 (WebCore::SVGMaskElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<EnumType>::fromString(attr->value()). 160 * svg/SVGMaskElement.h: 161 * svg/SVGPatternElement.cpp: 162 (WebCore::SVGPatternElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<EnumType>::fromString(attr->value()). 163 * svg/SVGPatternElement.h: 164 * svg/SVGRadialGradientElement.cpp: 165 (WebCore::SVGRadialGradientElement::collectGradientAttributes): Remove int->enum casting for SVGAnimatedEnumeration types, they are enums now. 166 * svg/SVGTextContentElement.cpp: 167 (WebCore::SVGTextContentElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<SVGLengthAdjustType>::fromString(attr->value()). 168 * svg/SVGTextContentElement.h: Add SVGPropertyTraits<SVGLengthAdjustType> specializations. 169 * svg/SVGTextPathElement.cpp: 170 (WebCore::SVGTextPathElement::parseMappedAttribute): Convert attribute parsing to use SVGPropertyTraits<SVGTextPathMethodType/SVGTextPathSpacingType>::fromString(attr->value()). 171 * svg/SVGTextPathElement.h: Add SVGPropertyTraits<SVGTextPathMethodType/SVGTextPathSpacingType> specializations. 172 * svg/SVGUnitTypes.h: Add SVGPropertyTraits<SVGUnitType> specializations. 173 * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h: Added. SVGAnimatedEnumerationPropertyTearOff inherits from SVGAnimatedStaticPropertyTearOff<int>. 174 SVGAnimatedEnumeration remains a typedef to SVGAnimatedStaticPropertyTearOff<int>, to have a common base 175 class for all enum types. This special tear off object, overrides setBaseVal, to verify the incoming int 176 is within the enum range, otherwhise raise an SVG DOM exception. This makes it impossible to make any of 177 the enums go out of range anymore (which lead to security bugs in the past). 178 (WebCore::SVGAnimatedEnumerationPropertyTearOff::setBaseVal): 179 (WebCore::SVGAnimatedEnumerationPropertyTearOff::create): 180 (WebCore::SVGAnimatedEnumerationPropertyTearOff::SVGAnimatedEnumerationPropertyTearOff): 181 * svg/properties/SVGAnimatedStaticPropertyTearOff.h: 182 (WebCore::SVGAnimatedStaticPropertyTearOff::setBaseVal): Made this method virtual, to SVGAnimatedEnumerationPropertyTearOff can override the default behaviour. Also added an ExceptionCode param. 183 (WebCore::SVGAnimatedStaticPropertyTearOff::~SVGAnimatedStaticPropertyTearOff): 184 1 185 2011-05-18 Kinuko Yasuda <kinuko@chromium.org> 2 186 -
trunk/Source/WebCore/GNUmakefile.list.am
r86764 r86765 3243 3243 Source/WebCore/svg/LinearGradientAttributes.h \ 3244 3244 Source/WebCore/svg/PatternAttributes.h \ 3245 Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h \ 3245 3246 Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h \ 3246 3247 Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h \ -
trunk/Source/WebCore/WebCore.gypi
r86764 r86765 1062 1062 'svg/animation/SMILTime.h', 1063 1063 'svg/animation/SVGSMILElement.h', 1064 'svg/properties/SVGAnimatedEnumerationPropertyTearOff.h', 1064 1065 'svg/properties/SVGAnimatedListPropertyTearOff.h', 1065 1066 'svg/properties/SVGAnimatedProperty.h', -
trunk/Source/WebCore/WebCore.pro
r86726 r86765 2263 2263 svg/graphics/filters/SVGFilter.h \ 2264 2264 svg/graphics/SVGImage.h \ 2265 svg/properties/SVGAnimatedEnumerationPropertyTearOff.h \ 2265 2266 svg/properties/SVGAnimatedListPropertyTearOff.h \ 2266 2267 svg/properties/SVGAnimatedPathSegListPropertyTearOff.h \ -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r86764 r86765 65418 65418 > 65419 65419 <File 65420 RelativePath="..\svg\properties\SVGAnimatedEnumerationPropertyTearOff.h" 65421 > 65422 </File> 65423 <File 65420 65424 RelativePath="..\svg\properties\SVGAnimatedListPropertyTearOff.h" 65421 65425 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r86764 r86765 1550 1550 6EE8A77210F803F3005A4A24 /* JSWebGLContextAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */; }; 1551 1551 6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */; }; 1552 71FB967B1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1552 1553 72626E020EF022FE00A07E20 /* FontFastPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72626E010EF022FE00A07E20 /* FontFastPath.cpp */; }; 1553 1554 750D029311D0E7F300BD1B27 /* RenderInputSpeech.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 750D029111D0E7F300BD1B27 /* RenderInputSpeech.cpp */; }; … … 4093 4094 B1827493134CA4C100B98C2D /* CallbackFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B1827492134CA4C100B98C2D /* CallbackFunction.cpp */; }; 4094 4095 B1D5ECB5134B58DA0087C78F /* CallbackFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = B1D5ECB4134B58DA0087C78F /* CallbackFunction.h */; }; 4096 B1E54593134629C10092A545 /* CallbackTask.h in Headers */ = {isa = PBXBuildFile; fileRef = B1E54587134629C10092A545 /* CallbackTask.h */; }; 4095 4097 B1E54594134629C10092A545 /* MediaStreamClient.h in Headers */ = {isa = PBXBuildFile; fileRef = B1E54588134629C10092A545 /* MediaStreamClient.h */; }; 4096 4098 B1E54595134629C10092A545 /* MediaStreamFrameController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B1E54589134629C10092A545 /* MediaStreamFrameController.cpp */; }; … … 4098 4100 B1E54597134629C10092A545 /* MediaStreamController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B1E5458B134629C10092A545 /* MediaStreamController.cpp */; }; 4099 4101 B1E54598134629C10092A545 /* MediaStreamController.h in Headers */ = {isa = PBXBuildFile; fileRef = B1E5458C134629C10092A545 /* MediaStreamController.h */; }; 4100 B1E54593134629C10092A545 /* CallbackTask.h in Headers */ = {isa = PBXBuildFile; fileRef = B1E54587134629C10092A545 /* CallbackTask.h */; };4101 4102 B1E54599134629C10092A545 /* NavigatorUserMediaError.h in Headers */ = {isa = PBXBuildFile; fileRef = B1E5458D134629C10092A545 /* NavigatorUserMediaError.h */; }; 4102 4103 B1E5459B134629C10092A545 /* NavigatorUserMediaErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B1E5458F134629C10092A545 /* NavigatorUserMediaErrorCallback.h */; }; … … 8104 8105 6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLContextAttributes.cpp; sourceTree = "<group>"; }; 8105 8106 6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLContextAttributes.h; sourceTree = "<group>"; }; 8107 71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedEnumerationPropertyTearOff.h; sourceTree = "<group>"; }; 8106 8108 72626E010EF022FE00A07E20 /* FontFastPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFastPath.cpp; sourceTree = "<group>"; }; 8107 8109 750D029111D0E7F300BD1B27 /* RenderInputSpeech.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderInputSpeech.cpp; sourceTree = "<group>"; }; … … 10365 10367 B1827492134CA4C100B98C2D /* CallbackFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CallbackFunction.cpp; sourceTree = "<group>"; }; 10366 10368 B1D5ECB4134B58DA0087C78F /* CallbackFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallbackFunction.h; sourceTree = "<group>"; }; 10369 B1E54587134629C10092A545 /* CallbackTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallbackTask.h; sourceTree = "<group>"; }; 10367 10370 B1E54588134629C10092A545 /* MediaStreamClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamClient.h; sourceTree = "<group>"; }; 10368 10371 B1E54589134629C10092A545 /* MediaStreamFrameController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStreamFrameController.cpp; sourceTree = "<group>"; }; … … 10370 10373 B1E5458B134629C10092A545 /* MediaStreamController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStreamController.cpp; sourceTree = "<group>"; }; 10371 10374 B1E5458C134629C10092A545 /* MediaStreamController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamController.h; sourceTree = "<group>"; }; 10372 B1E54587134629C10092A545 /* CallbackTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallbackTask.h; sourceTree = "<group>"; };10373 10375 B1E5458D134629C10092A545 /* NavigatorUserMediaError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigatorUserMediaError.h; sourceTree = "<group>"; }; 10374 10376 B1E5458E134629C10092A545 /* NavigatorUserMediaError.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorUserMediaError.idl; sourceTree = "<group>"; }; … … 12563 12565 isa = PBXGroup; 12564 12566 children = ( 12567 71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */, 12565 12568 088A0DFB126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h */, 12566 12569 089A8E06128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h */, … … 22833 22836 BCF7E491137CD7C7001DDAE7 /* AdjustViewSizeOrNot.h in Headers */, 22834 22837 B1E54593134629C10092A545 /* CallbackTask.h in Headers */, 22838 71FB967B1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h in Headers */, 22835 22839 ); 22836 22840 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r84741 r86765 804 804 # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary 805 805 $result = $getterString; 806 # Fix amigious conversion problem, by casting to the base type first ($getterString returns a type that inherits from SVGAnimatedEnumeration, not the base class directly). 807 $result = "static_pointer_cast<SVGAnimatedEnumeration>($result)" if $returnType eq "SVGAnimatedEnumeration"; 806 808 } 807 809 -
trunk/Source/WebCore/platform/graphics/GraphicsTypes.h
r65021 r86765 51 51 }; 52 52 53 // FIXME: Currently these constants have to match the values used in the SVG54 // DOM API. That's a mistake. We need to make cut that dependency.55 53 enum GradientSpreadMethod { 56 SpreadMethodPad = 1,57 SpreadMethodReflect = 2,58 SpreadMethodRepeat = 354 SpreadMethodPad, 55 SpreadMethodReflect, 56 SpreadMethodRepeat 59 57 }; 60 58 -
trunk/Source/WebCore/platform/graphics/filters/FEBlend.cpp
r79664 r86765 103 103 return; 104 104 105 if (m_mode <= FEBLEND_MODE_UNKNOWN || m_mode > FEBLEND_MODE_LIGHTEN)106 return;105 ASSERT(m_mode > FEBLEND_MODE_UNKNOWN); 106 ASSERT(m_mode <= FEBLEND_MODE_LIGHTEN); 107 107 108 108 ByteArray* dstPixelArray = createPremultipliedImageResult(); -
trunk/Source/WebCore/platform/graphics/filters/FEDisplacementMap.cpp
r80022 r86765 100 100 return; 101 101 102 if (m_xChannelSelector == CHANNEL_UNKNOWN || m_yChannelSelector == CHANNEL_UNKNOWN)103 return;102 ASSERT(m_xChannelSelector != CHANNEL_UNKNOWN); 103 ASSERT(m_yChannelSelector != CHANNEL_UNKNOWN); 104 104 105 105 ByteArray* dstPixelArray = createPremultipliedImageResult(); -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h
r76248 r86765 59 59 bool hitTestClipContent(const FloatRect&, const FloatPoint&); 60 60 61 SVGUnitTypes::SVGUnitType clipPathUnits() const { return toUnitType(static_cast<SVGClipPathElement*>(node())->clipPathUnits()); }61 SVGUnitTypes::SVGUnitType clipPathUnits() const { return static_cast<SVGClipPathElement*>(node())->clipPathUnits(); } 62 62 63 63 static RenderSVGResourceType s_resourceType; -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h
r85406 r86765 79 79 PassRefPtr<SVGFilterBuilder> buildPrimitives(Filter*); 80 80 81 SVGUnitTypes::SVGUnitType filterUnits() const { return toUnitType(static_cast<SVGFilterElement*>(node())->filterUnits()); }82 SVGUnitTypes::SVGUnitType primitiveUnits() const { return toUnitType(static_cast<SVGFilterElement*>(node())->primitiveUnits()); }81 SVGUnitTypes::SVGUnitType filterUnits() const { return static_cast<SVGFilterElement*>(node())->filterUnits(); } 82 SVGUnitTypes::SVGUnitType primitiveUnits() const { return static_cast<SVGFilterElement*>(node())->primitiveUnits(); } 83 83 84 84 void primitiveAttributeChanged(RenderObject*, const QualifiedName&); -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp
r84101 r86765 277 277 } 278 278 279 } 280 281 #endif 279 GradientSpreadMethod RenderSVGResourceGradient::platformSpreadMethodFromSVGType(SVGGradientElement::SVGSpreadMethodType method) const 280 { 281 switch (method) { 282 case SVGGradientElement::SVG_SPREADMETHOD_UNKNOWN: 283 case SVGGradientElement::SVG_SPREADMETHOD_PAD: 284 return SpreadMethodPad; 285 case SVGGradientElement::SVG_SPREADMETHOD_REFLECT: 286 return SpreadMethodReflect; 287 case SVGGradientElement::SVG_SPREADMETHOD_REPEAT: 288 return SpreadMethodRepeat; 289 } 290 291 ASSERT_NOT_REACHED(); 292 return SpreadMethodPad; 293 } 294 295 } 296 297 #endif -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h
r84101 r86765 62 62 virtual void buildGradient(GradientData*, SVGGradientElement*) const = 0; 63 63 64 GradientSpreadMethod platformSpreadMethodFromSVGType(SVGGradientElement::SVGSpreadMethodType) const; 65 64 66 private: 65 67 bool m_shouldCollectGradientAttributes : 1; -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceLinearGradient.cpp
r75350 r86765 56 56 57 57 gradientData->gradient = Gradient::create(startPoint, endPoint); 58 gradientData->gradient->setSpreadMethod( m_attributes.spreadMethod());58 gradientData->gradient->setSpreadMethod(platformSpreadMethodFromSVGType(m_attributes.spreadMethod())); 59 59 60 60 // Add stops -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceMarker.h
r75350 r86765 61 61 FloatPoint referencePoint() const; 62 62 float angle() const; 63 SVGMarkerElement::SVGMarkerUnitsType markerUnits() const { return static_cast<SVGMarkerElement ::SVGMarkerUnitsType>(static_cast<SVGMarkerElement*>(node())->markerUnits()); }63 SVGMarkerElement::SVGMarkerUnitsType markerUnits() const { return static_cast<SVGMarkerElement*>(node())->markerUnits(); } 64 64 65 65 virtual RenderSVGResourceType resourceType() const { return s_resourceType; } -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.h
r75350 r86765 51 51 virtual FloatRect resourceBoundingBox(RenderObject*); 52 52 53 SVGUnitTypes::SVGUnitType maskUnits() const { return toUnitType(static_cast<SVGMaskElement*>(node())->maskUnits()); }54 SVGUnitTypes::SVGUnitType maskContentUnits() const { return toUnitType(static_cast<SVGMaskElement*>(node())->maskContentUnits()); }53 SVGUnitTypes::SVGUnitType maskUnits() const { return static_cast<SVGMaskElement*>(node())->maskUnits(); } 54 SVGUnitTypes::SVGUnitType maskContentUnits() const { return static_cast<SVGMaskElement*>(node())->maskContentUnits(); } 55 55 56 56 virtual RenderSVGResourceType resourceType() const { return s_resourceType; } -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceRadialGradient.cpp
r75350 r86765 61 61 radius); 62 62 63 gradientData->gradient->setSpreadMethod( m_attributes.spreadMethod());63 gradientData->gradient->setSpreadMethod(platformSpreadMethodFromSVGType(m_attributes.spreadMethod())); 64 64 65 65 // Add stops -
trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp
r83607 r86765 189 189 static TextStream& operator<<(TextStream& ts, const SVGUnitTypes::SVGUnitType& unitType) 190 190 { 191 switch (unitType) { 192 case SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN: 193 ts << "unknown"; 194 break; 195 case SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE: 196 ts << "userSpaceOnUse"; 197 break; 198 case SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: 199 ts << "objectBoundingBox"; 200 break; 201 } 202 191 ts << SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::toString(unitType); 203 192 return ts; 204 193 } … … 206 195 static TextStream& operator<<(TextStream& ts, const SVGMarkerElement::SVGMarkerUnitsType& markerUnit) 207 196 { 208 switch (markerUnit) { 209 case SVGMarkerElement::SVG_MARKERUNITS_UNKNOWN: 210 ts << "unknown"; 211 break; 212 case SVGMarkerElement::SVG_MARKERUNITS_USERSPACEONUSE: 213 ts << "userSpaceOnUse"; 214 break; 215 case SVGMarkerElement::SVG_MARKERUNITS_STROKEWIDTH: 216 ts << "strokeWidth"; 217 break; 218 } 219 197 ts << SVGPropertyTraits<SVGMarkerElement::SVGMarkerUnitsType>::toString(markerUnit); 220 198 return ts; 221 199 } … … 274 252 } 275 253 276 // FIXME: Maybe this should be in Gradient.cpp 277 static TextStream& operator<<(TextStream& ts, GradientSpreadMethod mode) 278 { 279 switch (mode) { 280 case SpreadMethodPad: 281 ts << "PAD"; 282 break; 283 case SpreadMethodRepeat: 284 ts << "REPEAT"; 285 break; 286 case SpreadMethodReflect: 287 ts << "REFLECT"; 288 break; 289 } 290 254 static TextStream& operator<<(TextStream& ts, const SVGGradientElement::SVGSpreadMethodType& type) 255 { 256 ts << SVGPropertyTraits<SVGGradientElement::SVGSpreadMethodType>::toString(type).upper(); 291 257 return ts; 292 258 } … … 535 501 } 536 502 537 static inline void writeCommonGradientProperties(TextStream& ts, GradientSpreadMethodspreadMethod, const AffineTransform& gradientTransform, bool boundingBoxMode)503 static inline void writeCommonGradientProperties(TextStream& ts, SVGGradientElement::SVGSpreadMethodType spreadMethod, const AffineTransform& gradientTransform, bool boundingBoxMode) 538 504 { 539 505 writeNameValuePair(ts, "gradientUnits", boundingBoxModeString(boundingBoxMode)); 540 506 541 if (spreadMethod != S preadMethodPad)507 if (spreadMethod != SVGGradientElement::SVG_SPREADMETHOD_PAD) 542 508 ts << " [spreadMethod=" << spreadMethod << "]"; 543 509 -
trunk/Source/WebCore/rendering/svg/SVGTextChunkBuilder.cpp
r83710 r86765 130 130 desiredTextLength = textContentElement->specifiedTextLength().value(textContentElement); 131 131 132 switch ( static_cast<SVGTextContentElement::SVGLengthAdjustType>(textContentElement->lengthAdjust())) {132 switch (textContentElement->lengthAdjust()) { 133 133 case SVGTextContentElement::LENGTHADJUST_UNKNOWN: 134 134 break; -
trunk/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp
r83710 r86765 157 157 SVGTextContentElement* textContentElement = SVGTextContentElement::elementFromRenderer(currentParent); 158 158 if (textContentElement) { 159 SVGTextContentElement::SVGLengthAdjustType lengthAdjust = static_cast<SVGTextContentElement::SVGLengthAdjustType>(textContentElement->lengthAdjust());159 SVGTextContentElement::SVGLengthAdjustType lengthAdjust = textContentElement->lengthAdjust(); 160 160 if (lengthAdjust == SVGTextContentElement::LENGTHADJUST_SPACING && textContentElement->specifiedTextLength().value(textContentElement) > 0) 161 161 return true; … … 213 213 214 214 if (SVGTextContentElement* textContentElement = SVGTextContentElement::elementFromRenderer(textPath)) { 215 lengthAdjust = static_cast<SVGTextContentElement::SVGLengthAdjustType>(textContentElement->lengthAdjust());215 lengthAdjust = textContentElement->lengthAdjust(); 216 216 desiredTextLength = textContentElement->specifiedTextLength().value(textContentElement); 217 217 } -
trunk/Source/WebCore/svg/GradientAttributes.h
r64579 r86765 22 22 23 23 #if ENABLE(SVG) 24 #include "Color.h" 25 #include "Gradient.h" 24 #include "SVGGradientElement.h" 26 25 #include "SVGLength.h" 27 26 … … 30 29 struct GradientAttributes { 31 30 GradientAttributes() 32 : m_spreadMethod(S preadMethodPad)31 : m_spreadMethod(SVGGradientElement::SVG_SPREADMETHOD_PAD) 33 32 , m_boundingBoxMode(true) 34 33 , m_spreadMethodSet(false) … … 39 38 } 40 39 41 GradientSpreadMethodspreadMethod() const { return m_spreadMethod; }40 SVGGradientElement::SVGSpreadMethodType spreadMethod() const { return m_spreadMethod; } 42 41 bool boundingBoxMode() const { return m_boundingBoxMode; } 43 42 AffineTransform gradientTransform() const { return m_gradientTransform; } 44 43 const Vector<Gradient::ColorStop>& stops() const { return m_stops; } 45 44 46 void setSpreadMethod( GradientSpreadMethodvalue)45 void setSpreadMethod(SVGGradientElement::SVGSpreadMethodType value) 47 46 { 48 47 m_spreadMethod = value; … … 75 74 private: 76 75 // Properties 77 GradientSpreadMethodm_spreadMethod;76 SVGGradientElement::SVGSpreadMethodType m_spreadMethod; 78 77 bool m_boundingBoxMode; 79 78 AffineTransform m_gradientTransform; -
trunk/Source/WebCore/svg/SVGAnimatedBoolean.idl
r71014 r86765 27 27 28 28 interface [Conditional=SVG] SVGAnimatedBoolean { 29 attribute [StrictTypeChecking] boolean baseVal; 29 attribute [StrictTypeChecking] boolean baseVal 30 setter raises(DOMException); 30 31 readonly attribute boolean animVal; 31 32 }; -
trunk/Source/WebCore/svg/SVGAnimatedEnumeration.h
r73130 r86765 22 22 23 23 #if ENABLE(SVG) 24 #include "SVGAnimatedEnumerationPropertyTearOff.h" 24 25 #include "SVGAnimatedPropertyMacros.h" 25 #include "SVGAnimatedStaticPropertyTearOff.h"26 26 27 27 namespace WebCore { … … 30 30 31 31 // Helper macros to declare/define a SVGAnimatedEnumeration object 32 #define DECLARE_ANIMATED_ENUMERATION(UpperProperty, LowerProperty ) \33 DECLARE_ANIMATED_PROPERTY(SVGAnimatedEnumeration , int, UpperProperty, LowerProperty)32 #define DECLARE_ANIMATED_ENUMERATION(UpperProperty, LowerProperty, EnumType) \ 33 DECLARE_ANIMATED_PROPERTY(SVGAnimatedEnumerationPropertyTearOff<EnumType>, EnumType, UpperProperty, LowerProperty) 34 34 35 #define DEFINE_ANIMATED_ENUMERATION(OwnerType, DOMAttribute, UpperProperty, LowerProperty ) \36 DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedEnumeration , int, UpperProperty, LowerProperty)35 #define DEFINE_ANIMATED_ENUMERATION(OwnerType, DOMAttribute, UpperProperty, LowerProperty, EnumType) \ 36 DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedEnumerationPropertyTearOff<EnumType>, EnumType, UpperProperty, LowerProperty) 37 37 38 #define DEFINE_ANIMATED_ENUMERATION_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty ) \39 DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, SVGAnimatedEnumeration , int, UpperProperty, LowerProperty)38 #define DEFINE_ANIMATED_ENUMERATION_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty, EnumType) \ 39 DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, SVGAnimatedEnumerationPropertyTearOff<EnumType>, EnumType, UpperProperty, LowerProperty) 40 40 41 41 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGAnimatedEnumeration.idl
r71014 r86765 27 27 28 28 interface [Conditional=SVG] SVGAnimatedEnumeration { 29 attribute [StrictTypeChecking] unsigned short baseVal; 29 attribute [StrictTypeChecking] unsigned short baseVal 30 setter raises(DOMException); 30 31 readonly attribute unsigned short animVal; 31 32 }; -
trunk/Source/WebCore/svg/SVGAnimatedInteger.idl
r71014 r86765 27 27 28 28 interface [Conditional=SVG] SVGAnimatedInteger { 29 attribute [StrictTypeChecking] long baseVal; 29 attribute [StrictTypeChecking] long baseVal 30 setter raises(DOMException); 30 31 readonly attribute long animVal; 31 32 }; -
trunk/Source/WebCore/svg/SVGAnimatedNumber.idl
r70979 r86765 28 28 29 29 interface [Conditional=SVG] SVGAnimatedNumber { 30 attribute [StrictTypeChecking] float baseVal; 30 attribute [StrictTypeChecking] float baseVal 31 setter raises(DOMException); 31 32 readonly attribute float animVal; 32 33 }; -
trunk/Source/WebCore/svg/SVGAnimatedString.idl
r64579 r86765 27 27 28 28 interface [Conditional=SVG] SVGAnimatedString { 29 30 /*setter raises(DOMException)*/;29 attribute DOMString baseVal 30 setter raises(DOMException); 31 31 readonly attribute DOMString animVal; 32 32 }; -
trunk/Source/WebCore/svg/SVGClipPathElement.cpp
r86050 r86765 31 31 #include "SVGNames.h" 32 32 #include "SVGTransformList.h" 33 #include "SVGUnitTypes.h"34 33 35 34 namespace WebCore { 36 35 37 36 // Animated property definitions 38 DEFINE_ANIMATED_ENUMERATION(SVGClipPathElement, SVGNames::clipPathUnitsAttr, ClipPathUnits, clipPathUnits )37 DEFINE_ANIMATED_ENUMERATION(SVGClipPathElement, SVGNames::clipPathUnitsAttr, ClipPathUnits, clipPathUnits, SVGUnitTypes::SVGUnitType) 39 38 DEFINE_ANIMATED_BOOLEAN(SVGClipPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) 40 39 … … 54 53 { 55 54 if (attr->name() == SVGNames::clipPathUnitsAttr) { 56 if (attr->value() == "userSpaceOnUse") 57 setClipPathUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); 58 else if (attr->value() == "objectBoundingBox") 59 setClipPathUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); 55 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(attr->value()); 56 if (propertyValue > 0) 57 setClipPathUnitsBaseValue(propertyValue); 60 58 } else { 61 59 if (SVGTests::parseMappedAttribute(attr)) -
trunk/Source/WebCore/svg/SVGClipPathElement.h
r78249 r86765 29 29 #include "SVGStyledTransformableElement.h" 30 30 #include "SVGTests.h" 31 #include "SVGUnitTypes.h" 31 32 32 33 namespace WebCore { … … 57 58 58 59 // Animated property declarations 59 DECLARE_ANIMATED_ENUMERATION(ClipPathUnits, clipPathUnits )60 DECLARE_ANIMATED_ENUMERATION(ClipPathUnits, clipPathUnits, SVGUnitTypes::SVGUnitType) 60 61 61 62 // SVGExternalResourcesRequired -
trunk/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp
r82351 r86765 32 32 33 33 // Animated property definitions 34 DEFINE_ANIMATED_ENUMERATION(SVGComponentTransferFunctionElement, SVGNames::typeAttr, Type, type )34 DEFINE_ANIMATED_ENUMERATION(SVGComponentTransferFunctionElement, SVGNames::typeAttr, Type, type, ComponentTransferType) 35 35 DEFINE_ANIMATED_NUMBER_LIST(SVGComponentTransferFunctionElement, SVGNames::tableValuesAttr, TableValues, tableValues) 36 36 DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::slopeAttr, Slope, slope) … … 42 42 SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(const QualifiedName& tagName, Document* document) 43 43 : SVGElement(tagName, document) 44 , m_type(FECOMPONENTTRANSFER_TYPE_ UNKNOWN)44 , m_type(FECOMPONENTTRANSFER_TYPE_IDENTITY) 45 45 , m_slope(1) 46 46 , m_amplitude(1) … … 53 53 const String& value = attr->value(); 54 54 if (attr->name() == SVGNames::typeAttr) { 55 if (value == "identity") 56 setTypeBaseValue(FECOMPONENTTRANSFER_TYPE_IDENTITY); 57 else if (value == "table") 58 setTypeBaseValue(FECOMPONENTTRANSFER_TYPE_TABLE); 59 else if (value == "discrete") 60 setTypeBaseValue(FECOMPONENTTRANSFER_TYPE_DISCRETE); 61 else if (value == "linear") 62 setTypeBaseValue(FECOMPONENTTRANSFER_TYPE_LINEAR); 63 else if (value == "gamma") 64 setTypeBaseValue(FECOMPONENTTRANSFER_TYPE_GAMMA); 55 ComponentTransferType propertyValue = SVGPropertyTraits<ComponentTransferType>::fromString(value); 56 if (propertyValue > 0) 57 setTypeBaseValue(propertyValue); 65 58 } else if (attr->name() == SVGNames::tableValuesAttr) { 66 59 SVGNumberList newList; … … 80 73 else 81 74 SVGElement::parseMappedAttribute(attr); 82 }83 84 void SVGComponentTransferFunctionElement::svgAttributeChanged(const QualifiedName& attrName)85 {86 SVGElement::svgAttributeChanged(attrName);87 88 if (attrName == SVGNames::typeAttr) {89 ComponentTransferType componentType = static_cast<ComponentTransferType>(type());90 if (componentType < FECOMPONENTTRANSFER_TYPE_UNKNOWN || componentType > FECOMPONENTTRANSFER_TYPE_GAMMA)91 setTypeBaseValue(FECOMPONENTTRANSFER_TYPE_UNKNOWN);92 }93 75 } 94 76 … … 145 127 { 146 128 ComponentTransferFunction func; 147 func.type = static_cast<ComponentTransferType>(type());129 func.type = type(); 148 130 func.slope = slope(); 149 131 func.intercept = intercept(); -
trunk/Source/WebCore/svg/SVGComponentTransferFunctionElement.h
r82351 r86765 38 38 39 39 virtual void parseMappedAttribute(Attribute*); 40 virtual void svgAttributeChanged(const QualifiedName&);41 40 virtual void synchronizeProperty(const QualifiedName&); 42 41 virtual void fillAttributeToPropertyTypeMap(); … … 45 44 private: 46 45 // Animated property declarations 47 DECLARE_ANIMATED_ENUMERATION(Type, type )46 DECLARE_ANIMATED_ENUMERATION(Type, type, ComponentTransferType) 48 47 DECLARE_ANIMATED_NUMBER_LIST(TableValues, tableValues) 49 48 DECLARE_ANIMATED_NUMBER(Slope, slope) … … 54 53 }; 55 54 55 template<> 56 struct SVGPropertyTraits<ComponentTransferType> { 57 static ComponentTransferType highestEnumValue() { return FECOMPONENTTRANSFER_TYPE_GAMMA; } 58 59 static String toString(ComponentTransferType type) 60 { 61 switch (type) { 62 case FECOMPONENTTRANSFER_TYPE_UNKNOWN: 63 return emptyString(); 64 case FECOMPONENTTRANSFER_TYPE_IDENTITY: 65 return "identity"; 66 case FECOMPONENTTRANSFER_TYPE_TABLE: 67 return "table"; 68 case FECOMPONENTTRANSFER_TYPE_DISCRETE: 69 return "discrete"; 70 case FECOMPONENTTRANSFER_TYPE_LINEAR: 71 return "linear"; 72 case FECOMPONENTTRANSFER_TYPE_GAMMA: 73 return "gamma"; 74 } 75 76 ASSERT_NOT_REACHED(); 77 return emptyString(); 78 } 79 80 static ComponentTransferType fromString(const String& value) 81 { 82 if (value == "identity") 83 return FECOMPONENTTRANSFER_TYPE_IDENTITY; 84 if (value == "table") 85 return FECOMPONENTTRANSFER_TYPE_TABLE; 86 if (value == "discrete") 87 return FECOMPONENTTRANSFER_TYPE_DISCRETE; 88 if (value == "linear") 89 return FECOMPONENTTRANSFER_TYPE_LINEAR; 90 if (value == "gamma") 91 return FECOMPONENTTRANSFER_TYPE_GAMMA; 92 return FECOMPONENTTRANSFER_TYPE_UNKNOWN; 93 } 94 }; 95 56 96 } // namespace WebCore 57 97 -
trunk/Source/WebCore/svg/SVGFEBlendElement.cpp
r86050 r86765 34 34 DEFINE_ANIMATED_STRING(SVGFEBlendElement, SVGNames::inAttr, In1, in1) 35 35 DEFINE_ANIMATED_STRING(SVGFEBlendElement, SVGNames::in2Attr, In2, in2) 36 DEFINE_ANIMATED_ENUMERATION(SVGFEBlendElement, SVGNames::modeAttr, Mode, mode )36 DEFINE_ANIMATED_ENUMERATION(SVGFEBlendElement, SVGNames::modeAttr, Mode, mode, BlendModeType) 37 37 38 38 inline SVGFEBlendElement::SVGFEBlendElement(const QualifiedName& tagName, Document* document) … … 52 52 const String& value = attr->value(); 53 53 if (attr->name() == SVGNames::modeAttr) { 54 if (value == "normal") 55 setModeBaseValue(FEBLEND_MODE_NORMAL); 56 else if (value == "multiply") 57 setModeBaseValue(FEBLEND_MODE_MULTIPLY); 58 else if (value == "screen") 59 setModeBaseValue(FEBLEND_MODE_SCREEN); 60 else if (value == "darken") 61 setModeBaseValue(FEBLEND_MODE_DARKEN); 62 else if (value == "lighten") 63 setModeBaseValue(FEBLEND_MODE_LIGHTEN); 54 BlendModeType propertyValue = SVGPropertyTraits<BlendModeType>::fromString(value); 55 if (propertyValue > 0) 56 setModeBaseValue(propertyValue); 64 57 } else if (attr->name() == SVGNames::inAttr) 65 58 setIn1BaseValue(value); … … 74 67 FEBlend* blend = static_cast<FEBlend*>(effect); 75 68 if (attrName == SVGNames::modeAttr) 76 return blend->setBlendMode( static_cast<BlendModeType>(mode()));69 return blend->setBlendMode(mode()); 77 70 78 71 ASSERT_NOT_REACHED(); … … 135 128 return 0; 136 129 137 RefPtr<FilterEffect> effect = FEBlend::create(filter, static_cast<BlendModeType>(mode()));130 RefPtr<FilterEffect> effect = FEBlend::create(filter, mode()); 138 131 FilterEffectVector& inputEffects = effect->inputEffects(); 139 132 inputEffects.reserveCapacity(2); … … 146 139 147 140 #endif // ENABLE(SVG) 148 149 // vim:ts=4:noet -
trunk/Source/WebCore/svg/SVGFEBlendElement.h
r79664 r86765 47 47 DECLARE_ANIMATED_STRING(In1, in1) 48 48 DECLARE_ANIMATED_STRING(In2, in2) 49 DECLARE_ANIMATED_ENUMERATION(Mode, mode) 49 DECLARE_ANIMATED_ENUMERATION(Mode, mode, BlendModeType) 50 }; 51 52 template<> 53 struct SVGPropertyTraits<BlendModeType> { 54 static BlendModeType highestEnumValue() { return FEBLEND_MODE_LIGHTEN; } 55 56 static String toString(BlendModeType type) 57 { 58 switch (type) { 59 case FEBLEND_MODE_UNKNOWN: 60 return emptyString(); 61 case FEBLEND_MODE_NORMAL: 62 return "normal"; 63 case FEBLEND_MODE_MULTIPLY: 64 return "multiply"; 65 case FEBLEND_MODE_SCREEN: 66 return "screen"; 67 case FEBLEND_MODE_DARKEN: 68 return "darken"; 69 case FEBLEND_MODE_LIGHTEN: 70 return "lighten"; 71 } 72 73 ASSERT_NOT_REACHED(); 74 return emptyString(); 75 } 76 77 static BlendModeType fromString(const String& value) 78 { 79 if (value == "normal") 80 return FEBLEND_MODE_NORMAL; 81 if (value == "multiply") 82 return FEBLEND_MODE_MULTIPLY; 83 if (value == "screen") 84 return FEBLEND_MODE_SCREEN; 85 if (value == "darken") 86 return FEBLEND_MODE_DARKEN; 87 if (value == "lighten") 88 return FEBLEND_MODE_LIGHTEN; 89 return FEBLEND_MODE_UNKNOWN; 90 } 50 91 }; 51 92 -
trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp
r86050 r86765 33 33 // Animated property definitions 34 34 DEFINE_ANIMATED_STRING(SVGFEColorMatrixElement, SVGNames::inAttr, In1, in1) 35 DEFINE_ANIMATED_ENUMERATION(SVGFEColorMatrixElement, SVGNames::typeAttr, Type, type )35 DEFINE_ANIMATED_ENUMERATION(SVGFEColorMatrixElement, SVGNames::typeAttr, Type, type, ColorMatrixType) 36 36 DEFINE_ANIMATED_NUMBER_LIST(SVGFEColorMatrixElement, SVGNames::valuesAttr, Values, values) 37 37 … … 52 52 const String& value = attr->value(); 53 53 if (attr->name() == SVGNames::typeAttr) { 54 if (value == "matrix") 55 setTypeBaseValue(FECOLORMATRIX_TYPE_MATRIX); 56 else if (value == "saturate") 57 setTypeBaseValue(FECOLORMATRIX_TYPE_SATURATE); 58 else if (value == "hueRotate") 59 setTypeBaseValue(FECOLORMATRIX_TYPE_HUEROTATE); 60 else if (value == "luminanceToAlpha") 61 setTypeBaseValue(FECOLORMATRIX_TYPE_LUMINANCETOALPHA); 54 ColorMatrixType propertyValue = SVGPropertyTraits<ColorMatrixType>::fromString(attr->value()); 55 if (propertyValue > 0) 56 setTypeBaseValue(propertyValue); 62 57 } else if (attr->name() == SVGNames::inAttr) 63 58 setIn1BaseValue(value); … … 75 70 FEColorMatrix* colorMatrix = static_cast<FEColorMatrix*>(effect); 76 71 if (attrName == SVGNames::typeAttr) 77 return colorMatrix->setType( static_cast<ColorMatrixType>(type()));72 return colorMatrix->setType(type()); 78 73 if (attrName == SVGNames::valuesAttr) 79 74 return colorMatrix->setValues(values()); … … 137 132 138 133 Vector<float> filterValues; 139 const ColorMatrixType filterType(static_cast<ColorMatrixType>(type()));134 ColorMatrixType filterType = type(); 140 135 141 136 // Use defaults if values is empty (SVG 1.1 15.10). -
trunk/Source/WebCore/svg/SVGFEColorMatrixElement.h
r79488 r86765 47 47 // Animated property declarations 48 48 DECLARE_ANIMATED_STRING(In1, in1) 49 DECLARE_ANIMATED_ENUMERATION(Type, type )49 DECLARE_ANIMATED_ENUMERATION(Type, type, ColorMatrixType) 50 50 DECLARE_ANIMATED_NUMBER_LIST(Values, values) 51 }; 52 53 template<> 54 struct SVGPropertyTraits<ColorMatrixType> { 55 static ColorMatrixType highestEnumValue() { return FECOLORMATRIX_TYPE_LUMINANCETOALPHA; } 56 57 static String toString(ColorMatrixType type) 58 { 59 switch (type) { 60 case FECOLORMATRIX_TYPE_UNKNOWN: 61 return emptyString(); 62 case FECOLORMATRIX_TYPE_MATRIX: 63 return "matrix"; 64 case FECOLORMATRIX_TYPE_SATURATE: 65 return "saturate"; 66 case FECOLORMATRIX_TYPE_HUEROTATE: 67 return "hueRotate"; 68 case FECOLORMATRIX_TYPE_LUMINANCETOALPHA: 69 return "luminanceToAlpha"; 70 } 71 72 ASSERT_NOT_REACHED(); 73 return emptyString(); 74 } 75 76 static ColorMatrixType fromString(const String& value) 77 { 78 if (value == "matrix") 79 return FECOLORMATRIX_TYPE_MATRIX; 80 if (value == "saturate") 81 return FECOLORMATRIX_TYPE_SATURATE; 82 if (value == "hueRotate") 83 return FECOLORMATRIX_TYPE_HUEROTATE; 84 if (value == "luminanceToAlpha") 85 return FECOLORMATRIX_TYPE_LUMINANCETOALPHA; 86 return FECOLORMATRIX_TYPE_UNKNOWN; 87 } 51 88 }; 52 89 -
trunk/Source/WebCore/svg/SVGFECompositeElement.cpp
r86050 r86765 34 34 DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::inAttr, In1, in1) 35 35 DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::in2Attr, In2, in2) 36 DEFINE_ANIMATED_ENUMERATION(SVGFECompositeElement, SVGNames::operatorAttr, _operator, _operator )36 DEFINE_ANIMATED_ENUMERATION(SVGFECompositeElement, SVGNames::operatorAttr, _operator, _operator, CompositeOperationType) 37 37 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k1Attr, K1, k1) 38 38 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k2Attr, K2, k2) … … 56 56 const String& value = attr->value(); 57 57 if (attr->name() == SVGNames::operatorAttr) { 58 if (value == "over") 59 set_operatorBaseValue(FECOMPOSITE_OPERATOR_OVER); 60 else if (value == "in") 61 set_operatorBaseValue(FECOMPOSITE_OPERATOR_IN); 62 else if (value == "out") 63 set_operatorBaseValue(FECOMPOSITE_OPERATOR_OUT); 64 else if (value == "atop") 65 set_operatorBaseValue(FECOMPOSITE_OPERATOR_ATOP); 66 else if (value == "xor") 67 set_operatorBaseValue(FECOMPOSITE_OPERATOR_XOR); 68 else if (value == "arithmetic") 69 set_operatorBaseValue(FECOMPOSITE_OPERATOR_ARITHMETIC); 58 CompositeOperationType propertyValue = SVGPropertyTraits<CompositeOperationType>::fromString(value); 59 if (propertyValue > 0) 60 set_operatorBaseValue(propertyValue); 70 61 } else if (attr->name() == SVGNames::inAttr) 71 62 setIn1BaseValue(value); … … 88 79 FEComposite* composite = static_cast<FEComposite*>(effect); 89 80 if (attrName == SVGNames::operatorAttr) 90 return composite->setOperation( static_cast<CompositeOperationType>(_operator()));81 return composite->setOperation(_operator()); 91 82 if (attrName == SVGNames::k1Attr) 92 83 return composite->setK1(k1()); … … 178 169 return 0; 179 170 180 RefPtr<FilterEffect> effect = FEComposite::create(filter, static_cast<CompositeOperationType>(_operator()), 181 k1(), k2(), k3(), k4()); 171 RefPtr<FilterEffect> effect = FEComposite::create(filter, _operator(), k1(), k2(), k3(), k4()); 182 172 FilterEffectVector& inputEffects = effect->inputEffects(); 183 173 inputEffects.reserveCapacity(2); -
trunk/Source/WebCore/svg/SVGFECompositeElement.h
r79856 r86765 48 48 DECLARE_ANIMATED_STRING(In1, in1) 49 49 DECLARE_ANIMATED_STRING(In2, in2) 50 DECLARE_ANIMATED_ENUMERATION(_operator, _operator )50 DECLARE_ANIMATED_ENUMERATION(_operator, _operator, CompositeOperationType) 51 51 DECLARE_ANIMATED_NUMBER(K1, k1) 52 52 DECLARE_ANIMATED_NUMBER(K2, k2) … … 55 55 }; 56 56 57 template<> 58 struct SVGPropertyTraits<CompositeOperationType> { 59 static CompositeOperationType highestEnumValue() { return FECOMPOSITE_OPERATOR_ARITHMETIC; } 60 61 static String toString(CompositeOperationType type) 62 { 63 switch (type) { 64 case FECOMPOSITE_OPERATOR_UNKNOWN: 65 return emptyString(); 66 case FECOMPOSITE_OPERATOR_OVER: 67 return "over"; 68 case FECOMPOSITE_OPERATOR_IN: 69 return "in"; 70 case FECOMPOSITE_OPERATOR_OUT: 71 return "out"; 72 case FECOMPOSITE_OPERATOR_ATOP: 73 return "atop"; 74 case FECOMPOSITE_OPERATOR_XOR: 75 return "xor"; 76 case FECOMPOSITE_OPERATOR_ARITHMETIC: 77 return "arithmetic"; 78 } 79 80 ASSERT_NOT_REACHED(); 81 return emptyString(); 82 } 83 84 static CompositeOperationType fromString(const String& value) 85 { 86 if (value == "over") 87 return FECOMPOSITE_OPERATOR_OVER; 88 if (value == "in") 89 return FECOMPOSITE_OPERATOR_IN; 90 if (value == "out") 91 return FECOMPOSITE_OPERATOR_OUT; 92 if (value == "atop") 93 return FECOMPOSITE_OPERATOR_ATOP; 94 if (value == "xor") 95 return FECOMPOSITE_OPERATOR_XOR; 96 if (value == "arithmetic") 97 return FECOMPOSITE_OPERATOR_ARITHMETIC; 98 return FECOMPOSITE_OPERATOR_UNKNOWN; 99 } 100 }; 101 57 102 } // namespace WebCore 58 103 -
trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp
r86050 r86765 43 43 DEFINE_ANIMATED_INTEGER(SVGFEConvolveMatrixElement, SVGNames::targetXAttr, TargetX, targetX) 44 44 DEFINE_ANIMATED_INTEGER(SVGFEConvolveMatrixElement, SVGNames::targetYAttr, TargetY, targetY) 45 DEFINE_ANIMATED_ENUMERATION(SVGFEConvolveMatrixElement, SVGNames:: operatorAttr, EdgeMode, edgeMode)45 DEFINE_ANIMATED_ENUMERATION(SVGFEConvolveMatrixElement, SVGNames::edgeModeAttr, EdgeMode, edgeMode, EdgeModeType) 46 46 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), KernelUnitLengthX, kernelUnitLengthX) 47 47 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), KernelUnitLengthY, kernelUnitLengthY) … … 96 96 } 97 97 } else if (attr->name() == SVGNames::edgeModeAttr) { 98 if (value == "duplicate") 99 setEdgeModeBaseValue(EDGEMODE_DUPLICATE); 100 else if (value == "wrap") 101 setEdgeModeBaseValue(EDGEMODE_WRAP); 102 else if (value == "none") 103 setEdgeModeBaseValue(EDGEMODE_NONE); 98 EdgeModeType propertyValue = SVGPropertyTraits<EdgeModeType>::fromString(attr->value()); 99 if (propertyValue > 0) 100 setEdgeModeBaseValue(propertyValue); 104 101 } else if (attr->name() == SVGNames::kernelMatrixAttr) { 105 102 SVGNumberList newList; … … 134 131 FEConvolveMatrix* convolveMatrix = static_cast<FEConvolveMatrix*>(effect); 135 132 if (attrName == SVGNames::edgeModeAttr) 136 return convolveMatrix->setEdgeMode( static_cast<EdgeModeType>(edgeMode()));133 return convolveMatrix->setEdgeMode(edgeMode()); 137 134 if (attrName == SVGNames::divisorAttr) 138 135 return convolveMatrix->setDivisor(divisor()); … … 185 182 } 186 183 184 void SVGFEConvolveMatrixElement::synchronizeProperty(const QualifiedName& attrName) 185 { 186 SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName); 187 188 if (attrName == anyQName()) { 189 synchronizeEdgeMode(); 190 synchronizeDivisor(); 191 synchronizeBias(); 192 synchronizeTargetX(); 193 synchronizeTargetY(); 194 synchronizeKernelUnitLengthX(); 195 synchronizeKernelUnitLengthY(); 196 synchronizePreserveAlpha(); 197 return; 198 } 199 200 if (attrName == SVGNames::edgeModeAttr) 201 synchronizeEdgeMode(); 202 else if (attrName == SVGNames::divisorAttr) 203 synchronizeDivisor(); 204 else if (attrName == SVGNames::biasAttr) 205 synchronizeBias(); 206 else if (attrName == SVGNames::targetXAttr) 207 synchronizeTargetX(); 208 else if (attrName == SVGNames::targetYAttr) 209 synchronizeTargetY(); 210 else if (attrName == SVGNames::kernelUnitLengthAttr) { 211 synchronizeKernelUnitLengthX(); 212 synchronizeKernelUnitLengthY(); 213 } else if (attrName == SVGNames::preserveAlphaAttr) 214 synchronizePreserveAlpha(); 215 } 216 187 217 AttributeToPropertyTypeMap& SVGFEConvolveMatrixElement::attributeToPropertyTypeMap() 188 218 { … … 252 282 RefPtr<FilterEffect> effect = FEConvolveMatrix::create(filter, 253 283 IntSize(orderXValue, orderYValue), divisorValue, 254 bias(), IntPoint(targetXValue, targetYValue), static_cast<EdgeModeType>(edgeMode()),284 bias(), IntPoint(targetXValue, targetYValue), edgeMode(), 255 285 FloatPoint(kernelUnitLengthX(), kernelUnitLengthX()), preserveAlpha(), kernelMatrix); 256 286 effect->inputEffects().append(input1); -
trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.h
r79474 r86765 45 45 virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&); 46 46 virtual void svgAttributeChanged(const QualifiedName&); 47 virtual void synchronizeProperty(const QualifiedName&); 47 48 virtual void fillAttributeToPropertyTypeMap(); 48 49 virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap(); … … 63 64 DECLARE_ANIMATED_INTEGER(TargetX, targetX) 64 65 DECLARE_ANIMATED_INTEGER(TargetY, targetY) 65 DECLARE_ANIMATED_ENUMERATION(EdgeMode, edgeMode )66 DECLARE_ANIMATED_ENUMERATION(EdgeMode, edgeMode, EdgeModeType) 66 67 DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX) 67 68 DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY) 68 69 DECLARE_ANIMATED_BOOLEAN(PreserveAlpha, preserveAlpha) 70 }; 71 72 template<> 73 struct SVGPropertyTraits<EdgeModeType> { 74 static EdgeModeType highestEnumValue() { return EDGEMODE_NONE; } 75 76 static String toString(EdgeModeType type) 77 { 78 switch (type) { 79 case EDGEMODE_UNKNOWN: 80 return emptyString(); 81 case EDGEMODE_DUPLICATE: 82 return "duplicate"; 83 case EDGEMODE_WRAP: 84 return "wrap"; 85 case EDGEMODE_NONE: 86 return "none"; 87 } 88 89 ASSERT_NOT_REACHED(); 90 return emptyString(); 91 } 92 93 static EdgeModeType fromString(const String& value) 94 { 95 if (value == "duplicate") 96 return EDGEMODE_DUPLICATE; 97 if (value == "wrap") 98 return EDGEMODE_WRAP; 99 if (value == "none") 100 return EDGEMODE_NONE; 101 return EDGEMODE_UNKNOWN; 102 } 69 103 }; 70 104 -
trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp
r86050 r86765 33 33 DEFINE_ANIMATED_STRING(SVGFEDisplacementMapElement, SVGNames::inAttr, In1, in1) 34 34 DEFINE_ANIMATED_STRING(SVGFEDisplacementMapElement, SVGNames::in2Attr, In2, in2) 35 DEFINE_ANIMATED_ENUMERATION(SVGFEDisplacementMapElement, SVGNames::xChannelSelectorAttr, XChannelSelector, xChannelSelector )36 DEFINE_ANIMATED_ENUMERATION(SVGFEDisplacementMapElement, SVGNames::yChannelSelectorAttr, YChannelSelector, yChannelSelector )35 DEFINE_ANIMATED_ENUMERATION(SVGFEDisplacementMapElement, SVGNames::xChannelSelectorAttr, XChannelSelector, xChannelSelector, ChannelSelectorType) 36 DEFINE_ANIMATED_ENUMERATION(SVGFEDisplacementMapElement, SVGNames::yChannelSelectorAttr, YChannelSelector, yChannelSelector, ChannelSelectorType) 37 37 DEFINE_ANIMATED_NUMBER(SVGFEDisplacementMapElement, SVGNames::scaleAttr, Scale, scale) 38 38 … … 50 50 } 51 51 52 ChannelSelectorType SVGFEDisplacementMapElement::stringToChannel(const String& key)53 {54 if (key == "R")55 return CHANNEL_R;56 if (key == "G")57 return CHANNEL_G;58 if (key == "B")59 return CHANNEL_B;60 if (key == "A")61 return CHANNEL_A;62 63 return CHANNEL_UNKNOWN;64 }65 66 52 void SVGFEDisplacementMapElement::parseMappedAttribute(Attribute* attr) 67 53 { 68 54 const String& value = attr->value(); 69 if (attr->name() == SVGNames::xChannelSelectorAttr) 70 setXChannelSelectorBaseValue(stringToChannel(value)); 71 else if (attr->name() == SVGNames::yChannelSelectorAttr) 72 setYChannelSelectorBaseValue(stringToChannel(value)); 73 else if (attr->name() == SVGNames::inAttr) 55 if (attr->name() == SVGNames::xChannelSelectorAttr) { 56 ChannelSelectorType propertyValue = SVGPropertyTraits<ChannelSelectorType>::fromString(value); 57 if (propertyValue > 0) 58 setXChannelSelectorBaseValue(propertyValue); 59 } else if (attr->name() == SVGNames::yChannelSelectorAttr) { 60 ChannelSelectorType propertyValue = SVGPropertyTraits<ChannelSelectorType>::fromString(value); 61 if (propertyValue > 0) 62 setYChannelSelectorBaseValue(propertyValue); 63 } else if (attr->name() == SVGNames::inAttr) 74 64 setIn1BaseValue(value); 75 65 else if (attr->name() == SVGNames::in2Attr) … … 85 75 FEDisplacementMap* displacementMap = static_cast<FEDisplacementMap*>(effect); 86 76 if (attrName == SVGNames::xChannelSelectorAttr) 87 return displacementMap->setXChannelSelector( static_cast<ChannelSelectorType>(xChannelSelector()));77 return displacementMap->setXChannelSelector(xChannelSelector()); 88 78 if (attrName == SVGNames::yChannelSelectorAttr) 89 return displacementMap->setYChannelSelector( static_cast<ChannelSelectorType>(yChannelSelector()));79 return displacementMap->setYChannelSelector(yChannelSelector()); 90 80 if (attrName == SVGNames::scaleAttr) 91 81 return displacementMap->setScale(scale()); … … 99 89 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); 100 90 101 if (attrName == SVGNames::xChannelSelectorAttr) { 102 ChannelSelectorType selector = static_cast<ChannelSelectorType>(xChannelSelector()); 103 if (CHANNEL_UNKNOWN > selector || selector > CHANNEL_A) 104 setXChannelSelectorBaseValue(CHANNEL_UNKNOWN); 105 primitiveAttributeChanged(attrName); 106 } else if (attrName == SVGNames::yChannelSelectorAttr) { 107 ChannelSelectorType selector = static_cast<ChannelSelectorType>(yChannelSelector()); 108 if (CHANNEL_UNKNOWN > selector || selector > CHANNEL_A) 109 setYChannelSelectorBaseValue(CHANNEL_UNKNOWN); 110 primitiveAttributeChanged(attrName); 111 } else if (attrName == SVGNames::scaleAttr) 91 if (attrName == SVGNames::xChannelSelectorAttr || attrName == SVGNames::yChannelSelectorAttr || attrName == SVGNames::scaleAttr) 112 92 primitiveAttributeChanged(attrName); 113 93 else if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) … … 166 146 return 0; 167 147 168 RefPtr<FilterEffect> effect = FEDisplacementMap::create(filter, static_cast<ChannelSelectorType>(xChannelSelector()), 169 static_cast<ChannelSelectorType>(yChannelSelector()), scale()); 148 RefPtr<FilterEffect> effect = FEDisplacementMap::create(filter, xChannelSelector(), yChannelSelector(), scale()); 170 149 FilterEffectVector& inputEffects = effect->inputEffects(); 171 150 inputEffects.reserveCapacity(2); … … 178 157 179 158 #endif // ENABLE(SVG) 180 181 // vim:ts=4:noet -
trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.h
r80022 r86765 49 49 DECLARE_ANIMATED_STRING(In1, in1) 50 50 DECLARE_ANIMATED_STRING(In2, in2) 51 DECLARE_ANIMATED_ENUMERATION(XChannelSelector, xChannelSelector )52 DECLARE_ANIMATED_ENUMERATION(YChannelSelector, yChannelSelector )51 DECLARE_ANIMATED_ENUMERATION(XChannelSelector, xChannelSelector, ChannelSelectorType) 52 DECLARE_ANIMATED_ENUMERATION(YChannelSelector, yChannelSelector, ChannelSelectorType) 53 53 DECLARE_ANIMATED_NUMBER(Scale, scale) 54 }; 55 56 template<> 57 struct SVGPropertyTraits<ChannelSelectorType> { 58 static ChannelSelectorType highestEnumValue() { return CHANNEL_A; } 59 60 static String toString(ChannelSelectorType type) 61 { 62 switch (type) { 63 case CHANNEL_UNKNOWN: 64 return emptyString(); 65 case CHANNEL_R: 66 return "R"; 67 case CHANNEL_G: 68 return "G"; 69 case CHANNEL_B: 70 return "B"; 71 case CHANNEL_A: 72 return "A"; 73 } 74 75 ASSERT_NOT_REACHED(); 76 return emptyString(); 77 } 78 79 static ChannelSelectorType fromString(const String& value) 80 { 81 if (value == "R") 82 return CHANNEL_R; 83 if (value == "G") 84 return CHANNEL_G; 85 if (value == "B") 86 return CHANNEL_B; 87 if (value == "A") 88 return CHANNEL_A; 89 return CHANNEL_UNKNOWN; 90 } 54 91 }; 55 92 -
trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp
r86050 r86765 33 33 // Animated property definitions 34 34 DEFINE_ANIMATED_STRING(SVGFEMorphologyElement, SVGNames::inAttr, In1, in1) 35 DEFINE_ANIMATED_ENUMERATION(SVGFEMorphologyElement, SVGNames::operatorAttr, _operator, _operator )35 DEFINE_ANIMATED_ENUMERATION(SVGFEMorphologyElement, SVGNames::operatorAttr, _operator, _operator, MorphologyOperatorType) 36 36 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusXIdentifier(), RadiusX, radiusX) 37 37 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusYIdentifier(), RadiusY, radiusY) … … 72 72 const String& value = attr->value(); 73 73 if (attr->name() == SVGNames::operatorAttr) { 74 if (value == "erode") 75 set_operatorBaseValue(FEMORPHOLOGY_OPERATOR_ERODE); 76 else if (value == "dilate") 77 set_operatorBaseValue(FEMORPHOLOGY_OPERATOR_DILATE); 74 MorphologyOperatorType propertyValue = SVGPropertyTraits<MorphologyOperatorType>::fromString(value); 75 if (propertyValue > 0) 76 set_operatorBaseValue(propertyValue); 78 77 } else if (attr->name() == SVGNames::inAttr) 79 78 setIn1BaseValue(value); … … 92 91 FEMorphology* morphology = static_cast<FEMorphology*>(effect); 93 92 if (attrName == SVGNames::operatorAttr) 94 return morphology->setMorphologyOperator( static_cast<MorphologyOperatorType>(_operator()));93 return morphology->setMorphologyOperator(_operator()); 95 94 if (attrName == SVGNames::radiusAttr) 96 95 return (morphology->setRadiusX(radiusX()) || morphology->setRadiusY(radiusY())); … … 162 161 return 0; 163 162 164 RefPtr<FilterEffect> effect = FEMorphology::create(filter, static_cast<MorphologyOperatorType>(_operator()), xRadius, yRadius);163 RefPtr<FilterEffect> effect = FEMorphology::create(filter, _operator(), xRadius, yRadius); 165 164 effect->inputEffects().append(input1); 166 165 return effect.release(); -
trunk/Source/WebCore/svg/SVGFEMorphologyElement.h
r80099 r86765 51 51 // Animated property declarations 52 52 DECLARE_ANIMATED_STRING(In1, in1) 53 DECLARE_ANIMATED_ENUMERATION(_operator, _operator )53 DECLARE_ANIMATED_ENUMERATION(_operator, _operator, MorphologyOperatorType) 54 54 DECLARE_ANIMATED_NUMBER(RadiusX, radiusX) 55 55 DECLARE_ANIMATED_NUMBER(RadiusY, radiusY) 56 }; 57 58 template<> 59 struct SVGPropertyTraits<MorphologyOperatorType> { 60 static MorphologyOperatorType highestEnumValue() { return FEMORPHOLOGY_OPERATOR_DILATE; } 61 62 static String toString(MorphologyOperatorType type) 63 { 64 switch (type) { 65 case FEMORPHOLOGY_OPERATOR_UNKNOWN: 66 return emptyString(); 67 case FEMORPHOLOGY_OPERATOR_ERODE: 68 return "erode"; 69 case FEMORPHOLOGY_OPERATOR_DILATE: 70 return "dilate"; 71 } 72 73 ASSERT_NOT_REACHED(); 74 return emptyString(); 75 } 76 77 static MorphologyOperatorType fromString(const String& value) 78 { 79 if (value == "erode") 80 return FEMORPHOLOGY_OPERATOR_ERODE; 81 if (value == "dilate") 82 return FEMORPHOLOGY_OPERATOR_DILATE; 83 return FEMORPHOLOGY_OPERATOR_UNKNOWN; 84 } 56 85 }; 57 86 -
trunk/Source/WebCore/svg/SVGFETurbulenceElement.cpp
r86050 r86765 35 35 DEFINE_ANIMATED_INTEGER(SVGFETurbulenceElement, SVGNames::numOctavesAttr, NumOctaves, numOctaves) 36 36 DEFINE_ANIMATED_NUMBER(SVGFETurbulenceElement, SVGNames::seedAttr, Seed, seed) 37 DEFINE_ANIMATED_ENUMERATION(SVGFETurbulenceElement, SVGNames::stitchTilesAttr, StitchTiles, stitchTiles )38 DEFINE_ANIMATED_ENUMERATION(SVGFETurbulenceElement, SVGNames::typeAttr, Type, type )37 DEFINE_ANIMATED_ENUMERATION(SVGFETurbulenceElement, SVGNames::stitchTilesAttr, StitchTiles, stitchTiles, SVGStitchOptions) 38 DEFINE_ANIMATED_ENUMERATION(SVGFETurbulenceElement, SVGNames::typeAttr, Type, type, TurbulenceType) 39 39 40 40 inline SVGFETurbulenceElement::SVGFETurbulenceElement(const QualifiedName& tagName, Document* document) … … 68 68 const String& value = attr->value(); 69 69 if (attr->name() == SVGNames::typeAttr) { 70 if (value == "fractalNoise") 71 setTypeBaseValue(FETURBULENCE_TYPE_FRACTALNOISE); 72 else if (value == "turbulence") 73 setTypeBaseValue(FETURBULENCE_TYPE_TURBULENCE); 70 TurbulenceType propertyValue = SVGPropertyTraits<TurbulenceType>::fromString(value); 71 if (propertyValue > 0) 72 setTypeBaseValue(propertyValue); 74 73 } else if (attr->name() == SVGNames::stitchTilesAttr) { 75 if (value == "stitch") 76 setStitchTilesBaseValue(SVG_STITCHTYPE_STITCH); 77 else if (value == "noStitch") 78 setStitchTilesBaseValue(SVG_STITCHTYPE_NOSTITCH); 74 SVGStitchOptions propertyValue = SVGPropertyTraits<SVGStitchOptions>::fromString(value); 75 if (propertyValue > 0) 76 setStitchTilesBaseValue(propertyValue); 79 77 } else if (attr->name() == SVGNames::baseFrequencyAttr) { 80 78 float x, y; … … 95 93 FETurbulence* turbulence = static_cast<FETurbulence*>(effect); 96 94 if (attrName == SVGNames::typeAttr) 97 return turbulence->setType( static_cast<TurbulenceType>(type()));95 return turbulence->setType(type()); 98 96 if (attrName == SVGNames::stitchTilesAttr) 99 97 return turbulence->setStitchTiles(stitchTiles()); … … 170 168 if (baseFrequencyX() < 0 || baseFrequencyY() < 0) 171 169 return 0; 172 173 return FETurbulence::create(filter, static_cast<TurbulenceType>(type()), baseFrequencyX(), 174 baseFrequencyY(), numOctaves(), seed(), stitchTiles() == SVG_STITCHTYPE_STITCH); 170 return FETurbulence::create(filter, type(), baseFrequencyX(), baseFrequencyY(), numOctaves(), seed(), stitchTiles() == SVG_STITCHTYPE_STITCH); 175 171 } 176 172 -
trunk/Source/WebCore/svg/SVGFETurbulenceElement.h
r79851 r86765 60 60 DECLARE_ANIMATED_INTEGER(NumOctaves, numOctaves) 61 61 DECLARE_ANIMATED_NUMBER(Seed, seed) 62 DECLARE_ANIMATED_ENUMERATION(StitchTiles, stitchTiles) 63 DECLARE_ANIMATED_ENUMERATION(Type, type) 62 DECLARE_ANIMATED_ENUMERATION(StitchTiles, stitchTiles, SVGStitchOptions) 63 DECLARE_ANIMATED_ENUMERATION(Type, type, TurbulenceType) 64 }; 65 66 template<> 67 struct SVGPropertyTraits<SVGStitchOptions> { 68 static SVGStitchOptions highestEnumValue() { return SVG_STITCHTYPE_NOSTITCH; } 69 70 static String toString(SVGStitchOptions type) 71 { 72 switch (type) { 73 case SVG_STITCHTYPE_UNKNOWN: 74 return emptyString(); 75 case SVG_STITCHTYPE_STITCH: 76 return "stitch"; 77 case SVG_STITCHTYPE_NOSTITCH: 78 return "noStitch"; 79 } 80 81 ASSERT_NOT_REACHED(); 82 return emptyString(); 83 } 84 85 static SVGStitchOptions fromString(const String& value) 86 { 87 if (value == "stitch") 88 return SVG_STITCHTYPE_STITCH; 89 if (value == "noStitch") 90 return SVG_STITCHTYPE_NOSTITCH; 91 return SVG_STITCHTYPE_UNKNOWN; 92 } 93 }; 94 95 template<> 96 struct SVGPropertyTraits<TurbulenceType> { 97 static TurbulenceType highestEnumValue() { return FETURBULENCE_TYPE_TURBULENCE; } 98 99 static String toString(TurbulenceType type) 100 { 101 switch (type) { 102 case FETURBULENCE_TYPE_UNKNOWN: 103 return emptyString(); 104 case FETURBULENCE_TYPE_FRACTALNOISE: 105 return "fractalNoise"; 106 case FETURBULENCE_TYPE_TURBULENCE: 107 return "turbulence"; 108 } 109 110 ASSERT_NOT_REACHED(); 111 return emptyString(); 112 } 113 114 static TurbulenceType fromString(const String& value) 115 { 116 if (value == "fractalNoise") 117 return FETURBULENCE_TYPE_FRACTALNOISE; 118 if (value == "turbulence") 119 return FETURBULENCE_TYPE_TURBULENCE; 120 return FETURBULENCE_TYPE_UNKNOWN; 121 } 64 122 }; 65 123 -
trunk/Source/WebCore/svg/SVGFilterElement.cpp
r86050 r86765 33 33 #include "SVGNames.h" 34 34 #include "SVGParserUtilities.h" 35 #include "SVGUnitTypes.h"36 35 37 36 namespace WebCore { 38 37 39 38 // Animated property definitions 40 DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::filterUnitsAttr, FilterUnits, filterUnits )41 DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::primitiveUnitsAttr, PrimitiveUnits, primitiveUnits )39 DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::filterUnitsAttr, FilterUnits, filterUnits, SVGUnitTypes::SVGUnitType) 40 DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::primitiveUnitsAttr, PrimitiveUnits, primitiveUnits, SVGUnitTypes::SVGUnitType) 42 41 DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::xAttr, X, x) 43 42 DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::yAttr, Y, y) … … 96 95 const String& value = attr->value(); 97 96 if (attr->name() == SVGNames::filterUnitsAttr) { 98 if (value == "userSpaceOnUse") 99 setFilterUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); 100 else if (value == "objectBoundingBox") 101 setFilterUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); 97 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); 98 if (propertyValue > 0) 99 setFilterUnitsBaseValue(propertyValue); 102 100 } else if (attr->name() == SVGNames::primitiveUnitsAttr) { 103 if (value == "userSpaceOnUse") 104 setPrimitiveUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); 105 else if (value == "objectBoundingBox") 106 setPrimitiveUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); 101 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); 102 if (propertyValue > 0) 103 setPrimitiveUnitsBaseValue(propertyValue); 107 104 } else if (attr->name() == SVGNames::xAttr) 108 105 setXBaseValue(SVGLength(LengthModeWidth, value)); -
trunk/Source/WebCore/svg/SVGFilterElement.h
r78249 r86765 33 33 #include "SVGStyledElement.h" 34 34 #include "SVGURIReference.h" 35 #include "SVGUnitTypes.h" 35 36 36 37 namespace WebCore { … … 66 67 67 68 // Animated property declarations 68 DECLARE_ANIMATED_ENUMERATION(FilterUnits, filterUnits )69 DECLARE_ANIMATED_ENUMERATION(PrimitiveUnits, primitiveUnits )69 DECLARE_ANIMATED_ENUMERATION(FilterUnits, filterUnits, SVGUnitTypes::SVGUnitType) 70 DECLARE_ANIMATED_ENUMERATION(PrimitiveUnits, primitiveUnits, SVGUnitTypes::SVGUnitType) 70 71 DECLARE_ANIMATED_LENGTH(X, x) 71 72 DECLARE_ANIMATED_LENGTH(Y, y) -
trunk/Source/WebCore/svg/SVGGradientElement.cpp
r78345 r86765 35 35 #include "SVGTransformList.h" 36 36 #include "SVGTransformable.h" 37 #include "SVGUnitTypes.h"38 37 39 38 namespace WebCore { 40 39 41 40 // Animated property definitions 42 DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::spreadMethodAttr, SpreadMethod, spreadMethod )43 DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::gradientUnitsAttr, GradientUnits, gradientUnits )41 DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::spreadMethodAttr, SpreadMethod, spreadMethod, SVGGradientElement::SVGSpreadMethodType) 42 DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::gradientUnitsAttr, GradientUnits, gradientUnits, SVGUnitTypes::SVGUnitType) 44 43 DEFINE_ANIMATED_TRANSFORM_LIST(SVGGradientElement, SVGNames::gradientTransformAttr, GradientTransform, gradientTransform) 45 44 DEFINE_ANIMATED_STRING(SVGGradientElement, XLinkNames::hrefAttr, Href, href) … … 48 47 SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document* document) 49 48 : SVGStyledElement(tagName, document) 49 , m_spreadMethod(SVG_SPREADMETHOD_PAD) 50 50 , m_gradientUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) 51 51 { … … 55 55 { 56 56 if (attr->name() == SVGNames::gradientUnitsAttr) { 57 if (attr->value() == "userSpaceOnUse") 58 setGradientUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); 59 else if (attr->value() == "objectBoundingBox") 60 setGradientUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); 57 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(attr->value()); 58 if (propertyValue > 0) 59 setGradientUnitsBaseValue(propertyValue); 61 60 } else if (attr->name() == SVGNames::gradientTransformAttr) { 62 61 SVGTransformList newList; … … 67 66 setGradientTransformBaseValue(newList); 68 67 } else if (attr->name() == SVGNames::spreadMethodAttr) { 69 if (attr->value() == "reflect") 70 setSpreadMethodBaseValue(SpreadMethodReflect); 71 else if (attr->value() == "repeat") 72 setSpreadMethodBaseValue(SpreadMethodRepeat); 73 else if (attr->value() == "pad") 74 setSpreadMethodBaseValue(SpreadMethodPad); 68 SVGSpreadMethodType propertyValue = SVGPropertyTraits<SVGSpreadMethodType>::fromString(attr->value()); 69 if (propertyValue > 0) 70 setSpreadMethodBaseValue(propertyValue); 75 71 } else { 76 72 if (SVGURIReference::parseMappedAttribute(attr)) -
trunk/Source/WebCore/svg/SVGGradientElement.h
r78345 r86765 30 30 #include "SVGStyledElement.h" 31 31 #include "SVGURIReference.h" 32 #include "SVGUnitTypes.h" 32 33 33 34 namespace WebCore { … … 37 38 public SVGExternalResourcesRequired { 38 39 public: 40 enum SVGSpreadMethodType { 41 SVG_SPREADMETHOD_UNKNOWN = 0, 42 SVG_SPREADMETHOD_PAD = 1, 43 SVG_SPREADMETHOD_REFLECT = 2, 44 SVG_SPREADMETHOD_REPEAT = 3 45 }; 46 39 47 Vector<Gradient::ColorStop> buildStops(); 40 48 … … 53 61 54 62 // Animated property declarations 55 DECLARE_ANIMATED_ENUMERATION(SpreadMethod, spreadMethod )56 DECLARE_ANIMATED_ENUMERATION(GradientUnits, gradientUnits )63 DECLARE_ANIMATED_ENUMERATION(SpreadMethod, spreadMethod, SVGSpreadMethodType) 64 DECLARE_ANIMATED_ENUMERATION(GradientUnits, gradientUnits, SVGUnitTypes::SVGUnitType) 57 65 DECLARE_ANIMATED_TRANSFORM_LIST(GradientTransform, gradientTransform) 58 66 … … 64 72 }; 65 73 74 template<> 75 struct SVGPropertyTraits<SVGGradientElement::SVGSpreadMethodType> { 76 static SVGGradientElement::SVGSpreadMethodType highestEnumValue() { return SVGGradientElement::SVG_SPREADMETHOD_REPEAT; } 77 78 static String toString(SVGGradientElement::SVGSpreadMethodType type) 79 { 80 switch (type) { 81 case SVGGradientElement::SVG_SPREADMETHOD_UNKNOWN: 82 return emptyString(); 83 case SVGGradientElement::SVG_SPREADMETHOD_PAD: 84 return "pad"; 85 case SVGGradientElement::SVG_SPREADMETHOD_REFLECT: 86 return "reflect"; 87 case SVGGradientElement::SVG_SPREADMETHOD_REPEAT: 88 return "repeat"; 89 } 90 91 ASSERT_NOT_REACHED(); 92 return emptyString(); 93 } 94 95 static SVGGradientElement::SVGSpreadMethodType fromString(const String& value) 96 { 97 if (value == "pad") 98 return SVGGradientElement::SVG_SPREADMETHOD_PAD; 99 if (value == "reflect") 100 return SVGGradientElement::SVG_SPREADMETHOD_REFLECT; 101 if (value == "repeat") 102 return SVGGradientElement::SVG_SPREADMETHOD_REPEAT; 103 return SVGGradientElement::SVG_SPREADMETHOD_UNKNOWN; 104 } 105 }; 106 66 107 } // namespace WebCore 67 108 -
trunk/Source/WebCore/svg/SVGLinearGradientElement.cpp
r86050 r86765 147 147 while (current) { 148 148 if (!attributes.hasSpreadMethod() && current->hasAttribute(SVGNames::spreadMethodAttr)) 149 attributes.setSpreadMethod( (GradientSpreadMethod)current->spreadMethod());149 attributes.setSpreadMethod(current->spreadMethod()); 150 150 151 151 if (!attributes.hasBoundingBoxMode() && current->hasAttribute(SVGNames::gradientUnitsAttr)) -
trunk/Source/WebCore/svg/SVGMarkerElement.cpp
r86050 r86765 38 38 DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::markerWidthAttr, MarkerWidth, markerWidth) 39 39 DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::markerHeightAttr, MarkerHeight, markerHeight) 40 DEFINE_ANIMATED_ENUMERATION(SVGMarkerElement, SVGNames::markerUnitsAttr, MarkerUnits, markerUnits) 41 DEFINE_ANIMATED_ENUMERATION_MULTIPLE_WRAPPERS(SVGMarkerElement, SVGNames::orientAttr, orientTypeIdentifier(), OrientType, orientType) 40 DEFINE_ANIMATED_ENUMERATION(SVGMarkerElement, SVGNames::markerUnitsAttr, MarkerUnits, markerUnits, SVGMarkerElement::SVGMarkerUnitsType) 42 41 DEFINE_ANIMATED_ANGLE_MULTIPLE_WRAPPERS(SVGMarkerElement, SVGNames::orientAttr, orientAngleIdentifier(), OrientAngle, orientAngle) 43 42 DEFINE_ANIMATED_BOOLEAN(SVGMarkerElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) … … 82 81 void SVGMarkerElement::parseMappedAttribute(Attribute* attr) 83 82 { 83 const String& value = attr->value(); 84 84 if (attr->name() == SVGNames::markerUnitsAttr) { 85 if (attr->value() == "userSpaceOnUse") 86 setMarkerUnitsBaseValue(SVG_MARKERUNITS_USERSPACEONUSE); 87 else if (attr->value() == "strokeWidth") 88 setMarkerUnitsBaseValue(SVG_MARKERUNITS_STROKEWIDTH); 85 SVGMarkerUnitsType propertyValue = SVGPropertyTraits<SVGMarkerUnitsType>::fromString(value); 86 if (propertyValue > 0) 87 setMarkerUnitsBaseValue(propertyValue); 89 88 } else if (attr->name() == SVGNames::refXAttr) 90 setRefXBaseValue(SVGLength(LengthModeWidth, attr->value()));89 setRefXBaseValue(SVGLength(LengthModeWidth, value)); 91 90 else if (attr->name() == SVGNames::refYAttr) 92 setRefYBaseValue(SVGLength(LengthModeHeight, attr->value()));91 setRefYBaseValue(SVGLength(LengthModeHeight, value)); 93 92 else if (attr->name() == SVGNames::markerWidthAttr) 94 setMarkerWidthBaseValue(SVGLength(LengthModeWidth, attr->value()));93 setMarkerWidthBaseValue(SVGLength(LengthModeWidth, value)); 95 94 else if (attr->name() == SVGNames::markerHeightAttr) 96 setMarkerHeightBaseValue(SVGLength(LengthModeHeight, attr->value()));95 setMarkerHeightBaseValue(SVGLength(LengthModeHeight, value)); 97 96 else if (attr->name() == SVGNames::orientAttr) { 98 97 SVGAngle angle; 99 100 if (attr->value() == "auto") 101 setOrientTypeBaseValue(SVG_MARKER_ORIENT_AUTO); 102 else { 103 ExceptionCode ec = 0; 104 angle.setValueAsString(attr->value(), ec); 105 setOrientTypeBaseValue(SVG_MARKER_ORIENT_ANGLE); 106 } 107 108 setOrientAngleBaseValue(angle); 98 SVGMarkerOrientType orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(value, angle); 99 if (orientType > 0) 100 setOrientTypeBaseValue(orientType); 101 if (orientType == SVG_MARKER_ORIENT_ANGLE) 102 setOrientAngleBaseValue(angle); 109 103 } else { 110 104 if (SVGLangSpace::parseMappedAttribute(attr)) … … 247 241 } 248 242 243 void SVGMarkerElement::synchronizeOrientType() 244 { 245 if (!m_orientType.shouldSynchronize) 246 return; 247 248 AtomicString value; 249 if (m_orientType.value == SVG_MARKER_ORIENT_AUTO) 250 value = "auto"; 251 else if (m_orientType.value == SVG_MARKER_ORIENT_ANGLE) 252 value = orientAngle().valueAsString(); 253 254 SVGAnimatedPropertySynchronizer<true>::synchronize(this, SVGNames::orientAttr, value); 255 } 256 257 PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerElement::SVGMarkerOrientType> > SVGMarkerElement::orientTypeAnimated() 258 { 259 m_orientType.shouldSynchronize = true; 260 return SVGAnimatedProperty::lookupOrCreateWrapper<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>, SVGMarkerOrientType>(this, SVGNames::orientAttr, orientTypeIdentifier(), m_orientType.value); 261 } 262 249 263 } 250 264 -
trunk/Source/WebCore/svg/SVGMarkerElement.h
r78249 r86765 84 84 DECLARE_ANIMATED_LENGTH(MarkerWidth, markerWidth) 85 85 DECLARE_ANIMATED_LENGTH(MarkerHeight, markerHeight) 86 DECLARE_ANIMATED_ENUMERATION(MarkerUnits, markerUnits) 87 DECLARE_ANIMATED_ENUMERATION(OrientType, orientType) 86 DECLARE_ANIMATED_ENUMERATION(MarkerUnits, markerUnits, SVGMarkerUnitsType) 88 87 DECLARE_ANIMATED_ANGLE(OrientAngle, orientAngle) 89 88 … … 94 93 DECLARE_ANIMATED_RECT(ViewBox, viewBox) 95 94 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) 95 96 public: 97 // Custom animated property: orientType 98 SVGMarkerOrientType& orientType() const { return m_orientType.value; } 99 SVGMarkerOrientType& orientTypeBaseValue() const { return m_orientType.value; } 100 void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { m_orientType.value = type; } 101 PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType> > orientTypeAnimated(); 102 103 private: 104 void synchronizeOrientType(); 105 mutable SVGSynchronizableAnimatedProperty<SVGMarkerOrientType> m_orientType; 106 }; 107 108 template<> 109 struct SVGPropertyTraits<SVGMarkerElement::SVGMarkerUnitsType> { 110 static SVGMarkerElement::SVGMarkerUnitsType highestEnumValue() { return SVGMarkerElement::SVG_MARKERUNITS_STROKEWIDTH; } 111 112 static String toString(SVGMarkerElement::SVGMarkerUnitsType type) 113 { 114 switch (type) { 115 case SVGMarkerElement::SVG_MARKERUNITS_UNKNOWN: 116 return emptyString(); 117 case SVGMarkerElement::SVG_MARKERUNITS_USERSPACEONUSE: 118 return "userSpaceOnUse"; 119 case SVGMarkerElement::SVG_MARKERUNITS_STROKEWIDTH: 120 return "strokeWidth"; 121 } 122 123 ASSERT_NOT_REACHED(); 124 return emptyString(); 125 } 126 127 static SVGMarkerElement::SVGMarkerUnitsType fromString(const String& value) 128 { 129 if (value == "userSpaceOnUse") 130 return SVGMarkerElement::SVG_MARKERUNITS_USERSPACEONUSE; 131 if (value == "strokeWidth") 132 return SVGMarkerElement::SVG_MARKERUNITS_STROKEWIDTH; 133 return SVGMarkerElement::SVG_MARKERUNITS_UNKNOWN; 134 } 135 }; 136 137 template<> 138 struct SVGPropertyTraits<SVGMarkerElement::SVGMarkerOrientType> { 139 static SVGMarkerElement::SVGMarkerOrientType highestEnumValue() { return SVGMarkerElement::SVG_MARKER_ORIENT_ANGLE; } 140 141 // toString is not needed, synchronizeOrientType() handles this on its own. 142 143 static SVGMarkerElement::SVGMarkerOrientType fromString(const String& value, SVGAngle& angle) 144 { 145 if (value == "auto") 146 return SVGMarkerElement::SVG_MARKER_ORIENT_AUTO; 147 148 ExceptionCode ec = 0; 149 angle.setValueAsString(value, ec); 150 if (!ec) 151 return SVGMarkerElement::SVG_MARKER_ORIENT_ANGLE; 152 return SVGMarkerElement::SVG_MARKER_ORIENT_UNKNOWN; 153 } 96 154 }; 97 155 -
trunk/Source/WebCore/svg/SVGMaskElement.cpp
r86050 r86765 37 37 38 38 // Animated property definitions 39 DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskUnitsAttr, MaskUnits, maskUnits )40 DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskContentUnitsAttr, MaskContentUnits, maskContentUnits )39 DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskUnitsAttr, MaskUnits, maskUnits, SVGUnitTypes::SVGUnitType) 40 DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskContentUnitsAttr, MaskContentUnits, maskContentUnits, SVGUnitTypes::SVGUnitType) 41 41 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::xAttr, X, x) 42 42 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::yAttr, Y, y) … … 67 67 { 68 68 if (attr->name() == SVGNames::maskUnitsAttr) { 69 if (attr->value() == "userSpaceOnUse") 70 setMaskUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); 71 else if (attr->value() == "objectBoundingBox") 72 setMaskUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); 69 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(attr->value()); 70 if (propertyValue > 0) 71 setMaskUnitsBaseValue(propertyValue); 73 72 } else if (attr->name() == SVGNames::maskContentUnitsAttr) { 74 if (attr->value() == "userSpaceOnUse") 75 setMaskContentUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); 76 else if (attr->value() == "objectBoundingBox") 77 setMaskContentUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); 73 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(attr->value()); 74 if (propertyValue > 0) 75 setMaskContentUnitsBaseValue(propertyValue); 78 76 } else if (attr->name() == SVGNames::xAttr) 79 77 setXBaseValue(SVGLength(LengthModeWidth, attr->value())); -
trunk/Source/WebCore/svg/SVGMaskElement.h
r78249 r86765 29 29 #include "SVGStyledLocatableElement.h" 30 30 #include "SVGTests.h" 31 #include "SVGUnitTypes.h" 31 32 32 33 namespace WebCore { … … 59 60 60 61 // Animated property declarations 61 DECLARE_ANIMATED_ENUMERATION(MaskUnits, maskUnits )62 DECLARE_ANIMATED_ENUMERATION(MaskContentUnits, maskContentUnits )62 DECLARE_ANIMATED_ENUMERATION(MaskUnits, maskUnits, SVGUnitTypes::SVGUnitType) 63 DECLARE_ANIMATED_ENUMERATION(MaskContentUnits, maskContentUnits, SVGUnitTypes::SVGUnitType) 63 64 DECLARE_ANIMATED_LENGTH(X, x) 64 65 DECLARE_ANIMATED_LENGTH(Y, y) -
trunk/Source/WebCore/svg/SVGPatternElement.cpp
r86050 r86765 39 39 #include "SVGStyledTransformableElement.h" 40 40 #include "SVGTransformable.h" 41 #include "SVGUnitTypes.h"42 41 43 42 namespace WebCore { … … 48 47 DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::widthAttr, Width, width) 49 48 DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::heightAttr, Height, height) 50 DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternUnitsAttr, PatternUnits, patternUnits )51 DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternContentUnitsAttr, PatternContentUnits, patternContentUnits )49 DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternUnitsAttr, PatternUnits, patternUnits, SVGUnitTypes::SVGUnitType) 50 DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternContentUnitsAttr, PatternContentUnits, patternContentUnits, SVGUnitTypes::SVGUnitType) 52 51 DEFINE_ANIMATED_TRANSFORM_LIST(SVGPatternElement, SVGNames::patternTransformAttr, PatternTransform, patternTransform) 53 52 DEFINE_ANIMATED_STRING(SVGPatternElement, XLinkNames::hrefAttr, Href, href) … … 76 75 { 77 76 if (attr->name() == SVGNames::patternUnitsAttr) { 78 if (attr->value() == "userSpaceOnUse") 79 setPatternUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); 80 else if (attr->value() == "objectBoundingBox") 81 setPatternUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); 77 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(attr->value()); 78 if (propertyValue > 0) 79 setPatternUnitsBaseValue(propertyValue); 82 80 } else if (attr->name() == SVGNames::patternContentUnitsAttr) { 83 if (attr->value() == "userSpaceOnUse") 84 setPatternContentUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); 85 else if (attr->value() == "objectBoundingBox") 86 setPatternContentUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); 81 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(attr->value()); 82 if (propertyValue > 0) 83 setPatternContentUnitsBaseValue(propertyValue); 87 84 } else if (attr->name() == SVGNames::patternTransformAttr) { 88 85 SVGTransformList newList; -
trunk/Source/WebCore/svg/SVGPatternElement.h
r78249 r86765 35 35 #include "SVGTests.h" 36 36 #include "SVGURIReference.h" 37 #include "SVGUnitTypes.h" 37 38 38 39 namespace WebCore { … … 73 74 DECLARE_ANIMATED_LENGTH(Width, width) 74 75 DECLARE_ANIMATED_LENGTH(Height, height) 75 DECLARE_ANIMATED_ENUMERATION(PatternUnits, patternUnits )76 DECLARE_ANIMATED_ENUMERATION(PatternContentUnits, patternContentUnits )76 DECLARE_ANIMATED_ENUMERATION(PatternUnits, patternUnits, SVGUnitTypes::SVGUnitType) 77 DECLARE_ANIMATED_ENUMERATION(PatternContentUnits, patternContentUnits, SVGUnitTypes::SVGUnitType) 77 78 DECLARE_ANIMATED_TRANSFORM_LIST(PatternTransform, patternTransform) 78 79 -
trunk/Source/WebCore/svg/SVGRadialGradientElement.cpp
r86050 r86765 158 158 while (current) { 159 159 if (!attributes.hasSpreadMethod() && current->hasAttribute(SVGNames::spreadMethodAttr)) 160 attributes.setSpreadMethod( (GradientSpreadMethod)current->spreadMethod());160 attributes.setSpreadMethod(current->spreadMethod()); 161 161 162 162 if (!attributes.hasBoundingBoxMode() && current->hasAttribute(SVGNames::gradientUnitsAttr)) -
trunk/Source/WebCore/svg/SVGTextContentElement.cpp
r85864 r86765 38 38 39 39 // Animated property definitions 40 DEFINE_ANIMATED_ENUMERATION(SVGTextContentElement, SVGNames::lengthAdjustAttr, LengthAdjust, lengthAdjust )40 DEFINE_ANIMATED_ENUMERATION(SVGTextContentElement, SVGNames::lengthAdjustAttr, LengthAdjust, lengthAdjust, SVGTextContentElement::SVGLengthAdjustType) 41 41 DEFINE_ANIMATED_BOOLEAN(SVGTextContentElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) 42 42 … … 183 183 { 184 184 if (attr->name() == SVGNames::lengthAdjustAttr) { 185 if (attr->value() == "spacing") 186 setLengthAdjustBaseValue(LENGTHADJUST_SPACING); 187 else if (attr->value() == "spacingAndGlyphs") 188 setLengthAdjustBaseValue(LENGTHADJUST_SPACINGANDGLYPHS); 185 SVGLengthAdjustType propertyValue = SVGPropertyTraits<SVGLengthAdjustType>::fromString(attr->value()); 186 if (propertyValue > 0) 187 setLengthAdjustBaseValue(propertyValue); 189 188 } else if (attr->name() == SVGNames::textLengthAttr) { 190 189 m_textLength.value = SVGLength(LengthModeOther, attr->value()); -
trunk/Source/WebCore/svg/SVGTextContentElement.h
r83710 r86765 80 80 SVGLength m_specifiedTextLength; 81 81 mutable SVGSynchronizableAnimatedProperty<SVGLength> m_textLength; 82 DECLARE_ANIMATED_ENUMERATION(LengthAdjust, lengthAdjust )82 DECLARE_ANIMATED_ENUMERATION(LengthAdjust, lengthAdjust, SVGLengthAdjustType) 83 83 84 84 // SVGExternalResourcesRequired 85 85 DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) 86 }; 87 88 template<> 89 struct SVGPropertyTraits<SVGTextContentElement::SVGLengthAdjustType> { 90 static SVGTextContentElement::SVGLengthAdjustType highestEnumValue() { return SVGTextContentElement::LENGTHADJUST_SPACINGANDGLYPHS; } 91 92 static String toString(SVGTextContentElement::SVGLengthAdjustType type) 93 { 94 switch (type) { 95 case SVGTextContentElement::LENGTHADJUST_UNKNOWN: 96 return emptyString(); 97 case SVGTextContentElement::LENGTHADJUST_SPACING: 98 return "spacing"; 99 case SVGTextContentElement::LENGTHADJUST_SPACINGANDGLYPHS: 100 return "spacingAndGlyphs"; 101 } 102 103 ASSERT_NOT_REACHED(); 104 return emptyString(); 105 } 106 107 static SVGTextContentElement::SVGLengthAdjustType fromString(const String& value) 108 { 109 if (value == "spacingAndGlyphs") 110 return SVGTextContentElement::LENGTHADJUST_SPACINGANDGLYPHS; 111 if (value == "spacing") 112 return SVGTextContentElement::LENGTHADJUST_SPACING; 113 return SVGTextContentElement::LENGTHADJUST_UNKNOWN; 114 } 86 115 }; 87 116 -
trunk/Source/WebCore/svg/SVGTextPathElement.cpp
r86050 r86765 33 33 // Animated property definitions 34 34 DEFINE_ANIMATED_LENGTH(SVGTextPathElement, SVGNames::startOffsetAttr, StartOffset, startOffset) 35 DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::methodAttr, Method, method )36 DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::spacingAttr, Spacing, spacing )35 DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::methodAttr, Method, method, SVGTextPathMethodType) 36 DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::spacingAttr, Spacing, spacing, SVGTextPathSpacingType) 37 37 DEFINE_ANIMATED_STRING(SVGTextPathElement, XLinkNames::hrefAttr, Href, href) 38 38 … … 54 54 { 55 55 const String& value = attr->value(); 56 57 56 if (attr->name() == SVGNames::startOffsetAttr) 58 57 setStartOffsetBaseValue(SVGLength(LengthModeOther, value)); 59 58 else if (attr->name() == SVGNames::methodAttr) { 60 if (value == "align") 61 setSpacingBaseValue(SVG_TEXTPATH_METHODTYPE_ALIGN); 62 else if (value == "stretch") 63 setSpacingBaseValue(SVG_TEXTPATH_METHODTYPE_STRETCH); 59 SVGTextPathMethodType propertyValue = SVGPropertyTraits<SVGTextPathMethodType>::fromString(value); 60 if (propertyValue > 0) 61 setMethodBaseValue(propertyValue); 64 62 } else if (attr->name() == SVGNames::spacingAttr) { 65 if (value == "auto") 66 setMethodBaseValue(SVG_TEXTPATH_SPACINGTYPE_AUTO); 67 else if (value == "exact") 68 setMethodBaseValue(SVG_TEXTPATH_SPACINGTYPE_EXACT); 63 SVGTextPathSpacingType propertyValue = SVGPropertyTraits<SVGTextPathSpacingType>::fromString(value); 64 if (propertyValue > 0) 65 setSpacingBaseValue(propertyValue); 69 66 } else { 70 67 if (SVGURIReference::parseMappedAttribute(attr)) -
trunk/Source/WebCore/svg/SVGTextPathElement.h
r78249 r86765 74 74 // Animated property declarations 75 75 DECLARE_ANIMATED_LENGTH(StartOffset, startOffset) 76 DECLARE_ANIMATED_ENUMERATION(Method, method )77 DECLARE_ANIMATED_ENUMERATION(Spacing, spacing )76 DECLARE_ANIMATED_ENUMERATION(Method, method, SVGTextPathMethodType) 77 DECLARE_ANIMATED_ENUMERATION(Spacing, spacing, SVGTextPathSpacingType) 78 78 79 79 // SVGURIReference 80 80 DECLARE_ANIMATED_STRING(Href, href) 81 }; 82 83 template<> 84 struct SVGPropertyTraits<SVGTextPathMethodType> { 85 static SVGTextPathMethodType highestEnumValue() { return SVG_TEXTPATH_METHODTYPE_STRETCH; } 86 87 static String toString(SVGTextPathMethodType type) 88 { 89 switch (type) { 90 case SVG_TEXTPATH_METHODTYPE_UNKNOWN: 91 return emptyString(); 92 case SVG_TEXTPATH_METHODTYPE_ALIGN: 93 return "align"; 94 case SVG_TEXTPATH_METHODTYPE_STRETCH: 95 return "stretch"; 96 } 97 98 ASSERT_NOT_REACHED(); 99 return emptyString(); 100 } 101 102 static SVGTextPathMethodType fromString(const String& value) 103 { 104 if (value == "align") 105 return SVG_TEXTPATH_METHODTYPE_ALIGN; 106 if (value == "stretch") 107 return SVG_TEXTPATH_METHODTYPE_STRETCH; 108 return SVG_TEXTPATH_METHODTYPE_UNKNOWN; 109 } 110 }; 111 112 template<> 113 struct SVGPropertyTraits<SVGTextPathSpacingType> { 114 static SVGTextPathSpacingType highestEnumValue() { return SVG_TEXTPATH_SPACINGTYPE_EXACT; } 115 116 static String toString(SVGTextPathSpacingType type) 117 { 118 switch (type) { 119 case SVG_TEXTPATH_SPACINGTYPE_UNKNOWN: 120 return emptyString(); 121 case SVG_TEXTPATH_SPACINGTYPE_AUTO: 122 return "auto"; 123 case SVG_TEXTPATH_SPACINGTYPE_EXACT: 124 return "exact"; 125 } 126 127 ASSERT_NOT_REACHED(); 128 return emptyString(); 129 } 130 131 static SVGTextPathSpacingType fromString(const String& value) 132 { 133 if (value == "auto") 134 return SVG_TEXTPATH_SPACINGTYPE_AUTO; 135 if (value == "exact") 136 return SVG_TEXTPATH_SPACINGTYPE_EXACT; 137 return SVG_TEXTPATH_SPACINGTYPE_UNKNOWN; 138 } 81 139 }; 82 140 -
trunk/Source/WebCore/svg/SVGUnitTypes.h
r64579 r86765 22 22 23 23 #if ENABLE(SVG) 24 24 #include "SVGPropertyTraits.h" 25 25 #include <wtf/RefCounted.h> 26 26 … … 39 39 }; 40 40 41 static inline SVGUnitTypes::SVGUnitType toUnitType(int type) { return static_cast<SVGUnitTypes::SVGUnitType>(type); } 41 template<> 42 struct SVGPropertyTraits<SVGUnitTypes::SVGUnitType> { 43 static SVGUnitTypes::SVGUnitType highestEnumValue() { return SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; } 44 45 static String toString(SVGUnitTypes::SVGUnitType type) 46 { 47 switch (type) { 48 case SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN: 49 return emptyString(); 50 case SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE: 51 return "userSpaceOnUse"; 52 case SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: 53 return "objectBoundingBox"; 54 } 55 56 ASSERT_NOT_REACHED(); 57 return emptyString(); 58 } 59 60 static SVGUnitTypes::SVGUnitType fromString(const String& value) 61 { 62 if (value == "userSpaceOnUse") 63 return SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE; 64 if (value == "objectBoundingBox") 65 return SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; 66 return SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN; 67 } 68 }; 42 69 43 70 } -
trunk/Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h
r70857 r86765 40 40 } 41 41 42 v oid setBaseVal(const PropertyType& property)42 virtual void setBaseVal(const PropertyType& property, ExceptionCode&) 43 43 { 44 44 m_property = property; … … 49 49 void setAnimVal(const PropertyType&) { } 50 50 51 pr ivate:51 protected: 52 52 friend class SVGAnimatedProperty; 53 53 … … 64 64 } 65 65 66 virtual ~SVGAnimatedStaticPropertyTearOff() { } 67 66 68 private: 67 69 PropertyType& m_property;
Note: See TracChangeset
for help on using the changeset viewer.