[SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint...
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Nov 2016 21:18:41 +0000 (21:18 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Nov 2016 21:18:41 +0000 (21:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164696

Reviewed by Darin Adler.

- Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix
  real classes and stop special casing them in the bindings generator. This
  removes the remaining non-list SVG specializations from the bindings generator.
- Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue,
  SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue
  and SVGRectValue classes, as float, FloatPoint and FloatRect can be used
  directly. Going forward, we can get rid of SVGMatrixValue as well, and just
  use AffineTransform, but that will be done in a separate change.

* WebCore.xcodeproj/project.pbxproj:
* CMakeLists.txt:
Add new files.

* bindings/js/JSSVGLengthCustom.cpp:
(WebCore::JSSVGLength::value): Deleted.
(WebCore::JSSVGLength::setValue): Deleted.
(WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted.
Removed. This can now be generated completely.

* bindings/scripts/CodeGenerator.pm:
(SkipIncludeHeader):
Remove special casing of SVGNumber. A header for it now exists.

(GetSVGWrappedTypeNeedingTearOff):
Remove special casing SVGPropertyTearOffs. None remain.

(ShouldPassWrapperByReference):
Allow all tear off types to be passed by reference.

(IsSVGTypeWithWritablePropertiesNeedingTearOff):
Remove now unused function.

* bindings/scripts/CodeGeneratorJS.pm:
(GetImplClassName):
(GenerateHeader):
(GenerateImplementation):
(GenerateParametersCheck):
(GenerateImplementationFunctionCall):
(GetSVGPropertyTypes):
(NativeToJSValue):
(GenerateConstructorDefinition):
Remove non-property tear off specific code.

(IsNativeType):
Remove unused function.

* css/CSSPropertyNames.in:
* css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::strokeDashArrayToCSSValueList):
(WebCore::ComputedStyleExtractor::svgPropertyValue):
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertSVGLengthValue):
(WebCore::StyleBuilderConverter::convertSVGLengthVector):
(WebCore::StyleBuilderConverter::convertStrokeDashArray):
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyValueBaselineShift):
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::strokeDashArray):
(WebCore::RenderStyle::setStrokeDashArray):
(WebCore::RenderStyle::baselineShiftValue):
(WebCore::RenderStyle::setBaselineShiftValue):
(WebCore::RenderStyle::kerning):
(WebCore::RenderStyle::setKerning):
* rendering/style/SVGRenderStyle.h:
(WebCore::SVGRenderStyle::initialStrokeDashArray):
(WebCore::SVGRenderStyle::initialBaselineShiftValue):
(WebCore::SVGRenderStyle::initialKerning):
(WebCore::SVGRenderStyle::setStrokeDashArray):
(WebCore::SVGRenderStyle::setKerning):
(WebCore::SVGRenderStyle::setBaselineShiftValue):
(WebCore::SVGRenderStyle::strokeDashArray):
(WebCore::SVGRenderStyle::kerning):
(WebCore::SVGRenderStyle::baselineShiftValue):
* rendering/style/SVGRenderStyleDefs.h:
Update for name change of SVGLength to SVGLengthValue.

* rendering/svg/RenderSVGImage.cpp:
Remove unused include.

* html/canvas/DOMPath.h:
Add an overload that takes a DOMMatrix, now that it is distinct from
AffineTransform.

* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform):
Update for name change of SVGPoint to FloatPoint.

* rendering/svg/SVGRenderSupport.cpp:
(WebCore::SVGRenderSupport::applyStrokeStyleToContext):
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeStyle):
* rendering/svg/SVGTextLayoutEngineBaseline.cpp:
(WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift):
* rendering/svg/SVGTextLayoutEngineSpacing.cpp:
(WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing):
Update for name change of SVGLength to SVGLengthValue.

* rendering/svg/SVGTextQuery.cpp:
(WebCore::SVGTextQuery::startPositionOfCharacter):
(WebCore::SVGTextQuery::endPositionOfCharacter):
(WebCore::SVGTextQuery::characterNumberAtPosition):
* rendering/svg/SVGTextQuery.h:
Update for name change of SVGPoint to FloatPoint.

* svg/LinearGradientAttributes.h:
* svg/PatternAttributes.h:
* svg/RadialGradientAttributes.h:
Update for name change of SVGLength to SVGLengthValue.

* svg/SVGAllInOne.cpp:
Remove SVGLength.cpp

* svg/SVGAngle.h:
Add missing newline.

* svg/SVGAnimateTransformElement.cpp:
(WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement):
(WebCore::SVGAnimateTransformElement::parseAttribute):
* svg/SVGAnimateTransformElement.h:
Update for name change of SVGTransform to SVGTransformValue.

* svg/SVGAnimatedLength.cpp:
(WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator):
(WebCore::SVGAnimatedLengthAnimator::constructFromString):
(WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes):
(WebCore::parseLengthFromString):
(WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
(WebCore::SVGAnimatedLengthAnimator::calculateDistance):
* svg/SVGAnimatedLength.h:
* svg/SVGAnimatedLengthList.cpp:
(WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator):
(WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes):
(WebCore::parseLengthListFromString):
(WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
* svg/SVGAnimatedLengthList.h:
Update for name change of SVGLength to SVGLengthValue.

* svg/SVGAnimatedNumberList.h:
Include the new SVGNumber.h and switch typedef to type alias.

* svg/SVGAnimatedPointList.cpp:
Add now necessary include of SVGPoint.h

* svg/SVGAnimatedRect.h:
Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect.

* svg/SVGAnimatedTransformList.cpp:
(WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator):
(WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes):
(WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
(WebCore::SVGAnimatedTransformListAnimator::calculateDistance):
Update for name change of SVGTransform to SVGTransformValue.

* svg/SVGAnimatedType.cpp:
(WebCore::SVGAnimatedType::createLength):
(WebCore::SVGAnimatedType::setValueAsString):
* svg/SVGAnimatedType.h:
(WebCore::SVGAnimatedType::length):
* svg/SVGCircleElement.cpp:
(WebCore::SVGCircleElement::parseAttribute):
* svg/SVGCursorElement.cpp:
(WebCore::SVGCursorElement::parseAttribute):
* svg/SVGDocument.cpp:
(WebCore::SVGDocument::startPan):
* svg/SVGEllipseElement.cpp:
(WebCore::SVGEllipseElement::parseAttribute):
* svg/SVGFilterElement.cpp:
(WebCore::SVGFilterElement::parseAttribute):
* svg/SVGFilterPrimitiveStandardAttributes.cpp:
(WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute):
* svg/SVGForeignObjectElement.cpp:
(WebCore::SVGForeignObjectElement::parseAttribute):
* svg/SVGImageElement.cpp:
(WebCore::SVGImageElement::parseAttribute):
* svg/SVGLengthContext.cpp:
(WebCore::SVGLengthContext::resolveRectangle):
(WebCore::SVGLengthContext::resolvePoint):
(WebCore::SVGLengthContext::resolveLength):
* svg/SVGLengthContext.h:
* svg/SVGLengthList.cpp:
(WebCore::SVGLengthList::parse):
* svg/SVGLengthList.h:
(WebCore::SVGPropertyTraits<SVGLengthList>::initialValue):
* svg/SVGLineElement.cpp:
(WebCore::SVGLineElement::parseAttribute):
* svg/SVGLinearGradientElement.cpp:
(WebCore::SVGLinearGradientElement::parseAttribute):
* svg/SVGMarkerElement.cpp:
(WebCore::SVGMarkerElement::parseAttribute):
* svg/SVGMaskElement.cpp:
(WebCore::SVGMaskElement::parseAttribute):
* svg/SVGPatternElement.cpp:
(WebCore::SVGPatternElement::parseAttribute):
* svg/SVGRadialGradientElement.cpp:
(WebCore::SVGRadialGradientElement::parseAttribute):
* svg/SVGRectElement.cpp:
(WebCore::SVGRectElement::parseAttribute):
* svg/SVGTextPathElement.cpp:
(WebCore::SVGTextPathElement::parseAttribute):
Update for name change of SVGLength to SVGLengthValue.

* svg/SVGLength.cpp: Removed.
* svg/SVGLength.h:
(WebCore::SVGLength::create):
(WebCore::SVGLength::unitType):
(WebCore::SVGLength::valueForBindings):
(WebCore::SVGLength::setValueForBindings):
(WebCore::SVGLength::valueInSpecifiedUnits):
(WebCore::SVGLength::setValueInSpecifiedUnits):
(WebCore::SVGLength::valueAsString):
(WebCore::SVGLength::setValueAsString):
(WebCore::SVGLength::newValueSpecifiedUnits):
(WebCore::SVGLength::convertToSpecifiedUnits):
(WebCore::SVGLength::SVGLength):
Implement the SVGLength interface as a tear off.

* svg/SVGLength.idl:
Add annotations for exceptions, custom naming, and remove now unnecessary
custom binding annotation.

* svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp.
* svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h.

* svg/SVGGraphicsElement.cpp:
(WebCore::SVGGraphicsElement::getCTMForBindings):
(WebCore::SVGGraphicsElement::getScreenCTMForBindings):
(WebCore::SVGGraphicsElement::getBBoxForBindings):
* svg/SVGGraphicsElement.h:
Add bindings specific versions of transformation access functions that return
tear offs.

* svg/SVGGraphicsElement.idl:
Annotate tear off returning functions with NewObject and ImplementedAs as necessary.

* svg/SVGLocatable.cpp:
(WebCore::SVGLocatable::getTransformToElement):
* svg/SVGLocatable.h:
Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding
wants.

* svg/SVGMatrix.h:
Implement the SVGMatrix interface as a tear off.

* svg/SVGMatrix.idl:
Add annotations for exceptions. Remove meaningless Immutable annotation.

* svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h.

* svg/SVGNumber.h: Added.
(WebCore::SVGNumber::create):
(WebCore::SVGNumber::valueForBindings):
(WebCore::SVGNumber::setValueForBindings):
(WebCore::SVGNumber::SVGNumber):
Implement the SVGNumber interface as a tear off.

* svg/SVGNumber.idl:
Add exception annotation and custom naming annotations.

* svg/SVGNumberList.h:
Update for name change of SVGPropertyTearOff<float> to SVGNumber.

* svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::getPointAtLength):
* svg/SVGPathElement.h:
Make getPointAtLength return a Ref<SVGPoint> to match the bindings.

* svg/SVGPathElement.idl:
Annotate getPointAtLength with [NewObject].

* svg/SVGPathTraversalStateBuilder.cpp:
(WebCore::SVGPathTraversalStateBuilder::currentPoint):
* svg/SVGPathTraversalStateBuilder.h:
* svg/SVGPathUtilities.cpp:
(WebCore::getPointAtLengthOfSVGPathByteStream):
* svg/SVGPathUtilities.h:
* svg/SVGPointList.cpp:
(WebCore::SVGPointList::valueAsString):
* svg/SVGPointList.h:
* svg/SVGPolyElement.cpp:
Update for name change of SVGPoint to FloatPoint.

* svg/SVGPoint.h:
(WebCore::SVGPoint::create):
(WebCore::SVGPoint::x):
(WebCore::SVGPoint::setX):
(WebCore::SVGPoint::y):
(WebCore::SVGPoint::setY):
(WebCore::SVGPoint::matrixTransform):
(WebCore::SVGPoint::SVGPoint):
Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint
to SVGPoint.

* svg/SVGPoint.idl:
Add exception and NewObject annotations.

* svg/SVGRect.h:
(WebCore::SVGRect::create):
(WebCore::SVGRect::x):
(WebCore::SVGRect::setX):
(WebCore::SVGRect::y):
(WebCore::SVGRect::setY):
(WebCore::SVGRect::width):
(WebCore::SVGRect::setWidth):
(WebCore::SVGRect::height):
(WebCore::SVGRect::setHeight):
Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have
been moved to SVGRectTraits.h.

* svg/SVGRect.idl:
Add exception annotations.

* svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp.

* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::viewport):
(WebCore::SVGSVGElement::currentTranslate):
(WebCore::SVGSVGElement::parseAttribute):
(WebCore::SVGSVGElement::collectIntersectionOrEnclosureList):
(WebCore::SVGSVGElement::getIntersectionList):
(WebCore::SVGSVGElement::getEnclosureList):
(WebCore::SVGSVGElement::checkIntersection):
(WebCore::SVGSVGElement::checkEnclosure):
(WebCore::SVGSVGElement::createSVGNumber):
(WebCore::SVGSVGElement::createSVGLength):
(WebCore::SVGSVGElement::createSVGPoint):
(WebCore::SVGSVGElement::createSVGMatrix):
(WebCore::SVGSVGElement::createSVGRect):
(WebCore::SVGSVGElement::createSVGTransform):
(WebCore::SVGSVGElement::createSVGTransformFromMatrix):
* svg/SVGSVGElement.h:
(WebCore::SVGSVGElement::currentTranslateValue):
(WebCore::SVGSVGElement::currentTranslate): Deleted.
(WebCore::SVGSVGElement::createSVGNumber): Deleted.
Update functions taking tear off values to take the wrappers, and update
the factory functions returning tear offs, to return the wrappers.

* svg/SVGSVGElement.idl:
Annotate functions/properties returning tear offs with [NewObject].

* svg/SVGTextContentElement.cpp:
(WebCore::SVGTextContentElement::synchronizeTextLength):
(WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper):
(WebCore::SVGTextContentElement::textLengthAnimated):
(WebCore::SVGTextContentElement::getStartPositionOfChar):
(WebCore::SVGTextContentElement::getEndPositionOfChar):
(WebCore::SVGTextContentElement::getExtentOfChar):
(WebCore::SVGTextContentElement::getCharNumAtPosition):
(WebCore::SVGTextContentElement::parseAttribute):
* svg/SVGTextContentElement.h:
(WebCore::SVGTextContentElement::specifiedTextLength):
Update functions returning tear off values to return the wrappers
and ones taking the values to take the wrappers.

* svg/SVGTextContentElement.idl:
Annotate functions/properties returning tear offs with [NewObject].

* svg/SVGTransform.cpp:
(WebCore::SVGTransform::matrix):
* svg/SVGTransform.h:
(WebCore::SVGTransform::create):
(WebCore::SVGTransform::type):
(WebCore::SVGTransform::angle):
(WebCore::SVGTransform::setMatrix):
(WebCore::SVGTransform::setTranslate):
(WebCore::SVGTransform::setScale):
(WebCore::SVGTransform::setRotate):
(WebCore::SVGTransform::setSkewX):
(WebCore::SVGTransform::setSkewY):
Implement the SVGTransform interface as a tear off.

* svg/SVGTransform.idl:
Add ConstantsScope annotation to allow the constants to be defined on
SVGTransformValue. Add exception and NewObject annotations.

* svg/SVGTransformDistance.cpp:
(WebCore::SVGTransformDistance::SVGTransformDistance):
(WebCore::SVGTransformDistance::scaledDistance):
(WebCore::SVGTransformDistance::addSVGTransforms):
(WebCore::SVGTransformDistance::addToSVGTransform):
(WebCore::SVGTransformDistance::distance):
* svg/SVGTransformDistance.h:
* svg/SVGTransformList.cpp:
(WebCore::SVGTransformList::createSVGTransformFromMatrix):
(WebCore::SVGTransformList::consolidate):
* svg/SVGTransformList.h:
(WebCore::SVGPropertyTraits<SVGTransformList>::initialValue):
* svg/SVGTransformable.cpp:
(WebCore::SVGTransformable::parseTransformValue):
(WebCore::parseAndSkipType):
(WebCore::SVGTransformable::parseTransformType):
(WebCore::SVGTransformable::parseTransformAttribute):
* svg/SVGTransformable.h:
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::parseAttribute):
Update for name change of SVGTransform to SVGTransformValue.

* svg/SVGTransformList.idl:
Annotate functions returning tear offs with NewObject.

* svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp.
* svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h.

* svg/SVGZoomEvent.cpp:
(WebCore::SVGZoomEvent::zoomRectScreen):
(WebCore::SVGZoomEvent::previousTranslate):
(WebCore::SVGZoomEvent::newTranslate):
* svg/SVGZoomEvent.h:
Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions
returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>.

* svg/SVGZoomEvent.idl:
Annotate function returning tear off with NewObject.

* svg/properties/SVGAnimatedListPropertyTearOff.h:
(WebCore::SVGAnimatedListPropertyTearOff::findItem):
Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits
to get the correct tear off type (as we do for the other list property tear off
classes.)

* svg/properties/SVGListProperty.h:
(WebCore::SVGListProperty::clearValues):
(WebCore::SVGListProperty::clearValuesAndWrappers):
(WebCore::SVGListProperty::initializeValues):
(WebCore::SVGListProperty::initializeValuesAndWrappers):
(WebCore::SVGListProperty::getItemValues):
(WebCore::SVGListProperty::getItemValuesAndWrappers):
(WebCore::SVGListProperty::insertItemBeforeValues):
(WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
(WebCore::SVGListProperty::canReplaceItem):
(WebCore::SVGListProperty::replaceItemValues):
(WebCore::SVGListProperty::replaceItemValuesAndWrappers):
(WebCore::SVGListProperty::canRemoveItem):
(WebCore::SVGListProperty::removeItemValues):
(WebCore::SVGListProperty::removeItemValuesAndWrappers):
(WebCore::SVGListProperty::appendItemValues):
(WebCore::SVGListProperty::appendItemValuesAndWrappers):
* svg/properties/SVGListPropertyTearOff.h:
(WebCore::SVGListPropertyTearOff::initialize):
(WebCore::SVGListPropertyTearOff::getItem):
(WebCore::SVGListPropertyTearOff::insertItemBefore):
(WebCore::SVGListPropertyTearOff::replaceItem):
(WebCore::SVGListPropertyTearOff::removeItem):
(WebCore::SVGListPropertyTearOff::appendItem):
* svg/properties/SVGPathSegListPropertyTearOff.h:
* svg/properties/SVGStaticListPropertyTearOff.h:
* svg/properties/SVGTransformListPropertyTearOff.h:
Change functions returning PtrListItemTearOff, to instead return
Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions
that were returning nullptr, and replace them with a assertions (these
were cases where a function like canGetItem() was called, and it only
did one of two things, returning an exception, or returned true).

* svg/properties/SVGMatrixTearOff.h:
Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove
incorrect comment and update some SVGMatrix types to SVGMatrixValues.

* svg/properties/SVGStaticPropertyTearOff.h:
Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather
than the value type, so it can be directly inherited from. This allow the one user
of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly.

* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
Update test results now that svg property tear offs are not handled specially.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208705 268f45cc-cd09-0410-ab3c-d52691b4dbfc

124 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSSVGLengthCustom.cpp [deleted file]
Source/WebCore/bindings/scripts/CodeGenerator.pm
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/StyleBuilderCustom.h
Source/WebCore/html/canvas/DOMPath.h
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/SVGRenderStyle.h
Source/WebCore/rendering/style/SVGRenderStyleDefs.h
Source/WebCore/rendering/svg/RenderSVGImage.cpp
Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Source/WebCore/rendering/svg/SVGPathData.cpp
Source/WebCore/rendering/svg/SVGRenderSupport.cpp
Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp
Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp
Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.cpp
Source/WebCore/rendering/svg/SVGTextQuery.cpp
Source/WebCore/rendering/svg/SVGTextQuery.h
Source/WebCore/svg/LinearGradientAttributes.h
Source/WebCore/svg/PatternAttributes.h
Source/WebCore/svg/RadialGradientAttributes.h
Source/WebCore/svg/SVGAllInOne.cpp
Source/WebCore/svg/SVGAngle.h
Source/WebCore/svg/SVGAnimateTransformElement.cpp
Source/WebCore/svg/SVGAnimateTransformElement.h
Source/WebCore/svg/SVGAnimatedLength.cpp
Source/WebCore/svg/SVGAnimatedLength.h
Source/WebCore/svg/SVGAnimatedLengthList.cpp
Source/WebCore/svg/SVGAnimatedLengthList.h
Source/WebCore/svg/SVGAnimatedNumberList.h
Source/WebCore/svg/SVGAnimatedPointList.cpp
Source/WebCore/svg/SVGAnimatedRect.h
Source/WebCore/svg/SVGAnimatedTransformList.cpp
Source/WebCore/svg/SVGAnimatedType.cpp
Source/WebCore/svg/SVGAnimatedType.h
Source/WebCore/svg/SVGCircleElement.cpp
Source/WebCore/svg/SVGCursorElement.cpp
Source/WebCore/svg/SVGDocument.cpp
Source/WebCore/svg/SVGEllipseElement.cpp
Source/WebCore/svg/SVGFilterElement.cpp
Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
Source/WebCore/svg/SVGForeignObjectElement.cpp
Source/WebCore/svg/SVGGraphicsElement.cpp
Source/WebCore/svg/SVGGraphicsElement.h
Source/WebCore/svg/SVGGraphicsElement.idl
Source/WebCore/svg/SVGImageElement.cpp
Source/WebCore/svg/SVGLength.h
Source/WebCore/svg/SVGLength.idl
Source/WebCore/svg/SVGLengthContext.cpp
Source/WebCore/svg/SVGLengthContext.h
Source/WebCore/svg/SVGLengthList.cpp
Source/WebCore/svg/SVGLengthList.h
Source/WebCore/svg/SVGLengthValue.cpp [moved from Source/WebCore/svg/SVGLength.cpp with 77% similarity]
Source/WebCore/svg/SVGLengthValue.h [new file with mode: 0644]
Source/WebCore/svg/SVGLineElement.cpp
Source/WebCore/svg/SVGLinearGradientElement.cpp
Source/WebCore/svg/SVGLocatable.cpp
Source/WebCore/svg/SVGLocatable.h
Source/WebCore/svg/SVGMarkerElement.cpp
Source/WebCore/svg/SVGMaskElement.cpp
Source/WebCore/svg/SVGMatrix.h
Source/WebCore/svg/SVGMatrix.idl
Source/WebCore/svg/SVGMatrixValue.h [new file with mode: 0644]
Source/WebCore/svg/SVGNumber.h [new file with mode: 0644]
Source/WebCore/svg/SVGNumber.idl
Source/WebCore/svg/SVGNumberList.h
Source/WebCore/svg/SVGPathElement.cpp
Source/WebCore/svg/SVGPathElement.h
Source/WebCore/svg/SVGPathElement.idl
Source/WebCore/svg/SVGPathTraversalStateBuilder.cpp
Source/WebCore/svg/SVGPathTraversalStateBuilder.h
Source/WebCore/svg/SVGPathUtilities.cpp
Source/WebCore/svg/SVGPathUtilities.h
Source/WebCore/svg/SVGPatternElement.cpp
Source/WebCore/svg/SVGPoint.h
Source/WebCore/svg/SVGPoint.idl
Source/WebCore/svg/SVGPointList.cpp
Source/WebCore/svg/SVGPointList.h
Source/WebCore/svg/SVGPolyElement.cpp
Source/WebCore/svg/SVGRadialGradientElement.cpp
Source/WebCore/svg/SVGRect.h
Source/WebCore/svg/SVGRect.idl
Source/WebCore/svg/SVGRectElement.cpp
Source/WebCore/svg/SVGRectTraits.h [new file with mode: 0644]
Source/WebCore/svg/SVGSVGElement.cpp
Source/WebCore/svg/SVGSVGElement.h
Source/WebCore/svg/SVGSVGElement.idl
Source/WebCore/svg/SVGTextContentElement.cpp
Source/WebCore/svg/SVGTextContentElement.h
Source/WebCore/svg/SVGTextContentElement.idl
Source/WebCore/svg/SVGTextPathElement.cpp
Source/WebCore/svg/SVGTransform.cpp
Source/WebCore/svg/SVGTransform.h
Source/WebCore/svg/SVGTransform.idl
Source/WebCore/svg/SVGTransformDistance.cpp
Source/WebCore/svg/SVGTransformDistance.h
Source/WebCore/svg/SVGTransformList.cpp
Source/WebCore/svg/SVGTransformList.h
Source/WebCore/svg/SVGTransformList.idl
Source/WebCore/svg/SVGTransformValue.cpp [new file with mode: 0644]
Source/WebCore/svg/SVGTransformValue.h [new file with mode: 0644]
Source/WebCore/svg/SVGTransformable.cpp
Source/WebCore/svg/SVGTransformable.h
Source/WebCore/svg/SVGUseElement.cpp
Source/WebCore/svg/SVGZoomEvent.cpp
Source/WebCore/svg/SVGZoomEvent.h
Source/WebCore/svg/SVGZoomEvent.idl
Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
Source/WebCore/svg/properties/SVGListProperty.h
Source/WebCore/svg/properties/SVGListPropertyTearOff.h
Source/WebCore/svg/properties/SVGMatrixTearOff.h
Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.h
Source/WebCore/svg/properties/SVGStaticListPropertyTearOff.h
Source/WebCore/svg/properties/SVGStaticPropertyTearOff.h
Source/WebCore/svg/properties/SVGTransformListPropertyTearOff.h

index 1f88cd2..8aa5e41 100644 (file)
@@ -1185,7 +1185,6 @@ set(WebCore_SOURCES
     bindings/js/JSRTCStatsResponseCustom.cpp
     bindings/js/JSSQLResultSetRowListCustom.cpp
     bindings/js/JSSQLTransactionCustom.cpp
-    bindings/js/JSSVGLengthCustom.cpp
     bindings/js/JSSVGPathSegCustom.cpp
     bindings/js/JSStorageCustom.cpp
     bindings/js/JSStyleSheetCustom.cpp
@@ -2768,9 +2767,9 @@ set(WebCore_SOURCES
     svg/SVGImageElement.cpp
     svg/SVGImageLoader.cpp
     svg/SVGLangSpace.cpp
-    svg/SVGLength.cpp
     svg/SVGLengthContext.cpp
     svg/SVGLengthList.cpp
+    svg/SVGLengthValue.cpp
     svg/SVGLineElement.cpp
     svg/SVGLinearGradientElement.cpp
     svg/SVGLocatable.cpp
@@ -2823,6 +2822,7 @@ set(WebCore_SOURCES
     svg/SVGTransform.cpp
     svg/SVGTransformDistance.cpp
     svg/SVGTransformList.cpp
+    svg/SVGTransformValue.cpp
     svg/SVGTransformable.cpp
     svg/SVGURIReference.cpp
     svg/SVGUseElement.cpp
index 8f0e49b..601e834 100644 (file)
@@ -1,3 +1,478 @@
+2016-11-12  Sam Weinig  <sam@webkit.org>
+
+        [SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix
+        https://bugs.webkit.org/show_bug.cgi?id=164696
+
+        Reviewed by Darin Adler.
+
+        - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix
+          real classes and stop special casing them in the bindings generator. This 
+          removes the remaining non-list SVG specializations from the bindings generator.
+        - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, 
+          SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue 
+          and SVGRectValue classes, as float, FloatPoint and FloatRect can be used 
+          directly. Going forward, we can get rid of SVGMatrixValue as well, and just
+          use AffineTransform, but that will be done in a separate change.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * CMakeLists.txt:
+        Add new files.
+
+        * bindings/js/JSSVGLengthCustom.cpp:
+        (WebCore::JSSVGLength::value): Deleted.
+        (WebCore::JSSVGLength::setValue): Deleted.
+        (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted.
+        Removed. This can now be generated completely.
+
+        * bindings/scripts/CodeGenerator.pm:
+        (SkipIncludeHeader):
+        Remove special casing of SVGNumber. A header for it now exists.
+
+        (GetSVGWrappedTypeNeedingTearOff):
+        Remove special casing SVGPropertyTearOffs. None remain.
+
+        (ShouldPassWrapperByReference):
+        Allow all tear off types to be passed by reference.
+
+        (IsSVGTypeWithWritablePropertiesNeedingTearOff):
+        Remove now unused function.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GetImplClassName):
+        (GenerateHeader):
+        (GenerateImplementation):
+        (GenerateParametersCheck):
+        (GenerateImplementationFunctionCall):
+        (GetSVGPropertyTypes):
+        (NativeToJSValue):
+        (GenerateConstructorDefinition):
+        Remove non-property tear off specific code. 
+        
+        (IsNativeType): 
+        Remove unused function.
+
+        * css/CSSPropertyNames.in:
+        * css/SVGCSSComputedStyleDeclaration.cpp:
+        (WebCore::strokeDashArrayToCSSValueList):
+        (WebCore::ComputedStyleExtractor::svgPropertyValue):
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertSVGLengthValue):
+        (WebCore::StyleBuilderConverter::convertSVGLengthVector):
+        (WebCore::StyleBuilderConverter::convertStrokeDashArray):
+        * css/StyleBuilderCustom.h:
+        (WebCore::StyleBuilderCustom::applyValueBaselineShift):
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::blendFunc):
+        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::strokeDashArray):
+        (WebCore::RenderStyle::setStrokeDashArray):
+        (WebCore::RenderStyle::baselineShiftValue):
+        (WebCore::RenderStyle::setBaselineShiftValue):
+        (WebCore::RenderStyle::kerning):
+        (WebCore::RenderStyle::setKerning):
+        * rendering/style/SVGRenderStyle.h:
+        (WebCore::SVGRenderStyle::initialStrokeDashArray):
+        (WebCore::SVGRenderStyle::initialBaselineShiftValue):
+        (WebCore::SVGRenderStyle::initialKerning):
+        (WebCore::SVGRenderStyle::setStrokeDashArray):
+        (WebCore::SVGRenderStyle::setKerning):
+        (WebCore::SVGRenderStyle::setBaselineShiftValue):
+        (WebCore::SVGRenderStyle::strokeDashArray):
+        (WebCore::SVGRenderStyle::kerning):
+        (WebCore::SVGRenderStyle::baselineShiftValue):
+        * rendering/style/SVGRenderStyleDefs.h:
+        Update for name change of SVGLength to SVGLengthValue.
+
+        * rendering/svg/RenderSVGImage.cpp:
+        Remove unused include.
+
+        * html/canvas/DOMPath.h:
+        Add an overload that takes a DOMMatrix, now that it is distinct from
+        AffineTransform.
+
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform):
+        Update for name change of SVGPoint to FloatPoint.
+
+        * rendering/svg/SVGRenderSupport.cpp:
+        (WebCore::SVGRenderSupport::applyStrokeStyleToContext):
+        * rendering/svg/SVGRenderTreeAsText.cpp:
+        (WebCore::writeStyle):
+        * rendering/svg/SVGTextLayoutEngineBaseline.cpp:
+        (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift):
+        * rendering/svg/SVGTextLayoutEngineSpacing.cpp:
+        (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing):
+        Update for name change of SVGLength to SVGLengthValue.
+
+        * rendering/svg/SVGTextQuery.cpp:
+        (WebCore::SVGTextQuery::startPositionOfCharacter):
+        (WebCore::SVGTextQuery::endPositionOfCharacter):
+        (WebCore::SVGTextQuery::characterNumberAtPosition):
+        * rendering/svg/SVGTextQuery.h:
+        Update for name change of SVGPoint to FloatPoint.
+
+        * svg/LinearGradientAttributes.h:
+        * svg/PatternAttributes.h:
+        * svg/RadialGradientAttributes.h:
+        Update for name change of SVGLength to SVGLengthValue.
+
+        * svg/SVGAllInOne.cpp:
+        Remove SVGLength.cpp
+
+        * svg/SVGAngle.h:
+        Add missing newline.
+
+        * svg/SVGAnimateTransformElement.cpp:
+        (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement):
+        (WebCore::SVGAnimateTransformElement::parseAttribute):
+        * svg/SVGAnimateTransformElement.h:
+        Update for name change of SVGTransform to SVGTransformValue.
+        
+        * svg/SVGAnimatedLength.cpp:
+        (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator):
+        (WebCore::SVGAnimatedLengthAnimator::constructFromString):
+        (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes):
+        (WebCore::parseLengthFromString):
+        (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
+        (WebCore::SVGAnimatedLengthAnimator::calculateDistance):
+        * svg/SVGAnimatedLength.h:
+        * svg/SVGAnimatedLengthList.cpp:
+        (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator):
+        (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes):
+        (WebCore::parseLengthListFromString):
+        (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedLengthList.h:
+        Update for name change of SVGLength to SVGLengthValue.
+
+        * svg/SVGAnimatedNumberList.h:
+        Include the new SVGNumber.h and switch typedef to type alias.
+
+        * svg/SVGAnimatedPointList.cpp:
+        Add now necessary include of SVGPoint.h
+
+        * svg/SVGAnimatedRect.h:
+        Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect.
+    
+        * svg/SVGAnimatedTransformList.cpp:
+        (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator):
+        (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes):
+        (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
+        (WebCore::SVGAnimatedTransformListAnimator::calculateDistance):
+        Update for name change of SVGTransform to SVGTransformValue.
+
+        * svg/SVGAnimatedType.cpp:
+        (WebCore::SVGAnimatedType::createLength):
+        (WebCore::SVGAnimatedType::setValueAsString):
+        * svg/SVGAnimatedType.h:
+        (WebCore::SVGAnimatedType::length):
+        * svg/SVGCircleElement.cpp:
+        (WebCore::SVGCircleElement::parseAttribute):
+        * svg/SVGCursorElement.cpp:
+        (WebCore::SVGCursorElement::parseAttribute):
+        * svg/SVGDocument.cpp:
+        (WebCore::SVGDocument::startPan):
+        * svg/SVGEllipseElement.cpp:
+        (WebCore::SVGEllipseElement::parseAttribute):
+        * svg/SVGFilterElement.cpp:
+        (WebCore::SVGFilterElement::parseAttribute):
+        * svg/SVGFilterPrimitiveStandardAttributes.cpp:
+        (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute):
+        * svg/SVGForeignObjectElement.cpp:
+        (WebCore::SVGForeignObjectElement::parseAttribute):
+        * svg/SVGImageElement.cpp:
+        (WebCore::SVGImageElement::parseAttribute):
+        * svg/SVGLengthContext.cpp:
+        (WebCore::SVGLengthContext::resolveRectangle):
+        (WebCore::SVGLengthContext::resolvePoint):
+        (WebCore::SVGLengthContext::resolveLength):
+        * svg/SVGLengthContext.h:
+        * svg/SVGLengthList.cpp:
+        (WebCore::SVGLengthList::parse):
+        * svg/SVGLengthList.h:
+        (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue):
+        * svg/SVGLineElement.cpp:
+        (WebCore::SVGLineElement::parseAttribute):
+        * svg/SVGLinearGradientElement.cpp:
+        (WebCore::SVGLinearGradientElement::parseAttribute):
+        * svg/SVGMarkerElement.cpp:
+        (WebCore::SVGMarkerElement::parseAttribute):
+        * svg/SVGMaskElement.cpp:
+        (WebCore::SVGMaskElement::parseAttribute):
+        * svg/SVGPatternElement.cpp:
+        (WebCore::SVGPatternElement::parseAttribute):
+        * svg/SVGRadialGradientElement.cpp:
+        (WebCore::SVGRadialGradientElement::parseAttribute):
+        * svg/SVGRectElement.cpp:
+        (WebCore::SVGRectElement::parseAttribute):
+        * svg/SVGTextPathElement.cpp:
+        (WebCore::SVGTextPathElement::parseAttribute):
+        Update for name change of SVGLength to SVGLengthValue.
+
+        * svg/SVGLength.cpp: Removed.
+        * svg/SVGLength.h:
+        (WebCore::SVGLength::create):
+        (WebCore::SVGLength::unitType):
+        (WebCore::SVGLength::valueForBindings):
+        (WebCore::SVGLength::setValueForBindings):
+        (WebCore::SVGLength::valueInSpecifiedUnits):
+        (WebCore::SVGLength::setValueInSpecifiedUnits):
+        (WebCore::SVGLength::valueAsString):
+        (WebCore::SVGLength::setValueAsString):
+        (WebCore::SVGLength::newValueSpecifiedUnits):
+        (WebCore::SVGLength::convertToSpecifiedUnits):
+        (WebCore::SVGLength::SVGLength):
+        Implement the SVGLength interface as a tear off.
+
+        * svg/SVGLength.idl:
+        Add annotations for exceptions, custom naming, and remove now unnecessary
+        custom binding annotation.
+
+        * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp.
+        * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h.
+
+        * svg/SVGGraphicsElement.cpp:
+        (WebCore::SVGGraphicsElement::getCTMForBindings):
+        (WebCore::SVGGraphicsElement::getScreenCTMForBindings):
+        (WebCore::SVGGraphicsElement::getBBoxForBindings):
+        * svg/SVGGraphicsElement.h:
+        Add bindings specific versions of transformation access functions that return
+        tear offs.
+
+        * svg/SVGGraphicsElement.idl:
+        Annotate tear off returning functions with NewObject and ImplementedAs as necessary.
+
+        * svg/SVGLocatable.cpp:
+        (WebCore::SVGLocatable::getTransformToElement):
+        * svg/SVGLocatable.h:
+        Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding
+        wants.
+
+        * svg/SVGMatrix.h:
+        Implement the SVGMatrix interface as a tear off.
+        
+        * svg/SVGMatrix.idl:
+        Add annotations for exceptions. Remove meaningless Immutable annotation.
+
+        * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h.
+
+        * svg/SVGNumber.h: Added.
+        (WebCore::SVGNumber::create):
+        (WebCore::SVGNumber::valueForBindings):
+        (WebCore::SVGNumber::setValueForBindings):
+        (WebCore::SVGNumber::SVGNumber):
+        Implement the SVGNumber interface as a tear off.
+
+        * svg/SVGNumber.idl:
+        Add exception annotation and custom naming annotations.
+
+        * svg/SVGNumberList.h:
+        Update for name change of SVGPropertyTearOff<float> to SVGNumber.
+
+        * svg/SVGPathElement.cpp:
+        (WebCore::SVGPathElement::getPointAtLength):
+        * svg/SVGPathElement.h:
+        Make getPointAtLength return a Ref<SVGPoint> to match the bindings.
+
+        * svg/SVGPathElement.idl:
+        Annotate getPointAtLength with [NewObject].
+
+        * svg/SVGPathTraversalStateBuilder.cpp:
+        (WebCore::SVGPathTraversalStateBuilder::currentPoint):
+        * svg/SVGPathTraversalStateBuilder.h:
+        * svg/SVGPathUtilities.cpp:
+        (WebCore::getPointAtLengthOfSVGPathByteStream):
+        * svg/SVGPathUtilities.h:
+        * svg/SVGPointList.cpp:
+        (WebCore::SVGPointList::valueAsString):
+        * svg/SVGPointList.h:
+        * svg/SVGPolyElement.cpp:
+        Update for name change of SVGPoint to FloatPoint.
+        
+        * svg/SVGPoint.h:
+        (WebCore::SVGPoint::create):
+        (WebCore::SVGPoint::x):
+        (WebCore::SVGPoint::setX):
+        (WebCore::SVGPoint::y):
+        (WebCore::SVGPoint::setY):
+        (WebCore::SVGPoint::matrixTransform):
+        (WebCore::SVGPoint::SVGPoint):
+        Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint
+        to SVGPoint.
+
+        * svg/SVGPoint.idl:
+        Add exception and NewObject annotations.
+
+        * svg/SVGRect.h:
+        (WebCore::SVGRect::create):
+        (WebCore::SVGRect::x):
+        (WebCore::SVGRect::setX):
+        (WebCore::SVGRect::y):
+        (WebCore::SVGRect::setY):
+        (WebCore::SVGRect::width):
+        (WebCore::SVGRect::setWidth):
+        (WebCore::SVGRect::height):
+        (WebCore::SVGRect::setHeight):
+        Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have 
+        been moved to SVGRectTraits.h.
+
+        * svg/SVGRect.idl:
+        Add exception annotations.
+
+        * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp.
+        
+        * svg/SVGSVGElement.cpp:
+        (WebCore::SVGSVGElement::viewport):
+        (WebCore::SVGSVGElement::currentTranslate):
+        (WebCore::SVGSVGElement::parseAttribute):
+        (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList):
+        (WebCore::SVGSVGElement::getIntersectionList):
+        (WebCore::SVGSVGElement::getEnclosureList):
+        (WebCore::SVGSVGElement::checkIntersection):
+        (WebCore::SVGSVGElement::checkEnclosure):
+        (WebCore::SVGSVGElement::createSVGNumber):
+        (WebCore::SVGSVGElement::createSVGLength):
+        (WebCore::SVGSVGElement::createSVGPoint):
+        (WebCore::SVGSVGElement::createSVGMatrix):
+        (WebCore::SVGSVGElement::createSVGRect):
+        (WebCore::SVGSVGElement::createSVGTransform):
+        (WebCore::SVGSVGElement::createSVGTransformFromMatrix):
+        * svg/SVGSVGElement.h:
+        (WebCore::SVGSVGElement::currentTranslateValue):
+        (WebCore::SVGSVGElement::currentTranslate): Deleted.
+        (WebCore::SVGSVGElement::createSVGNumber): Deleted.
+        Update functions taking tear off values to take the wrappers, and update
+        the factory functions returning tear offs, to return the wrappers.
+        
+        * svg/SVGSVGElement.idl:
+        Annotate functions/properties returning tear offs with [NewObject].
+
+        * svg/SVGTextContentElement.cpp:
+        (WebCore::SVGTextContentElement::synchronizeTextLength):
+        (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper):
+        (WebCore::SVGTextContentElement::textLengthAnimated):
+        (WebCore::SVGTextContentElement::getStartPositionOfChar):
+        (WebCore::SVGTextContentElement::getEndPositionOfChar):
+        (WebCore::SVGTextContentElement::getExtentOfChar):
+        (WebCore::SVGTextContentElement::getCharNumAtPosition):
+        (WebCore::SVGTextContentElement::parseAttribute):
+        * svg/SVGTextContentElement.h:
+        (WebCore::SVGTextContentElement::specifiedTextLength):
+        Update functions returning tear off values to return the wrappers
+        and ones taking the values to take the wrappers.
+
+        * svg/SVGTextContentElement.idl:
+        Annotate functions/properties returning tear offs with [NewObject].
+
+        * svg/SVGTransform.cpp:
+        (WebCore::SVGTransform::matrix):
+        * svg/SVGTransform.h:
+        (WebCore::SVGTransform::create):
+        (WebCore::SVGTransform::type):
+        (WebCore::SVGTransform::angle):
+        (WebCore::SVGTransform::setMatrix):
+        (WebCore::SVGTransform::setTranslate):
+        (WebCore::SVGTransform::setScale):
+        (WebCore::SVGTransform::setRotate):
+        (WebCore::SVGTransform::setSkewX):
+        (WebCore::SVGTransform::setSkewY):
+        Implement the SVGTransform interface as a tear off.
+
+        * svg/SVGTransform.idl:
+        Add ConstantsScope annotation to allow the constants to be defined on 
+        SVGTransformValue. Add exception and NewObject annotations.
+
+        * svg/SVGTransformDistance.cpp:
+        (WebCore::SVGTransformDistance::SVGTransformDistance):
+        (WebCore::SVGTransformDistance::scaledDistance):
+        (WebCore::SVGTransformDistance::addSVGTransforms):
+        (WebCore::SVGTransformDistance::addToSVGTransform):
+        (WebCore::SVGTransformDistance::distance):
+        * svg/SVGTransformDistance.h:
+        * svg/SVGTransformList.cpp:
+        (WebCore::SVGTransformList::createSVGTransformFromMatrix):
+        (WebCore::SVGTransformList::consolidate):
+        * svg/SVGTransformList.h:
+        (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue):
+        * svg/SVGTransformable.cpp:
+        (WebCore::SVGTransformable::parseTransformValue):
+        (WebCore::parseAndSkipType):
+        (WebCore::SVGTransformable::parseTransformType):
+        (WebCore::SVGTransformable::parseTransformAttribute):
+        * svg/SVGTransformable.h:
+        * svg/SVGUseElement.cpp:
+        (WebCore::SVGUseElement::parseAttribute):
+        Update for name change of SVGTransform to SVGTransformValue.
+
+        * svg/SVGTransformList.idl:
+        Annotate functions returning tear offs with NewObject.
+
+        * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp.
+        * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h.
+
+        * svg/SVGZoomEvent.cpp:
+        (WebCore::SVGZoomEvent::zoomRectScreen):
+        (WebCore::SVGZoomEvent::previousTranslate):
+        (WebCore::SVGZoomEvent::newTranslate):
+        * svg/SVGZoomEvent.h:
+        Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions
+        returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>.
+
+        * svg/SVGZoomEvent.idl:
+        Annotate function returning tear off with NewObject.
+
+        * svg/properties/SVGAnimatedListPropertyTearOff.h:
+        (WebCore::SVGAnimatedListPropertyTearOff::findItem):
+        Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits
+        to get the correct tear off type (as we do for the other list property tear off 
+        classes.)
+        * svg/properties/SVGListProperty.h:
+        (WebCore::SVGListProperty::clearValues):
+        (WebCore::SVGListProperty::clearValuesAndWrappers):
+        (WebCore::SVGListProperty::initializeValues):
+        (WebCore::SVGListProperty::initializeValuesAndWrappers):
+        (WebCore::SVGListProperty::getItemValues):
+        (WebCore::SVGListProperty::getItemValuesAndWrappers):
+        (WebCore::SVGListProperty::insertItemBeforeValues):
+        (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
+        (WebCore::SVGListProperty::canReplaceItem):
+        (WebCore::SVGListProperty::replaceItemValues):
+        (WebCore::SVGListProperty::replaceItemValuesAndWrappers):
+        (WebCore::SVGListProperty::canRemoveItem):
+        (WebCore::SVGListProperty::removeItemValues):
+        (WebCore::SVGListProperty::removeItemValuesAndWrappers):
+        (WebCore::SVGListProperty::appendItemValues):
+        (WebCore::SVGListProperty::appendItemValuesAndWrappers):
+        * svg/properties/SVGListPropertyTearOff.h:
+        (WebCore::SVGListPropertyTearOff::initialize):
+        (WebCore::SVGListPropertyTearOff::getItem):
+        (WebCore::SVGListPropertyTearOff::insertItemBefore):
+        (WebCore::SVGListPropertyTearOff::replaceItem):
+        (WebCore::SVGListPropertyTearOff::removeItem):
+        (WebCore::SVGListPropertyTearOff::appendItem):
+        * svg/properties/SVGPathSegListPropertyTearOff.h:
+        * svg/properties/SVGStaticListPropertyTearOff.h:
+        * svg/properties/SVGTransformListPropertyTearOff.h:
+        Change functions returning PtrListItemTearOff, to instead return
+        Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions
+        that were returning nullptr, and replace them with a assertions (these
+        were cases where a function like canGetItem() was called, and it only
+        did one of two things, returning an exception, or returned true).
+
+        * svg/properties/SVGMatrixTearOff.h:
+        Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove
+        incorrect comment and update some SVGMatrix types to SVGMatrixValues.
+
+        * svg/properties/SVGStaticPropertyTearOff.h:
+        Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather
+        than the value type, so it can be directly inherited from. This allow the one user 
+        of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. 
+
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+        Update test results now that svg property tear offs are not handled specially.
+
 2016-11-14  Youenn Fablet  <youenn@apple.com>
 
         Move updateSignalingState to PeerConnectionBackend
index 4ffb327..b65e372 100644 (file)
                08C9251A0FCC7C4A00480DEC /* FilterEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C925180FCC7C4A00480DEC /* FilterEffect.h */; settings = {ATTRIBUTES = (Private, ); }; };
                08CA3D4412894A3800FFF260 /* SVGMatrixTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 08CA3D4312894A3800FFF260 /* SVGMatrixTearOff.h */; };
                08D46CE3127AD5FC0089694B /* SVGAnimatedEnumeration.h in Headers */ = {isa = PBXBuildFile; fileRef = 08D46CE2127AD5FC0089694B /* SVGAnimatedEnumeration.h */; };
-               08E4FE460E2BD41400F4CAE0 /* JSSVGLengthCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08E4FE450E2BD41400F4CAE0 /* JSSVGLengthCustom.cpp */; };
                08EDE19F12A50B8E00B95797 /* SVGRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 08EDE19E12A50B8E00B95797 /* SVGRect.h */; };
                08F0BFC31255C53C00075185 /* SVGTextChunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 08F0BFBE1255C53C00075185 /* SVGTextChunk.h */; };
                08F0BFC41255C53C00075185 /* SVGTextFragment.h in Headers */ = {isa = PBXBuildFile; fileRef = 08F0BFBF1255C53C00075185 /* SVGTextFragment.h */; };
                7CC69940191EC5F500AF2270 /* JSWebKitNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */; };
                7CC69941191EC5F500AF2270 /* JSWebKitNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */; };
                7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */; };
+               7CCEBFC01DD8F6AB002C40B8 /* SVGLengthValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D531DD7B09300128552 /* SVGLengthValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7CD0BA041B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD0BA021B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.cpp */; };
                7CD0BA051B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */; };
                7CD494CC1A86EB1D000A87EC /* RenderAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */; };
                7CD494CD1A86EB1D000A87EC /* RenderAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               7CE58D4A1DD64A5B00128552 /* SVGPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D491DD64A5B00128552 /* SVGPoint.h */; };
+               7CE58D4E1DD694FE00128552 /* SVGRectTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */; };
+               7CE58D501DD69A1E00128552 /* SVGNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4F1DD69A1E00128552 /* SVGNumber.h */; };
+               7CE58D541DD7D6E200128552 /* SVGLengthValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */; };
+               7CE58D571DD7D96D00128552 /* SVGTransformValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE58D551DD7D96D00128552 /* SVGTransformValue.cpp */; };
+               7CE58D581DD7D96D00128552 /* SVGTransformValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D561DD7D96D00128552 /* SVGTransformValue.h */; };
+               7CE58D5A1DD7DE5200128552 /* SVGTransform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE58D591DD7DE5200128552 /* SVGTransform.cpp */; };
+               7CE58D5C1DD7EC9C00128552 /* SVGMatrixValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D5B1DD7EC9C00128552 /* SVGMatrixValue.h */; };
                7CE68344192143A800F4D928 /* UserMessageHandlerDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE68342192143A800F4D928 /* UserMessageHandlerDescriptor.cpp */; };
                7CE68345192143A800F4D928 /* UserMessageHandlerDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE68343192143A800F4D928 /* UserMessageHandlerDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7CE683471921821500F4D928 /* UserMessageHandlerDescriptorTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE683461921821500F4D928 /* UserMessageHandlerDescriptorTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
                B2227A2D0D00BF220071B782 /* SVGImageElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278970D00BF200071B782 /* SVGImageElement.h */; };
                B2227A2F0D00BF220071B782 /* SVGLangSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278990D00BF200071B782 /* SVGLangSpace.cpp */; };
                B2227A300D00BF220071B782 /* SVGLangSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = B222789A0D00BF200071B782 /* SVGLangSpace.h */; };
-               B2227A320D00BF220071B782 /* SVGLength.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B222789C0D00BF200071B782 /* SVGLength.cpp */; };
-               B2227A330D00BF220071B782 /* SVGLength.h in Headers */ = {isa = PBXBuildFile; fileRef = B222789D0D00BF200071B782 /* SVGLength.h */; settings = {ATTRIBUTES = (Private, ); }; };
                B2227A350D00BF220071B782 /* SVGLengthList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B222789F0D00BF200071B782 /* SVGLengthList.cpp */; };
                B2227A360D00BF220071B782 /* SVGLengthList.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278A00D00BF200071B782 /* SVGLengthList.h */; settings = {ATTRIBUTES = (Private, ); }; };
                B2227A380D00BF220071B782 /* SVGLinearGradientElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278A20D00BF200071B782 /* SVGLinearGradientElement.cpp */; };
                B2227AD10D00BF220071B782 /* SVGTextPositioningElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B222793B0D00BF210071B782 /* SVGTextPositioningElement.h */; };
                B2227AD30D00BF220071B782 /* SVGTitleElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B222793D0D00BF210071B782 /* SVGTitleElement.cpp */; };
                B2227AD40D00BF220071B782 /* SVGTitleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B222793E0D00BF210071B782 /* SVGTitleElement.h */; };
-               B2227AD60D00BF220071B782 /* SVGTransform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22279400D00BF210071B782 /* SVGTransform.cpp */; };
                B2227AD70D00BF220071B782 /* SVGTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = B22279410D00BF210071B782 /* SVGTransform.h */; };
                B2227AD90D00BF220071B782 /* SVGTransformable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22279430D00BF210071B782 /* SVGTransformable.cpp */; };
                B2227ADA0D00BF220071B782 /* SVGTransformable.h in Headers */ = {isa = PBXBuildFile; fileRef = B22279440D00BF210071B782 /* SVGTransformable.h */; };
                08C925180FCC7C4A00480DEC /* FilterEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilterEffect.h; sourceTree = "<group>"; };
                08CA3D4312894A3800FFF260 /* SVGMatrixTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMatrixTearOff.h; sourceTree = "<group>"; };
                08D46CE2127AD5FC0089694B /* SVGAnimatedEnumeration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedEnumeration.h; sourceTree = "<group>"; };
-               08E4FE450E2BD41400F4CAE0 /* JSSVGLengthCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGLengthCustom.cpp; sourceTree = "<group>"; };
                08EDE19E12A50B8E00B95797 /* SVGRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRect.h; sourceTree = "<group>"; };
                08F0BFBD1255C53C00075185 /* SVGTextChunk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextChunk.cpp; sourceTree = "<group>"; };
                08F0BFBE1255C53C00075185 /* SVGTextChunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextChunk.h; sourceTree = "<group>"; };
                7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActiveDOMCallbackMicrotask.h; sourceTree = "<group>"; };
                7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderAttachment.cpp; sourceTree = "<group>"; };
                7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderAttachment.h; sourceTree = "<group>"; };
+               7CE58D491DD64A5B00128552 /* SVGPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPoint.h; sourceTree = "<group>"; };
+               7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRectTraits.h; sourceTree = "<group>"; };
+               7CE58D4F1DD69A1E00128552 /* SVGNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGNumber.h; sourceTree = "<group>"; };
+               7CE58D511DD7B09300128552 /* SVGLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLength.h; sourceTree = "<group>"; };
+               7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthValue.cpp; sourceTree = "<group>"; };
+               7CE58D531DD7B09300128552 /* SVGLengthValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLengthValue.h; sourceTree = "<group>"; };
+               7CE58D551DD7D96D00128552 /* SVGTransformValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTransformValue.cpp; sourceTree = "<group>"; };
+               7CE58D561DD7D96D00128552 /* SVGTransformValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTransformValue.h; sourceTree = "<group>"; };
+               7CE58D591DD7DE5200128552 /* SVGTransform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTransform.cpp; sourceTree = "<group>"; };
+               7CE58D5B1DD7EC9C00128552 /* SVGMatrixValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMatrixValue.h; sourceTree = "<group>"; };
                7CE68342192143A800F4D928 /* UserMessageHandlerDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMessageHandlerDescriptor.cpp; sourceTree = "<group>"; };
                7CE68343192143A800F4D928 /* UserMessageHandlerDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandlerDescriptor.h; sourceTree = "<group>"; };
                7CE683461921821500F4D928 /* UserMessageHandlerDescriptorTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandlerDescriptorTypes.h; sourceTree = "<group>"; };
                B22278980D00BF200071B782 /* SVGImageElement.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SVGImageElement.idl; sourceTree = "<group>"; };
                B22278990D00BF200071B782 /* SVGLangSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLangSpace.cpp; sourceTree = "<group>"; };
                B222789A0D00BF200071B782 /* SVGLangSpace.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGLangSpace.h; sourceTree = "<group>"; };
-               B222789C0D00BF200071B782 /* SVGLength.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLength.cpp; sourceTree = "<group>"; };
-               B222789D0D00BF200071B782 /* SVGLength.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGLength.h; sourceTree = "<group>"; };
                B222789E0D00BF200071B782 /* SVGLength.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SVGLength.idl; sourceTree = "<group>"; };
                B222789F0D00BF200071B782 /* SVGLengthList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthList.cpp; sourceTree = "<group>"; };
                B22278A00D00BF200071B782 /* SVGLengthList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGLengthList.h; sourceTree = "<group>"; };
                B222793D0D00BF210071B782 /* SVGTitleElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTitleElement.cpp; sourceTree = "<group>"; };
                B222793E0D00BF210071B782 /* SVGTitleElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGTitleElement.h; sourceTree = "<group>"; };
                B222793F0D00BF210071B782 /* SVGTitleElement.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SVGTitleElement.idl; sourceTree = "<group>"; };
-               B22279400D00BF210071B782 /* SVGTransform.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTransform.cpp; sourceTree = "<group>"; };
                B22279410D00BF210071B782 /* SVGTransform.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGTransform.h; sourceTree = "<group>"; };
                B22279420D00BF210071B782 /* SVGTransform.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SVGTransform.idl; sourceTree = "<group>"; };
                B22279430D00BF210071B782 /* SVGTransformable.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTransformable.cpp; sourceTree = "<group>"; };
                                B28C6A210D00C44800334AA4 /* SVGImageLoader.h */,
                                B22278990D00BF200071B782 /* SVGLangSpace.cpp */,
                                B222789A0D00BF200071B782 /* SVGLangSpace.h */,
-                               B222789C0D00BF200071B782 /* SVGLength.cpp */,
-                               B222789D0D00BF200071B782 /* SVGLength.h */,
                                B222789E0D00BF200071B782 /* SVGLength.idl */,
+                               7CE58D511DD7B09300128552 /* SVGLength.h */,
                                7134496B146941B300720312 /* SVGLengthContext.cpp */,
                                7134496C146941B300720312 /* SVGLengthContext.h */,
                                B222789F0D00BF200071B782 /* SVGLengthList.cpp */,
                                B22278A00D00BF200071B782 /* SVGLengthList.h */,
                                B22278A10D00BF200071B782 /* SVGLengthList.idl */,
+                               7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */,
+                               7CE58D531DD7B09300128552 /* SVGLengthValue.h */,
                                B22278A20D00BF200071B782 /* SVGLinearGradientElement.cpp */,
                                B22278A30D00BF200071B782 /* SVGLinearGradientElement.h */,
                                B22278A40D00BF200071B782 /* SVGLinearGradientElement.idl */,
                                B22278B20D00BF200071B782 /* SVGMaskElement.idl */,
                                0806E57912893045007CED32 /* SVGMatrix.h */,
                                B22278B30D00BF200071B782 /* SVGMatrix.idl */,
+                               7CE58D5B1DD7EC9C00128552 /* SVGMatrixValue.h */,
                                B22278B40D00BF200071B782 /* SVGMetadataElement.cpp */,
                                B22278B50D00BF200071B782 /* SVGMetadataElement.h */,
                                B22278B60D00BF200071B782 /* SVGMetadataElement.idl */,
                                B22278B70D00BF200071B782 /* SVGMPathElement.cpp */,
                                B22278B80D00BF200071B782 /* SVGMPathElement.h */,
                                44D8DA98139545BE00337B75 /* SVGMPathElement.idl */,
+                               7CE58D4F1DD69A1E00128552 /* SVGNumber.h */,
                                B22278B90D00BF200071B782 /* SVGNumber.idl */,
                                B22278BA0D00BF200071B782 /* SVGNumberList.cpp */,
                                B22278BB0D00BF200071B782 /* SVGNumberList.h */,
                                B22278F20D00BF210071B782 /* SVGPatternElement.h */,
                                B22278F30D00BF210071B782 /* SVGPatternElement.idl */,
                                B22278F40D00BF210071B782 /* SVGPoint.idl */,
+                               7CE58D491DD64A5B00128552 /* SVGPoint.h */,
                                B22278F50D00BF210071B782 /* SVGPointList.cpp */,
                                B22278F60D00BF210071B782 /* SVGPointList.h */,
                                B22278F70D00BF210071B782 /* SVGPointList.idl */,
                                B22279050D00BF210071B782 /* SVGRadialGradientElement.idl */,
                                08EDE19E12A50B8E00B95797 /* SVGRect.h */,
                                B22279060D00BF210071B782 /* SVGRect.idl */,
+                               7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */,
                                B22279070D00BF210071B782 /* SVGRectElement.cpp */,
                                B22279080D00BF210071B782 /* SVGRectElement.h */,
                                B22279090D00BF210071B782 /* SVGRectElement.idl */,
                                B222793F0D00BF210071B782 /* SVGTitleElement.idl */,
                                1CCDF5BB1990332400BCEBAD /* SVGToOTFFontConversion.cpp */,
                                1CCDF5BC1990332400BCEBAD /* SVGToOTFFontConversion.h */,
-                               B22279400D00BF210071B782 /* SVGTransform.cpp */,
+                               7CE58D591DD7DE5200128552 /* SVGTransform.cpp */,
                                B22279410D00BF210071B782 /* SVGTransform.h */,
                                B22279420D00BF210071B782 /* SVGTransform.idl */,
                                B22279430D00BF210071B782 /* SVGTransformable.cpp */,
                                B22279480D00BF210071B782 /* SVGTransformList.cpp */,
                                B22279490D00BF210071B782 /* SVGTransformList.h */,
                                B222794A0D00BF210071B782 /* SVGTransformList.idl */,
+                               7CE58D551DD7D96D00128552 /* SVGTransformValue.cpp */,
+                               7CE58D561DD7D96D00128552 /* SVGTransformValue.h */,
                                B222794B0D00BF210071B782 /* SVGTRefElement.cpp */,
                                B222794C0D00BF210071B782 /* SVGTRefElement.h */,
                                B222794D0D00BF210071B782 /* SVGTRefElement.idl */,
                                AD726FEC16D9F4B9003A4E6D /* JSStyleSheetCustom.h */,
                                A84EBD770CB8C89200079609 /* JSStyleSheetListCustom.cpp */,
                                57A9C88D1DA70BF800BC7305 /* JSSubtleCryptoCustom.cpp */,
-                               08E4FE450E2BD41400F4CAE0 /* JSSVGLengthCustom.cpp */,
                                B2C96D8C0B3AF2B7005E80EC /* JSSVGPathSegCustom.cpp */,
                                838869EB1CE81E9E00D16A9E /* JSTextCustom.cpp */,
                                07E117061489EBEB00EC5ACE /* JSTextTrackCueCustom.cpp */,
                                D05CED2A0A40BB2C00C5AF38 /* FormatBlockCommand.h in Headers */,
                                7CE6CBFB187F370700D46BF5 /* FormatConverter.h in Headers */,
                                F50664F8157F52DC00AC226F /* FormController.h in Headers */,
+                               7CCEBFC01DD8F6AB002C40B8 /* SVGLengthValue.h in Headers */,
                                514C76700CE923A1007EF3CD /* FormData.h in Headers */,
                                085B92BB0EFDE73D00E6123C /* FormDataBuilder.h in Headers */,
                                A8136D380973A8E700D74463 /* FormDataList.h in Headers */,
                                BE16C59317CFE17200852C04 /* InbandGenericTextTrack.h in Headers */,
                                07E9E12E18F5E2760011A3A4 /* InbandMetadataTextTrackPrivateAVF.h in Headers */,
                                07941792166E855F009416C2 /* InbandTextTrack.h in Headers */,
+                               7CE58D581DD7D96D00128552 /* SVGTransformValue.h in Headers */,
                                07941794166EA04E009416C2 /* InbandTextTrackPrivate.h in Headers */,
                                07B442D7166C70B000556CAD /* InbandTextTrackPrivateAVF.h in Headers */,
                                07AA6B6C166D2C1300D45671 /* InbandTextTrackPrivateAVFObjC.h in Headers */,
                                512DD8F50D91E6AF000F89EE /* LegacyWebArchive.h in Headers */,
                                BCE65BEB0EACDF16007E4533 /* Length.h in Headers */,
                                BCFF64910EAD15C200C1D6F7 /* LengthBox.h in Headers */,
+                               7CE58D4A1DD64A5B00128552 /* SVGPoint.h in Headers */,
                                E5BA7D63151437CA00FE1E3F /* LengthFunctions.h in Headers */,
                                0F8716701C869D83004FF0DE /* LengthPoint.h in Headers */,
                                F42FFB461984B71600F6837F /* LengthRepeat.h in Headers */,
                                CDCD41E81C3DDB0A00965D99 /* ParsedContentRange.h in Headers */,
                                447958041643B49A001E0A7F /* ParsedContentType.h in Headers */,
                                BC76AC130DD7AD5C00415F34 /* ParserUtilities.h in Headers */,
+                               7CE58D5C1DD7EC9C00128552 /* SVGMatrixValue.h in Headers */,
                                536D5A23193E8E0C00CE4CAB /* ParsingUtilities.h in Headers */,
                                1AED3BDA1D3D5F260099FD78 /* PassKitSPI.h in Headers */,
                                F55B3DCA1251F12D003EF269 /* PasswordInputType.h in Headers */,
                                0854B01F1255E4E600B9CDD0 /* SVGInlineFlowBox.h in Headers */,
                                0854B0211255E4E600B9CDD0 /* SVGInlineTextBox.h in Headers */,
                                B2227A300D00BF220071B782 /* SVGLangSpace.h in Headers */,
-                               B2227A330D00BF220071B782 /* SVGLength.h in Headers */,
                                7134496E146941B300720312 /* SVGLengthContext.h in Headers */,
                                B2227A360D00BF220071B782 /* SVGLengthList.h in Headers */,
                                B2227A390D00BF220071B782 /* SVGLinearGradientElement.h in Headers */,
                                0806E57A12893045007CED32 /* SVGMatrix.h in Headers */,
                                08CA3D4412894A3800FFF260 /* SVGMatrixTearOff.h in Headers */,
                                B2227A4B0D00BF220071B782 /* SVGMetadataElement.h in Headers */,
+                               7CE58D4E1DD694FE00128552 /* SVGRectTraits.h in Headers */,
                                B2A1F2B10CEF0ABF00442F6A /* SVGMissingGlyphElement.h in Headers */,
                                B2227A4E0D00BF220071B782 /* SVGMPathElement.h in Headers */,
                                B2227A510D00BF220071B782 /* SVGNumberList.h in Headers */,
                                A833C80D0A2CF25600D57664 /* XMLNames.h in Headers */,
                                E15A36D71104572000B7B639 /* XMLNSNames.h in Headers */,
                                1ACE53EB0A8D18E70022947D /* XMLSerializer.h in Headers */,
+                               7CE58D501DD69A1E00128552 /* SVGNumber.h in Headers */,
                                5905ADC01302F3CE00F116DF /* XMLTreeViewer.h in Headers */,
                                1AB7FC690A8B92EC00D9D37B /* XPathEvaluator.h in Headers */,
                                BC60DA5B0D2A31F700B9918F /* XPathException.h in Headers */,
                                A8C4A80809D563270003AC8D /* Element.cpp in Sources */,
                                B5B7A17017C10AA800E4AA0A /* ElementData.cpp in Sources */,
                                4FFC022D1643B726004E1638 /* ElementRareData.cpp in Sources */,
+                               7CE58D541DD7D6E200128552 /* SVGLengthValue.cpp in Sources */,
                                FBDB619B16D6032A00BB3394 /* ElementRuleCollector.cpp in Sources */,
                                A8CFF6CB0A1561CD000A4234 /* EllipsisBox.cpp in Sources */,
                                F55B3DBB1251F12D003EF269 /* EmailInputType.cpp in Sources */,
                                8485227B1190162C006EDC7F /* JSSVGHKernElement.cpp in Sources */,
                                B2FA3D9E0AB75A6F000E5AC4 /* JSSVGImageElement.cpp in Sources */,
                                B2FA3DA00AB75A6F000E5AC4 /* JSSVGLength.cpp in Sources */,
-                               08E4FE460E2BD41400F4CAE0 /* JSSVGLengthCustom.cpp in Sources */,
                                B2FA3DA20AB75A6F000E5AC4 /* JSSVGLengthList.cpp in Sources */,
                                B2FA3DA40AB75A6F000E5AC4 /* JSSVGLinearGradientElement.cpp in Sources */,
                                B2FA3DA60AB75A6F000E5AC4 /* JSSVGLineElement.cpp in Sources */,
                                1F3C3BEA135CAF3C00B8C1AC /* MediaControls.cpp in Sources */,
                                4157AF8112F1FB0400A8C6F5 /* MediaControlsApple.cpp in Sources */,
                                CDAB6D2817C7DE6C00C60B34 /* MediaControlsHost.cpp in Sources */,
+                               7CE58D5A1DD7DE5200128552 /* SVGTransform.cpp in Sources */,
                                159AE82B1B3A402F0037478B /* MediaDeviceInfo.cpp in Sources */,
                                5EA725D21ACABD4700EAD17B /* MediaDevices.cpp in Sources */,
                                07ABEF6C1D8A1C5800F21972 /* MediaDevicesEnumerationRequest.cpp in Sources */,
                                07EDC3EE1AACB75D00983EB5 /* MediaSessionManagerMac.mm in Sources */,
                                CD3A495E17A9D01B00274E42 /* MediaSource.cpp in Sources */,
                                CDC8B5A6180474F70016E685 /* MediaSourcePrivateAVFObjC.mm in Sources */,
+                               7CE58D571DD7D96D00128552 /* SVGTransformValue.cpp in Sources */,
                                CD61FE671794AADB004101EB /* MediaSourceRegistry.cpp in Sources */,
                                07C59B6817F784BA000FBCBB /* MediaSourceSettings.cpp in Sources */,
                                078E08FF17D14CEE00420AA1 /* MediaStream.cpp in Sources */,
                                08F859D41463F9CD0067D934 /* SVGImageForContainer.cpp in Sources */,
                                B28C6A290D00C44800334AA4 /* SVGImageLoader.cpp in Sources */,
                                B2227A2F0D00BF220071B782 /* SVGLangSpace.cpp in Sources */,
-                               B2227A320D00BF220071B782 /* SVGLength.cpp in Sources */,
                                7134496D146941B300720312 /* SVGLengthContext.cpp in Sources */,
                                B2227A350D00BF220071B782 /* SVGLengthList.cpp in Sources */,
                                B2227A380D00BF220071B782 /* SVGLinearGradientElement.cpp in Sources */,
                                B2227AD00D00BF220071B782 /* SVGTextPositioningElement.cpp in Sources */,
                                B2227AD30D00BF220071B782 /* SVGTitleElement.cpp in Sources */,
                                1CCDF5BD1990332400BCEBAD /* SVGToOTFFontConversion.cpp in Sources */,
-                               B2227AD60D00BF220071B782 /* SVGTransform.cpp in Sources */,
                                B2227AD90D00BF220071B782 /* SVGTransformable.cpp in Sources */,
                                B2227ADC0D00BF220071B782 /* SVGTransformDistance.cpp in Sources */,
                                B2227ADE0D00BF220071B782 /* SVGTransformList.cpp in Sources */,
index 821ad27..b071212 100644 (file)
 #include "JSReadableStreamPrivateConstructors.cpp"
 #include "JSSQLResultSetRowListCustom.cpp"
 #include "JSSQLTransactionCustom.cpp"
-#include "JSSVGLengthCustom.cpp"
 #include "JSSVGPathSegCustom.cpp"
 #include "JSStorageCustom.cpp"
 #include "JSStyleSheetCustom.cpp"
diff --git a/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp b/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp
deleted file mode 100644 (file)
index fd83d27..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-    Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
-    Copyright (C) 2016 Apple Inc. All rights reserved.
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-#include "JSSVGLength.h"
-
-#include "ExceptionCode.h"
-#include "JSDOMConvert.h"
-#include "SVGAnimatedProperty.h"
-#include "SVGException.h"
-#include "SVGLengthContext.h"
-#include <runtime/Error.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-JSValue JSSVGLength::value(ExecState& state) const
-{
-    VM& vm = state.vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-    return toJS<IDLUnrestrictedFloat>(state, scope, wrapped().propertyReference().valueForBindings(SVGLengthContext { wrapped().contextElement() }));
-}
-
-void JSSVGLength::setValue(ExecState& state, JSValue value)
-{
-    VM& vm = state.vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    if (wrapped().isReadOnly()) {
-        setDOMException(&state, NO_MODIFICATION_ALLOWED_ERR);
-        return;
-    }
-
-    if (!value.isUndefinedOrNull() && !value.isNumber() && !value.isBoolean()) {
-        throwVMTypeError(&state, scope);
-        return;
-    }
-
-    auto floatValue = value.toFloat(&state);
-    RETURN_IF_EXCEPTION(scope, void());
-
-    auto result = wrapped().propertyReference().setValue(floatValue, SVGLengthContext { wrapped().contextElement() });
-    if (result.hasException()) {
-        propagateException(state, scope, result.releaseException());
-        return;
-    }
-
-    wrapped().commitChange();
-}
-
-JSValue JSSVGLength::convertToSpecifiedUnits(ExecState& state)
-{
-    VM& vm = state.vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    if (wrapped().isReadOnly()) {
-        setDOMException(&state, NO_MODIFICATION_ALLOWED_ERR);
-        return { };
-    }
-
-    if (state.argumentCount() < 1)
-        return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
-    unsigned short unitType = state.uncheckedArgument(0).toUInt32(&state);
-    RETURN_IF_EXCEPTION(scope, JSValue());
-
-    auto result = wrapped().propertyReference().convertToSpecifiedUnits(unitType, SVGLengthContext { wrapped().contextElement() });
-    if (result.hasException()) {
-        propagateException(state, scope, result.releaseException());
-        return { };
-    }
-
-    wrapped().commitChange();
-    return jsUndefined();
-}
-
-}
index e1eccce..af92028 100644 (file)
@@ -119,25 +119,14 @@ my %svgAttributesInHTMLHash = (
 );
 
 my %svgTypeNeedingTearOff = (
-    "SVGLength" => "SVGPropertyTearOff<SVGLength>",
     "SVGLengthList" => "SVGListPropertyTearOff<SVGLengthList>",
-    "SVGMatrix" => "SVGPropertyTearOff<SVGMatrix>",
-    "SVGNumber" => "SVGPropertyTearOff<float>",
     "SVGNumberList" => "SVGListPropertyTearOff<SVGNumberList>",
-    "SVGPathSegList" => "SVGPathSegListPropertyTearOff",
-    "SVGPoint" => "SVGPropertyTearOff<SVGPoint>",
     "SVGPointList" => "SVGListPropertyTearOff<SVGPointList>",
-    "SVGRect" => "SVGPropertyTearOff<FloatRect>",
     "SVGStringList" => "SVGStaticListPropertyTearOff<SVGStringList>",
-    "SVGTransform" => "SVGPropertyTearOff<SVGTransform>",
+    "SVGPathSegList" => "SVGPathSegListPropertyTearOff",
     "SVGTransformList" => "SVGTransformListPropertyTearOff"
 );
 
-my %svgTypeWithWritablePropertiesNeedingTearOff = (
-    "SVGPoint" => 1,
-    "SVGMatrix" => 1
-);
-
 # Cache of IDL file pathnames.
 my $idlFiles;
 my $cachedInterfaces = {};
@@ -383,7 +372,6 @@ sub SkipIncludeHeader
     return 1 if $typedArrayTypes{$typeName};
     return 1 if $stringTypeHash{$typeName};
     return 1 if $typeName eq "BufferSource";
-    return 1 if $typeName eq "SVGNumber";
     return 1 if $typeName eq "any";
 
     return 0;
@@ -626,16 +614,6 @@ sub IsSVGTypeNeedingTearOff
     return 0;
 }
 
-sub IsSVGTypeWithWritablePropertiesNeedingTearOff
-{
-    my ($object, $type) = @_;
-
-    assert("Not a type") if ref($type) ne "IDLType";
-
-    return 1 if $svgTypeWithWritablePropertiesNeedingTearOff{$type->name};
-    return 0;
-}
-
 sub IsTypedArrayType
 {
     my ($object, $type) = @_;
@@ -681,9 +659,7 @@ sub GetSVGWrappedTypeNeedingTearOff
     my $svgTypeNeedingTearOff = $object->GetSVGTypeNeedingTearOff($type);
     return $svgTypeNeedingTearOff if not $svgTypeNeedingTearOff;
 
-    if ($svgTypeNeedingTearOff =~ /SVGPropertyTearOff/) {
-        $svgTypeNeedingTearOff =~ s/SVGPropertyTearOff<//;
-    } elsif ($svgTypeNeedingTearOff =~ /SVGListPropertyTearOff/) {
+    if ($svgTypeNeedingTearOff =~ /SVGListPropertyTearOff/) {
         $svgTypeNeedingTearOff =~ s/SVGListPropertyTearOff<//;
     } elsif ($svgTypeNeedingTearOff =~ /SVGStaticListPropertyTearOff/) {
         $svgTypeNeedingTearOff =~ s/SVGStaticListPropertyTearOff<//;
@@ -1205,7 +1181,6 @@ sub ShouldPassWrapperByReference
 
     return 0 if $argument->type->isNullable;
     return 0 if !$object->IsWrapperType($argument->type) && !$object->IsTypedArrayType($argument->type);
-    return 0 if $object->IsSVGTypeNeedingTearOff($argument->type);
 
     return 1;
 }
index bee6016..1220b5f 100644 (file)
@@ -842,7 +842,7 @@ sub GetImplClassName
 {
     my $interface = shift;
 
-    my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($interface);
+    my ($svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($interface);
     return $svgNativeType if $svgNativeType;
 
     return $interface->type->name;
@@ -1342,10 +1342,7 @@ sub GenerateHeader
     $headerIncludes{"SVGElement.h"} = 1 if $className =~ /^JSSVG/;
 
     my $implType = GetImplClassName($interface);
-    my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($interface);
-    my $svgPropertyOrListPropertyType;
-    $svgPropertyOrListPropertyType = $svgPropertyType if $svgPropertyType;
-    $svgPropertyOrListPropertyType = $svgListPropertyType if $svgListPropertyType;
+    my ($svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($interface);
 
     my $numConstants = @{$interface->constants};
     my $numAttributes = @{$interface->attributes};
@@ -1358,7 +1355,7 @@ sub GenerateHeader
     } else {
         # Implementation class forward declaration
         if (IsDOMGlobalObject($interface)) {
-            AddClassForwardIfNeeded($interface->type) unless $svgPropertyOrListPropertyType;
+            AddClassForwardIfNeeded($interface->type) unless $svgListPropertyType;
         }
     }
 
@@ -1391,7 +1388,7 @@ sub GenerateHeader
         push(@headerContent, "        return ptr;\n");
         push(@headerContent, "    }\n\n");
     } elsif ($interface->extendedAttributes->{MasqueradesAsUndefined}) {
-        AddIncludesForImplementationTypeInHeader($implType) unless $svgPropertyOrListPropertyType;
+        AddIncludesForImplementationTypeInHeader($implType) unless $svgListPropertyType;
         push(@headerContent, "    static $className* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<$implType>&& impl)\n");
         push(@headerContent, "    {\n");
         push(@headerContent, "        globalObject->masqueradesAsUndefinedWatchpoint()->fireAll(globalObject->vm(), \"Allocated masquerading object\");\n");
@@ -1407,7 +1404,7 @@ sub GenerateHeader
         push(@headerContent, "        return ptr;\n");
         push(@headerContent, "    }\n\n");  
     } else {
-        AddIncludesForImplementationTypeInHeader($implType) unless $svgPropertyOrListPropertyType;
+        AddIncludesForImplementationTypeInHeader($implType) unless $svgListPropertyType;
         push(@headerContent, "    static $className* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<$implType>&& impl)\n");
         push(@headerContent, "    {\n");
         push(@headerContent, "        $className* ptr = new (NotNull, JSC::allocateCell<$className>(globalObject->vm().heap)) $className(structure, *globalObject, WTFMove(impl));\n");
@@ -2969,10 +2966,7 @@ sub GenerateImplementation
     }
     push(@implContent, ", CREATE_METHOD_TABLE($className) };\n\n");
 
-    my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($interface);
-    my $svgPropertyOrListPropertyType;
-    $svgPropertyOrListPropertyType = $svgPropertyType if $svgPropertyType;
-    $svgPropertyOrListPropertyType = $svgListPropertyType if $svgListPropertyType;
+    my ($svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($interface);
 
     # Constructor
     if ($interfaceName eq "DOMWindow") {
@@ -3342,14 +3336,6 @@ sub GenerateImplementation
 
                 if ($svgListPropertyType) {
                     push(@implContent, "    JSValue result =  " . NativeToJSValueUsingReferences($attribute, 0, $interface, "thisObject.wrapped().$implGetterFunctionName(" . (join ", ", @callWithArgs) . ")", "thisObject") . ";\n");
-                } elsif ($svgPropertyOrListPropertyType) {
-                    push(@implContent, "    $svgPropertyOrListPropertyType& impl = thisObject.wrapped().propertyReference();\n");
-                    if ($svgPropertyOrListPropertyType eq "float") { # Special case for JSSVGNumber
-                        push(@implContent, "    JSValue result = " . NativeToJSValueUsingReferences($attribute, 0, $interface, "impl", "thisObject") . ";\n");
-                    } else {
-                        push(@implContent, "    JSValue result = " . NativeToJSValueUsingReferences($attribute, 0, $interface, "impl.$implGetterFunctionName(" . (join ", ", @callWithArgs) . ")", "thisObject") . ";\n");
-
-                    }
                 } else {
                     my ($functionName, @arguments) = $codeGenerator->GetterExpression(\%implIncludes, $interfaceName, $attribute);
                     my $implementedBy = $attribute->extendedAttributes->{ImplementedBy};
@@ -3618,23 +3604,11 @@ sub GenerateImplementation
                     push (@implContent, "        return false;\n");
                 }
 
-                if ($svgPropertyOrListPropertyType) {
-                    if ($svgPropertyType) {
-                        push(@implContent, "    if (impl.isReadOnly()) {\n");
-                        push(@implContent, "        setDOMException(&state, throwScope, NO_MODIFICATION_ALLOWED_ERR);\n");
-                        push(@implContent, "        return false;\n");
-                        push(@implContent, "    }\n");
-                        $implIncludes{"ExceptionCode.h"} = 1;
-                    }
-                    push(@implContent, "    $svgPropertyOrListPropertyType& podImpl = impl.propertyReference();\n");
-                    if ($svgPropertyOrListPropertyType eq "float") { # Special case for JSSVGNumber
-                        push(@implContent, "    podImpl = nativeValue;\n");
-                    } else {
-                        my $functionString = "podImpl.set$implSetterFunctionName(nativeValue)";
-                        $functionString = "propagateException(state, throwScope, $functionString)" if $attribute->extendedAttributes->{SetterMayThrowException};
-                        push(@implContent, "    $functionString;\n");
-                    }
-                    push(@implContent, "    impl.commitChange();\n") if $svgPropertyType;
+                if ($svgListPropertyType) {
+                    push(@implContent, "    ${svgListPropertyType}& podImpl = impl.propertyReference();\n");
+                    my $functionString = "podImpl.set$implSetterFunctionName(nativeValue)";
+                    $functionString = "propagateException(state, throwScope, $functionString)" if $attribute->extendedAttributes->{SetterMayThrowException};
+                    push(@implContent, "    $functionString;\n");
                     push(@implContent, "    return true;\n");
                 } else {
                     my ($functionName, @arguments) = $codeGenerator->SetterExpression(\%implIncludes, $interfaceName, $attribute);
@@ -3791,8 +3765,8 @@ END
 
                     GenerateArgumentsCountCheck(\@implContent, $function, $interface);
 
-                    my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName, $svgPropertyType, $svgPropertyOrListPropertyType, $svgListPropertyType);
-                    GenerateImplementationFunctionCall($function, $functionString, "    ", $svgPropertyType, $interface);
+                    my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName);
+                    GenerateImplementationFunctionCall($function, $functionString, "    ", $interface);
                 }
             } else {
                 my $methodName = $function->name;
@@ -3837,19 +3811,11 @@ END
                     push(@implContent, "    return JSValue::encode(castedThis->" . $functionImplementationName . "(*state));\n");
                 } else {
                     push(@implContent, "    auto& impl = castedThis->wrapped();\n");
-                    if ($svgPropertyType) {
-                        push(@implContent, "    if (impl.isReadOnly()) {\n");
-                        push(@implContent, "        setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);\n");
-                        push(@implContent, "        return JSValue::encode(jsUndefined());\n");
-                        push(@implContent, "    }\n");
-                        push(@implContent, "    $svgPropertyType& podImpl = impl.propertyReference();\n");
-                        $implIncludes{"ExceptionCode.h"} = 1;
-                    }
 
                     GenerateArgumentsCountCheck(\@implContent, $function, $interface);
 
-                    my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName, $svgPropertyType, $svgPropertyOrListPropertyType, $svgListPropertyType);
-                    GenerateImplementationFunctionCall($function, $functionString, "    ", $svgPropertyType, $interface);
+                    my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName);
+                    GenerateImplementationFunctionCall($function, $functionString, "    ", $interface);
                 }
             }
 
@@ -3884,8 +3850,6 @@ END
                     $implFunctionName = "WebCore::${implementedBy}::${functionImplementationName}";
                 } elsif ($function->isStatic) {
                     $implFunctionName = "${interfaceName}::${functionImplementationName}";
-                } elsif ($svgPropertyOrListPropertyType and !$svgListPropertyType) {
-                    $implFunctionName = "podImpl.${functionImplementationName}";
                 } else {
                     $implFunctionName = "impl.${functionImplementationName}";
                 }
@@ -4358,7 +4322,7 @@ sub NeedsExplicitPropagateExceptionCall
 
 sub GenerateParametersCheck
 {
-    my ($outputArray, $function, $interface, $functionImplementationName, $svgPropertyType, $svgPropertyOrListPropertyType, $svgListPropertyType) = @_;
+    my ($outputArray, $function, $interface, $functionImplementationName) = @_;
 
     my $interfaceName = $interface->type->name;
     my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($interface);
@@ -4373,8 +4337,6 @@ sub GenerateParametersCheck
         $functionName = "WebCore::${implementedBy}::${functionImplementationName}";
     } elsif ($function->isStatic) {
         $functionName = "${interfaceName}::${functionImplementationName}";
-    } elsif ($svgPropertyOrListPropertyType and !$svgListPropertyType) {
-        $functionName = "podImpl.${functionImplementationName}";
     } else {
         $functionName = "impl.${functionImplementationName}";
     }
@@ -4943,7 +4905,7 @@ sub GenerateCallbackImplementationContent
 
 sub GenerateImplementationFunctionCall()
 {
-    my ($function, $functionString, $indent, $svgPropertyType, $interface) = @_;
+    my ($function, $functionString, $indent, $interface) = @_;
 
     my $nondeterministic = $function->extendedAttributes->{Nondeterministic};
 
@@ -4960,7 +4922,6 @@ sub GenerateImplementationFunctionCall()
         } else {
             push(@implContent, $indent . "$functionString;\n");
         }
-        push(@implContent, $indent . "impl.commitChange();\n") if $svgPropertyType and !$function->isStatic;
         push(@implContent, $indent . "return JSValue::encode(jsUndefined());\n");
     } else {
         my $thisObject = $function->isStatic ? 0 : "castedThis";
@@ -5308,21 +5269,16 @@ sub GetSVGPropertyTypes
 
     my $interfaceName = $interface->type->name;
 
-    my $svgPropertyType;
     my $svgListPropertyType;
     my $svgNativeType;
 
-    return ($svgPropertyType, $svgListPropertyType, $svgNativeType) if not $interfaceName =~ /SVG/;
+    return ($svgListPropertyType, $svgNativeType) if not $interfaceName =~ /SVG/;
 
     $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($interface->type);
-    return ($svgPropertyType, $svgListPropertyType, $svgNativeType) if not $svgNativeType;
+    return ($svgListPropertyType, $svgNativeType) if not $svgNativeType;
 
     my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($interface->type);
-    if ($svgNativeType =~ /SVGPropertyTearOff/) {
-        $svgPropertyType = $svgWrappedNativeType;
-        $headerIncludes{"$svgWrappedNativeType.h"} = 1;
-        $headerIncludes{"SVGAnimatedPropertyTearOff.h"} = 1;
-    } elsif ($svgNativeType =~ /SVGListPropertyTearOff/ or $svgNativeType =~ /SVGStaticListPropertyTearOff/) {
+    if ($svgNativeType =~ /SVGListPropertyTearOff/ or $svgNativeType =~ /SVGStaticListPropertyTearOff/) {
         $svgListPropertyType = $svgWrappedNativeType;
         $headerIncludes{"$svgWrappedNativeType.h"} = 1;
         $headerIncludes{"SVGAnimatedListPropertyTearOff.h"} = 1;
@@ -5338,14 +5294,7 @@ sub GetSVGPropertyTypes
         $headerIncludes{"SVGPathSegListPropertyTearOff.h"} = 1;
     }
 
-    return ($svgPropertyType, $svgListPropertyType, $svgNativeType);
-}
-
-sub IsNativeType
-{
-    my $type = shift;
-
-    return exists $nativeType{$type->name};
+    return ($svgListPropertyType, $svgNativeType);
 }
 
 sub GetIntegerConversionConfiguration
@@ -5570,25 +5519,7 @@ sub NativeToJSValue
             $value = "static_cast<" . GetNativeType($interface, $type) . ">($value)";
         } elsif ($codeGenerator->IsSVGTypeNeedingTearOff($type) and not $interface->type->name =~ /List$/) {
             my $tearOffType = $codeGenerator->GetSVGTypeNeedingTearOff($type);
-            if ($codeGenerator->IsSVGTypeWithWritablePropertiesNeedingTearOff($type) and !$inFunctionCall and not defined $context->extendedAttributes->{Immutable}) {
-                my $getter = $value;
-                $getter =~ s/impl\.//;
-                $getter =~ s/impl->//;
-                $getter =~ s/\(\)//;
-                my $updateMethod = "&" . $interface->type->name . "::update" . $codeGenerator->WK_ucfirst($getter);
-
-                my $selfIsTearOffType = $codeGenerator->IsSVGTypeNeedingTearOff($interface->type);
-                if ($selfIsTearOffType) {
-                    # FIXME: Why SVGMatrix specifically?
-                    AddToImplIncludes("SVGMatrixTearOff.h", $conditional);
-                    $value = "SVGMatrixTearOff::create($wrapped, $value)";
-                } else {
-                    AddToImplIncludes("SVGStaticPropertyTearOff.h", $conditional);
-                    my $interfaceName = $interface->type->name;
-                    $tearOffType =~ s/SVGPropertyTearOff</SVGStaticPropertyTearOff<$interfaceName, /;
-                    $value = "${tearOffType}::create(impl, $value, $updateMethod)";
-                }
-            } elsif ($tearOffType =~ /SVGStaticListPropertyTearOff/) {
+            if ($tearOffType =~ /SVGStaticListPropertyTearOff/) {
                 $value = "${tearOffType}::create(impl, $value)";
             } elsif (not $tearOffType =~ /SVG(Point|PathSeg)List/) {
                 $value = "${tearOffType}::create($value)";
@@ -6024,7 +5955,7 @@ sub GenerateConstructorDefinition
 
             # FIXME: For now, we do not support SVG constructors.
             # FIXME: Currently [Constructor(...)] does not yet support optional arguments without [Default=...]
-            my ($dummy, $paramIndex) = GenerateParametersCheck($outputArray, $function, $interface, "constructorCallback", undef, undef, undef);
+            my ($dummy, $paramIndex) = GenerateParametersCheck($outputArray, $function, $interface, "constructorCallback");
 
             push(@constructorArgList, "*state") if $codeGenerator->ExtendedAttributeContains($interface->extendedAttributes->{ConstructorCallWith}, "ScriptState");;
 
index 6f5ee27..4692665 100644 (file)
@@ -53,7 +53,6 @@
 #include "JSTestSubObj.h"
 #include "JSXPathNSResolver.h"
 #include "RuntimeEnabledFeatures.h"
-#include "SVGStaticPropertyTearOff.h"
 #include "SerializedScriptValue.h"
 #include "Settings.h"
 #include "URL.h"
@@ -2925,7 +2924,7 @@ static inline JSValue jsTestObjMutablePointGetter(ExecState& state, JSTestObj& t
     UNUSED_PARAM(throwScope);
     UNUSED_PARAM(state);
     auto& impl = thisObject.wrapped();
-    JSValue result = toJS<IDLInterface<SVGPropertyTearOff<SVGPoint>>>(state, *thisObject.globalObject(), SVGStaticPropertyTearOff<TestObj, SVGPoint>::create(impl, impl.mutablePoint(), &TestObj::updateMutablePoint));
+    JSValue result = toJS<IDLInterface<SVGPoint>>(state, *thisObject.globalObject(), impl.mutablePoint());
     return result;
 }
 
@@ -2941,7 +2940,7 @@ static inline JSValue jsTestObjImmutablePointGetter(ExecState& state, JSTestObj&
     UNUSED_PARAM(throwScope);
     UNUSED_PARAM(state);
     auto& impl = thisObject.wrapped();
-    JSValue result = toJS<IDLInterface<SVGPropertyTearOff<SVGPoint>>>(state, *thisObject.globalObject(), SVGPropertyTearOff<SVGPoint>::create(impl.immutablePoint()));
+    JSValue result = toJS<IDLInterface<SVGPoint>>(state, *thisObject.globalObject(), impl.immutablePoint());
     return result;
 }
 
@@ -4393,9 +4392,9 @@ static inline bool setJSTestObjMutablePointFunction(ExecState& state, JSTestObj&
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = thisObject.wrapped();
-    auto nativeValue = convert<IDLInterface<SVGPropertyTearOff<SVGPoint>>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "mutablePoint", "SVGPoint"); });
+    auto nativeValue = convert<IDLInterface<SVGPoint>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "mutablePoint", "SVGPoint"); });
     RETURN_IF_EXCEPTION(throwScope, false);
-    impl.setMutablePoint(WTFMove(nativeValue));
+    impl.setMutablePoint(*nativeValue);
     return true;
 }
 
@@ -4412,9 +4411,9 @@ static inline bool setJSTestObjImmutablePointFunction(ExecState& state, JSTestOb
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = thisObject.wrapped();
-    auto nativeValue = convert<IDLInterface<SVGPropertyTearOff<SVGPoint>>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "immutablePoint", "SVGPoint"); });
+    auto nativeValue = convert<IDLInterface<SVGPoint>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "immutablePoint", "SVGPoint"); });
     RETURN_IF_EXCEPTION(throwScope, false);
-    impl.setImmutablePoint(WTFMove(nativeValue));
+    impl.setImmutablePoint(*nativeValue);
     return true;
 }
 
@@ -7419,7 +7418,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMutablePointFunction
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    return JSValue::encode(toJS<IDLInterface<SVGPropertyTearOff<SVGPoint>>>(*state, *castedThis->globalObject(), SVGPropertyTearOff<SVGPoint>::create(impl.mutablePointFunction())));
+    return JSValue::encode(toJS<IDLInterface<SVGPoint>>(*state, *castedThis->globalObject(), impl.mutablePointFunction()));
 }
 
 static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionImmutablePointFunctionCaller(JSC::ExecState*, JSTestObj*, JSC::ThrowScope&);
@@ -7434,7 +7433,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionImmutablePointFuncti
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    return JSValue::encode(toJS<IDLInterface<SVGPropertyTearOff<SVGPoint>>>(*state, *castedThis->globalObject(), SVGPropertyTearOff<SVGPoint>::create(impl.immutablePointFunction())));
+    return JSValue::encode(toJS<IDLInterface<SVGPoint>>(*state, *castedThis->globalObject(), impl.immutablePointFunction()));
 }
 
 static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOrangeCaller(JSC::ExecState*, JSTestObj*, JSC::ThrowScope&);
index e08ae9d..9b45ef0 100644 (file)
@@ -687,7 +687,7 @@ static inline JSC::EncodedJSValue jsTestTypedefsPrototypeFunctionImmutablePointF
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    return JSValue::encode(toJS<IDLInterface<SVGPropertyTearOff<SVGPoint>>>(*state, *castedThis->globalObject(), SVGPropertyTearOff<SVGPoint>::create(impl.immutablePointFunction())));
+    return JSValue::encode(toJS<IDLInterface<SVGPoint>>(*state, *castedThis->globalObject(), impl.immutablePointFunction()));
 }
 
 static inline JSC::EncodedJSValue jsTestTypedefsPrototypeFunctionStringSequenceFunctionCaller(JSC::ExecState*, JSTestTypedefs*, JSC::ThrowScope&);
index ca564a6..0623b88 100644 (file)
@@ -249,7 +249,7 @@ image-rendering [Inherited]
 #if defined(ENABLE_CSS_IMAGE_RESOLUTION) && ENABLE_CSS_IMAGE_RESOLUTION
 image-resolution [Inherited, Custom=All]
 #endif
-kerning [Inherited, SVG, Converter=SVGLength]
+kerning [Inherited, SVG, Converter=SVGLengthValue]
 left [Initial=initialOffset, Converter=LengthOrAuto]
 letter-spacing [Inherited, Converter=Spacing]
 lighting-color [SVG, Converter=SVGColor]
index 4236b26..530dac0 100644 (file)
@@ -81,17 +81,16 @@ static RefPtr<CSSPrimitiveValue> glyphOrientationToCSSPrimitiveValue(EGlyphOrien
     }
 }
 
-static RefPtr<CSSValue> strokeDashArrayToCSSValueList(const Vector<SVGLength>& dashes)
+static RefPtr<CSSValue> strokeDashArrayToCSSValueList(const Vector<SVGLengthValue>& dashes)
 {
     if (dashes.isEmpty())
         return CSSPrimitiveValue::createIdentifier(CSSValueNone);
 
-    RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-    const Vector<SVGLength>::const_iterator end = dashes.end();
-    for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it)
-        list->append(SVGLength::toCSSPrimitiveValue(*it));
+    auto list = CSSValueList::createCommaSeparated();
+    for (auto& length : dashes)
+        list->append(SVGLengthValue::toCSSPrimitiveValue(length));
 
-    return list;
+    return WTFMove(list);
 }
 
 RefPtr<SVGPaint> ComputedStyleExtractor::adjustSVGPaintForCurrentColor(RefPtr<SVGPaint>&& paint, const RenderStyle* style) const
@@ -166,7 +165,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::svgPropertyValue(CSSPropertyID property
         case CSSPropertyFill:
             return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle.fillPaintType(), svgStyle.fillPaintUri(), svgStyle.fillPaintColor()), style);
         case CSSPropertyKerning:
-            return SVGLength::toCSSPrimitiveValue(svgStyle.kerning());
+            return SVGLengthValue::toCSSPrimitiveValue(svgStyle.kerning());
         case CSSPropertyMarkerEnd:
             if (!svgStyle.markerEndResource().isEmpty())
                 return CSSPrimitiveValue::create(svgStyle.markerEndResource(), CSSPrimitiveValue::CSS_URI);
@@ -192,7 +191,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::svgPropertyValue(CSSPropertyID property
                 case BS_SUB:
                     return CSSPrimitiveValue::createIdentifier(CSSValueSub);
                 case BS_LENGTH:
-                    return SVGLength::toCSSPrimitiveValue(svgStyle.baselineShiftValue());
+                    return SVGLengthValue::toCSSPrimitiveValue(svgStyle.baselineShiftValue());
             }
             ASSERT_NOT_REACHED();
             return nullptr;
index 94a6803..856287b 100644 (file)
@@ -121,9 +121,9 @@ public:
 #if ENABLE(VARIATION_FONTS)
     static FontVariationSettings convertFontVariationSettings(StyleResolver&, const CSSValue&);
 #endif
-    static SVGLength convertSVGLength(StyleResolver&, const CSSValue&);
-    static Vector<SVGLength> convertSVGLengthVector(StyleResolver&, const CSSValue&);
-    static Vector<SVGLength> convertStrokeDashArray(StyleResolver&, const CSSValue&);
+    static SVGLengthValue convertSVGLengthValue(StyleResolver&, const CSSValue&);
+    static Vector<SVGLengthValue> convertSVGLengthVector(StyleResolver&, const CSSValue&);
+    static Vector<SVGLengthValue> convertStrokeDashArray(StyleResolver&, const CSSValue&);
     static PaintOrder convertPaintOrder(StyleResolver&, const CSSValue&);
     static float convertOpacity(StyleResolver&, const CSSValue&);
     static String convertSVGURIReference(StyleResolver&, const CSSValue&);
@@ -1257,24 +1257,24 @@ inline bool StyleBuilderConverter::convertOverflowScrolling(StyleResolver&, cons
 }
 #endif
 
-inline SVGLength StyleBuilderConverter::convertSVGLength(StyleResolver&, const CSSValue& value)
+inline SVGLengthValue StyleBuilderConverter::convertSVGLengthValue(StyleResolver&, const CSSValue& value)
 {
-    return SVGLength::fromCSSPrimitiveValue(downcast<CSSPrimitiveValue>(value));
+    return SVGLengthValue::fromCSSPrimitiveValue(downcast<CSSPrimitiveValue>(value));
 }
 
-inline Vector<SVGLength> StyleBuilderConverter::convertSVGLengthVector(StyleResolver& styleResolver, const CSSValue& value)
+inline Vector<SVGLengthValue> StyleBuilderConverter::convertSVGLengthVector(StyleResolver& styleResolver, const CSSValue& value)
 {
     auto& valueList = downcast<CSSValueList>(value);
 
-    Vector<SVGLength> svgLengths;
+    Vector<SVGLengthValue> svgLengths;
     svgLengths.reserveInitialCapacity(valueList.length());
     for (auto& item : valueList)
-        svgLengths.uncheckedAppend(convertSVGLength(styleResolver, item));
+        svgLengths.uncheckedAppend(convertSVGLengthValue(styleResolver, item));
 
     return svgLengths;
 }
 
-inline Vector<SVGLength> StyleBuilderConverter::convertStrokeDashArray(StyleResolver& styleResolver, const CSSValue& value)
+inline Vector<SVGLengthValue> StyleBuilderConverter::convertStrokeDashArray(StyleResolver& styleResolver, const CSSValue& value)
 {
     if (is<CSSPrimitiveValue>(value)) {
         ASSERT(downcast<CSSPrimitiveValue>(value).valueID() == CSSValueNone);
index 9fb2eb1..711e589 100644 (file)
@@ -962,7 +962,7 @@ inline void StyleBuilderCustom::applyValueBaselineShift(StyleResolver& styleReso
         }
     } else {
         svgStyle.setBaselineShift(BS_LENGTH);
-        svgStyle.setBaselineShiftValue(SVGLength::fromCSSPrimitiveValue(primitiveValue));
+        svgStyle.setBaselineShiftValue(SVGLengthValue::fromCSSPrimitiveValue(primitiveValue));
     }
 }
 
index b644884..0bbff13 100644 (file)
@@ -52,6 +52,7 @@ public:
 
 #if ENABLE(CANVAS_PATH)
     void addPath(const DOMPath* path) { addPath(path, AffineTransform()); }
+    void addPath(const DOMPath* path, SVGMatrix& matrix) { addPath(path, matrix.propertyReference()); }
     void addPath(const DOMPath* path, const AffineTransform& transform)
     {
         if (!path || !transform.isInvertible())
index 2b9df46..e2f4c49 100644 (file)
@@ -253,12 +253,12 @@ static inline LengthBox blendFunc(const AnimationBase* anim, const LengthBox& fr
     return result;
 }
 
-static inline SVGLength blendFunc(const AnimationBase*, const SVGLength& from, const SVGLength& to, double progress)
+static inline SVGLengthValue blendFunc(const AnimationBase*, const SVGLengthValue& from, const SVGLengthValue& to, double progress)
 {
     return to.blend(from, narrowPrecisionToFloat(progress));
 }
 
-static inline Vector<SVGLength> blendFunc(const AnimationBase*, const Vector<SVGLength>& from, const Vector<SVGLength>& to, double progress)
+static inline Vector<SVGLengthValue> blendFunc(const AnimationBase*, const Vector<SVGLengthValue>& from, const Vector<SVGLengthValue>& to, double progress)
 {
     size_t fromLength = from.size();
     size_t toLength = to.size();
@@ -273,7 +273,7 @@ static inline Vector<SVGLength> blendFunc(const AnimationBase*, const Vector<SVG
         else
             resultLength = fromLength * toLength;
     }
-    Vector<SVGLength> result(resultLength);
+    Vector<SVGLengthValue> result(resultLength);
     for (size_t i = 0; i < resultLength; ++i)
         result[i] = to[i % toLength].blend(from[i % fromLength], narrowPrecisionToFloat(progress));
     return result;
@@ -1451,7 +1451,7 @@ CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap()
 
         new PropertyWrapperSVGPaint(CSSPropertyStroke, &RenderStyle::strokePaintType, &RenderStyle::strokePaintColor, &RenderStyle::setStrokePaintColor),
         new PropertyWrapper<float>(CSSPropertyStrokeOpacity, &RenderStyle::strokeOpacity, &RenderStyle::setStrokeOpacity),
-        new PropertyWrapper< Vector<SVGLength>>(CSSPropertyStrokeDasharray, &RenderStyle::strokeDashArray, &RenderStyle::setStrokeDashArray),
+        new PropertyWrapper<Vector<SVGLengthValue>>(CSSPropertyStrokeDasharray, &RenderStyle::strokeDashArray, &RenderStyle::setStrokeDashArray),
         new PropertyWrapper<float>(CSSPropertyStrokeMiterlimit, &RenderStyle::strokeMiterLimit, &RenderStyle::setStrokeMiterLimit),
 
         new LengthPropertyWrapper<Length>(CSSPropertyCx, &RenderStyle::cx, &RenderStyle::setCx),
@@ -1472,8 +1472,8 @@ CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap()
 
         new PropertyWrapperMaybeInvalidColor(CSSPropertyLightingColor, &RenderStyle::lightingColor, &RenderStyle::setLightingColor),
 
-        new PropertyWrapper<SVGLength>(CSSPropertyBaselineShift, &RenderStyle::baselineShiftValue, &RenderStyle::setBaselineShiftValue),
-        new PropertyWrapper<SVGLength>(CSSPropertyKerning, &RenderStyle::kerning, &RenderStyle::setKerning),
+        new PropertyWrapper<SVGLengthValue>(CSSPropertyBaselineShift, &RenderStyle::baselineShiftValue, &RenderStyle::setBaselineShiftValue),
+        new PropertyWrapper<SVGLengthValue>(CSSPropertyKerning, &RenderStyle::kerning, &RenderStyle::setKerning),
 #if ENABLE(VARIATION_FONTS)
         new PropertyWrapperFontVariationSettings(CSSPropertyFontVariationSettings, &RenderStyle::fontVariationSettings, &RenderStyle::setFontVariationSettings),
 #endif
index f22aa1b..d7bc5ae 100644 (file)
@@ -1751,8 +1751,8 @@ public:
     void setStrokeOpacity(float f) { accessSVGStyle().setStrokeOpacity(f); }
     const Length& strokeWidth() const { return svgStyle().strokeWidth(); }
     void setStrokeWidth(Length w) { accessSVGStyle().setStrokeWidth(w); }
-    Vector<SVGLength> strokeDashArray() const { return svgStyle().strokeDashArray(); }
-    void setStrokeDashArray(Vector<SVGLength> array) { accessSVGStyle().setStrokeDashArray(array); }
+    Vector<SVGLengthValue> strokeDashArray() const { return svgStyle().strokeDashArray(); }
+    void setStrokeDashArray(Vector<SVGLengthValue> array) { accessSVGStyle().setStrokeDashArray(array); }
     const Length& strokeDashOffset() const { return svgStyle().strokeDashOffset(); }
     void setStrokeDashOffset(Length d) { accessSVGStyle().setStrokeDashOffset(d); }
     float strokeMiterLimit() const { return svgStyle().strokeMiterLimit(); }
@@ -1783,10 +1783,10 @@ public:
     void setFloodColor(const Color& c) { accessSVGStyle().setFloodColor(c); }
     void setLightingColor(const Color& c) { accessSVGStyle().setLightingColor(c); }
 
-    SVGLength baselineShiftValue() const { return svgStyle().baselineShiftValue(); }
-    void setBaselineShiftValue(SVGLength s) { accessSVGStyle().setBaselineShiftValue(s); }
-    SVGLength kerning() const { return svgStyle().kerning(); }
-    void setKerning(SVGLength k) { accessSVGStyle().setKerning(k); }
+    SVGLengthValue baselineShiftValue() const { return svgStyle().baselineShiftValue(); }
+    void setBaselineShiftValue(SVGLengthValue s) { accessSVGStyle().setBaselineShiftValue(s); }
+    SVGLengthValue kerning() const { return svgStyle().kerning(); }
+    void setKerning(SVGLengthValue k) { accessSVGStyle().setKerning(k); }
 
     void setShapeOutside(RefPtr<ShapeValue>&& value)
     {
index 7a5d13a..43504ac 100644 (file)
@@ -78,7 +78,7 @@ public:
     static SVGPaint::SVGPaintType initialStrokePaintType() { return SVGPaint::SVG_PAINTTYPE_NONE; }
     static Color initialStrokePaintColor() { return Color(); }
     static String initialStrokePaintUri() { return String(); }
-    static Vector<SVGLength> initialStrokeDashArray() { return Vector<SVGLength>(); }
+    static Vector<SVGLengthValue> initialStrokeDashArray() { return { }; }
     static float initialStrokeMiterLimit() { return 4; }
     static float initialStopOpacity() { return 1; }
     static Color initialStopColor() { return Color(0, 0, 0); }
@@ -94,16 +94,16 @@ public:
     static EMaskType initialMaskType() { return MT_LUMINANCE; }
     static PaintOrder initialPaintOrder() { return PaintOrderNormal; }
 
-    static SVGLength initialBaselineShiftValue()
+    static SVGLengthValue initialBaselineShiftValue()
     {
-        SVGLength length;
+        SVGLengthValue length;
         length.newValueSpecifiedUnits(LengthTypeNumber, 0);
         return length;
     }
 
-    static SVGLength initialKerning()
+    static SVGLengthValue initialKerning()
     {
-        SVGLength length;
+        SVGLengthValue length;
         length.newValueSpecifiedUnits(LengthTypeNumber, 0);
         return length;
     }
@@ -215,7 +215,7 @@ public:
         }
     }
 
-    void setStrokeDashArray(const Vector<SVGLength>& obj)
+    void setStrokeDashArray(const Vector<SVGLengthValue>& obj)
     {
         if (!(stroke->dashArray == obj))
             stroke.access()->dashArray = obj;
@@ -239,7 +239,7 @@ public:
             stroke.access()->dashOffset = obj;
     }
 
-    void setKerning(const SVGLength& obj)
+    void setKerning(const SVGLengthValue& obj)
     {
         if (!(text->kerning == obj))
             text.access()->kerning = obj;
@@ -275,7 +275,7 @@ public:
             misc.access()->lightingColor = obj;
     }
 
-    void setBaselineShiftValue(const SVGLength& obj)
+    void setBaselineShiftValue(const SVGLengthValue& obj)
     {
         if (!(misc->baselineShiftValue == obj))
             misc.access()->baselineShiftValue = obj;
@@ -340,17 +340,17 @@ public:
     const SVGPaint::SVGPaintType& strokePaintType() const { return stroke->paintType; }
     const Color& strokePaintColor() const { return stroke->paintColor; }
     const String& strokePaintUri() const { return stroke->paintUri; }
-    Vector<SVGLength> strokeDashArray() const { return stroke->dashArray; }
+    Vector<SVGLengthValue> strokeDashArray() const { return stroke->dashArray; }
     float strokeMiterLimit() const { return stroke->miterLimit; }
     const Length& strokeWidth() const { return stroke->width; }
     const Length& strokeDashOffset() const { return stroke->dashOffset; }
-    SVGLength kerning() const { return text->kerning; }
+    SVGLengthValue kerning() const { return text->kerning; }
     float stopOpacity() const { return stops->opacity; }
     const Color& stopColor() const { return stops->color; }
     float floodOpacity() const { return misc->floodOpacity; }
     const Color& floodColor() const { return misc->floodColor; }
     const Color& lightingColor() const { return misc->lightingColor; }
-    SVGLength baselineShiftValue() const { return misc->baselineShiftValue; }
+    SVGLengthValue baselineShiftValue() const { return misc->baselineShiftValue; }
     ShadowData* shadow() const { return shadowSVG->shadow.get(); }
     const Length& cx() const { return layout->cx; }
     const Length& cy() const { return layout->cy; }
index a4667eb..1b92ce6 100644 (file)
@@ -29,7 +29,7 @@
 #pragma once
 
 #include "Length.h"
-#include "SVGLength.h"
+#include "SVGLengthValue.h"
 #include "SVGPaint.h"
 #include "ShadowData.h"
 #include <wtf/RefCounted.h>
@@ -150,7 +150,7 @@ namespace WebCore {
 
         Length width;
         Length dashOffset;
-        Vector<SVGLength> dashArray;
+        Vector<SVGLengthValue> dashArray;
 
         SVGPaint::SVGPaintType paintType;
         Color paintColor;
@@ -194,7 +194,7 @@ namespace WebCore {
             return !(*this == other);
         }
 
-        SVGLength kerning;
+        SVGLengthValue kerning;
 
     private:
         StyleTextData();
@@ -218,7 +218,7 @@ namespace WebCore {
         Color lightingColor;
 
         // non-inherited text stuff lives here not in StyleTextData.
-        SVGLength baselineShiftValue;
+        SVGLengthValue baselineShiftValue;
 
     private:
         StyleMiscData();
index 104aa98..1ded651 100644 (file)
@@ -35,7 +35,6 @@
 #include "RenderSVGResource.h"
 #include "RenderSVGResourceFilter.h"
 #include "SVGImageElement.h"
-#include "SVGLength.h"
 #include "SVGRenderingContext.h"
 #include "SVGResources.h"
 #include "SVGResourcesCache.h"
index 1aca4e5..c526ecf 100644 (file)
@@ -39,7 +39,6 @@
 #include "RenderSVGResourceFilter.h"
 #include "RenderView.h"
 #include "SVGImage.h"
-#include "SVGLength.h"
 #include "SVGRenderingContext.h"
 #include "SVGResources.h"
 #include "SVGResourcesCache.h"
@@ -340,10 +339,10 @@ void RenderSVGRoot::removeChild(RenderObject& child)
 void RenderSVGRoot::buildLocalToBorderBoxTransform()
 {
     float scale = style().effectiveZoom();
-    SVGPoint translate = svgSVGElement().currentTranslate();
+    FloatPoint translate = svgSVGElement().currentTranslateValue();
     LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + paddingTop());
     m_localToBorderBoxTransform = svgSVGElement().viewBoxToViewTransform(contentWidth() / scale, contentHeight() / scale);
-    if (borderAndPadding.isZero() && scale == 1 && translate == SVGPoint::zero())
+    if (borderAndPadding.isZero() && scale == 1 && translate == FloatPoint::zero())
         return;
     m_localToBorderBoxTransform = AffineTransform(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y()) * m_localToBorderBoxTransform;
 }
index 06cb222..02078aa 100644 (file)
@@ -30,6 +30,7 @@
 #include "SVGNames.h"
 #include "SVGPathElement.h"
 #include "SVGPathUtilities.h"
+#include "SVGPoint.h"
 #include "SVGPolygonElement.h"
 #include "SVGPolylineElement.h"
 #include "SVGRectElement.h"
index 4c7dcc2..84b7e3f 100644 (file)
@@ -433,7 +433,7 @@ void SVGRenderSupport::applyStrokeStyleToContext(GraphicsContext* context, const
     if (svgStyle.joinStyle() == MiterJoin)
         context->setMiterLimit(svgStyle.strokeMiterLimit());
 
-    const Vector<SVGLength>& dashes = svgStyle.strokeDashArray();
+    const Vector<SVGLengthValue>& dashes = svgStyle.strokeDashArray();
     if (dashes.isEmpty())
         context->setStrokeStyle(SolidStroke);
     else {
index a77efe7..c184d04 100644 (file)
@@ -191,12 +191,11 @@ static void writeStyle(TextStream& ts, const RenderElement& renderer)
             SVGLengthContext lengthContext(&shape.graphicsElement());
             double dashOffset = lengthContext.valueForLength(svgStyle.strokeDashOffset());
             double strokeWidth = lengthContext.valueForLength(svgStyle.strokeWidth());
-            const Vector<SVGLength>& dashes = svgStyle.strokeDashArray();
+            const auto& dashes = svgStyle.strokeDashArray();
 
             DashArray dashArray;
-            const Vector<SVGLength>::const_iterator end = dashes.end();
-            for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it)
-                dashArray.append((*it).value(lengthContext));
+            for (auto& length : dashes)
+                dashArray.append(length.value(lengthContext));
 
             writeIfNotDefault(ts, "opacity", svgStyle.strokeOpacity(), 1.0f);
             writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0);
index 378e529..e037716 100644 (file)
@@ -36,7 +36,7 @@ SVGTextLayoutEngineBaseline::SVGTextLayoutEngineBaseline(const FontCascade& font
 float SVGTextLayoutEngineBaseline::calculateBaselineShift(const SVGRenderStyle& style, SVGElement* context) const
 {
     if (style.baselineShift() == BS_LENGTH) {
-        SVGLength baselineShiftValueLength = style.baselineShiftValue();
+        auto baselineShiftValueLength = style.baselineShiftValue();
         if (baselineShiftValueLength.unitType() == LengthTypePercentage)
             return baselineShiftValueLength.valueAsPercentage() * m_font.pixelSize();
 
index c3bdd4a..48d80ae 100644 (file)
@@ -40,7 +40,7 @@ SVGTextLayoutEngineSpacing::SVGTextLayoutEngineSpacing(const FontCascade& font)
 float SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing(const SVGRenderStyle* style, SVGElement* contextElement, const UChar* currentCharacter)
 {
     float kerning = 0;
-    SVGLength kerningLength = style->kerning();
+    auto kerningLength = style->kerning();
     if (kerningLength.unitType() == LengthTypePercentage)
         kerning = kerningLength.valueAsPercentage() * m_font.pixelSize();
     else {
index f491ffb..3520c2a 100644 (file)
@@ -345,10 +345,10 @@ bool SVGTextQuery::startPositionOfCharacterCallback(Data* queryData, const SVGTe
     return true;
 }
 
-SVGPoint SVGTextQuery::startPositionOfCharacter(unsigned position) const
+FloatPoint SVGTextQuery::startPositionOfCharacter(unsigned position) const
 {
     if (m_textBoxes.isEmpty())
-        return SVGPoint();
+        return { };
 
     StartPositionOfCharacterData data(position);
     executeQuery(&data, &SVGTextQuery::startPositionOfCharacterCallback);
@@ -392,10 +392,10 @@ bool SVGTextQuery::endPositionOfCharacterCallback(Data* queryData, const SVGText
     return true;
 }
 
-SVGPoint SVGTextQuery::endPositionOfCharacter(unsigned position) const
+FloatPoint SVGTextQuery::endPositionOfCharacter(unsigned position) const
 {
     if (m_textBoxes.isEmpty())
-        return SVGPoint();
+        return { };
 
     EndPositionOfCharacterData data(position);
     executeQuery(&data, &SVGTextQuery::endPositionOfCharacterCallback);
@@ -536,7 +536,7 @@ bool SVGTextQuery::characterNumberAtPositionCallback(Data* queryData, const SVGT
     return false;
 }
 
-int SVGTextQuery::characterNumberAtPosition(const SVGPoint& position) const
+int SVGTextQuery::characterNumberAtPosition(const FloatPoint& position) const
 {
     if (m_textBoxes.isEmpty())
         return -1;
index f4452ee..3f09a76 100644 (file)
@@ -20,7 +20,6 @@
 #pragma once
 
 #include "FloatRect.h"
-#include "SVGPoint.h"
 #include "SVGTextFragment.h"
 #include <wtf/Vector.h>
 
@@ -37,11 +36,11 @@ public:
     unsigned numberOfCharacters() const;
     float textLength() const;
     float subStringLength(unsigned startPosition, unsigned length) const;
-    SVGPoint startPositionOfCharacter(unsigned position) const;
-    SVGPoint endPositionOfCharacter(unsigned position) const;
+    FloatPoint startPositionOfCharacter(unsigned position) const;
+    FloatPoint endPositionOfCharacter(unsigned position) const;
     float rotationOfCharacter(unsigned position) const;
     FloatRect extentOfCharacter(unsigned position) const;
-    int characterNumberAtPosition(const SVGPoint&) const;
+    int characterNumberAtPosition(const FloatPoint&) const;
 
     // Public helper struct. Private classes in SVGTextQuery inherit from it.
     struct Data;
index 278b7f9..f52019f 100644 (file)
@@ -35,15 +35,15 @@ struct LinearGradientAttributes : GradientAttributes {
     {
     }
 
-    SVGLength x1() const { return m_x1; }
-    SVGLength y1() const { return m_y1; }
-    SVGLength x2() const { return m_x2; }
-    SVGLength y2() const { return m_y2; }
+    SVGLengthValue x1() const { return m_x1; }
+    SVGLengthValue y1() const { return m_y1; }
+    SVGLengthValue x2() const { return m_x2; }
+    SVGLengthValue y2() const { return m_y2; }
 
-    void setX1(const SVGLength& value) { m_x1 = value; m_x1Set = true; }
-    void setY1(const SVGLength& value) { m_y1 = value; m_y1Set = true; }
-    void setX2(const SVGLength& value) { m_x2 = value; m_x2Set = true; }
-    void setY2(const SVGLength& value) { m_y2 = value; m_y2Set = true; }
+    void setX1(SVGLengthValue value) { m_x1 = value; m_x1Set = true; }
+    void setY1(SVGLengthValue value) { m_y1 = value; m_y1Set = true; }
+    void setX2(SVGLengthValue value) { m_x2 = value; m_x2Set = true; }
+    void setY2(SVGLengthValue value) { m_y2 = value; m_y2Set = true; }
 
     bool hasX1() const { return m_x1Set; }
     bool hasY1() const { return m_y1Set; }
@@ -52,10 +52,10 @@ struct LinearGradientAttributes : GradientAttributes {
 
 private:
     // Properties
-    SVGLength m_x1;
-    SVGLength m_y1;
-    SVGLength m_x2;
-    SVGLength m_y2;
+    SVGLengthValue m_x1;
+    SVGLengthValue m_y1;
+    SVGLengthValue m_x2;
+    SVGLengthValue m_y2;
 
     // Property states
     bool m_x1Set : 1;
index ae6c594..5bed0be 100644 (file)
@@ -19,8 +19,8 @@
 
 #pragma once
 
-#include "SVGLength.h"
-#include "SVGPreserveAspectRatio.h"
+#include "SVGLengthValue.h"
+#include "SVGPreserveAspectRatioValue.h"
 
 namespace WebCore {
 
@@ -50,10 +50,10 @@ struct PatternAttributes {
     {
     }
 
-    SVGLength x() const { return m_x; }
-    SVGLength y() const { return m_y; }
-    SVGLength width() const { return m_width; }
-    SVGLength height() const { return m_height; }
+    SVGLengthValue x() const { return m_x; }
+    SVGLengthValue y() const { return m_y; }
+    SVGLengthValue width() const { return m_width; }
+    SVGLengthValue height() const { return m_height; }
     FloatRect viewBox() const { return m_viewBox; }
     SVGPreserveAspectRatioValue preserveAspectRatio() const { return m_preserveAspectRatio; }
     SVGUnitTypes::SVGUnitType patternUnits() const { return m_patternUnits; }
@@ -61,25 +61,25 @@ struct PatternAttributes {
     AffineTransform patternTransform() const { return m_patternTransform; }
     const SVGPatternElement* patternContentElement() const { return m_patternContentElement; }
 
-    void setX(const SVGLength& value)
+    void setX(SVGLengthValue value)
     {
         m_x = value;
         m_xSet = true;
     }
 
-    void setY(const SVGLength& value)
+    void setY(SVGLengthValue value)
     {
         m_y = value;
         m_ySet = true;
     }
 
-    void setWidth(const SVGLength& value)
+    void setWidth(SVGLengthValue value)
     {
         m_width = value;
         m_widthSet = true;
     }
 
-    void setHeight(const SVGLength& value)
+    void setHeight(SVGLengthValue value)
     {
         m_height = value;
         m_heightSet = true;
@@ -91,7 +91,7 @@ struct PatternAttributes {
         m_viewBoxSet = true;
     }
 
-    void setPreserveAspectRatio(const SVGPreserveAspectRatioValue& value)
+    void setPreserveAspectRatio(SVGPreserveAspectRatioValue value)
     {
         m_preserveAspectRatio = value;
         m_preserveAspectRatioSet = true;
@@ -134,10 +134,10 @@ struct PatternAttributes {
 
 private:
     // Properties
-    SVGLength m_x;
-    SVGLength m_y;
-    SVGLength m_width;
-    SVGLength m_height;
+    SVGLengthValue m_x;
+    SVGLengthValue m_y;
+    SVGLengthValue m_width;
+    SVGLengthValue m_height;
     FloatRect m_viewBox;
     SVGPreserveAspectRatioValue m_preserveAspectRatio;
     SVGUnitTypes::SVGUnitType m_patternUnits;
index 0d162ee..87be722 100644 (file)
@@ -37,19 +37,19 @@ struct RadialGradientAttributes : GradientAttributes {
     {
     }
 
-    SVGLength cx() const { return m_cx; }
-    SVGLength cy() const { return m_cy; }
-    SVGLength r() const { return m_r; }
-    SVGLength fx() const { return m_fx; }
-    SVGLength fy() const { return m_fy; }
-    SVGLength fr() const { return m_fr; }
+    SVGLengthValue cx() const { return m_cx; }
+    SVGLengthValue cy() const { return m_cy; }
+    SVGLengthValue r() const { return m_r; }
+    SVGLengthValue fx() const { return m_fx; }
+    SVGLengthValue fy() const { return m_fy; }
+    SVGLengthValue fr() const { return m_fr; }
 
-    void setCx(const SVGLength& value) { m_cx = value; m_cxSet = true; }
-    void setCy(const SVGLength& value) { m_cy = value; m_cySet = true; }
-    void setR(const SVGLength& value) { m_r = value; m_rSet = true; }
-    void setFx(const SVGLength& value) { m_fx = value; m_fxSet = true; }
-    void setFy(const SVGLength& value) { m_fy = value; m_fySet = true; }
-    void setFr(const SVGLength& value) { m_fr = value; m_frSet = true; }
+    void setCx(SVGLengthValue value) { m_cx = value; m_cxSet = true; }
+    void setCy(SVGLengthValue value) { m_cy = value; m_cySet = true; }
+    void setR(SVGLengthValue value) { m_r = value; m_rSet = true; }
+    void setFx(SVGLengthValue value) { m_fx = value; m_fxSet = true; }
+    void setFy(SVGLengthValue value) { m_fy = value; m_fySet = true; }
+    void setFr(SVGLengthValue value) { m_fr = value; m_frSet = true; }
 
     bool hasCx() const { return m_cxSet; }
     bool hasCy() const { return m_cySet; }
@@ -60,12 +60,12 @@ struct RadialGradientAttributes : GradientAttributes {
 
 private:
     // Properties
-    SVGLength m_cx;
-    SVGLength m_cy;
-    SVGLength m_r;
-    SVGLength m_fx;
-    SVGLength m_fy;
-    SVGLength m_fr;
+    SVGLengthValue m_cx;
+    SVGLengthValue m_cy;
+    SVGLengthValue m_r;
+    SVGLengthValue m_fx;
+    SVGLengthValue m_fy;
+    SVGLengthValue m_fr;
 
     // Property states
     bool m_cxSet : 1;
index 49fa354..06e337f 100644 (file)
 #include "SVGImageElement.cpp"
 #include "SVGImageLoader.cpp"
 #include "SVGLangSpace.cpp"
-#include "SVGLength.cpp"
 #include "SVGLengthContext.cpp"
 #include "SVGLengthList.cpp"
 #include "SVGLineElement.cpp"
index a4be5c4..ca3c96b 100644 (file)
@@ -22,6 +22,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 #pragma once
 
 #include "ExceptionCode.h"
index 6887daf..72eb772 100644 (file)
@@ -30,7 +30,7 @@ namespace WebCore {
 
 inline SVGAnimateTransformElement::SVGAnimateTransformElement(const QualifiedName& tagName, Document& document)
     : SVGAnimateElementBase(tagName, document)
-    , m_type(SVGTransform::SVG_TRANSFORM_UNKNOWN)
+    , m_type(SVGTransformValue::SVG_TRANSFORM_UNKNOWN)
 {
     ASSERT(hasTagName(SVGNames::animateTransformTag));
 }
@@ -56,8 +56,8 @@ void SVGAnimateTransformElement::parseAttribute(const QualifiedName& name, const
 {
     if (name == SVGNames::typeAttr) {
         m_type = SVGTransformable::parseTransformType(value);
-        if (m_type == SVGTransform::SVG_TRANSFORM_MATRIX)
-            m_type = SVGTransform::SVG_TRANSFORM_UNKNOWN;
+        if (m_type == SVGTransformValue::SVG_TRANSFORM_MATRIX)
+            m_type = SVGTransformValue::SVG_TRANSFORM_UNKNOWN;
         return;
     }
 
index 7d31800..e223489 100644 (file)
@@ -23,7 +23,7 @@
 #pragma once
 
 #include "SVGAnimateElementBase.h"
-#include "SVGTransform.h"
+#include "SVGTransformValue.h"
 
 namespace WebCore {
 
@@ -33,7 +33,7 @@ class SVGAnimateTransformElement final : public SVGAnimateElementBase {
 public:
     static Ref<SVGAnimateTransformElement> create(const QualifiedName&, Document&);
 
-    SVGTransform::SVGTransformType transformType() const { return m_type; }
+    SVGTransformValue::SVGTransformType transformType() const { return m_type; }
 
 private:
     SVGAnimateTransformElement(const QualifiedName&, Document&);
@@ -41,7 +41,7 @@ private:
     bool hasValidAttributeType() final;
     void parseAttribute(const QualifiedName&, const AtomicString&) final;
 
-    SVGTransform::SVGTransformType m_type;
+    SVGTransformValue::SVGTransformType m_type;
 };
 
 } // namespace WebCore
index 3f218c3..ab58f18 100644 (file)
@@ -28,13 +28,13 @@ namespace WebCore {
 
 SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator(SVGAnimationElement* animationElement, SVGElement* contextElement)
     : SVGAnimatedTypeAnimator(AnimatedLength, animationElement, contextElement)
-    , m_lengthMode(SVGLength::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()))
+    , m_lengthMode(SVGLengthValue::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()))
 {
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::constructFromString(const String& string)
 {
-    return SVGAnimatedType::createLength(std::make_unique<SVGLength>(m_lengthMode, string));
+    return SVGAnimatedType::createLength(std::make_unique<SVGLengthValue>(m_lengthMode, string));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
@@ -68,16 +68,16 @@ void SVGAnimatedLengthAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnima
     ASSERT(from->type() == to->type());
 
     SVGLengthContext lengthContext(m_contextElement);
-    const SVGLength& fromLength = from->length();
-    SVGLength& toLength = to->length();
+    const auto& fromLength = from->length();
+    auto& toLength = to->length();
 
     toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthContext), lengthContext);
 }
 
-static SVGLength parseLengthFromString(SVGAnimationElement* animationElement, const String& string)
+static SVGLengthValue parseLengthFromString(SVGAnimationElement* animationElement, const String& string)
 {
-    SVGLength length;
-    length.setValueAsString(string, SVGLength::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()));
+    SVGLengthValue length;
+    length.setValueAsString(string, SVGLengthValue::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()));
     return length;
 }
 
@@ -86,14 +86,14 @@ void SVGAnimatedLengthAnimator::calculateAnimatedValue(float percentage, unsigne
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
 
-    SVGLength fromSVGLength = m_animationElement->animationMode() == ToAnimation ? animated->length() : from->length();
-    SVGLength toSVGLength = to->length();
-    const SVGLength& toAtEndOfDurationSVGLength = toAtEndOfDuration->length();
-    SVGLength& animatedSVGLength = animated->length();
+    auto fromSVGLength = m_animationElement->animationMode() == ToAnimation ? animated->length() : from->length();
+    auto toSVGLength = to->length();
+    const auto& toAtEndOfDurationSVGLength = toAtEndOfDuration->length();
+    auto& animatedSVGLength = animated->length();
 
     // Apply CSS inheritance rules.
-    m_animationElement->adjustForInheritance<SVGLength>(parseLengthFromString, m_animationElement->fromPropertyValueType(), fromSVGLength, m_contextElement);
-    m_animationElement->adjustForInheritance<SVGLength>(parseLengthFromString, m_animationElement->toPropertyValueType(), toSVGLength, m_contextElement);
+    m_animationElement->adjustForInheritance<SVGLengthValue>(parseLengthFromString, m_animationElement->fromPropertyValueType(), fromSVGLength, m_contextElement);
+    m_animationElement->adjustForInheritance<SVGLengthValue>(parseLengthFromString, m_animationElement->toPropertyValueType(), toSVGLength, m_contextElement);
 
     SVGLengthContext lengthContext(m_contextElement);
     float animatedNumber = animatedSVGLength.value(lengthContext);
@@ -107,9 +107,9 @@ float SVGAnimatedLengthAnimator::calculateDistance(const String& fromString, con
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
-    SVGLengthMode lengthMode = SVGLength::lengthModeForAnimatedLengthAttribute(m_animationElement->attributeName());
-    SVGLength from = SVGLength(lengthMode, fromString);
-    SVGLength to = SVGLength(lengthMode, toString);
+    auto lengthMode = SVGLengthValue::lengthModeForAnimatedLengthAttribute(m_animationElement->attributeName());
+    auto from = SVGLengthValue(lengthMode, fromString);
+    auto to = SVGLengthValue(lengthMode, toString);
     SVGLengthContext lengthContext(m_contextElement);
     return fabsf(to.value(lengthContext) - from.value(lengthContext));
 }
index 8610731..14a3460 100644 (file)
 
 namespace WebCore {
 
-template<typename T> 
-class SVGPropertyTearOff;
-
-using SVGAnimatedLength = SVGAnimatedPropertyTearOff<SVGPropertyTearOff<SVGLength>>;
+using SVGAnimatedLength = SVGAnimatedPropertyTearOff<SVGLength>;
 
 // Helper macros to declare/define a SVGAnimatedLength object
 #define DECLARE_ANIMATED_LENGTH(UpperProperty, LowerProperty) \
-DECLARE_ANIMATED_PROPERTY(SVGAnimatedLength, SVGLength, UpperProperty, LowerProperty, )
+DECLARE_ANIMATED_PROPERTY(SVGAnimatedLength, SVGLengthValue, UpperProperty, LowerProperty, )
 
 #define DEFINE_ANIMATED_LENGTH(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
 DEFINE_ANIMATED_PROPERTY(AnimatedLength, OwnerType, DOMAttribute, DOMAttribute.localName(), UpperProperty, LowerProperty)
index a9d90c3..6f0562b 100644 (file)
@@ -27,7 +27,7 @@ namespace WebCore {
 
 SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator(SVGAnimationElement* animationElement, SVGElement* contextElement)
     : SVGAnimatedTypeAnimator(AnimatedLengthList, animationElement, contextElement)
-    , m_lengthMode(SVGLength::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()))
+    , m_lengthMode(SVGLengthValue::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()))
 {
 }
 
@@ -68,8 +68,8 @@ void SVGAnimatedLengthListAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGA
     ASSERT(from->type() == AnimatedLengthList);
     ASSERT(from->type() == to->type());
 
-    const SVGLengthList& fromLengthList = from->lengthList();
-    SVGLengthList& toLengthList = to->lengthList();
+    const auto& fromLengthList = from->lengthList();
+    auto& toLengthList = to->lengthList();
 
     unsigned fromLengthListSize = fromLengthList.size();
     if (!fromLengthListSize || fromLengthListSize != toLengthList.size())
@@ -83,7 +83,7 @@ void SVGAnimatedLengthListAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGA
 static SVGLengthList parseLengthListFromString(SVGAnimationElement* animationElement, const String& string)
 {
     SVGLengthList lengthList;
-    lengthList.parse(string, SVGLength::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()));
+    lengthList.parse(string, SVGLengthValue::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()));
     return lengthList;
 }
 
@@ -92,10 +92,10 @@ void SVGAnimatedLengthListAnimator::calculateAnimatedValue(float percentage, uns
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
 
-    SVGLengthList fromLengthList = m_animationElement->animationMode() == ToAnimation ? animated->lengthList() : from->lengthList();
-    SVGLengthList toLengthList = to->lengthList();
-    const SVGLengthList& toAtEndOfDurationLengthList = toAtEndOfDuration->lengthList();
-    SVGLengthList& animatedLengthList = animated->lengthList();
+    auto fromLengthList = m_animationElement->animationMode() == ToAnimation ? animated->lengthList() : from->lengthList();
+    auto toLengthList = to->lengthList();
+    const auto& toAtEndOfDurationLengthList = toAtEndOfDuration->lengthList();
+    auto& animatedLengthList = animated->lengthList();
 
     // Apply CSS inheritance rules.
     m_animationElement->adjustForInheritance<SVGLengthList>(parseLengthListFromString, m_animationElement->fromPropertyValueType(), fromLengthList, m_contextElement);
index 1d2d59a..5125393 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "SVGAnimatedListPropertyTearOff.h"
 #include "SVGAnimatedTypeAnimator.h"
-#include "SVGLengthList.h"
+#include "SVGLength.h"
 
 namespace WebCore {
 
index 9d28b0f..6076372 100644 (file)
 
 #include "SVGAnimatedListPropertyTearOff.h"
 #include "SVGAnimatedTypeAnimator.h"
+#include "SVGNumber.h"
 #include "SVGNumberList.h"
 
 namespace WebCore {
 
-typedef SVGAnimatedListPropertyTearOff<SVGNumberList> SVGAnimatedNumberList;
+using SVGAnimatedNumberList = SVGAnimatedListPropertyTearOff<SVGNumberList>;
 
 // Helper macros to declare/define a SVGAnimatedNumberList object
 #define DECLARE_ANIMATED_NUMBER_LIST(UpperProperty, LowerProperty) \
index fc8e91e..ef772a8 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "SVGAnimateElementBase.h"
 #include "SVGParserUtilities.h"
+#include "SVGPoint.h"
 #include "SVGPointList.h"
 
 namespace WebCore {
index a601b01..c8fce4b 100644 (file)
 
 namespace WebCore {
 
-template<typename T> 
-class SVGPropertyTearOff;
+class SVGRect;
 
-using SVGAnimatedRect = SVGAnimatedPropertyTearOff<SVGPropertyTearOff<FloatRect>>;
+using SVGAnimatedRect = SVGAnimatedPropertyTearOff<SVGRect>;
 
 // Helper macros to declare/define a SVGAnimatedRect object
 #define DECLARE_ANIMATED_RECT(UpperProperty, LowerProperty) \
index ec350a8..42aeac1 100644 (file)
@@ -33,7 +33,7 @@ namespace WebCore {
 
 SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator(SVGAnimationElement* animationElement, SVGElement* contextElement)
     : SVGAnimatedTypeAnimator(AnimatedTransformList, animationElement, contextElement)
-    , m_transformTypeString(SVGTransform::transformTypePrefixForParsing(downcast<SVGAnimateTransformElement>(animationElement)->transformType()))
+    , m_transformTypeString(SVGTransformValue::transformTypePrefixForParsing(downcast<SVGAnimateTransformElement>(animationElement)->transformType()))
 {
     // Only <animateTransform> uses this animator, as <animate> doesn't allow to animate transform lists directly.
     ASSERT(animationElement->hasTagName(SVGNames::animateTransformTag));
@@ -77,15 +77,15 @@ void SVGAnimatedTransformListAnimator::addAnimatedTypes(SVGAnimatedType* from, S
     ASSERT(from->type() == AnimatedTransformList);
     ASSERT(from->type() == to->type());
 
-    const SVGTransformList& fromTransformList = from->transformList();
-    SVGTransformList& toTransformList = to->transformList();
-    unsigned fromTransformListSize = fromTransformList.size();
+    const auto& fromTransformList = from->transformList();
+    auto& toTransformList = to->transformList();
+    auto fromTransformListSize = fromTransformList.size();
     if (!fromTransformListSize || fromTransformListSize != toTransformList.size())
         return;
 
     ASSERT(fromTransformListSize == 1);
-    const SVGTransform& fromTransform = fromTransformList[0];
-    SVGTransform& toTransform = toTransformList[0];
+    const auto& fromTransform = fromTransformList[0];
+    auto& toTransform = toTransformList[0];
 
     ASSERT(fromTransform.type() == toTransform.type());
     toTransform = SVGTransformDistance::addSVGTransforms(fromTransform, toTransform);
@@ -98,10 +98,10 @@ void SVGAnimatedTransformListAnimator::calculateAnimatedValue(float percentage,
     // Spec: To animations provide specific functionality to get a smooth change from the underlying value to the
     // ‘to’ attribute value, which conflicts mathematically with the requirement for additive transform animations
     // to be post-multiplied. As a consequence, in SVG 1.1 the behavior of to animations for ‘animateTransform’ is undefined.
-    const SVGTransformList& fromTransformList = from->transformList();
-    const SVGTransformList& toTransformList = to->transformList();
-    const SVGTransformList& toAtEndOfDurationTransformList = toAtEndOfDuration->transformList();
-    SVGTransformList& animatedTransformList = animated->transformList();
+    const auto& fromTransformList = from->transformList();
+    const auto& toTransformList = to->transformList();
+    const auto& toAtEndOfDurationTransformList = toAtEndOfDuration->transformList();
+    auto& animatedTransformList = animated->transformList();
 
     // Pass false to 'resizeAnimatedListIfNeeded' here, as the special post-multiplication behavior of <animateTransform> needs to be respected below.
     if (!m_animationElement->adjustFromToListValues<SVGTransformList>(fromTransformList, toTransformList, animatedTransformList, percentage, false))
@@ -111,12 +111,12 @@ void SVGAnimatedTransformListAnimator::calculateAnimatedValue(float percentage,
     if (!animatedTransformList.isEmpty() && (!m_animationElement->isAdditive() || m_animationElement->animationMode() == ToAnimation))
         animatedTransformList.clear();
 
-    unsigned fromTransformListSize = fromTransformList.size();
-    const SVGTransform& toTransform = toTransformList[0];
-    const SVGTransform effectiveFrom = fromTransformListSize ? fromTransformList[0] : SVGTransform(toTransform.type(), SVGTransform::ConstructZeroTransform);
-    SVGTransform currentTransform = SVGTransformDistance(effectiveFrom, toTransform).scaledDistance(percentage).addToSVGTransform(effectiveFrom);
+    auto fromTransformListSize = fromTransformList.size();
+    const auto& toTransform = toTransformList[0];
+    const auto effectiveFrom = fromTransformListSize ? fromTransformList[0] : SVGTransformValue(toTransform.type(), SVGTransformValue::ConstructZeroTransform);
+    auto currentTransform = SVGTransformDistance(effectiveFrom, toTransform).scaledDistance(percentage).addToSVGTransform(effectiveFrom);
     if (m_animationElement->isAccumulated() && repeatCount) {
-        const SVGTransform effectiveToAtEnd = toAtEndOfDurationTransformList.size() ? toAtEndOfDurationTransformList[0] : SVGTransform(toTransform.type(), SVGTransform::ConstructZeroTransform);
+        const auto effectiveToAtEnd = toAtEndOfDurationTransformList.size() ? toAtEndOfDurationTransformList[0] : SVGTransformValue(toTransform.type(), SVGTransformValue::ConstructZeroTransform);
         animatedTransformList.append(SVGTransformDistance::addSVGTransforms(currentTransform, effectiveToAtEnd, repeatCount));
     } else
         animatedTransformList.append(currentTransform);
@@ -128,11 +128,11 @@ float SVGAnimatedTransformListAnimator::calculateDistance(const String& fromStri
 
     // FIXME: This is not correct in all cases. The spec demands that each component (translate x and y for example)
     // is paced separately. To implement this we need to treat each component as individual animation everywhere.
-    std::unique_ptr<SVGAnimatedType> from = constructFromString(fromString);
-    std::unique_ptr<SVGAnimatedType> to = constructFromString(toString);
+    auto from = constructFromString(fromString);
+    auto to = constructFromString(toString);
 
-    SVGTransformList& fromTransformList = from->transformList();
-    SVGTransformList& toTransformList = to->transformList();
+    auto& fromTransformList = from->transformList();
+    auto& toTransformList = to->transformList();
     unsigned itemsCount = fromTransformList.size();
     if (!itemsCount || itemsCount != toTransformList.size())
         return -1;
index 553d081..d5ebcde 100644 (file)
@@ -138,7 +138,7 @@ std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createIntegerOptionalInteger(s
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createLength(std::unique_ptr<SVGLength> length)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createLength(std::unique_ptr<SVGLengthValue> length)
 {
     ASSERT(length);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedLength);
@@ -279,10 +279,10 @@ bool SVGAnimatedType::setValueAsString(const QualifiedName& attrName, const Stri
         return true;
     case AnimatedLength:
         ASSERT(m_data.length);
-        return !m_data.length->setValueAsString(value, SVGLength::lengthModeForAnimatedLengthAttribute(attrName)).hasException();
+        return !m_data.length->setValueAsString(value, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName)).hasException();
     case AnimatedLengthList:
         ASSERT(m_data.lengthList);
-        m_data.lengthList->parse(value, SVGLength::lengthModeForAnimatedLengthAttribute(attrName));
+        m_data.lengthList->parse(value, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName));
         return true;
     case AnimatedNumber:
         ASSERT(m_data.number);
index 80af132..0e0651a 100644 (file)
@@ -22,8 +22,8 @@
 #include "FloatRect.h"
 #include "SVGAngleValue.h"
 #include "SVGColor.h"
-#include "SVGLength.h"
 #include "SVGLengthList.h"
+#include "SVGLengthValue.h"
 #include "SVGNumberList.h"
 #include "SVGPointList.h"
 #include "SVGPreserveAspectRatioValue.h"
@@ -46,7 +46,7 @@ public:
     static std::unique_ptr<SVGAnimatedType> createEnumeration(std::unique_ptr<unsigned>);
     static std::unique_ptr<SVGAnimatedType> createInteger(std::unique_ptr<int>);
     static std::unique_ptr<SVGAnimatedType> createIntegerOptionalInteger(std::unique_ptr<std::pair<int, int>>);
-    static std::unique_ptr<SVGAnimatedType> createLength(std::unique_ptr<SVGLength>);
+    static std::unique_ptr<SVGAnimatedType> createLength(std::unique_ptr<SVGLengthValue>);
     static std::unique_ptr<SVGAnimatedType> createLengthList(std::unique_ptr<SVGLengthList>);
     static std::unique_ptr<SVGAnimatedType> createNumber(std::unique_ptr<float>);
     static std::unique_ptr<SVGAnimatedType> createNumberList(std::unique_ptr<SVGNumberList>);
@@ -98,7 +98,7 @@ public:
         return *m_data.integerOptionalInteger;
     }
 
-    const SVGLength& length() const
+    const SVGLengthValue& length() const
     {
         ASSERT(m_type == AnimatedLength);
         return *m_data.length;
@@ -201,7 +201,7 @@ public:
         return *m_data.integerOptionalInteger;
     }
 
-    SVGLength& length()
+    SVGLengthValue& length()
     {
         ASSERT(m_type == AnimatedLength);
         return *m_data.length;
@@ -285,7 +285,7 @@ private:
         unsigned* enumeration;
         int* integer;
         std::pair<int, int>* integerOptionalInteger;
-        SVGLength* length;
+        SVGLengthValue* length;
         SVGLengthList* lengthList;
         float* number;
         SVGNumberList* numberList;
index 914ff7b..db8364f 100644 (file)
@@ -26,7 +26,7 @@
 #include "RenderSVGPath.h"
 #include "RenderSVGResource.h"
 #include "SVGException.h"
-#include "SVGLength.h"
+#include "SVGLengthValue.h"
 #include "SVGNames.h"
 
 namespace WebCore {
@@ -65,11 +65,11 @@ void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::cxAttr)
-        setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setCxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::cyAttr)
-        setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setCyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::rAttr)
-        setRBaseValue(SVGLength::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
+        setRBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
 
     reportAttributeParsingError(parseError, name, value);
 
index 7699b41..9f27e01 100644 (file)
@@ -81,9 +81,9 @@ void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicStr
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::xAttr)
-        setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::yAttr)
-        setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
 
     reportAttributeParsingError(parseError, name, value);
 
index 177b97e..391e049 100644 (file)
@@ -53,7 +53,7 @@ void SVGDocument::startPan(const FloatPoint& start)
     auto* element = rootElement(*this);
     if (!element)
         return;
-    m_panningOffset = start - element->currentTranslate();
+    m_panningOffset = start - element->currentTranslateValue();
 }
 
 void SVGDocument::updatePan(const FloatPoint& position) const
index c23d9b6..96ec6a5 100644 (file)
@@ -25,7 +25,7 @@
 #include "RenderSVGEllipse.h"
 #include "RenderSVGPath.h"
 #include "RenderSVGResource.h"
-#include "SVGLength.h"
+#include "SVGLengthValue.h"
 #include "SVGNames.h"
 
 namespace WebCore {
@@ -67,13 +67,13 @@ void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::cxAttr)
-        setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setCxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::cyAttr)
-        setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setCyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::rxAttr)
-        setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
+        setRxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
     else if (name == SVGNames::ryAttr)
-        setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
+        setRyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
 
     reportAttributeParsingError(parseError, name, value);
 
index 7f13c80..80663b8 100644 (file)
@@ -132,13 +132,13 @@ void SVGFilterElement::parseAttribute(const QualifiedName& name, const AtomicStr
         if (propertyValue > 0)
             setPrimitiveUnitsBaseValue(propertyValue);
     } else if (name == SVGNames::xAttr)
-        setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::yAttr)
-        setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::widthAttr)
-        setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::heightAttr)
-        setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::filterResAttr) {
         float x, y;
         if (parseNumberOptionalNumber(value, x, y)) {
index 5070777..d69ddf3 100644 (file)
@@ -26,7 +26,7 @@
 #include "RenderSVGResourceFilterPrimitive.h"
 #include "SVGElement.h"
 #include "SVGFilterBuilder.h"
-#include "SVGLength.h"
+#include "SVGLengthValue.h"
 #include "SVGNames.h"
 #include "SVGUnitTypes.h"
 #include <wtf/NeverDestroyed.h>
@@ -79,13 +79,13 @@ void SVGFilterPrimitiveStandardAttributes::parseAttribute(const QualifiedName& n
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::xAttr)
-        setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::yAttr)
-        setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::widthAttr)
-        setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::heightAttr)
-        setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::resultAttr)
         setResultBaseValue(value);
 
index cc31606..c2af1f4 100644 (file)
@@ -25,7 +25,7 @@
 #include "CSSPropertyNames.h"
 #include "RenderSVGForeignObject.h"
 #include "RenderSVGResource.h"
-#include "SVGLength.h"
+#include "SVGLengthValue.h"
 #include "SVGNames.h"
 #include "XLinkNames.h"
 #include <wtf/Assertions.h>
@@ -86,13 +86,13 @@ void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::xAttr)
-        setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::yAttr)
-        setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::widthAttr)
-        setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::heightAttr)
-        setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
 
     reportAttributeParsingError(parseError, name, value);
 
index ddb2aa0..2f7512f 100644 (file)
 #include "config.h"
 #include "SVGGraphicsElement.h"
 
-#include "AffineTransform.h"
 #include "RenderSVGPath.h"
 #include "RenderSVGResource.h"
+#include "SVGMatrix.h"
 #include "SVGNames.h"
 #include "SVGPathData.h"
+#include "SVGRect.h"
 #include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
@@ -50,11 +51,21 @@ SVGGraphicsElement::~SVGGraphicsElement()
 {
 }
 
+Ref<SVGMatrix> SVGGraphicsElement::getCTMForBindings()
+{
+    return SVGMatrix::create(getCTM());
+}
+
 AffineTransform SVGGraphicsElement::getCTM(StyleUpdateStrategy styleUpdateStrategy)
 {
     return SVGLocatable::computeCTM(this, SVGLocatable::NearestViewportScope, styleUpdateStrategy);
 }
 
+Ref<SVGMatrix> SVGGraphicsElement::getScreenCTMForBindings()
+{
+    return SVGMatrix::create(getScreenCTM());
+}
+
 AffineTransform SVGGraphicsElement::getScreenCTM(StyleUpdateStrategy styleUpdateStrategy)
 {
     return SVGLocatable::computeCTM(this, SVGLocatable::ScreenScope, styleUpdateStrategy);
@@ -156,6 +167,11 @@ SVGElement* SVGGraphicsElement::farthestViewportElement() const
     return SVGTransformable::farthestViewportElement(this);
 }
 
+Ref<SVGRect> SVGGraphicsElement::getBBoxForBindings()
+{
+    return SVGRect::create(getBBox());
+}
+
 FloatRect SVGGraphicsElement::getBBox(StyleUpdateStrategy styleUpdateStrategy)
 {
     return SVGTransformable::getBBox(this, styleUpdateStrategy);
index c927b2f..3d896c3 100644 (file)
@@ -29,13 +29,19 @@ namespace WebCore {
 
 class AffineTransform;
 class Path;
+class SVGRect;
+class SVGMatrix;
 
 class SVGGraphicsElement : public SVGElement, public SVGTransformable, public SVGTests {
 public:
     virtual ~SVGGraphicsElement();
 
+    Ref<SVGMatrix> getCTMForBindings();
     AffineTransform getCTM(StyleUpdateStrategy = AllowStyleUpdate) override;
+
+    Ref<SVGMatrix> getScreenCTMForBindings();
     AffineTransform getScreenCTM(StyleUpdateStrategy = AllowStyleUpdate) override;
+
     SVGElement* nearestViewportElement() const override;
     SVGElement* farthestViewportElement() const override;
 
@@ -43,6 +49,7 @@ public:
     AffineTransform animatedLocalTransform() const override;
     AffineTransform* supplementalTransform() override;
 
+    Ref<SVGRect> getBBoxForBindings();
     FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate) override;
 
     bool shouldIsolateBlending() const { return m_shouldIsolateBlending; }
index c81f072..f12bb6a 100644 (file)
@@ -29,10 +29,10 @@ interface SVGGraphicsElement : SVGElement {
     readonly attribute SVGElement nearestViewportElement;
     readonly attribute SVGElement farthestViewportElement;
 
-    SVGRect getBBox();
-    SVGMatrix getCTM();
-    SVGMatrix getScreenCTM();
-    [MayThrowException] SVGMatrix getTransformToElement(optional SVGElement? element = null);
+    [ImplementedAs=getBBoxForBindings, NewObject] SVGRect getBBox();
+    [ImplementedAs=getCTMForBindings, NewObject] SVGMatrix getCTM();
+    [ImplementedAs=getScreenCTMForBindings, NewObject] SVGMatrix getScreenCTM();
+    [MayThrowException, NewObject] SVGMatrix getTransformToElement(optional SVGElement? element = null);
 };
 
 SVGGraphicsElement implements SVGTests;
index c9db807..e7add36 100644 (file)
@@ -106,13 +106,13 @@ void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicStri
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::xAttr)
-        setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::yAttr)
-        setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::widthAttr)
-        setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
+        setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
     else if (name == SVGNames::heightAttr)
-        setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
+        setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
 
     reportAttributeParsingError(parseError, name, value);
 
index 2c9828b..d4f8e59 100644 (file)
@@ -1,42 +1,37 @@
 /*
- * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
  *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #pragma once
 
-#include "AnimationUtilities.h"
-#include "SVGLengthContext.h"
-#include "SVGParsingError.h"
-#include "SVGPropertyTraits.h"
+#include "ExceptionCode.h"
+#include "SVGLengthValue.h"
+#include "SVGPropertyTearOff.h"
 
 namespace WebCore {
 
-class CSSPrimitiveValue;
-class QualifiedName;
-
-enum SVGLengthNegativeValuesMode {
-    AllowNegativeLengths,
-    ForbidNegativeLengths
-};
-
-class SVGLength {
-    WTF_MAKE_FAST_ALLOCATED;
+class SVGLength : public SVGPropertyTearOff<SVGLengthValue> {
 public:
     // Forward declare these enums in the w3c naming scheme, for IDL generation
     enum {
@@ -53,118 +48,127 @@ public:
         SVG_LENGTHTYPE_PC = LengthTypePC
     };
 
-    // FIXME: Once all SVGLength users use Length internally, we make this a wrapper for Length.
-    SVGLength(SVGLengthMode = LengthModeOther, const String& valueAsString = String());
-    SVGLength(const SVGLengthContext&, float, SVGLengthMode = LengthModeOther, SVGLengthType = LengthTypeNumber);
+    static Ref<SVGLength> create(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, SVGLengthValue& value)
+    {
+        ASSERT(animatedProperty);
+        return adoptRef(*new SVGLength(animatedProperty, role, value));
+    }
 
-    SVGLengthType unitType() const;
-    SVGLengthMode unitMode() const;
+    static Ref<SVGLength> create(const SVGLengthValue& initialValue = { })
+    {
+        return adoptRef(*new SVGLength(initialValue));
+    }
+
+    static Ref<SVGLength> create(const SVGLengthValue* initialValue)
+    {
+        return adoptRef(*new SVGLength(initialValue));
+    }
+
+    template<typename T> static ExceptionOr<Ref<SVGLength>> create(ExceptionOr<T>&& initialValue)
+    {
+        if (initialValue.hasException())
+            return initialValue.releaseException();
+        return create(initialValue.releaseReturnValue());
+    }
+
+    unsigned short unitType()
+    {
+        return propertyReference().unitType();
+    }
+
+    ExceptionOr<float> valueForBindings()
+    {
+        return propertyReference().valueForBindings(SVGLengthContext { contextElement() });
+    }
+
+    ExceptionOr<void> setValueForBindings(float value)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        auto result = propertyReference().setValue(value, SVGLengthContext { contextElement() });
+        if (result.hasException())
+            return result;
+        
+        commitChange();
+        return result;
+    }
+    
+    float valueInSpecifiedUnits()
+    {
+        return propertyReference().valueInSpecifiedUnits();
+    }
 
-    bool operator==(const SVGLength&) const;
-    bool operator!=(const SVGLength&) const;
+    ExceptionOr<void> setValueInSpecifiedUnits(float valueInSpecifiedUnits)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
 
-    static SVGLength construct(SVGLengthMode, const String&, SVGParsingError&, SVGLengthNegativeValuesMode = AllowNegativeLengths);
+        propertyReference().setValueInSpecifiedUnits(valueInSpecifiedUnits);
+        commitChange();
+        
+        return { };
+    }
+    
+    String valueAsString()
+    {
+        return propertyReference().valueAsString();
+    }
 
-    float value(const SVGLengthContext&) const;
-    ExceptionOr<float> valueForBindings(const SVGLengthContext&) const;
-    ExceptionOr<void> setValue(float, const SVGLengthContext&);
-    ExceptionOr<void> setValue(const SVGLengthContext&, float, SVGLengthMode, SVGLengthType);
+    ExceptionOr<void> setValueAsString(const String& value)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
 
-    float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; }
-    void setValueInSpecifiedUnits(float value) { m_valueInSpecifiedUnits = value; }
+        auto result = propertyReference().setValueAsString(value);
+        if (result.hasException())
+            return result;
+        
+        commitChange();
+        return result;
+    }
 
-    float valueAsPercentage() const;
+    ExceptionOr<void> newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
 
-    String valueAsString() const;
-    ExceptionOr<void> setValueAsString(const String&);
-    ExceptionOr<void> setValueAsString(const String&, SVGLengthMode);
+        auto result = propertyReference().newValueSpecifiedUnits(unitType, valueInSpecifiedUnits);
+        if (result.hasException())
+            return result;
+        
+        commitChange();
+        return result;
+    }
     
-    ExceptionOr<void> newValueSpecifiedUnits(unsigned short, float valueInSpecifiedUnits);
-    ExceptionOr<void> convertToSpecifiedUnits(unsigned short, const SVGLengthContext&);
-
-    // Helper functions
-    bool isRelative() const
-    {
-        SVGLengthType type = unitType();
-        return type == LengthTypePercentage || type == LengthTypeEMS || type == LengthTypeEXS;
-    }
-
-    bool isZero() const 
-    {
-        return !m_valueInSpecifiedUnits;
-    }
-
-    static SVGLength fromCSSPrimitiveValue(const CSSPrimitiveValue&);
-    static Ref<CSSPrimitiveValue> toCSSPrimitiveValue(const SVGLength&);
-    static SVGLengthMode lengthModeForAnimatedLengthAttribute(const QualifiedName&);
-
-    SVGLength blend(const SVGLength& from, float progress) const
-    {
-        SVGLengthType toType = unitType();
-        SVGLengthType fromType = from.unitType();
-        if ((from.isZero() && isZero())
-            || fromType == LengthTypeUnknown
-            || toType == LengthTypeUnknown
-            || (!from.isZero() && fromType != LengthTypePercentage && toType == LengthTypePercentage)
-            || (!isZero() && fromType == LengthTypePercentage && toType != LengthTypePercentage)
-            || (!from.isZero() && !isZero() && (fromType == LengthTypeEMS || fromType == LengthTypeEXS) && fromType != toType))
-            return *this;
-
-        SVGLength length;
-
-        if (fromType == LengthTypePercentage || toType == LengthTypePercentage) {
-            float fromPercent = from.valueAsPercentage() * 100;
-            float toPercent = valueAsPercentage() * 100;
-            auto result = length.newValueSpecifiedUnits(LengthTypePercentage, WebCore::blend(fromPercent, toPercent, progress));
-            if (result.hasException())
-                return SVGLength();
-            return length;
-        }
-
-        if (fromType == toType || from.isZero() || isZero() || fromType == LengthTypeEMS || fromType == LengthTypeEXS) {
-            float fromValue = from.valueInSpecifiedUnits();
-            float toValue = valueInSpecifiedUnits();
-            if (isZero()) {
-                auto result = length.newValueSpecifiedUnits(fromType, WebCore::blend(fromValue, toValue, progress));
-                if (result.hasException())
-                    return SVGLength();
-            } else {
-                auto result = length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue, toValue, progress));
-                if (result.hasException())
-                    return SVGLength();
-            }
-            return length;
-        }
-
-        ASSERT(!isRelative());
-        ASSERT(!from.isRelative());
-
-        SVGLengthContext nonRelativeLengthContext(nullptr);
-        auto fromValueInUserUnits = nonRelativeLengthContext.convertValueToUserUnits(from.valueInSpecifiedUnits(), from.unitMode(), fromType);
-        if (fromValueInUserUnits.hasException())
-            return SVGLength();
-
-        auto fromValue = nonRelativeLengthContext.convertValueFromUserUnits(fromValueInUserUnits.releaseReturnValue(), unitMode(), toType);
-        if (fromValue.hasException())
-            return SVGLength();
-
-        float toValue = valueInSpecifiedUnits();
-        auto result = length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue.releaseReturnValue(), toValue, progress));
+    ExceptionOr<void> convertToSpecifiedUnits(unsigned short unitType)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        auto result = propertyReference().convertToSpecifiedUnits(unitType, SVGLengthContext { contextElement() });
         if (result.hasException())
-            return SVGLength();
-        return length;
+            return result;
+        
+        commitChange();
+        return result;
     }
 
 private:
-    float m_valueInSpecifiedUnits;
-    unsigned m_unit;
-};
+    SVGLength(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, SVGLengthValue& value)
+        : SVGPropertyTearOff<SVGLengthValue>(animatedProperty, role, value)
+    {
+    }
 
-template<> struct SVGPropertyTraits<SVGLength> {
-    static SVGLength initialValue() { return SVGLength(); }
-    static String toString(const SVGLength& type) { return type.valueAsString(); }
-};
+    explicit SVGLength(const SVGLengthValue& initialValue)
+        : SVGPropertyTearOff<SVGLengthValue>(initialValue)
+    {
+    }
 
-TextStream& operator<<(TextStream&, const SVGLength&);
+    explicit SVGLength(const SVGLengthValue* initialValue)
+        : SVGPropertyTearOff<SVGLengthValue>(initialValue)
+    {
+    }
+};
 
 } // namespace WebCore
index dfc61e1..3bc3d44 100644 (file)
@@ -35,11 +35,11 @@ interface SVGLength {
     const unsigned short SVG_LENGTHTYPE_PC = 10;
 
     readonly attribute unsigned short unitType;
-    [Custom, GetterMayThrowException, SetterMayThrowException] attribute unrestricted float value;
+    [GetterMayThrowException, SetterMayThrowException, ImplementedAs=valueForBindings] attribute unrestricted float value;
 
-    attribute unrestricted float valueInSpecifiedUnits;
+    [SetterMayThrowException] attribute unrestricted float valueInSpecifiedUnits;
     [SetterMayThrowException] attribute DOMString valueAsString;
 
     [MayThrowException] void newValueSpecifiedUnits(unsigned short unitType, unrestricted float valueInSpecifiedUnits);
-    [Custom, MayThrowException] void convertToSpecifiedUnits(unsigned short unitType);
+    [MayThrowException] void convertToSpecifiedUnits(unsigned short unitType);
 };
index 61c1c10..e114bf8 100644 (file)
@@ -48,7 +48,7 @@ SVGLengthContext::SVGLengthContext(const SVGElement* context, const FloatRect& v
 {
 }
 
-FloatRect SVGLengthContext::resolveRectangle(const SVGElement* context, SVGUnitTypes::SVGUnitType type, const FloatRect& viewport, const SVGLength& x, const SVGLength& y, const SVGLength& width, const SVGLength& height)
+FloatRect SVGLengthContext::resolveRectangle(const SVGElement* context, SVGUnitTypes::SVGUnitType type, const FloatRect& viewport, const SVGLengthValue& x, const SVGLengthValue& y, const SVGLengthValue& width, const SVGLengthValue& height)
 {
     ASSERT(type != SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN);
     if (type == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) {
@@ -63,7 +63,7 @@ FloatRect SVGLengthContext::resolveRectangle(const SVGElement* context, SVGUnitT
                      height.value(lengthContext));
 }
 
-FloatPoint SVGLengthContext::resolvePoint(const SVGElement* context, SVGUnitTypes::SVGUnitType type, const SVGLength& x, const SVGLength& y)
+FloatPoint SVGLengthContext::resolvePoint(const SVGElement* context, SVGUnitTypes::SVGUnitType type, const SVGLengthValue& x, const SVGLengthValue& y)
 {
     ASSERT(type != SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN);
     if (type == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) {
@@ -75,7 +75,7 @@ FloatPoint SVGLengthContext::resolvePoint(const SVGElement* context, SVGUnitType
     return FloatPoint(x.valueAsPercentage(), y.valueAsPercentage());
 }
 
-float SVGLengthContext::resolveLength(const SVGElement* context, SVGUnitTypes::SVGUnitType type, const SVGLength& x)
+float SVGLengthContext::resolveLength(const SVGElement* context, SVGUnitTypes::SVGUnitType type, const SVGLengthValue& x)
 {
     ASSERT(type != SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN);
     if (type == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) {
index 9a6fd90..b03eb1f 100644 (file)
@@ -26,7 +26,7 @@
 namespace WebCore {
 
 class SVGElement;
-class SVGLength;
+class SVGLengthValue;
 
 struct Length;
 
@@ -60,9 +60,9 @@ public:
         return SVGLengthContext::resolveRectangle(context, type, viewport, context->x(), context->y(), context->width(), context->height());
     }
 
-    static FloatRect resolveRectangle(const SVGElement*, SVGUnitTypes::SVGUnitType, const FloatRect& viewport, const SVGLength& x, const SVGLength& y, const SVGLength& width, const SVGLength& height);
-    static FloatPoint resolvePoint(const SVGElement*, SVGUnitTypes::SVGUnitType, const SVGLength& x, const SVGLength& y);
-    static float resolveLength(const SVGElement*, SVGUnitTypes::SVGUnitType, const SVGLength&);
+    static FloatRect resolveRectangle(const SVGElement*, SVGUnitTypes::SVGUnitType, const FloatRect& viewport, const SVGLengthValue& x, const SVGLengthValue& y, const SVGLengthValue& width, const SVGLengthValue& height);
+    static FloatPoint resolvePoint(const SVGElement*, SVGUnitTypes::SVGUnitType, const SVGLengthValue& x, const SVGLengthValue& y);
+    static float resolveLength(const SVGElement*, SVGUnitTypes::SVGUnitType, const SVGLengthValue&);
 
     float valueForLength(const Length&, SVGLengthMode = LengthModeOther);
     ExceptionOr<float> convertValueToUserUnits(float, SVGLengthMode, SVGLengthType fromUnit) const;
index cb6fae2..5a15800 100644 (file)
@@ -40,7 +40,7 @@ void SVGLengthList::parse(const String& value, SVGLengthMode mode)
         if (ptr == start)
             break;
 
-        SVGLength length(mode);
+        SVGLengthValue length(mode);
         String valueString(start, ptr - start);
         if (valueString.isEmpty())
             return;
index 990327f..d36103e 100644 (file)
 
 #pragma once
 
-#include "SVGLength.h"
+#include "SVGLengthValue.h"
 #include <wtf/Vector.h>
 
 namespace WebCore {
 
-template<typename T> 
-class SVGPropertyTearOff;
+class SVGLength;
 
-class SVGLengthList final : public Vector<SVGLength> {
+class SVGLengthList final : public Vector<SVGLengthValue> {
 public:
     void parse(const String& value, SVGLengthMode);
     String valueAsString() const;
 };
 
 template<> struct SVGPropertyTraits<SVGLengthList> {
-    using ListItemType = SVGLength;
-    using ListItemTearOff = SVGPropertyTearOff<SVGLength>;
+    using ListItemType = SVGLengthValue;
+    using ListItemTearOff = SVGLength;
 
-    static SVGLengthList initialValue() { return SVGLengthList(); }
+    static SVGLengthList initialValue() { return  { }; }
     static String toString(const SVGLengthList& type) { return type.valueAsString(); }
 };
 
similarity index 77%
rename from Source/WebCore/svg/SVGLength.cpp
rename to Source/WebCore/svg/SVGLengthValue.cpp
index fcf5a6f..b58d42d 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 #include "config.h"
-#include "SVGLength.h"
+#include "SVGLengthValue.h"
 
 #include "CSSHelper.h"
 #include "CSSPrimitiveValue.h"
 namespace WebCore {
 
 // Helper functions
-static inline unsigned int storeUnit(SVGLengthMode mode, SVGLengthType type)
+static inline unsigned storeUnit(SVGLengthMode mode, SVGLengthType type)
 {
     return (mode << 4) | type;
 }
 
-static inline SVGLengthMode extractMode(unsigned int unit)
+static inline SVGLengthMode extractMode(unsigned unit)
 {
-    unsigned int mode = unit >> 4;    
+    unsigned mode = unit >> 4;    
     return static_cast<SVGLengthMode>(mode);
 }
 
-static inline SVGLengthType extractType(unsigned int unit)
+static inline SVGLengthType extractType(unsigned unit)
 {
-    unsigned int mode = unit >> 4;
-    unsigned int type = unit ^ (mode << 4);
-    return static_cast<SVGLengthType>(type);
+    return static_cast<SVGLengthType>(unit & ((1 << 4) - 1));
 }
 
 static inline const char* lengthTypeToString(SVGLengthType type)
@@ -119,41 +117,38 @@ inline SVGLengthType parseLengthType(const UChar* ptr, const UChar* end)
     return LengthTypeUnknown;
 }
 
-SVGLength::SVGLength(SVGLengthMode mode, const String& valueAsString)
-    : m_valueInSpecifiedUnits(0)
-    , m_unit(storeUnit(mode, LengthTypeNumber))
+SVGLengthValue::SVGLengthValue(SVGLengthMode mode, const String& valueAsString)
+    : m_unit(storeUnit(mode, LengthTypeNumber))
 {
     setValueAsString(valueAsString);
 }
 
-SVGLength::SVGLength(const SVGLengthContext& context, float value, SVGLengthMode mode, SVGLengthType unitType)
-    : m_valueInSpecifiedUnits(0)
-    , m_unit(storeUnit(mode, unitType))
+SVGLengthValue::SVGLengthValue(const SVGLengthContext& context, float value, SVGLengthMode mode, SVGLengthType unitType)
+    : m_unit(storeUnit(mode, unitType))
 {
     setValue(value, context);
 }
 
-ExceptionOr<void> SVGLength::setValueAsString(const String& valueAsString, SVGLengthMode mode)
+ExceptionOr<void> SVGLengthValue::setValueAsString(const String& valueAsString, SVGLengthMode mode)
 {
     m_valueInSpecifiedUnits = 0;
     m_unit = storeUnit(mode, LengthTypeNumber);
     return setValueAsString(valueAsString);
 }
 
-bool SVGLength::operator==(const SVGLength& other) const
+bool SVGLengthValue::operator==(const SVGLengthValue& other) const
 {
-    return m_unit == other.m_unit
-        && m_valueInSpecifiedUnits == other.m_valueInSpecifiedUnits;
+    return m_unit == other.m_unit && m_valueInSpecifiedUnits == other.m_valueInSpecifiedUnits;
 }
 
-bool SVGLength::operator!=(const SVGLength& other) const
+bool SVGLengthValue::operator!=(const SVGLengthValue& other) const
 {
     return !operator==(other);
 }
 
-SVGLength SVGLength::construct(SVGLengthMode mode, const String& valueAsString, SVGParsingError& parseError, SVGLengthNegativeValuesMode negativeValuesMode)
+SVGLengthValue SVGLengthValue::construct(SVGLengthMode mode, const String& valueAsString, SVGParsingError& parseError, SVGLengthNegativeValuesMode negativeValuesMode)
 {
-    SVGLength length(mode);
+    SVGLengthValue length(mode);
 
     if (length.setValueAsString(valueAsString).hasException())
         parseError = ParsingAttributeFailedError;
@@ -163,17 +158,17 @@ SVGLength SVGLength::construct(SVGLengthMode mode, const String& valueAsString,
     return length;
 }
 
-SVGLengthType SVGLength::unitType() const
+SVGLengthType SVGLengthValue::unitType() const
 {
     return extractType(m_unit);
 }
 
-SVGLengthMode SVGLength::unitMode() const
+SVGLengthMode SVGLengthValue::unitMode() const
 {
     return extractMode(m_unit);
 }
 
-float SVGLength::value(const SVGLengthContext& context) const
+float SVGLengthValue::value(const SVGLengthContext& context) const
 {
     auto result = valueForBindings(context);
     if (result.hasException())
@@ -181,19 +176,19 @@ float SVGLength::value(const SVGLengthContext& context) const
     return result.releaseReturnValue();
 }
 
-ExceptionOr<float> SVGLength::valueForBindings(const SVGLengthContext& context) const
+ExceptionOr<float> SVGLengthValue::valueForBindings(const SVGLengthContext& context) const
 {
     return context.convertValueToUserUnits(m_valueInSpecifiedUnits, extractMode(m_unit), extractType(m_unit));
 }
 
-ExceptionOr<void> SVGLength::setValue(const SVGLengthContext& context, float value, SVGLengthMode mode, SVGLengthType unitType)
+ExceptionOr<void> SVGLengthValue::setValue(const SVGLengthContext& context, float value, SVGLengthMode mode, SVGLengthType unitType)
 {
     // FIXME: Seems like a bug that we change the value of m_unit even if setValue throws an exception.
     m_unit = storeUnit(mode, unitType);
     return setValue(value, context);
 }
 
-ExceptionOr<void> SVGLength::setValue(float value, const SVGLengthContext& context)
+ExceptionOr<void> SVGLengthValue::setValue(float value, const SVGLengthContext& context)
 {
     // 100% = 100.0 instead of 1.0 for historical reasons, this could eventually be changed
     if (extractType(m_unit) == LengthTypePercentage)
@@ -205,7 +200,7 @@ ExceptionOr<void> SVGLength::setValue(float value, const SVGLengthContext& conte
     m_valueInSpecifiedUnits = convertedValue.releaseReturnValue();
     return { };
 }
-float SVGLength::valueAsPercentage() const
+float SVGLengthValue::valueAsPercentage() const
 {
     // 100% = 100.0 instead of 1.0 for historical reasons, this could eventually be changed
     if (extractType(m_unit) == LengthTypePercentage)
@@ -214,7 +209,7 @@ float SVGLength::valueAsPercentage() const
     return m_valueInSpecifiedUnits;
 }
 
-ExceptionOr<void> SVGLength::setValueAsString(const String& string)
+ExceptionOr<void> SVGLengthValue::setValueAsString(const String& string)
 {
     if (string.isEmpty())
         return { };
@@ -236,12 +231,12 @@ ExceptionOr<void> SVGLength::setValueAsString(const String& string)
     return { };
 }
 
-String SVGLength::valueAsString() const
+String SVGLengthValue::valueAsString() const
 {
     return String::number(m_valueInSpecifiedUnits) + lengthTypeToString(extractType(m_unit));
 }
 
-ExceptionOr<void> SVGLength::newValueSpecifiedUnits(unsigned short type, float value)
+ExceptionOr<void> SVGLengthValue::newValueSpecifiedUnits(unsigned short type, float value)
 {
     if (type == LengthTypeUnknown || type > LengthTypePC)
         return Exception { NOT_SUPPORTED_ERR };
@@ -251,7 +246,7 @@ ExceptionOr<void> SVGLength::newValueSpecifiedUnits(unsigned short type, float v
     return { };
 }
 
-ExceptionOr<void> SVGLength::convertToSpecifiedUnits(unsigned short type, const SVGLengthContext& context)
+ExceptionOr<void> SVGLengthValue::convertToSpecifiedUnits(unsigned short type, const SVGLengthContext& context)
 {
     if (type == LengthTypeUnknown || type > LengthTypePC)
         return Exception { NOT_SUPPORTED_ERR };
@@ -271,55 +266,51 @@ ExceptionOr<void> SVGLength::convertToSpecifiedUnits(unsigned short type, const
     return { };
 }
 
-SVGLength SVGLength::fromCSSPrimitiveValue(const CSSPrimitiveValue& value)
+SVGLengthValue SVGLengthValue::fromCSSPrimitiveValue(const CSSPrimitiveValue& value)
 {
-    SVGLengthType svgType;
+    SVGLengthType type;
     switch (value.primitiveType()) {
     case CSSPrimitiveValue::CSS_NUMBER:
-        svgType = LengthTypeNumber;
+        type = LengthTypeNumber;
         break;
     case CSSPrimitiveValue::CSS_PERCENTAGE:
-        svgType = LengthTypePercentage;
+        type = LengthTypePercentage;
         break;
     case CSSPrimitiveValue::CSS_EMS:
-        svgType = LengthTypeEMS;
+        type = LengthTypeEMS;
         break;
     case CSSPrimitiveValue::CSS_EXS:
-        svgType = LengthTypeEXS;
+        type = LengthTypeEXS;
         break;
     case CSSPrimitiveValue::CSS_PX:
-        svgType = LengthTypePX;
+        type = LengthTypePX;
         break;
     case CSSPrimitiveValue::CSS_CM:
-        svgType = LengthTypeCM;
+        type = LengthTypeCM;
         break;
     case CSSPrimitiveValue::CSS_MM:
-        svgType = LengthTypeMM;
+        type = LengthTypeMM;
         break;
     case CSSPrimitiveValue::CSS_IN:
-        svgType = LengthTypeIN;
+        type = LengthTypeIN;
         break;
     case CSSPrimitiveValue::CSS_PT:
-        svgType = LengthTypePT;
+        type = LengthTypePT;
         break;
     case CSSPrimitiveValue::CSS_PC:
-        svgType = LengthTypePC;
+        type = LengthTypePC;
         break;
     case CSSPrimitiveValue::CSS_UNKNOWN:
     default:
-        svgType = LengthTypeUnknown;
-        break;
+        return { };
     };
 
-    if (svgType == LengthTypeUnknown)
-        return SVGLength();
-
-    SVGLength length;
-    length.newValueSpecifiedUnits(svgType, value.floatValue());
+    SVGLengthValue length;
+    length.newValueSpecifiedUnits(type, value.floatValue());
     return length;
 }
 
-Ref<CSSPrimitiveValue> SVGLength::toCSSPrimitiveValue(const SVGLength& length)
+Ref<CSSPrimitiveValue> SVGLengthValue::toCSSPrimitiveValue(const SVGLengthValue& length)
 {
     CSSPrimitiveValue::UnitTypes cssType = CSSPrimitiveValue::CSS_UNKNOWN;
     switch (length.unitType()) {
@@ -360,7 +351,7 @@ Ref<CSSPrimitiveValue> SVGLength::toCSSPrimitiveValue(const SVGLength& length)
     return CSSPrimitiveValue::create(length.valueInSpecifiedUnits(), cssType);
 }
 
-SVGLengthMode SVGLength::lengthModeForAnimatedLengthAttribute(const QualifiedName& attrName)
+SVGLengthMode SVGLengthValue::lengthModeForAnimatedLengthAttribute(const QualifiedName& attrName)
 {
     using Map = HashMap<QualifiedName, SVGLengthMode>;
     static NeverDestroyed<Map> map = [] {
@@ -402,7 +393,7 @@ SVGLengthMode SVGLength::lengthModeForAnimatedLengthAttribute(const QualifiedNam
     return result->value;
 }
 
-TextStream& operator<<(TextStream& ts, const SVGLength& length)
+TextStream& operator<<(TextStream& ts, const SVGLengthValue& length)
 {
     ts << length.valueAsString();
     return ts;
diff --git a/Source/WebCore/svg/SVGLengthValue.h b/Source/WebCore/svg/SVGLengthValue.h
new file mode 100644 (file)
index 0000000..c7082b4
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include "AnimationUtilities.h"
+#include "SVGLengthContext.h"
+#include "SVGParsingError.h"
+#include "SVGPropertyTraits.h"
+
+namespace WebCore {
+
+class CSSPrimitiveValue;
+class QualifiedName;
+
+enum SVGLengthNegativeValuesMode {
+    AllowNegativeLengths,
+    ForbidNegativeLengths
+};
+
+class SVGLengthValue {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    // FIXME: Once all SVGLengthValue users use Length internally, we make this a wrapper for Length.
+    SVGLengthValue(SVGLengthMode = LengthModeOther, const String& valueAsString = String());
+    SVGLengthValue(const SVGLengthContext&, float, SVGLengthMode = LengthModeOther, SVGLengthType = LengthTypeNumber);
+
+    SVGLengthType unitType() const;
+    SVGLengthMode unitMode() const;
+
+    bool operator==(const SVGLengthValue&) const;
+    bool operator!=(const SVGLengthValue&) const;
+
+    static SVGLengthValue construct(SVGLengthMode, const String&, SVGParsingError&, SVGLengthNegativeValuesMode = AllowNegativeLengths);
+
+    float value(const SVGLengthContext&) const;
+    ExceptionOr<float> valueForBindings(const SVGLengthContext&) const;
+    ExceptionOr<void> setValue(float, const SVGLengthContext&);
+    ExceptionOr<void> setValue(const SVGLengthContext&, float, SVGLengthMode, SVGLengthType);
+
+    float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; }
+    void setValueInSpecifiedUnits(float value) { m_valueInSpecifiedUnits = value; }
+
+    float valueAsPercentage() const;
+
+    String valueAsString() const;
+    ExceptionOr<void> setValueAsString(const String&);
+    ExceptionOr<void> setValueAsString(const String&, SVGLengthMode);
+    
+    ExceptionOr<void> newValueSpecifiedUnits(unsigned short, float valueInSpecifiedUnits);
+    ExceptionOr<void> convertToSpecifiedUnits(unsigned short, const SVGLengthContext&);
+
+    // Helper functions
+    bool isRelative() const
+    {
+        auto type = unitType();
+        return type == LengthTypePercentage || type == LengthTypeEMS || type == LengthTypeEXS;
+    }
+
+    bool isZero() const 
+    {
+        return !m_valueInSpecifiedUnits;
+    }
+
+    static SVGLengthValue fromCSSPrimitiveValue(const CSSPrimitiveValue&);
+    static Ref<CSSPrimitiveValue> toCSSPrimitiveValue(const SVGLengthValue&);
+    static SVGLengthMode lengthModeForAnimatedLengthAttribute(const QualifiedName&);
+
+    SVGLengthValue blend(const SVGLengthValue& from, float progress) const
+    {
+        auto toType = unitType();
+        auto fromType = from.unitType();
+        if ((from.isZero() && isZero())
+            || fromType == LengthTypeUnknown
+            || toType == LengthTypeUnknown
+            || (!from.isZero() && fromType != LengthTypePercentage && toType == LengthTypePercentage)
+            || (!isZero() && fromType == LengthTypePercentage && toType != LengthTypePercentage)
+            || (!from.isZero() && !isZero() && (fromType == LengthTypeEMS || fromType == LengthTypeEXS) && fromType != toType))
+            return *this;
+
+        SVGLengthValue length;
+
+        if (fromType == LengthTypePercentage || toType == LengthTypePercentage) {
+            auto fromPercent = from.valueAsPercentage() * 100;
+            auto toPercent = valueAsPercentage() * 100;
+            auto result = length.newValueSpecifiedUnits(LengthTypePercentage, WebCore::blend(fromPercent, toPercent, progress));
+            if (result.hasException())
+                return { };
+            return length;
+        }
+
+        if (fromType == toType || from.isZero() || isZero() || fromType == LengthTypeEMS || fromType == LengthTypeEXS) {
+            auto fromValue = from.valueInSpecifiedUnits();
+            auto toValue = valueInSpecifiedUnits();
+            if (isZero()) {
+                auto result = length.newValueSpecifiedUnits(fromType, WebCore::blend(fromValue, toValue, progress));
+                if (result.hasException())
+                    return { };
+            } else {
+                auto result = length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue, toValue, progress));
+                if (result.hasException())
+                    return { };
+            }
+            return length;
+        }
+
+        ASSERT(!isRelative());
+        ASSERT(!from.isRelative());
+
+        SVGLengthContext nonRelativeLengthContext(nullptr);
+        auto fromValueInUserUnits = nonRelativeLengthContext.convertValueToUserUnits(from.valueInSpecifiedUnits(), from.unitMode(), fromType);
+        if (fromValueInUserUnits.hasException())
+            return { };
+
+        auto fromValue = nonRelativeLengthContext.convertValueFromUserUnits(fromValueInUserUnits.releaseReturnValue(), unitMode(), toType);
+        if (fromValue.hasException())
+            return { };
+
+        float toValue = valueInSpecifiedUnits();
+        auto result = length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue.releaseReturnValue(), toValue, progress));
+        if (result.hasException())
+            return { };
+        return length;
+    }
+
+private:
+    float m_valueInSpecifiedUnits { 0 };
+    unsigned m_unit;
+};
+
+template<> struct SVGPropertyTraits<SVGLengthValue> {
+    static SVGLengthValue initialValue() { return { }; }
+    static String toString(const SVGLengthValue& type) { return type.valueAsString(); }
+};
+
+TextStream& operator<<(TextStream&, const SVGLengthValue&);
+
+} // namespace WebCore
index 5d431f8..526d7b0 100644 (file)
@@ -24,7 +24,7 @@
 #include "FloatPoint.h"
 #include "RenderSVGPath.h"
 #include "RenderSVGResource.h"
-#include "SVGLength.h"
+#include "SVGLengthValue.h"
 #include "SVGNames.h"
 #include <wtf/NeverDestroyed.h>
 
@@ -81,13 +81,13 @@ void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicStrin
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::x1Attr)
-        setX1BaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setX1BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::y1Attr)
-        setY1BaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setY1BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::x2Attr)
-        setX2BaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setX2BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::y2Attr)
-        setY2BaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setY2BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
 
     reportAttributeParsingError(parseError, name, value);
 
index b9ec24b..86f387a 100644 (file)
@@ -28,9 +28,8 @@
 #include "FloatPoint.h"
 #include "LinearGradientAttributes.h"
 #include "RenderSVGResourceLinearGradient.h"
-#include "SVGLength.h"
+#include "SVGLengthValue.h"
 #include "SVGNames.h"
-#include "SVGTransform.h"
 #include "SVGTransformList.h"
 #include "SVGUnitTypes.h"
 #include <wtf/NeverDestroyed.h>
@@ -85,13 +84,13 @@ void SVGLinearGradientElement::parseAttribute(const QualifiedName& name, const A
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::x1Attr)
-        setX1BaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setX1BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::y1Attr)
-        setY1BaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setY1BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::x2Attr)
-        setX2BaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setX2BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::y2Attr)
-        setY2BaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setY2BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
 
     reportAttributeParsingError(parseError, name, value);
 
index c0aea77..b7fab2d 100644 (file)
@@ -27,6 +27,7 @@
 #include "SVGException.h"
 #include "SVGGraphicsElement.h"
 #include "SVGImageElement.h"
+#include "SVGMatrix.h"
 #include "SVGNames.h"
 
 namespace WebCore {
@@ -97,7 +98,7 @@ AffineTransform SVGLocatable::computeCTM(SVGElement* element, CTMScope mode, Sty
     return ctm;
 }
 
-ExceptionOr<AffineTransform> SVGLocatable::getTransformToElement(SVGElement* target, StyleUpdateStrategy styleUpdateStrategy)
+ExceptionOr<Ref<SVGMatrix>> SVGLocatable::getTransformToElement(SVGElement* target, StyleUpdateStrategy styleUpdateStrategy)
 {
     AffineTransform ctm = getCTM(styleUpdateStrategy);
 
@@ -109,7 +110,7 @@ ExceptionOr<AffineTransform> SVGLocatable::getTransformToElement(SVGElement* tar
             return Exception { SVGException::SVG_MATRIX_NOT_INVERTABLE };
     }
 
-    return WTFMove(ctm);
+    return SVGMatrix::create(ctm);
 }
 
 }
index 410e9b9..acbe7e8 100644 (file)
@@ -28,6 +28,7 @@ namespace WebCore {
 
 class FloatRect;
 class SVGElement;
+class SVGMatrix;
 
 class SVGLocatable {
 public:
@@ -42,7 +43,8 @@ public:
     virtual FloatRect getBBox(StyleUpdateStrategy) = 0;
     virtual AffineTransform getCTM(StyleUpdateStrategy) = 0;
     virtual AffineTransform getScreenCTM(StyleUpdateStrategy) = 0;
-    ExceptionOr<AffineTransform> getTransformToElement(SVGElement*, StyleUpdateStrategy = AllowStyleUpdate);
+
+    ExceptionOr<Ref<SVGMatrix>> getTransformToElement(SVGElement*, StyleUpdateStrategy = AllowStyleUpdate);
 
     static SVGElement* nearestViewportElement(const SVGElement*);
     static SVGElement* farthestViewportElement(const SVGElement*);
index 82bb574..9fc4a7f 100644 (file)
@@ -144,13 +144,13 @@ void SVGMarkerElement::parseAttribute(const QualifiedName& name, const AtomicStr
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::refXAttr)
-        setRefXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setRefXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::refYAttr)
-        setRefYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setRefYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::markerWidthAttr)
-        setMarkerWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setMarkerWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::markerHeightAttr)
-        setMarkerHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setMarkerHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
 
     reportAttributeParsingError(parseError, name, value);
 
index 0ab3f23..80ad6df 100644 (file)
@@ -110,13 +110,13 @@ void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicStrin
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::xAttr)
-        setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::yAttr)
-        setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::widthAttr)
-        setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::heightAttr)
-        setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
 
     reportAttributeParsingError(parseError, name, value);
 
index 69c9f8b..ba02897 100644 (file)
 /*
- * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
  *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #pragma once
 
-#include "AffineTransform.h"
-#include "ExceptionOr.h"
-#include "SVGException.h"
+#include "ExceptionCode.h"
+#include "SVGMatrixValue.h"
+#include "SVGPropertyTearOff.h"
 
 namespace WebCore {
 
-class SVGMatrix final : public AffineTransform {
+class SVGMatrix : public SVGPropertyTearOff<SVGMatrixValue> {
 public:
-    SVGMatrix() { }
-    SVGMatrix(const AffineTransform& other)
-        : AffineTransform(other)
+    static Ref<SVGMatrix> create(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, SVGMatrixValue& value)
+    {
+        ASSERT(animatedProperty);
+        return adoptRef(*new SVGMatrix(animatedProperty, role, value));
+    }
+
+    static Ref<SVGMatrix> create(const SVGMatrixValue& initialValue = { })
+    {
+        return adoptRef(*new SVGMatrix(initialValue));
+    }
+
+    static Ref<SVGMatrix> create(const SVGMatrixValue* initialValue)
+    {
+        return adoptRef(*new SVGMatrix(initialValue));
+    }
+
+    template<typename T> static ExceptionOr<Ref<SVGMatrix>> create(ExceptionOr<T>&& initialValue)
+    {
+        if (initialValue.hasException())
+            return initialValue.releaseException();
+        return create(initialValue.releaseReturnValue());
+    }
+
+    double a()
+    {
+        return propertyReference().a();
+    }
+
+    ExceptionOr<void> setA(double value)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setA(value);
+        commitChange();
+
+        return { };
+    }
+
+    double b()
     {
+        return propertyReference().b();
     }
 
-    SVGMatrix(double a, double b, double c, double d, double e, double f)
-        : AffineTransform(a, b, c, d, e, f)
+    ExceptionOr<void> setB(double value)
     {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setB(value);
+        commitChange();
+
+        return { };
     }
 
-    SVGMatrix translate(double tx, double ty)
+    double c()
     {
-        AffineTransform copy { *this };
-        copy.translate(tx, ty);
-        return SVGMatrix { copy };
+        return propertyReference().c();
     }
 
-    SVGMatrix scale(double s)
+    ExceptionOr<void> setC(double value)
     {
-        AffineTransform copy { *this };
-        copy.scale(s, s);
-        return SVGMatrix { copy };
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setC(value);
+        commitChange();
+
+        return { };
     }
 
-    SVGMatrix scaleNonUniform(double sx, double sy)
+    double d()
     {
-        AffineTransform copy { *this };
-        copy.scale(sx, sy);
-        return SVGMatrix { copy };
+        return propertyReference().d();
     }
 
-    SVGMatrix rotate(double d)
+    ExceptionOr<void> setD(double value)
     {
-        AffineTransform copy { *this };
-        copy.rotate(d);
-        return SVGMatrix { copy };
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setD(value);
+        commitChange();
+
+        return { };
     }
 
-    SVGMatrix flipX()
+    double e()
     {
-        AffineTransform copy { *this };
-        copy.flipX();
-        return SVGMatrix { copy };
+        return propertyReference().e();
     }
 
-    SVGMatrix flipY()
+    ExceptionOr<void> setE(double value)
     {
-        AffineTransform copy { *this };
-        copy.flipY();
-        return SVGMatrix { copy };
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setE(value);
+        commitChange();
+
+        return { };
     }
 
-    SVGMatrix skewX(double angle)
+    double f()
     {
-        AffineTransform copy { *this };
-        copy.skewX(angle);
-        return SVGMatrix { copy };
+        return propertyReference().f();
     }
 
-    SVGMatrix skewY(double angle)
+    ExceptionOr<void> setF(double value)
     {
-        AffineTransform copy { *this };
-        copy.skewY(angle);
-        return SVGMatrix { copy };
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setF(value);
+        commitChange();
+
+        return { };
     }
 
-    SVGMatrix multiply(const SVGMatrix& other)
+    ExceptionOr<Ref<SVGMatrix>> multiply(SVGMatrix& secondMatrix)
     {
-        AffineTransform copy { *this };
-        copy *= static_cast<const AffineTransform&>(other);
-        return SVGMatrix { copy };
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        auto result = propertyReference().multiply(secondMatrix.propertyReference());
+        commitChange();
+
+        return SVGMatrix::create(result);
     }
 
-    ExceptionOr<SVGMatrix> inverse() const
+    ExceptionOr<Ref<SVGMatrix>> inverse()
     {
-        if (auto inverse = AffineTransform::inverse())
-            return SVGMatrix { inverse.value() };
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        auto result = propertyReference().inverse();
+        if (result.hasException())
+            return result.releaseException();
         
-        return Exception { SVGException::SVG_MATRIX_NOT_INVERTABLE };
+        commitChange();
+        return SVGMatrix::create(result.releaseReturnValue());
+    }
+
+    ExceptionOr<Ref<SVGMatrix>> translate(float x, float y)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        auto result = propertyReference().translate(x, y);        
+        commitChange();
+
+        return SVGMatrix::create(result);
     }
 
-    ExceptionOr<SVGMatrix> rotateFromVector(double x, double y)
+    ExceptionOr<Ref<SVGMatrix>> scale(float scaleFactor)
     {
-        if (!x || !y)
-            return Exception { SVGException::SVG_INVALID_VALUE_ERR };
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        auto result = propertyReference().scale(scaleFactor);        
+        commitChange();
 
-        AffineTransform copy { *this };
-        copy.rotateFromVector(x, y);
-        return SVGMatrix { copy };
+        return SVGMatrix::create(result);
     }
 
+    ExceptionOr<Ref<SVGMatrix>> scaleNonUniform(float scaleFactorX, float scaleFactorY)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        auto result = propertyReference().scaleNonUniform(scaleFactorX, scaleFactorY);        
+        commitChange();
+
+        return SVGMatrix::create(result);
+    }
+
+    ExceptionOr<Ref<SVGMatrix>> rotate(float angle)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        auto result = propertyReference().rotate(angle);        
+        commitChange();
+
+        return SVGMatrix::create(result);
+    }
+
+    ExceptionOr<Ref<SVGMatrix>> rotateFromVector(float x, float y)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        auto result = propertyReference().rotateFromVector(x, y);        
+        if (result.hasException())
+            return result.releaseException();
+        
+        commitChange();
+        return SVGMatrix::create(result.releaseReturnValue());
+    }
+
+    ExceptionOr<Ref<SVGMatrix>> flipX()
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        auto result = propertyReference().flipX();        
+        commitChange();
+
+        return SVGMatrix::create(result);
+    }
+
+    ExceptionOr<Ref<SVGMatrix>> flipY()
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        auto result = propertyReference().flipY();        
+        commitChange();
+
+        return SVGMatrix::create(result);
+    }
+
+    ExceptionOr<Ref<SVGMatrix>> skewX(float angle)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        auto result = propertyReference().skewX(angle);        
+        commitChange();
+
+        return SVGMatrix::create(result);
+    }
+
+    ExceptionOr<Ref<SVGMatrix>> skewY(float angle)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        auto result = propertyReference().skewY(angle);        
+        commitChange();
+
+        return SVGMatrix::create(result);
+    }
+
+protected:
+    SVGMatrix(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, SVGMatrixValue& value)
+        : SVGPropertyTearOff<SVGMatrixValue>(animatedProperty, role, value)
+    {
+    }
+
+    explicit SVGMatrix(const SVGMatrixValue& initialValue)
+        : SVGPropertyTearOff<SVGMatrixValue>(initialValue)
+    {
+    }
+
+    explicit SVGMatrix(const SVGMatrixValue* initialValue)
+        : SVGPropertyTearOff<SVGMatrixValue>(initialValue)
+    {
+    }
 };
 
 } // namespace WebCore
index e63ada8..0747eb6 100644 (file)
  * Boston, MA 02110-1301, USA.
  */
 
-interface SVGMatrix {
+[
+    SkipVTableValidation
+] interface SVGMatrix {
     // FIXME: these attributes should all be floats but since we implement
     // AffineTransform with doubles setting these as doubles makes more sense.
-    attribute unrestricted double a;
-    attribute unrestricted double b;
-    attribute unrestricted double c;
-    attribute unrestricted double d;
-    attribute unrestricted double e;
-    attribute unrestricted double f;
+    [SetterMayThrowException] attribute unrestricted double a;
+    [SetterMayThrowException] attribute unrestricted double b;
+    [SetterMayThrowException] attribute unrestricted double c;
+    [SetterMayThrowException] attribute unrestricted double d;
+    [SetterMayThrowException] attribute unrestricted double e;
+    [SetterMayThrowException] attribute unrestricted double f;
 
-    SVGMatrix multiply(SVGMatrix secondMatrix);
+    [MayThrowException] SVGMatrix multiply(SVGMatrix secondMatrix);
     [MayThrowException] SVGMatrix inverse();
-    [Immutable] SVGMatrix translate(unrestricted float x, unrestricted float y);
-    [Immutable] SVGMatrix scale(unrestricted float scaleFactor);
-    [Immutable] SVGMatrix scaleNonUniform(unrestricted float scaleFactorX, unrestricted float scaleFactorY);
-    [Immutable] SVGMatrix rotate(unrestricted float angle);
+    [MayThrowException] SVGMatrix translate(unrestricted float x, unrestricted float y);
+    [MayThrowException] SVGMatrix scale(unrestricted float scaleFactor);
+    [MayThrowException] SVGMatrix scaleNonUniform(unrestricted float scaleFactorX, unrestricted float scaleFactorY);
+    [MayThrowException] SVGMatrix rotate(unrestricted float angle);
     [MayThrowException] SVGMatrix rotateFromVector(unrestricted float x, unrestricted float y);
-    [Immutable] SVGMatrix flipX();
-    [Immutable] SVGMatrix flipY();
-    [Immutable] SVGMatrix skewX(unrestricted float angle);
-    [Immutable] SVGMatrix skewY(unrestricted float angle);
+    [MayThrowException] SVGMatrix flipX();
+    [MayThrowException] SVGMatrix flipY();
+    [MayThrowException] SVGMatrix skewX(unrestricted float angle);
+    [MayThrowException] SVGMatrix skewY(unrestricted float angle);
 };
diff --git a/Source/WebCore/svg/SVGMatrixValue.h b/Source/WebCore/svg/SVGMatrixValue.h
new file mode 100644 (file)
index 0000000..e02244b
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include "AffineTransform.h"
+#include "ExceptionOr.h"
+#include "SVGException.h"
+
+namespace WebCore {
+
+class SVGMatrixValue final : public AffineTransform {
+public:
+    SVGMatrixValue() = default;
+
+    SVGMatrixValue(const AffineTransform& other)
+        : AffineTransform(other)
+    {
+    }
+
+    SVGMatrixValue(double a, double b, double c, double d, double e, double f)
+        : AffineTransform(a, b, c, d, e, f)
+    {
+    }
+
+    SVGMatrixValue translate(double tx, double ty)
+    {
+        AffineTransform copy { *this };
+        copy.translate(tx, ty);
+        return SVGMatrixValue { copy };
+    }
+
+    SVGMatrixValue scale(double s)
+    {
+        AffineTransform copy { *this };
+        copy.scale(s, s);
+        return SVGMatrixValue { copy };
+    }
+
+    SVGMatrixValue scaleNonUniform(double sx, double sy)
+    {
+        AffineTransform copy { *this };
+        copy.scale(sx, sy);
+        return SVGMatrixValue { copy };
+    }
+
+    SVGMatrixValue rotate(double d)
+    {
+        AffineTransform copy { *this };
+        copy.rotate(d);
+        return SVGMatrixValue { copy };
+    }
+
+    SVGMatrixValue flipX()
+    {
+        AffineTransform copy { *this };
+        copy.flipX();
+        return SVGMatrixValue { copy };
+    }
+
+    SVGMatrixValue flipY()
+    {
+        AffineTransform copy { *this };
+        copy.flipY();
+        return SVGMatrixValue { copy };
+    }
+
+    SVGMatrixValue skewX(double angle)
+    {
+        AffineTransform copy { *this };
+        copy.skewX(angle);
+        return SVGMatrixValue { copy };
+    }
+
+    SVGMatrixValue skewY(double angle)
+    {
+        AffineTransform copy { *this };
+        copy.skewY(angle);
+        return SVGMatrixValue { copy };
+    }
+
+    SVGMatrixValue multiply(const SVGMatrixValue& other)
+    {
+        AffineTransform copy { *this };
+        copy *= static_cast<const AffineTransform&>(other);
+        return SVGMatrixValue { copy };
+    }
+
+    ExceptionOr<SVGMatrixValue> inverse() const
+    {
+        if (auto inverse = AffineTransform::inverse())
+            return SVGMatrixValue { inverse.value() };
+        
+        return Exception { SVGException::SVG_MATRIX_NOT_INVERTABLE };
+    }
+
+    ExceptionOr<SVGMatrixValue> rotateFromVector(double x, double y)
+    {
+        if (!x || !y)
+            return Exception { SVGException::SVG_INVALID_VALUE_ERR };
+
+        AffineTransform copy { *this };
+        copy.rotateFromVector(x, y);
+        return SVGMatrixValue { copy };
+    }
+
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/svg/SVGNumber.h b/Source/WebCore/svg/SVGNumber.h
new file mode 100644 (file)
index 0000000..4855258
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "ExceptionCode.h"
+#include "SVGPropertyTearOff.h"
+
+namespace WebCore {
+
+class SVGNumber : public SVGPropertyTearOff<float> {
+public:
+    static Ref<SVGNumber> create(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, float& value)
+    {
+        ASSERT(animatedProperty);
+        return adoptRef(*new SVGNumber(animatedProperty, role, value));
+    }
+
+    static Ref<SVGNumber> create(const float& initialValue = { })
+    {
+        return adoptRef(*new SVGNumber(initialValue));
+    }
+
+    static Ref<SVGNumber> create(const float* initialValue)
+    {
+        return adoptRef(*new SVGNumber(initialValue));
+    }
+
+    template<typename T> static ExceptionOr<Ref<SVGNumber>> create(ExceptionOr<T>&& initialValue)
+    {
+        if (initialValue.hasException())
+            return initialValue.releaseException();
+        return create(initialValue.releaseReturnValue());
+    }
+
+    float valueForBindings()
+    {
+        return propertyReference();
+    }
+
+    ExceptionOr<void> setValueForBindings(float value)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference() = value;
+        commitChange();
+
+        return { };
+    }
+
+private:
+    SVGNumber(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, float& value)
+        : SVGPropertyTearOff<float>(animatedProperty, role, value)
+    {
+    }
+
+    explicit SVGNumber(const float& initialValue)
+        : SVGPropertyTearOff<float>(initialValue)
+    {
+    }
+
+    explicit SVGNumber(const float* initialValue)
+        : SVGPropertyTearOff<float>(initialValue)
+    {
+    }
+};
+
+} // namespace WebCore
index f609037..97ed695 100644 (file)
@@ -21,6 +21,6 @@
  */
 
 interface SVGNumber {
-    attribute unrestricted float value;
+    [SetterMayThrowException, ImplementedAs=valueForBindings] attribute unrestricted float value;
 };
 
index f8f9cbe..46c58f1 100644 (file)
@@ -25,8 +25,7 @@
 
 namespace WebCore {
 
-template<typename T> 
-class SVGPropertyTearOff;
+class SVGNumber;
 
 class SVGNumberList final : public Vector<float> {
 public:
@@ -39,7 +38,7 @@ template<> struct SVGPropertyTraits<SVGNumberList> {
     static String toString(const SVGNumberList& type) { return type.valueAsString(); }
 
     using ListItemType = float;
-    using ListItemTearOff = SVGPropertyTearOff<float>;
+    using ListItemTearOff = SVGNumber;
 };
 
 } // namespace WebCore
index badf88c..15dfd98 100644 (file)
@@ -47,6 +47,7 @@
 #include "SVGPathSegMovetoAbs.h"
 #include "SVGPathSegMovetoRel.h"
 #include "SVGPathUtilities.h"
+#include "SVGPoint.h"
 #include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
@@ -99,11 +100,11 @@ float SVGPathElement::getTotalLength() const
     return totalLength;
 }
 
-SVGPoint SVGPathElement::getPointAtLength(float length) const
+Ref<SVGPoint> SVGPathElement::getPointAtLength(float length) const
 {
-    SVGPoint point;
+    FloatPoint point;
     getPointAtLengthOfSVGPathByteStream(pathByteStream(), length, point);
-    return point;
+    return SVGPoint::create(point);
 }
 
 unsigned SVGPathElement::getPathSegAtLength(float length) const
index 2a382ac..17847c1 100644 (file)
@@ -50,6 +50,7 @@ class SVGPathSegCurvetoCubicSmoothRel;
 class SVGPathSegCurvetoQuadraticSmoothAbs;
 class SVGPathSegCurvetoQuadraticSmoothRel;
 class SVGPathSegListPropertyTearOff;
+class SVGPoint;
 
 class SVGPathElement final : public SVGGraphicsElement,
                              public SVGExternalResourcesRequired {
@@ -57,7 +58,7 @@ public:
     static Ref<SVGPathElement> create(const QualifiedName&, Document&);
     
     float getTotalLength() const;
-    SVGPoint getPointAtLength(float distance) const;
+    Ref<SVGPoint> getPointAtLength(float distance) const;
     unsigned getPathSegAtLength(float distance) const;
 
     Ref<SVGPathSegClosePath> createSVGPathSegClosePath(SVGPathSegRole = PathSegUndefinedRole);
index 34042b5..b4df563 100644 (file)
@@ -28,7 +28,7 @@ interface SVGPathElement : SVGGraphicsElement {
     readonly attribute SVGAnimatedNumber pathLength;
 
     unrestricted float getTotalLength();
-    SVGPoint getPointAtLength(optional unrestricted float distance = NaN);
+    [NewObject] SVGPoint getPointAtLength(optional unrestricted float distance = NaN);
     unsigned long getPathSegAtLength(optional unrestricted float distance = NaN);
 
     SVGPathSegClosePath createSVGPathSegClosePath();
index 5da7e88..de1a0ca 100644 (file)
@@ -66,7 +66,7 @@ float SVGPathTraversalStateBuilder::totalLength() const
     return m_traversalState.totalLength();
 }
 
-SVGPoint SVGPathTraversalStateBuilder::currentPoint() const
+FloatPoint SVGPathTraversalStateBuilder::currentPoint() const
 {
     return m_traversalState.current();
 }
index c74ce67..6bd24d5 100644 (file)
 #pragma once
 
 #include "SVGPathConsumer.h"
-#include "SVGPoint.h"
 
 namespace WebCore {
 
+class FloatPoint;
 class PathTraversalState;
 
 class SVGPathTraversalStateBuilder final : public SVGPathConsumer {
@@ -34,7 +34,7 @@ public:
 
     unsigned pathSegmentIndex() const { return m_segmentIndex; }
     float totalLength() const;
-    SVGPoint currentPoint() const;
+    FloatPoint currentPoint() const;
 
     void incrementPathSegmentCount() final { ++m_segmentIndex; }
     bool continueConsuming() final;
index 1ac7700..757917a 100644 (file)
@@ -21,6 +21,7 @@
 #include "config.h"
 #include "SVGPathUtilities.h"
 
+#include "FloatPoint.h"
 #include "Path.h"
 #include "PathTraversalState.h"
 #include "SVGPathBlender.h"
@@ -192,7 +193,7 @@ bool getTotalLengthOfSVGPathByteStream(const SVGPathByteStream& stream, float& t
     return ok;
 }
 
-bool getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream& stream, float length, SVGPoint& point)
+bool getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream& stream, float length, FloatPoint& point)
 {
     if (stream.isEmpty())
         return false;
index b4de046..7347357 100644 (file)
 #pragma once
 
 #include "SVGPathConsumer.h"
-#include "SVGPoint.h"
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
+class FloatPoint;
 class Path;
 class SVGPathByteStream;
 class SVGPathElement;
@@ -55,6 +55,6 @@ bool addToSVGPathByteStream(SVGPathByteStream& streamToAppendTo, const SVGPathBy
 
 bool getSVGPathSegAtLengthFromSVGPathByteStream(const SVGPathByteStream&, float length, unsigned& pathSeg);
 bool getTotalLengthOfSVGPathByteStream(const SVGPathByteStream&, float& totalLength);
-bool getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream&, float length, SVGPoint&);
+bool getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream&, float length, FloatPoint&);
 
 } // namespace WebCore
index e97a602..4ef0dbb 100644 (file)
@@ -133,13 +133,13 @@ void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicSt
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::xAttr)
-        setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::yAttr)
-        setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::widthAttr)
-        setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
+        setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
     else if (name == SVGNames::heightAttr)
-        setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
+        setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
 
     reportAttributeParsingError(parseError, name, value);
 
index 02f12ff..23adf2a 100644 (file)
 
 #pragma once
 
+#include "ExceptionCode.h"
 #include "FloatPoint.h"
+#include "SVGMatrix.h"
+#include "SVGPropertyTearOff.h"
 
 namespace WebCore {
 
-typedef FloatPoint SVGPoint;
+class SVGPoint : public SVGPropertyTearOff<FloatPoint> {
+public:
+    static Ref<SVGPoint> create(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, FloatPoint& value)
+    {
+        ASSERT(animatedProperty);
+        return adoptRef(*new SVGPoint(animatedProperty, role, value));
+    }
+
+    static Ref<SVGPoint> create(const FloatPoint& initialValue = { })
+    {
+        return adoptRef(*new SVGPoint(initialValue));
+    }
+
+    static Ref<SVGPoint> create(const FloatPoint* initialValue)
+    {
+        return adoptRef(*new SVGPoint(initialValue));
+    }
+
+    template<typename T> static ExceptionOr<Ref<SVGPoint>> create(ExceptionOr<T>&& initialValue)
+    {
+        if (initialValue.hasException())
+            return initialValue.releaseException();
+        return create(initialValue.releaseReturnValue());
+    }
+
+    float x()
+    {
+        return propertyReference().x();
+    }
+
+    ExceptionOr<void> setX(float xValue)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setX(xValue);
+        commitChange();
+
+        return { };
+    }
+
+    float y()
+    {
+        return propertyReference().y();
+    }
+
+    ExceptionOr<void> setY(float xValue)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setY(xValue);
+        commitChange();
+
+        return { };
+    }
+
+    ExceptionOr<Ref<SVGPoint>> matrixTransform(SVGMatrix& matrix)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        auto newPoint = propertyReference().matrixTransform(matrix.propertyReference());
+        commitChange();
+
+        return SVGPoint::create(newPoint);
+    }
+
+protected:
+    SVGPoint(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, FloatPoint& value)
+        : SVGPropertyTearOff<FloatPoint>(animatedProperty, role, value)
+    {
+    }
+
+    explicit SVGPoint(const FloatPoint& initialValue)
+        : SVGPropertyTearOff<FloatPoint>(initialValue)
+    {
+    }
+
+    explicit SVGPoint(const FloatPoint* initialValue)
+        : SVGPropertyTearOff<FloatPoint>(initialValue)
+    {
+    }
+};
 
 } // namespace WebCore
index 6cdbacc..135cded 100644 (file)
  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
+[
+    SkipVTableValidation
+] interface SVGPoint {
+    [SetterMayThrowException] attribute unrestricted float x;
+    [SetterMayThrowException] attribute unrestricted float y;
 
-interface SVGPoint {
-    attribute unrestricted float x;
-    attribute unrestricted float y;
-
-    SVGPoint matrixTransform(SVGMatrix matrix);
+    [MayThrowException, NewObject] SVGPoint matrixTransform(SVGMatrix matrix);
 };
 
index de511c0..f0843c0 100644 (file)
@@ -35,7 +35,7 @@ String SVGPointList::valueAsString() const
         if (i > 0)
             builder.append(' '); // FIXME: Shouldn't we use commas to seperate?
 
-        const SVGPoint& point = at(i);
+        const auto& point = at(i);
         builder.appendNumber(point.x());
         builder.append(' ');
         builder.appendNumber(point.y());
index 0d99e1b..8ae2a69 100644 (file)
 
 #pragma once
 
-#include "SVGPoint.h"
+#include "FloatPoint.h"
 #include "SVGPropertyTraits.h"
 #include <wtf/Vector.h>
 
 namespace WebCore {
 
-template<typename T> 
-class SVGPropertyTearOff;
+class SVGPoint;
 
-class SVGPointList final : public Vector<SVGPoint> {
+class SVGPointList final : public Vector<FloatPoint> {
 public:
     String valueAsString() const;
 };
@@ -37,8 +36,8 @@ public:
 template<> struct SVGPropertyTraits<SVGPointList> {
     static SVGPointList initialValue() { return SVGPointList(); }
 
-    using ListItemType = SVGPoint;
-    using ListItemTearOff = SVGPropertyTearOff<SVGPoint>;
+    using ListItemType = FloatPoint;
+    using ListItemTearOff = SVGPoint;
 };
 
 } // namespace WebCore
index df32a5c..6acb8ce 100644 (file)
 #include "SVGPolyElement.h"
 
 #include "Document.h"
-#include "FloatPoint.h"
 #include "RenderSVGPath.h"
 #include "RenderSVGResource.h"
 #include "SVGAnimatedPointList.h"
 #include "SVGNames.h"
 #include "SVGParserUtilities.h"
+#include "SVGPoint.h"
 
 namespace WebCore {
 
index c9c529d..6fe5640 100644 (file)
@@ -30,7 +30,6 @@
 #include "RenderSVGResourceRadialGradient.h"
 #include "SVGNames.h"
 #include "SVGStopElement.h"
-#include "SVGTransform.h"
 #include "SVGTransformList.h"
 #include "SVGUnitTypes.h"
 #include <wtf/NeverDestroyed.h>
@@ -93,17 +92,17 @@ void SVGRadialGradientElement::parseAttribute(const QualifiedName& name, const A
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::cxAttr)
-        setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setCxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::cyAttr)
-        setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setCyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::rAttr)
-        setRBaseValue(SVGLength::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
+        setRBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
     else if (name == SVGNames::fxAttr)
-        setFxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setFxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::fyAttr)
-        setFyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setFyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::frAttr)
-        setFrBaseValue(SVGLength::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
+        setFrBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
 
     reportAttributeParsingError(parseError, name, value);
 
index 3a1452a..4bc95e1 100644 (file)
 
 #pragma once
 
-#include "FloatRect.h"
-#include "SVGPropertyTraits.h"
-#include <wtf/text/StringBuilder.h>
+#include "SVGPropertyTearOff.h"
+#include "SVGRectTraits.h"
 
 namespace WebCore {
 
-template<>
-struct SVGPropertyTraits<FloatRect> {
-    static FloatRect initialValue() { return FloatRect(); }
-    static String toString(const FloatRect& type)
-    {
-        StringBuilder builder;
-        builder.appendNumber(type.x());
-        builder.append(' ');
-        builder.appendNumber(type.y());
-        builder.append(' ');
-        builder.appendNumber(type.width());
-        builder.append(' ');
-        builder.appendNumber(type.height());
-        return builder.toString();
+class SVGRect : public SVGPropertyTearOff<FloatRect> {
+public:
+    static Ref<SVGRect> create(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, FloatRect& value)
+    {
+        ASSERT(animatedProperty);
+        return adoptRef(*new SVGRect(animatedProperty, role, value));
+    }
+
+    static Ref<SVGRect> create(const FloatRect& initialValue = { })
+    {
+        return adoptRef(*new SVGRect(initialValue));
+    }
+
+    static Ref<SVGRect> create(const FloatRect* initialValue)
+    {
+        return adoptRef(*new SVGRect(initialValue));
+    }
+
+    template<typename T> static ExceptionOr<Ref<SVGRect>> create(ExceptionOr<T>&& initialValue)
+    {
+        if (initialValue.hasException())
+            return initialValue.releaseException();
+        return create(initialValue.releaseReturnValue());
+    }
+
+    float x()
+    {
+        return propertyReference().x();
+    }
+
+    ExceptionOr<void> setX(float xValue)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setX(xValue);
+        commitChange();
+
+        return { };
+    }
+
+    float y()
+    {
+        return propertyReference().y();
+    }
+
+    ExceptionOr<void> setY(float xValue)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setY(xValue);
+        commitChange();
+
+        return { };
+    }
+
+    float width()
+    {
+        return propertyReference().width();
+    }
+
+    ExceptionOr<void> setWidth(float widthValue)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setWidth(widthValue);
+        commitChange();
+
+        return { };
+    }
+
+    float height()
+    {
+        return propertyReference().height();
+    }
+
+    ExceptionOr<void> setHeight(float heightValue)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setHeight(heightValue);
+        commitChange();
+
+        return { };
+    }
+
+private:
+    SVGRect(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, FloatRect& value)
+        : SVGPropertyTearOff<FloatRect>(animatedProperty, role, value)
+    {
+    }
+
+    explicit SVGRect(const FloatRect& initialValue)
+        : SVGPropertyTearOff<FloatRect>(initialValue)
+    {
+    }
+
+    explicit SVGRect(const FloatRect* initialValue)
+        : SVGPropertyTearOff<FloatRect>(initialValue)
+    {
     }
 };
 
+
 } // namespace WebCore
index 729e163..395a7f5 100644 (file)
@@ -21,9 +21,9 @@
  */
 
 interface SVGRect {
-    attribute unrestricted float x;
-    attribute unrestricted float y;
-    attribute unrestricted float width;
-    attribute unrestricted float height;
+    [SetterMayThrowException] attribute unrestricted float x;
+    [SetterMayThrowException] attribute unrestricted float y;
+    [SetterMayThrowException] attribute unrestricted float width;
+    [SetterMayThrowException] attribute unrestricted float height;
 };
 
index 4f43902..06399a0 100644 (file)
@@ -25,7 +25,7 @@
 #include "RenderSVGPath.h"
 #include "RenderSVGRect.h"
 #include "RenderSVGResource.h"
-#include "SVGLength.h"
+#include "SVGLengthValue.h"
 #include "SVGNames.h"
 
 namespace WebCore {
@@ -73,17 +73,17 @@ void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::xAttr)
-        setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::yAttr)
-        setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::rxAttr)
-        setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
+        setRxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
     else if (name == SVGNames::ryAttr)
-        setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
+        setRyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
     else if (name == SVGNames::widthAttr)
-        setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
+        setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
     else if (name == SVGNames::heightAttr)
-        setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
+        setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
 
     reportAttributeParsingError(parseError, name, value);
 
diff --git a/Source/WebCore/svg/SVGRectTraits.h b/Source/WebCore/svg/SVGRectTraits.h
new file mode 100644 (file)
index 0000000..7d84c6e
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "FloatRect.h"
+#include "SVGPropertyTraits.h"
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+template<>
+struct SVGPropertyTraits<FloatRect> {
+    static FloatRect initialValue() { return { }; }
+    static String toString(const FloatRect& type)
+    {
+        StringBuilder builder;
+        builder.appendNumber(type.x());
+        builder.append(' ');
+        builder.appendNumber(type.y());
+        builder.append(' ');
+        builder.appendNumber(type.width());
+        builder.append(' ');
+        builder.appendNumber(type.height());
+        return builder.toString();
+    }
+};
+
+} // namespace WebCore
index e225787..f8a47c3 100644 (file)
 #include "RenderView.h"
 #include "SMILTimeContainer.h"
 #include "SVGAngle.h"
+#include "SVGLength.h"
+#include "SVGMatrix.h"
+#include "SVGNumber.h"
+#include "SVGPoint.h"
+#include "SVGRect.h"
+#include "SVGStaticPropertyTearOff.h"
+#include "SVGTransform.h"
 #include "SVGViewElement.h"
 #include "SVGViewSpec.h"
 #include "StaticNodeList.h"
@@ -123,10 +130,10 @@ void SVGSVGElement::setContentStyleType(const AtomicString& type)
     setAttributeWithoutSynchronization(SVGNames::contentStyleTypeAttr, type);
 }
 
-FloatRect SVGSVGElement::viewport() const
+Ref<SVGRect> SVGSVGElement::viewport() const
 {
     // FIXME: Not implemented.
-    return { };
+    return SVGRect::create();
 }
 
 float SVGSVGElement::pixelUnitToMillimeterX() const
@@ -182,6 +189,11 @@ void SVGSVGElement::setCurrentScale(float scale)
         frame->setPageZoomFactor(scale);
 }
 
+Ref<SVGPoint> SVGSVGElement::currentTranslate()
+{
+    return SVGStaticPropertyTearOff<SVGSVGElement, SVGPoint>::create(*this, m_currentTranslate, &SVGSVGElement::updateCurrentTranslate);
+}
+
 void SVGSVGElement::setCurrentTranslate(const FloatPoint& translation)
 {
     if (m_currentTranslate == translation)
@@ -236,23 +248,23 @@ void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::xAttr)
-        setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+        setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::yAttr)
-        setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+        setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     else if (name == SVGNames::widthAttr) {
-        SVGLength length = SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths);
+        auto length = SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths);
         if (parseError != NoError || value.isEmpty()) {
             // FIXME: This is definitely the correct behavior for a missing/removed attribute.
             // Not sure it's correct for the empty string or for something that can't be parsed.
-            length = SVGLength(LengthModeWidth, ASCIILiteral("100%"));
+            length = SVGLengthValue(LengthModeWidth, ASCIILiteral("100%"));
         }
         setWidthBaseValue(length);
     } else if (name == SVGNames::heightAttr) {
-        SVGLength length = SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths);
+        auto length = SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths);
         if (parseError != NoError || value.isEmpty()) {
             // FIXME: This is definitely the correct behavior for a removed attribute.
             // Not sure it's correct for the empty string or for something that can't be parsed.
-            length = SVGLength(LengthModeHeight, ASCIILiteral("100%"));
+            length = SVGLengthValue(LengthModeHeight, ASCIILiteral("100%"));
         }
         setHeightBaseValue(length);
     }
@@ -310,7 +322,7 @@ void SVGSVGElement::forceRedraw()
 {
 }
 
-Ref<NodeList> SVGSVGElement::collectIntersectionOrEnclosureList(const FloatRect& rect, SVGElement* referenceElement, bool (*checkFunction)(const SVGElement*, const FloatRect&))
+Ref<NodeList> SVGSVGElement::collectIntersectionOrEnclosureList(SVGRect& rect, SVGElement* referenceElement, bool (*checkFunction)(const SVGElement*, SVGRect&))
 {
     Vector<Ref<Element>> elements;
     for (auto& element : descendantsOfType<SVGElement>(referenceElement ? *referenceElement : *this)) {
@@ -320,24 +332,24 @@ Ref<NodeList> SVGSVGElement::collectIntersectionOrEnclosureList(const FloatRect&
     return StaticElementList::create(WTFMove(elements));
 }
 
-Ref<NodeList> SVGSVGElement::getIntersectionList(const FloatRect& rect, SVGElement* referenceElement)
+Ref<NodeList> SVGSVGElement::getIntersectionList(SVGRect& rect, SVGElement* referenceElement)
 {
     return collectIntersectionOrEnclosureList(rect, referenceElement, checkIntersection);
 }
 
-Ref<NodeList> SVGSVGElement::getEnclosureList(const FloatRect& rect, SVGElement* referenceElement)
+Ref<NodeList> SVGSVGElement::getEnclosureList(SVGRect& rect, SVGElement* referenceElement)
 {
     return collectIntersectionOrEnclosureList(rect, referenceElement, checkEnclosure);
 }
 
-bool SVGSVGElement::checkIntersection(const SVGElement* element, const FloatRect& rect)
+bool SVGSVGElement::checkIntersection(const SVGElement* element, SVGRect& rect)
 {
-    return element && RenderSVGModelObject::checkIntersection(element->renderer(), rect);
+    return element && RenderSVGModelObject::checkIntersection(element->renderer(), rect.propertyReference());
 }
 
-bool SVGSVGElement::checkEnclosure(const SVGElement* element, const FloatRect& rect)
+bool SVGSVGElement::checkEnclosure(const SVGElement* element, SVGRect& rect)
 {
-    return element && RenderSVGModelObject::checkEnclosure(element->renderer(), rect);
+    return element && RenderSVGModelObject::checkEnclosure(element->renderer(), rect.propertyReference());
 }
 
 void SVGSVGElement::deselectAll()
@@ -346,9 +358,14 @@ void SVGSVGElement::deselectAll()
         frame->selection().clear();
 }
 
-SVGLength SVGSVGElement::createSVGLength()
+Ref<SVGNumber> SVGSVGElement::createSVGNumber()
+{
+    return SVGNumber::create();
+}
+
+Ref<SVGLength> SVGSVGElement::createSVGLength()
 {
-    return { };
+    return SVGLength::create();
 }
 
 Ref<SVGAngle> SVGSVGElement::createSVGAngle()
@@ -356,29 +373,29 @@ Ref<SVGAngle> SVGSVGElement::createSVGAngle()
     return SVGAngle::create();
 }
 
-SVGPoint SVGSVGElement::createSVGPoint()
+Ref<SVGPoint> SVGSVGElement::createSVGPoint()
 {
-    return { };
+    return SVGPoint::create();
 }
 
-SVGMatrix SVGSVGElement::createSVGMatrix()
+Ref<SVGMatrix> SVGSVGElement::createSVGMatrix()
 {
-    return { };
+    return SVGMatrix::create();
 }
 
-FloatRect SVGSVGElement::createSVGRect()
+Ref<SVGRect> SVGSVGElement::createSVGRect()
 {
-    return { };
+    return SVGRect::create();
 }
 
-SVGTransform SVGSVGElement::createSVGTransform()
+Ref<SVGTransform> SVGSVGElement::createSVGTransform()
 {
-    return SVGTransform::SVG_TRANSFORM_MATRIX;
+    return SVGTransform::create(SVGTransformValue { SVGTransformValue::SVG_TRANSFORM_MATRIX });
 }
 
-SVGTransform SVGSVGElement::createSVGTransformFromMatrix(const SVGMatrix& matrix)
+Ref<SVGTransform> SVGSVGElement::createSVGTransformFromMatrix(SVGMatrix& matrix)
 {
-    return SVGTransform { matrix };
+    return SVGTransform::create(SVGTransformValue { matrix.propertyReference() });
 }
 
 AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const
index a3eaf89..549e3bf 100644 (file)
@@ -21,6 +21,7 @@
 
 #pragma once
 
+#include "FloatPoint.h"
 #include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedLength.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
 
 namespace WebCore {
 
+class SMILTimeContainer;
 class SVGAngle;
+class SVGLength;
+class SVGMatrix;
+class SVGNumber;
+class SVGRect;
+class SVGTransform;
 class SVGViewSpec;
-class SMILTimeContainer;
 
 class SVGSVGElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired, public SVGFitToViewBox, public SVGZoomAndPan {
 
@@ -55,7 +61,7 @@ public: // DOM
     const AtomicString& contentStyleType() const;
     void setContentStyleType(const AtomicString&);
 
-    FloatRect viewport() const;
+    Ref<SVGRect> viewport() const;
 
     float pixelUnitToMillimeterX() const;
     float pixelUnitToMillimeterY() const;
@@ -68,7 +74,8 @@ public: // DOM
     float currentScale() const;
     void setCurrentScale(float);
 
-    SVGPoint& currentTranslate();
+    Ref<SVGPoint> currentTranslate();
+    FloatPoint currentTranslateValue();
 
     unsigned suspendRedraw(unsigned maxWaitMilliseconds);
     void unsuspendRedraw(unsigned suspendHandleId);
@@ -82,20 +89,20 @@ public: // DOM
     float getCurrentTime() const;
     void setCurrentTime(float);
 
-    Ref<NodeList> getIntersectionList(const FloatRect&, SVGElement* referenceElement);
-    Ref<NodeList> getEnclosureList(const FloatRect&, SVGElement* referenceElement);
-    static bool checkIntersection(const SVGElement*, const FloatRect&);
-    static bool checkEnclosure(const SVGElement*, const FloatRect&);
+    Ref<NodeList> getIntersectionList(SVGRect&, SVGElement* referenceElement);
+    Ref<NodeList> getEnclosureList(SVGRect&, SVGElement* referenceElement);
+    static bool checkIntersection(const SVGElement*, SVGRect&);
+    static bool checkEnclosure(const SVGElement*, SVGRect&);
     void deselectAll();
 
-    static float createSVGNumber();
-    static SVGLength createSVGLength();
+    static Ref<SVGNumber> createSVGNumber();
+    static Ref<SVGLength> createSVGLength();
     static Ref<SVGAngle> createSVGAngle();
-    static SVGPoint createSVGPoint();
-    static SVGMatrix createSVGMatrix();
-    static FloatRect createSVGRect();
-    static SVGTransform createSVGTransform();
-    static SVGTransform createSVGTransformFromMatrix(const SVGMatrix&);
+    static Ref<SVGPoint> createSVGPoint();
+    static Ref<SVGMatrix> createSVGMatrix();
+    static Ref<SVGRect> createSVGRect();
+    static Ref<SVGTransform> createSVGTransform();
+    static Ref<SVGTransform> createSVGTransformFromMatrix(SVGMatrix&);
 
     Element* getElementById(const AtomicString&);
 
@@ -145,12 +152,12 @@ private:
 
     Frame* frameForCurrentScale() const;
     void inheritViewAttributes(const SVGViewElement&);
-    Ref<NodeList> collectIntersectionOrEnclosureList(const FloatRect&, SVGElement*, bool (*checkFunction)(const SVGElement*, const FloatRect&));
+    Ref<NodeList> collectIntersectionOrEnclosureList(SVGRect&, SVGElement*, bool (*checkFunction)(const SVGElement*, SVGRect&));
 
     bool m_useCurrentView { false };
     SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify };
     Ref<SMILTimeContainer> m_timeContainer;
-    SVGPoint m_currentTranslate;
+    FloatPoint m_currentTranslate;
     RefPtr<SVGViewSpec> m_viewSpec;
 };
 
@@ -159,7 +166,7 @@ inline bool SVGSVGElement::useCurrentView() const
     return m_useCurrentView;
 }
 
-inline SVGPoint& SVGSVGElement::currentTranslate()
+inline FloatPoint SVGSVGElement::currentTranslateValue()
 {
     return m_currentTranslate;
 }
@@ -184,9 +191,4 @@ inline bool SVGSVGElement::hasEmptyViewBox() const
     return viewBoxIsValid() && viewBox().isEmpty();
 }
 
-inline float SVGSVGElement::createSVGNumber()
-{
-    return 0;
-}
-
 } // namespace WebCore
index a7ed792..e665d47 100644 (file)
@@ -31,7 +31,7 @@ interface SVGSVGElement : SVGGraphicsElement {
     readonly attribute SVGAnimatedLength height;
     attribute DOMString contentScriptType;
     attribute DOMString contentStyleType;
-    readonly attribute SVGRect viewport;
+    [NewObject] readonly attribute SVGRect viewport;
     readonly attribute unrestricted float pixelUnitToMillimeterX;
     readonly attribute unrestricted float pixelUnitToMillimeterY;
     readonly attribute unrestricted float screenPixelToMillimeterX;
@@ -39,7 +39,7 @@ interface SVGSVGElement : SVGGraphicsElement {
     readonly attribute boolean useCurrentView;
     readonly attribute SVGViewSpec currentView;
     attribute unrestricted float currentScale;
-    readonly attribute SVGPoint currentTranslate;
+    [NewObject] readonly attribute SVGPoint currentTranslate;
 
     unsigned long suspendRedraw(optional unsigned long maxWaitMilliseconds = 0);
     void unsuspendRedraw(optional unsigned long suspendHandleId = 0);
@@ -62,14 +62,14 @@ interface SVGSVGElement : SVGGraphicsElement {
 
     void deselectAll();
 
-    SVGNumber createSVGNumber();
-    SVGLength createSVGLength();
+    [NewObject] SVGNumber createSVGNumber();
+    [NewObject] SVGLength createSVGLength();
     [NewObject] SVGAngle createSVGAngle();
-    SVGPoint createSVGPoint();
-    SVGMatrix createSVGMatrix();
-    SVGRect createSVGRect();
-    SVGTransform createSVGTransform();
-    SVGTransform createSVGTransformFromMatrix(SVGMatrix matrix);
+    [NewObject] SVGPoint createSVGPoint();
+    [NewObject] SVGMatrix createSVGMatrix();
+    [NewObject] SVGRect createSVGRect();
+    [NewObject] SVGTransform createSVGTransform();
+    [NewObject] SVGTransform createSVGTransformFromMatrix(SVGMatrix matrix);
 
     Element getElementById([RequiresExistingAtomicString] DOMString elementId);
 };
index 213bd7a..12f1dcb 100644 (file)
@@ -30,6 +30,8 @@
 #include "RenderSVGText.h"
 #include "SVGDocumentExtensions.h"
 #include "SVGNames.h"
+#include "SVGPoint.h"
+#include "SVGRect.h"
 #include "SVGTextQuery.h"
 #include "XMLNames.h"
 #include <wtf/NeverDestroyed.h>
@@ -77,7 +79,7 @@ void SVGTextContentElement::synchronizeTextLength(SVGElement* contextElement)
     SVGTextContentElement& ownerType = downcast<SVGTextContentElement>(*contextElement);
     if (!ownerType.m_textLength.shouldSynchronize)
         return;
-    AtomicString value(SVGPropertyTraits<SVGLength>::toString(ownerType.m_specifiedTextLength));
+    AtomicString value(SVGPropertyTraits<SVGLengthValue>::toString(ownerType.m_specifiedTextLength));
     ownerType.m_textLength.synchronize(&ownerType, textLengthPropertyInfo()->attributeName, value);
 }
 
@@ -85,13 +87,13 @@ Ref<SVGAnimatedProperty> SVGTextContentElement::lookupOrCreateTextLengthWrapper(
 {
     ASSERT(contextElement);
     SVGTextContentElement& ownerType = downcast<SVGTextContentElement>(*contextElement);
-    return SVGAnimatedProperty::lookupOrCreateWrapper<SVGTextContentElement, SVGAnimatedLength, SVGLength>
+    return SVGAnimatedProperty::lookupOrCreateWrapper<SVGTextContentElement, SVGAnimatedLength, SVGLengthValue>
         (&ownerType, textLengthPropertyInfo(), ownerType.m_textLength.value);
 }
 
 Ref<SVGAnimatedLength> SVGTextContentElement::textLengthAnimated()
 {
-    static NeverDestroyed<SVGLength> defaultTextLength(LengthModeOther);
+    static NeverDestroyed<SVGLengthValue> defaultTextLength(LengthModeOther);
     if (m_specifiedTextLength == defaultTextLength)
         m_textLength.value.newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength());
 
@@ -121,28 +123,28 @@ ExceptionOr<float> SVGTextContentElement::getSubStringLength(unsigned charnum, u
     return SVGTextQuery(renderer()).subStringLength(charnum, nchars);
 }
 
-ExceptionOr<SVGPoint> SVGTextContentElement::getStartPositionOfChar(unsigned charnum)
+ExceptionOr<Ref<SVGPoint>> SVGTextContentElement::getStartPositionOfChar(unsigned charnum)
 {
     if (charnum > getNumberOfChars())
         return Exception { INDEX_SIZE_ERR };
 
-    return SVGTextQuery(renderer()).startPositionOfCharacter(charnum);
+    return SVGPoint::create(SVGTextQuery(renderer()).startPositionOfCharacter(charnum));
 }
 
-ExceptionOr<SVGPoint> SVGTextContentElement::getEndPositionOfChar(unsigned charnum)
+ExceptionOr<Ref<SVGPoint>> SVGTextContentElement::getEndPositionOfChar(unsigned charnum)
 {
     if (charnum > getNumberOfChars())
         return Exception { INDEX_SIZE_ERR };
 
-    return SVGTextQuery(renderer()).endPositionOfCharacter(charnum);
+    return SVGPoint::create(SVGTextQuery(renderer()).endPositionOfCharacter(charnum));
 }
 
-ExceptionOr<FloatRect> SVGTextContentElement::getExtentOfChar(unsigned charnum)
+ExceptionOr<Ref<SVGRect>> SVGTextContentElement::getExtentOfChar(unsigned charnum)
 {
     if (charnum > getNumberOfChars())
         return Exception { INDEX_SIZE_ERR };
 
-    return SVGTextQuery(renderer()).extentOfCharacter(charnum);
+    return SVGRect::create(SVGTextQuery(renderer()).extentOfCharacter(charnum));
 }
 
 ExceptionOr<float> SVGTextContentElement::getRotationOfChar(unsigned charnum)
@@ -153,10 +155,10 @@ ExceptionOr<float> SVGTextContentElement::getRotationOfChar(unsigned charnum)
     return SVGTextQuery(renderer()).rotationOfCharacter(charnum);
 }
 
-int SVGTextContentElement::getCharNumAtPosition(const SVGPoint& point)
+int SVGTextContentElement::getCharNumAtPosition(SVGPoint& point)
 {
     document().updateLayoutIgnorePendingStylesheets();
-    return SVGTextQuery(renderer()).characterNumberAtPosition(point);
+    return SVGTextQuery(renderer()).characterNumberAtPosition(point.propertyReference());
 }
 
 ExceptionOr<void> SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars)
@@ -227,7 +229,7 @@ void SVGTextContentElement::parseAttribute(const QualifiedName& name, const Atom
         if (propertyValue > 0)
             setLengthAdjustBaseValue(propertyValue);
     } else if (name == SVGNames::textLengthAttr)
-        m_textLength.value = SVGLength::construct(LengthModeOther, value, parseError, ForbidNegativeLengths);
+        m_textLength.value = SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths);
 
     reportAttributeParsingError(parseError, name, value);
 
index 2a15b56..7d2cb1b 100644 (file)
@@ -73,18 +73,18 @@ public:
     unsigned getNumberOfChars();
     float getComputedTextLength();
     ExceptionOr<float> getSubStringLength(unsigned charnum, unsigned nchars);
-    ExceptionOr<SVGPoint> getStartPositionOfChar(unsigned charnum);
-    ExceptionOr<SVGPoint> getEndPositionOfChar(unsigned charnum);
-    ExceptionOr<FloatRect> getExtentOfChar(unsigned charnum);
+    ExceptionOr<Ref<SVGPoint>> getStartPositionOfChar(unsigned charnum);
+    ExceptionOr<Ref<SVGPoint>> getEndPositionOfChar(unsigned charnum);
+    ExceptionOr<Ref<SVGRect>> getExtentOfChar(unsigned charnum);
     ExceptionOr<float> getRotationOfChar(unsigned charnum);
-    int getCharNumAtPosition(const SVGPoint&);
+    int getCharNumAtPosition(SVGPoint&);
     ExceptionOr<void> selectSubString(unsigned charnum, unsigned nchars);
 
     static SVGTextContentElement* elementFromRenderer(RenderObject*);
 
     // textLength is not declared using the standard DECLARE_ANIMATED_LENGTH macro
     // as its getter needs special handling (return getComputedTextLength(), instead of m_textLength).
-    SVGLength& specifiedTextLength() { return m_specifiedTextLength; }
+    SVGLengthValue& specifiedTextLength() { return m_specifiedTextLength; }
     Ref<SVGAnimatedLength> textLengthAnimated();
     static const SVGPropertyInfo* textLengthPropertyInfo();
 
@@ -108,8 +108,8 @@ private:
     // Custom 'textLength' property
     static void synchronizeTextLength(SVGElement* contextElement);
     static Ref<SVGAnimatedProperty> lookupOrCreateTextLengthWrapper(SVGElement* contextElement);
-    mutable SVGSynchronizableAnimatedProperty<SVGLength> m_textLength;
-    SVGLength m_specifiedTextLength;
+    mutable SVGSynchronizableAnimatedProperty<SVGLengthValue> m_textLength;
+    SVGLengthValue m_specifiedTextLength;
   
     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextContentElement)
         DECLARE_ANIMATED_ENUMERATION(LengthAdjust, lengthAdjust, SVGLengthAdjustType)
index 9e795fd..629e8ab 100644 (file)
@@ -35,9 +35,9 @@ interface SVGTextContentElement : SVGGraphicsElement {
     long getNumberOfChars();
     unrestricted float getComputedTextLength();
     [MayThrowException] unrestricted float getSubStringLength(optional unsigned long offset = 0, optional unsigned long length = 0);
-    [MayThrowException] SVGPoint getStartPositionOfChar(optional unsigned long offset = 0);
-    [MayThrowException] SVGPoint getEndPositionOfChar(optional unsigned long offset = 0);
-    [MayThrowException] SVGRect getExtentOfChar(optional unsigned long offset = 0);
+    [MayThrowException, NewObject] SVGPoint getStartPositionOfChar(optional unsigned long offset = 0);
+    [MayThrowException, NewObject] SVGPoint getEndPositionOfChar(optional unsigned long offset = 0);
+    [MayThrowException, NewObject] SVGRect getExtentOfChar(optional unsigned long offset = 0);
     [MayThrowException] unrestricted float getRotationOfChar(optional unsigned long offset = 0);
     long getCharNumAtPosition(SVGPoint point);
     [MayThrowException] void selectSubString(optional unsigned long offset = 0, optional unsigned long length = 0);
index 8f2d2b0..92f8223 100644 (file)
@@ -85,7 +85,7 @@ void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicS
     SVGParsingError parseError = NoError;
 
     if (name == SVGNames::startOffsetAttr)
-        setStartOffsetBaseValue(SVGLength::construct(LengthModeOther, value, parseError));
+        setStartOffsetBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError));
     else if (name == SVGNames::methodAttr) {
         SVGTextPathMethodType propertyValue = SVGPropertyTraits<SVGTextPathMethodType>::fromString(value);
         if (propertyValue > 0)
index 3335ca0..5903794 100644 (file)
 /*
- * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
  *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "config.h"
 #include "SVGTransform.h"
 
-#include "FloatConversion.h"
-#include "FloatPoint.h"
-#include "FloatSize.h"
-#include <wtf/MathExtras.h>
-#include <wtf/NeverDestroyed.h>
-#include <wtf/text/StringBuilder.h>
-#include <wtf/text/WTFString.h>
+#include "SVGMatrixTearOff.h"
 
 namespace WebCore {
 
-SVGTransform::SVGTransform()
-    : m_type(SVG_TRANSFORM_UNKNOWN)
-    , m_angle(0)
-{
-}
-
-SVGTransform::SVGTransform(SVGTransformType type, ConstructionMode mode)
-    : m_type(type)
-    , m_angle(0)
-{
-    if (mode == ConstructZeroTransform)
-        m_matrix = AffineTransform(0, 0, 0, 0, 0, 0);
-}
-
-SVGTransform::SVGTransform(const AffineTransform& matrix)
-    : m_type(SVG_TRANSFORM_MATRIX)
-    , m_angle(0)
-    , m_matrix(matrix)
-{
-}
-
-void SVGTransform::setMatrix(const AffineTransform& matrix)
-{
-    m_type = SVG_TRANSFORM_MATRIX;
-    m_angle = 0;
-    m_matrix = matrix;
-}
-
-void SVGTransform::updateSVGMatrix()
-{
-    // The underlying matrix has been changed, alter the transformation type.
-    // Spec: In case the matrix object is changed directly (i.e., without using the methods on the SVGTransform interface itself)
-    // then the type of the SVGTransform changes to SVG_TRANSFORM_MATRIX.
-    m_type = SVG_TRANSFORM_MATRIX;
-    m_angle = 0;
-}
-
-void SVGTransform::setTranslate(float tx, float ty)
-{
-    m_type = SVG_TRANSFORM_TRANSLATE;
-    m_angle = 0;
-
-    m_matrix.makeIdentity();
-    m_matrix.translate(tx, ty);
-}
-
-FloatPoint SVGTransform::translate() const
-{
-    return FloatPoint::narrowPrecision(m_matrix.e(), m_matrix.f());
-}
-
-void SVGTransform::setScale(float sx, float sy)
+Ref<SVGMatrix> SVGTransform::matrix()
 {
-    m_type = SVG_TRANSFORM_SCALE;
-    m_angle = 0;
-    m_center = FloatPoint();
-
-    m_matrix.makeIdentity();
-    m_matrix.scaleNonUniform(sx, sy);
-}
-
-FloatSize SVGTransform::scale() const
-{
-    return FloatSize::narrowPrecision(m_matrix.a(), m_matrix.d());
-}
-
-void SVGTransform::setRotate(float angle, float cx, float cy)
-{
-    m_type = SVG_TRANSFORM_ROTATE;
-    m_angle = angle;
-    m_center = FloatPoint(cx, cy);
-
-    // TODO: toString() implementation, which can show cx, cy (need to be stored?)
-    m_matrix.makeIdentity();
-    m_matrix.translate(cx, cy);
-    m_matrix.rotate(angle);
-    m_matrix.translate(-cx, -cy);
-}
-
-void SVGTransform::setSkewX(float angle)
-{
-    m_type = SVG_TRANSFORM_SKEWX;
-    m_angle = angle;
-
-    m_matrix.makeIdentity();
-    m_matrix.skewX(angle);
-}
-
-void SVGTransform::setSkewY(float angle)
-{
-    m_type = SVG_TRANSFORM_SKEWY;
-    m_angle = angle;
-
-    m_matrix.makeIdentity();
-    m_matrix.skewY(angle);
-}
-
-const String& SVGTransform::transformTypePrefixForParsing(SVGTransformType type)
-{
-    switch (type) {
-    case SVG_TRANSFORM_UNKNOWN:
-        return emptyString();
-    case SVG_TRANSFORM_MATRIX: {
-        static NeverDestroyed<String> matrixString(ASCIILiteral("matrix("));
-        return matrixString;
-    }
-    case SVG_TRANSFORM_TRANSLATE: {
-        static NeverDestroyed<String> translateString(ASCIILiteral("translate("));
-        return translateString;
-    }
-    case SVG_TRANSFORM_SCALE: {
-        static NeverDestroyed<String> scaleString(ASCIILiteral("scale("));
-        return scaleString;
-    }
-    case SVG_TRANSFORM_ROTATE: {
-        static NeverDestroyed<String> rotateString(ASCIILiteral("rotate("));
-        return rotateString;
-    }    
-    case SVG_TRANSFORM_SKEWX: {
-        static NeverDestroyed<String> skewXString(ASCIILiteral("skewX("));
-        return skewXString;
-    }
-    case SVG_TRANSFORM_SKEWY: {
-        static NeverDestroyed<String> skewYString(ASCIILiteral("skewY("));
-        return skewYString;
-    }
-    }
-
-    ASSERT_NOT_REACHED();
-    return emptyString();
-}
-
-String SVGTransform::valueAsString() const
-{
-    const String& prefix = transformTypePrefixForParsing(m_type);
-    switch (m_type) {
-    case SVG_TRANSFORM_UNKNOWN:
-        return prefix;
-    case SVG_TRANSFORM_MATRIX: {
-        StringBuilder builder;
-        builder.append(prefix);
-        builder.appendNumber(m_matrix.a());
-        builder.append(' ');
-        builder.appendNumber(m_matrix.b());
-        builder.append(' ');
-        builder.appendNumber(m_matrix.c());
-        builder.append(' ');
-        builder.appendNumber(m_matrix.d());
-        builder.append(' ');
-        builder.appendNumber(m_matrix.e());
-        builder.append(' ');
-        builder.appendNumber(m_matrix.f());
-        builder.append(')');
-        return builder.toString();
-    }
-    case SVG_TRANSFORM_TRANSLATE: {
-        StringBuilder builder;
-        builder.append(prefix);
-        builder.appendNumber(m_matrix.e());
-        builder.append(' ');
-        builder.appendNumber(m_matrix.f());
-        builder.append(')');
-        return builder.toString();
-    }
-    case SVG_TRANSFORM_SCALE: {
-        StringBuilder builder;
-        builder.append(prefix);
-        builder.appendNumber(m_matrix.xScale());
-        builder.append(' ');
-        builder.appendNumber(m_matrix.yScale());
-        builder.append(')');
-        return builder.toString();
-    }
-    case SVG_TRANSFORM_ROTATE: {
-        double angleInRad = deg2rad(m_angle);
-        double cosAngle = cos(angleInRad);
-        double sinAngle = sin(angleInRad);
-        float cx = narrowPrecisionToFloat(cosAngle != 1 ? (m_matrix.e() * (1 - cosAngle) - m_matrix.f() * sinAngle) / (1 - cosAngle) / 2 : 0);
-        float cy = narrowPrecisionToFloat(cosAngle != 1 ? (m_matrix.e() * sinAngle / (1 - cosAngle) + m_matrix.f()) / 2 : 0);
-        StringBuilder builder;
-        builder.append(prefix);
-        builder.appendNumber(m_angle);
-        if (cx || cy) {
-            builder.append(' ');
-            builder.appendNumber(cx);
-            builder.append(' ');
-            builder.appendNumber(cy);
-        }
-        builder.append(')');
-        return builder.toString();
-    }
-    case SVG_TRANSFORM_SKEWX:
-    case SVG_TRANSFORM_SKEWY: {
-        StringBuilder builder;
-        builder.append(prefix);
-        builder.appendNumber(m_angle);
-        builder.append(')');
-        return builder.toString();
-    }
-    }
-
-    ASSERT_NOT_REACHED();
-    return emptyString();
+    return SVGMatrixTearOff::create(*this, propertyReference().svgMatrix());
 }
 
 } // namespace WebCore
index 0c4304f..aeaaa41 100644 (file)
 /*
- * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
  *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #pragma once
 
-#include "FloatPoint.h"
+#include "ExceptionCode.h"
 #include "SVGMatrix.h"
+#include "SVGPropertyTearOff.h"
+#include "SVGTransformValue.h"
 
 namespace WebCore {
 
-class FloatSize;
-
-class SVGTransform {
+class SVGTransform : public SVGPropertyTearOff<SVGTransformValue> {
 public:
-    enum SVGTransformType {
-        SVG_TRANSFORM_UNKNOWN = 0,
-        SVG_TRANSFORM_MATRIX = 1,
-        SVG_TRANSFORM_TRANSLATE = 2,
-        SVG_TRANSFORM_SCALE = 3,
-        SVG_TRANSFORM_ROTATE = 4,
-        SVG_TRANSFORM_SKEWX = 5,
-        SVG_TRANSFORM_SKEWY = 6
-    };
-
-    enum ConstructionMode {
-        ConstructIdentityTransform,
-        ConstructZeroTransform
-    };
-
-    SVGTransform();
-    SVGTransform(SVGTransformType, ConstructionMode = ConstructIdentityTransform);
-    explicit SVGTransform(const AffineTransform&);
-
-    SVGTransformType type() const { return m_type; }
-
-    SVGMatrix& svgMatrix() { return static_cast<SVGMatrix&>(m_matrix); }
-    AffineTransform matrix() const { return m_matrix; }
-    void updateSVGMatrix();
-
-    float angle() const { return m_angle; }
-    FloatPoint rotationCenter() const { return m_center; }
-
-    void setMatrix(const AffineTransform&);
-    void setTranslate(float tx, float ty);
-    void setScale(float sx, float sy);
-    void setRotate(float angle, float cx, float cy);
-    void setSkewX(float angle);
-    void setSkewY(float angle);
-    
-    // Internal use only (animation system)
-    FloatPoint translate() const;
-    FloatSize scale() const;
-
-    bool isValid() const { return m_type != SVG_TRANSFORM_UNKNOWN; }
-    String valueAsString() const;
-
-    static const String& transformTypePrefixForParsing(SVGTransformType);
+    static Ref<SVGTransform> create(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, SVGTransformValue& value)
+    {
+        ASSERT(animatedProperty);
+        return adoptRef(*new SVGTransform(animatedProperty, role, value));
+    }
 
-private:
-    friend bool operator==(const SVGTransform& a, const SVGTransform& b);
+    static Ref<SVGTransform> create(const SVGTransformValue& initialValue = { })
+    {
+        return adoptRef(*new SVGTransform(initialValue));
+    }
 
-    SVGTransformType m_type;
-    float m_angle;
-    FloatPoint m_center;
-    AffineTransform m_matrix;
-};
+    static Ref<SVGTransform> create(const SVGTransformValue* initialValue)
+    {
+        return adoptRef(*new SVGTransform(initialValue));
+    }
+
+    template<typename T> static ExceptionOr<Ref<SVGTransform>> create(ExceptionOr<T>&& initialValue)
+    {
+        if (initialValue.hasException())
+            return initialValue.releaseException();
+        return create(initialValue.releaseReturnValue());
+    }
+
+    unsigned short type()
+    {
+        return propertyReference().type();
+    }
+
+    Ref<SVGMatrix> matrix();
+
+    float angle()
+    {
+        return propertyReference().angle();
+    }
+
+    ExceptionOr<void> setMatrix(SVGMatrix& matrix)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setMatrix(matrix.propertyReference());
+        commitChange();
+
+        return { };
+    }
+
+    ExceptionOr<void> setTranslate(float tx, float ty)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setTranslate(tx, ty);
+        commitChange();
+
+        return { };
+    }
 
-inline bool operator==(const SVGTransform& a, const SVGTransform& b)
-{
-    return a.m_type == b.m_type && a.m_angle == b.m_angle && a.m_matrix == b.m_matrix;
-}
+    ExceptionOr<void> setScale(float sx, float sy)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
 
-inline bool operator!=(const SVGTransform& a, const SVGTransform& b)
-{
-    return !(a == b);
-}
+        propertyReference().setScale(sx, sy);
+        commitChange();
+
+        return { };
+    }
+
+    ExceptionOr<void> setRotate(float angle, float cx, float cy)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setRotate(angle, cx, cy);
+        commitChange();
+
+        return { };
+    }
+
+    ExceptionOr<void> setSkewX(float angle)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setSkewX(angle);
+        commitChange();
+
+        return { };
+    }
+
+    ExceptionOr<void> setSkewY(float angle)
+    {
+        if (isReadOnly())
+            return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+        propertyReference().setSkewY(angle);
+        commitChange();
+
+        return { };
+    }
+
+private:
+    SVGTransform(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, SVGTransformValue& value)
+        : SVGPropertyTearOff<SVGTransformValue>(animatedProperty, role, value)
+    {
+    }
+
+    explicit SVGTransform(const SVGTransformValue& initialValue)
+        : SVGPropertyTearOff<SVGTransformValue>(initialValue)
+    {
+    }
+
+    explicit SVGTransform(const SVGTransformValue* initialValue)
+        : SVGPropertyTearOff<SVGTransformValue>(initialValue)
+    {
+    }
+};
 
 } // namespace WebCore
index 4b45a23..1197405 100644 (file)
@@ -19,7 +19,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
-interface SVGTransform { 
+[
+    ConstantsScope=SVGTransformValue
+] interface SVGTransform { 
     // Transform Types
     const unsigned short SVG_TRANSFORM_UNKNOWN = 0;
     const unsigned short SVG_TRANSFORM_MATRIX = 1;
@@ -30,14 +32,14 @@ interface SVGTransform {
     const unsigned short SVG_TRANSFORM_SKEWY = 6;
 
     readonly attribute unsigned short type;
-    [ImplementedAs=svgMatrix] readonly attribute SVGMatrix matrix;
+    [NewObject] readonly attribute SVGMatrix matrix;
     readonly attribute unrestricted float angle;
 
-    void setMatrix(SVGMatrix matrix);
-    void setTranslate(unrestricted float tx, unrestricted float ty);
-    void setScale(unrestricted float sx, unrestricted float sy);
-    void setRotate(unrestricted float angle, unrestricted float cx, unrestricted float cy);
-    void setSkewX(unrestricted float angle);
-    void setSkewY(unrestricted float angle);
+    [MayThrowException] void setMatrix(SVGMatrix matrix);
+    [MayThrowException] void setTranslate(unrestricted float tx, unrestricted float ty);
+    [MayThrowException] void setScale(unrestricted float sx, unrestricted float sy);
+    [MayThrowException] void setRotate(unrestricted float angle, unrestricted float cx, unrestricted float cy);
+    [MayThrowException] void setSkewX(unrestricted float angle);
+    [MayThrowException] void setSkewY(unrestricted float angle);
 };
 
index 967fea5..04f0835 100644 (file)
 #include "FloatConversion.h"
 #include "FloatPoint.h"
 #include "FloatSize.h"
-#include "SVGTransform.h"
+#include "SVGTransformValue.h"
 
 #include <math.h>
 
 namespace WebCore {
     
 SVGTransformDistance::SVGTransformDistance()
-    : m_type(SVGTransform::SVG_TRANSFORM_UNKNOWN)
+    : m_type(SVGTransformValue::SVG_TRANSFORM_UNKNOWN)
     , m_angle(0)
     , m_cx(0)
     , m_cy(0)
 {
 }
 
-SVGTransformDistance::SVGTransformDistance(SVGTransform::SVGTransformType type, float angle, float cx, float cy, const AffineTransform& transform)
+SVGTransformDistance::SVGTransformDistance(SVGTransformValue::SVGTransformType type, float angle, float cx, float cy, const AffineTransform& transform)
     : m_type(type)
     , m_angle(angle)
     , m_cx(cx)
@@ -46,7 +46,7 @@ SVGTransformDistance::SVGTransformDistance(SVGTransform::SVGTransformType type,
 {
 }
 
-SVGTransformDistance::SVGTransformDistance(const SVGTransform& fromSVGTransform, const SVGTransform& toSVGTransform)
+SVGTransformDistance::SVGTransformDistance(const SVGTransformValue& fromSVGTransform, const SVGTransformValue& toSVGTransform)
     : m_type(fromSVGTransform.type())
     , m_angle(0)
     , m_cx(0)
@@ -55,33 +55,33 @@ SVGTransformDistance::SVGTransformDistance(const SVGTransform& fromSVGTransform,
     ASSERT(m_type == toSVGTransform.type());
     
     switch (m_type) {
-    case SVGTransform::SVG_TRANSFORM_MATRIX:
+    case SVGTransformValue::SVG_TRANSFORM_MATRIX:
         ASSERT_NOT_REACHED();
 #if ASSERT_DISABLED
         FALLTHROUGH;
 #endif
-    case SVGTransform::SVG_TRANSFORM_UNKNOWN:
+    case SVGTransformValue::SVG_TRANSFORM_UNKNOWN:
         break;
-    case SVGTransform::SVG_TRANSFORM_ROTATE: {
+    case SVGTransformValue::SVG_TRANSFORM_ROTATE: {
         FloatSize centerDistance = toSVGTransform.rotationCenter() - fromSVGTransform.rotationCenter();
         m_angle = toSVGTransform.angle() - fromSVGTransform.angle();
         m_cx = centerDistance.width();
         m_cy = centerDistance.height();
         break;
     }
-    case SVGTransform::SVG_TRANSFORM_TRANSLATE: {
+    case SVGTransformValue::SVG_TRANSFORM_TRANSLATE: {
         FloatSize translationDistance = toSVGTransform.translate() - fromSVGTransform.translate();
         m_transform.translate(translationDistance.width(), translationDistance.height());
         break;
     }
-    case SVGTransform::SVG_TRANSFORM_SCALE: {
+    case SVGTransformValue::SVG_TRANSFORM_SCALE: {
         float scaleX = toSVGTransform.scale().width() - fromSVGTransform.scale().width();        
         float scaleY = toSVGTransform.scale().height() - fromSVGTransform.scale().height();
         m_transform.scaleNonUniform(scaleX, scaleY);
         break;
     }
-    case SVGTransform::SVG_TRANSFORM_SKEWX:
-    case SVGTransform::SVG_TRANSFORM_SKEWY:
+    case SVGTransformValue::SVG_TRANSFORM_SKEWX:
+    case SVGTransformValue::SVG_TRANSFORM_SKEWY:
         m_angle = toSVGTransform.angle() - fromSVGTransform.angle();
         break;
     }
@@ -90,25 +90,25 @@ SVGTransformDistance::SVGTransformDistance(const SVGTransform& fromSVGTransform,
 SVGTransformDistance SVGTransformDistance::scaledDistance(float scaleFactor) const
 {
     switch (m_type) {
-    case SVGTransform::SVG_TRANSFORM_MATRIX:
+    case SVGTransformValue::SVG_TRANSFORM_MATRIX:
         ASSERT_NOT_REACHED();
 #if ASSERT_DISABLED
         FALLTHROUGH;
 #endif
-    case SVGTransform::SVG_TRANSFORM_UNKNOWN:
+    case SVGTransformValue::SVG_TRANSFORM_UNKNOWN:
         return SVGTransformDistance();
-    case SVGTransform::SVG_TRANSFORM_ROTATE:
+    case SVGTransformValue::SVG_TRANSFORM_ROTATE:
         return SVGTransformDistance(m_type, m_angle * scaleFactor, m_cx * scaleFactor, m_cy * scaleFactor, AffineTransform());
-    case SVGTransform::SVG_TRANSFORM_SCALE:
+    case SVGTransformValue::SVG_TRANSFORM_SCALE:
         return SVGTransformDistance(m_type, m_angle * scaleFactor, m_cx * scaleFactor, m_cy * scaleFactor, AffineTransform(m_transform).scale(scaleFactor));
-    case SVGTransform::SVG_TRANSFORM_TRANSLATE: {
+    case SVGTransformValue::SVG_TRANSFORM_TRANSLATE: {
         AffineTransform newTransform(m_transform);
         newTransform.setE(m_transform.e() * scaleFactor);
         newTransform.setF(m_transform.f() * scaleFactor);
         return SVGTransformDistance(m_type, 0, 0, 0, newTransform);
     }
-    case SVGTransform::SVG_TRANSFORM_SKEWX:
-    case SVGTransform::SVG_TRANSFORM_SKEWY:
+    case SVGTransformValue::SVG_TRANSFORM_SKEWX:
+    case SVGTransformValue::SVG_TRANSFORM_SKEWY:
         return SVGTransformDistance(m_type, m_angle * scaleFactor, m_cx * scaleFactor, m_cy * scaleFactor, AffineTransform());
     }
     
@@ -116,89 +116,89 @@ SVGTransformDistance SVGTransformDistance::scaledDistance(float scaleFactor) con
     return SVGTransformDistance();
 }