Changeset 207716 in webkit


Ignore:
Timestamp:
Oct 22, 2016, 1:56:47 PM (9 years ago)
Author:
Darin Adler
Message:

Move SVG from ExceptionCode to Exception
https://bugs.webkit.org/show_bug.cgi?id=163837

Reviewed by Chris Dumez.

  • WebCore.xcodeproj/project.pbxproj: Added SVGGraphicsElement.idl.
  • bindings/js/JSSVGLengthCustom.cpp:

(WebCore::JSSVGLength::value): Use toJSNumber.
(WebCore::JSSVGLength::setValue): Use propagateException.
(WebCore::JSSVGLength::convertToSpecifiedUnits): Ditto.

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation): Properly handle SetterMayThrowException
in the special case for SVG setters.

  • rendering/style/SVGRenderStyle.h:

(WebCore::SVGRenderStyle::initialBaselineShiftValue): Removed
ASSERT_NO_EXCEPTION, no longer needed.
(WebCore::SVGRenderStyle::initialKerning): Ditto.

  • svg/SVGAltGlyphElement.cpp:

(WebCore::SVGAltGlyphElement::setGlyphRef): Use ExceptionOr.
(WebCore::SVGAltGlyphElement::setFormat): Ditto.
(WebCore::SVGAltGlyphElement::hasValidGlyphElements): Tweaked a bit.

  • svg/SVGAltGlyphElement.h: Updated for above changes.
  • svg/SVGAltGlyphElement.idl: Use non-legacy exceptions.
  • svg/SVGAngle.cpp:

(WebCore::SVGAngle::valueAsString): Removed unneeded String globals.
(WebCore::parseAngleType): Rewrote to be simpler and more direct.
(WebCore::SVGAngle::setValueAsString): Use ExceptionOr.
(WebCore::SVGAngle::newValueSpecifiedUnits): Ditto.
(WebCore::SVGAngle::convertToSpecifiedUnits): Ditto.

  • svg/SVGAngle.h: Updated for above changes. Initialized data members

here in the class definite and removed constructor; default now works.

  • svg/SVGAngle.idl: Use non-legacy exceptions.
  • svg/SVGAnimateElementBase.cpp:

(WebCore::SVGAnimateElementBase::calculateAnimatedValue): Update since
CalcMode is now an enum class.

  • svg/SVGAnimateMotionElement.cpp:

(WebCore::SVGAnimateMotionElement::SVGAnimateMotionElement): Ditto.

  • svg/SVGAnimateTransformElement.cpp:

(WebCore::SVGAnimateTransformElement::hasValidAttributeType): Update
since AttributeType is now an enum class.

  • svg/SVGAnimatedAngle.cpp:

(WebCore::SVGAnimatedAngleAnimator::calculateDistance): Removed
ASSERT_NO_EXCEPTION, no longer needed.

  • svg/SVGAnimatedBoolean.idl: Use non-legacy exception.
  • svg/SVGAnimatedEnumeration.idl: Ditto.
  • svg/SVGAnimatedInteger.idl: Ditto.
  • svg/SVGAnimatedLength.cpp:

(WebCore::sharedSVGLength): Deleted.
(WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): Removed
ASSERT_NO_EXCEPTION, no longer needed.
(WebCore::parseLengthFromString): Ditto. Also rewrote to not use
a shared SVGLength; no benefit to doing that.
(WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): Ditto.

  • svg/SVGAnimatedLengthList.cpp:

(WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): Ditto.
(WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): Ditto.

  • svg/SVGAnimatedNumber.idl: Use non-legacy exception.
  • svg/SVGAnimatedString.idl: Ditto.
  • svg/SVGAnimatedType.cpp:

(WebCore::SVGAnimatedType::setValueAsString): Updated since
setValueAsString now uses ExceptionOr.

  • svg/SVGAnimationElement.cpp:

(WebCore::SVGAnimationElement::SVGAnimationElement): Initialized scalars
in the class definition instead of here.
(WebCore::SVGAnimationElement::getSimpleDuration): Removed uneeded ExceptionCode&.
(WebCore::SVGAnimationElement::setCalcMode): Updated since CalcMode is now an enum class.
(WebCore::SVGAnimationElement::setAttributeType): Updated since AttributeType
is now an enum class.
(WebCore::SVGAnimationElement::shouldApplyAnimation): Ditto.
(WebCore::SVGAnimationElement::calculateKeyTimesForCalcModePaced): Ditto.
(WebCore::SVGAnimationElement::calculatePercentForSpline): Ditto.
(WebCore::SVGAnimationElement::calculatePercentFromKeyPoints): Ditto.
(WebCore::SVGAnimationElement::calculatePercentForFromTo): Ditto.
(WebCore::SVGAnimationElement::currentValuesFromKeyPoints): Ditto.
(WebCore::SVGAnimationElement::currentValuesForValuesAnimation): Ditto.
(WebCore::SVGAnimationElement::startedActiveInterval): Ditto.
(WebCore::SVGAnimationElement::updateAnimation): Ditto.
(WebCore::SVGAnimationElement::checkInvalidCSSAttributeType): Ditto.

  • svg/SVGAnimationElement.h: Changed CalcMode into an enum class.

Updated for above changes.

  • svg/SVGAnimationElement.idl: Removed MayThrowLegacyException from

getSimpleDuration.

  • svg/SVGColor.cpp:

(WebCore::SVGColor::SVGColor): Updated to take scalar in the straightforward
manner instead of constt SVGColorType&.
(WebCore::SVGColor::setRGBColor): Use ExceptionOr.
(WebCore::SVGColor::setRGBColorICCColor): Ditto.
(WebCore::SVGColor::setColor): Ditto.

  • svg/SVGColor.h: Updated for above changes. Removed unneeded destructor.
  • svg/SVGColor.idl: Use non-legacy exceptions.
  • svg/SVGGlyphRefElement.cpp:

(WebCore::SVGGlyphRefElement::SVGGlyphRefElement): Initialize data members
in class definition, not here.
(WebCore::parseFloat): Added helper. Used in parseAttribute.
(WebCore::SVGGlyphRefElement::parseAttribute): Updated to use parseFloat helper.
(WebCore::SVGGlyphRefElement::glyphRef): Deleted.
(WebCore::SVGGlyphRefElement::setGlyphRef): Deleted.
(WebCore::SVGGlyphRefElement::setX): Removed unused Exception& argument.
(WebCore::SVGGlyphRefElement::setY): Ditto.
(WebCore::SVGGlyphRefElement::setDx): Ditto.
(WebCore::SVGGlyphRefElement::setDy): Ditto.

  • svg/SVGGlyphRefElement.h: Updated for above changes.
  • svg/SVGGlyphRefElement.idl: Use Reflect on glyphRef. Removed incorrect

SetterMayThrowLegacyException attributes for x, y, dx, and dy. Longer term
it might be nice to use [Reflect] on these too.

  • svg/SVGGraphicsElement.idl: Use non-legacy exception.
  • svg/SVGLength.cpp:

(WebCore::parseLengthType): Changed argument type since caller does not
need to know how many characters are consumed.
(WebCore::SVGLength::SVGLength): Removed IGNORE_EXCEPTION and ASSERT_NO_EXCEPTION.
Also removed the copy constructor, letting the compiler generate the default.
(WebCore::SVGLength::setValueAsString): Use ExceptionOr.
(WebCore::SVGLength::construct): Updated since setValueAsString uses ExceptionOr.
(WebCore::SVGLength::value): Ditto.
(WebCore::SVGLength::valueForBindings): Use ExceptionOr. Also renamed to
disambiguate with the version used outside of bindings.
(WebCore::SVGLength::setValue): Use ExceptionOr.
(WebCore::SVGLength::newValueSpecifiedUnits): Ditto.
(WebCore::SVGLength::convertToSpecifiedUnits): Ditto.
(WebCore::SVGLength::fromCSSPrimitiveValue): Updated since newValueSpecifiedUnits
uses ExceptionOr.
(WebCore::SVGLength::lengthModeForAnimatedLengthAttribute): Rewrote map generation
code to be more efficient and not unrolled. Only do one hash table lookup.

  • svg/SVGLength.h: Updated for above changes.
  • svg/SVGLength.idl: Use non-legacy exceptions.
  • svg/SVGLengthContext.cpp:

(WebCore::SVGLengthContext::valueForLength): Update since function
uses ExceptionOr.
(WebCore::SVGLengthContext::convertValueToUserUnits): Use ExceptionOr.
(WebCore::SVGLengthContext::convertValueFromUserUnits): Ditto.
(WebCore::SVGLengthContext::convertValueFromUserUnitsToPercentage): Ditto.
(WebCore::SVGLengthContext::convertValueFromPercentageToUserUnits): Ditto.
(WebCore::SVGLengthContext::convertValueFromUserUnitsToEMS): Ditto.
(WebCore::SVGLengthContext::convertValueFromEMSToUserUnits): Ditto.
(WebCore::SVGLengthContext::convertValueFromUserUnitsToEXS): Ditto.
(WebCore::SVGLengthContext::convertValueFromEXSToUserUnits): Ditto.

  • svg/SVGLengthContext.h: Updatedfor above changes.
  • svg/SVGLengthList.cpp:

(WebCore::SVGLengthList::parse): Updated since setValueAsString uses
ExceptionOr now.

  • svg/SVGLengthList.h: Removed unneeded constructor.
  • svg/SVGLengthList.idl: Use non-legacy exceptions.
  • svg/SVGLocatable.cpp:

(WebCore::SVGLocatable::getTransformToElement): Use ExceptionOr.

  • svg/SVGLocatable.h: Updated for above change.
  • svg/SVGMarkerElement.h:

(WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
Updated since setValueAsString uses ExceptionOr now.

  • svg/SVGMatrix.h: Use ExceptionOr.
  • svg/SVGMatrix.idl: Use non-legacy exceptions.
  • svg/SVGNumberList.h: Removed unneeded constructor.
  • svg/SVGNumberList.idl: Use non-legacy exceptions.
  • svg/SVGPaint.cpp:

(WebCore::SVGPaint::setPaint): Use ExceptionOr.

  • svg/SVGPaint.h: Updated for above chagne.
  • svg/SVGPaint.idl: Use non-legacy exception.
  • svg/SVGPathSegList.h: Tweaked a bit.
  • svg/SVGPathSegList.idl: Use non-legacy exceptions.
  • svg/SVGPointList.h: Removed unneeded constructor.
  • svg/SVGPointList.idl: Use non-legacy exceptions.
  • svg/SVGPreserveAspectRatio.cpp:

(WebCore::SVGPreserveAspectRatio::setAlign): Use ExceptionOr.
(WebCore::SVGPreserveAspectRatio::setMeetOrSlice): Ditto.

  • svg/SVGPreserveAspectRatio.h: Updated for above changes.
  • svg/SVGPreserveAspectRatio.idl: Use non-legacy exceptions.
  • svg/SVGSVGElement.cpp:

(WebCore::SVGSVGElement::currentView): Pass a reference.

  • svg/SVGStringList.h: Tweaked a bit.
  • svg/SVGStringList.idl: Use non-legacy exceptions.
  • svg/SVGStyleElement.cpp:

(WebCore::SVGStyleElement::setType): Removed unneeded ExceptionCode&.
(WebCore::SVGStyleElement::setMedia): Ditto.
(WebCore::SVGStyleElement::setTitle): Deleted.

  • svg/SVGStyleElement.h: Updated for above changes, and made the title

function override be private.

  • svg/SVGStyleElement.idl: Use Reflect for title. Removed unneeded

SetterMayThrowLegacyException on all attributes.

  • svg/SVGTextContentElement.cpp:

(WebCore::SVGTextContentElement::textLengthAnimated): Removed
ASSERT_NO_EXCEPTION, won't work any more.
(WebCore::SVGTextContentElement::getSubStringLength): Use ExceptionOr.
Also remove redundant call to updateLayoutIgnorePendingStylesheets,
called by getNumberOfChars.
(WebCore::SVGTextContentElement::getStartPositionOfChar): Ditto.
(WebCore::SVGTextContentElement::getEndPositionOfChar): Ditto.
(WebCore::SVGTextContentElement::getExtentOfChar): Ditto.
(WebCore::SVGTextContentElement::getRotationOfChar): Ditto.
(WebCore::SVGTextContentElement::selectSubString): Ditto.

  • svg/SVGTextContentElement.h: Updated for above changes.
  • svg/SVGTextContentElement.idl: Use non-legacy exceptions.
  • svg/SVGTransformList.h: Removed unneeded constructor.
  • svg/SVGTransformList.idl: Use non-legacy exceptions.
  • svg/SVGViewSpec.cpp:

(WebCore::SVGViewSpec::SVGViewSpec): Updated to take a reference.
(WebCore::SVGViewSpec::setZoomAndPan): Use ExceptionOr.
(WebCore::SVGViewSpec::setTransformString): Deleted.
(WebCore::SVGViewSpec::viewBoxString): Use m_viewBox directly.
(WebCore::SVGViewSpec::preserveAspectRatioString): Use
m_preserveAspectRatio directly.
(WebCore::SVGViewSpec::viewTarget): Use is<SVGElement>.
(WebCore::SVGViewSpec::lookupOrCreateViewBoxWrapper): Use
m_contextElement directly.
(WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper):
Ditto.
(WebCore::SVGViewSpec::lookupOrCreateTransformWrapper): Ditto.
(WebCore::SVGViewSpec::parseViewSpec): Set m_viewTargetString directly.

  • svg/SVGViewSpec.h: Updated for above changes. Removed unneeded virtual

destructor, unneeded using for ref/deref, unused functions including
setTransformString, setViewTargetString, non-exception setZoomAndPan,
contextElement, viewBoxBaseValue, and preserveAspectRatioBaseValue.

  • svg/SVGViewSpec.idl: Use non-legacy exceptions. Also specify

ImplementationLacksVTable.

  • svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:

Use ExceptionOr.

  • svg/properties/SVGAnimatedStaticPropertyTearOff.h: Ditto.
  • svg/properties/SVGListProperty.h: Ditto.
  • svg/properties/SVGListPropertyTearOff.h: Ditto.
    • svg/properties/SVGPathSegListPropertyTearOff.cpp:

(WebCore::SVGPathSegListPropertyTearOff::clear): Ditto.
(WebCore::SVGPathSegListPropertyTearOff::getItem): Ditto.
(WebCore::SVGPathSegListPropertyTearOff::replaceItem): Ditto.
(WebCore::SVGPathSegListPropertyTearOff::removeItem): Ditto.

  • svg/properties/SVGPathSegListPropertyTearOff.h: Ditto.
  • svg/properties/SVGPropertyTearOff.h: Ditto. Also added an overload

of create that knows how to deal with exceptions.

  • svg/properties/SVGStaticListPropertyTearOff.h: Ditto.
  • svg/properties/SVGTransformListPropertyTearOff.h: Ditto.
Location:
trunk/Source/WebCore
Files:
81 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r207715 r207716  
     12016-10-22  Darin Adler  <darin@apple.com>
     2
     3        Move SVG from ExceptionCode to Exception
     4        https://bugs.webkit.org/show_bug.cgi?id=163837
     5
     6        Reviewed by Chris Dumez.
     7
     8        * WebCore.xcodeproj/project.pbxproj: Added SVGGraphicsElement.idl.
     9
     10        * bindings/js/JSSVGLengthCustom.cpp:
     11        (WebCore::JSSVGLength::value): Use toJSNumber.
     12        (WebCore::JSSVGLength::setValue): Use propagateException.
     13        (WebCore::JSSVGLength::convertToSpecifiedUnits): Ditto.
     14
     15        * bindings/scripts/CodeGeneratorJS.pm:
     16        (GenerateImplementation): Properly handle SetterMayThrowException
     17        in the special case for SVG setters.
     18
     19        * rendering/style/SVGRenderStyle.h:
     20        (WebCore::SVGRenderStyle::initialBaselineShiftValue): Removed
     21        ASSERT_NO_EXCEPTION, no longer needed.
     22        (WebCore::SVGRenderStyle::initialKerning): Ditto.
     23
     24        * svg/SVGAltGlyphElement.cpp:
     25        (WebCore::SVGAltGlyphElement::setGlyphRef): Use ExceptionOr.
     26        (WebCore::SVGAltGlyphElement::setFormat): Ditto.
     27        (WebCore::SVGAltGlyphElement::hasValidGlyphElements): Tweaked a bit.
     28        * svg/SVGAltGlyphElement.h: Updated for above changes.
     29        * svg/SVGAltGlyphElement.idl: Use non-legacy exceptions.
     30
     31        * svg/SVGAngle.cpp:
     32        (WebCore::SVGAngle::valueAsString): Removed unneeded String globals.
     33        (WebCore::parseAngleType): Rewrote to be simpler and more direct.
     34        (WebCore::SVGAngle::setValueAsString): Use ExceptionOr.
     35        (WebCore::SVGAngle::newValueSpecifiedUnits): Ditto.
     36        (WebCore::SVGAngle::convertToSpecifiedUnits): Ditto.
     37        * svg/SVGAngle.h: Updated for above changes. Initialized data members
     38        here in the class definite and removed constructor; default now works.
     39        * svg/SVGAngle.idl: Use non-legacy exceptions.
     40
     41        * svg/SVGAnimateElementBase.cpp:
     42        (WebCore::SVGAnimateElementBase::calculateAnimatedValue): Update since
     43        CalcMode is now an enum class.
     44        * svg/SVGAnimateMotionElement.cpp:
     45        (WebCore::SVGAnimateMotionElement::SVGAnimateMotionElement): Ditto.
     46
     47        * svg/SVGAnimateTransformElement.cpp:
     48        (WebCore::SVGAnimateTransformElement::hasValidAttributeType): Update
     49        since AttributeType is now an enum class.
     50
     51        * svg/SVGAnimatedAngle.cpp:
     52        (WebCore::SVGAnimatedAngleAnimator::calculateDistance): Removed
     53        ASSERT_NO_EXCEPTION, no longer needed.
     54
     55        * svg/SVGAnimatedBoolean.idl: Use non-legacy exception.
     56        * svg/SVGAnimatedEnumeration.idl: Ditto.
     57        * svg/SVGAnimatedInteger.idl: Ditto.
     58
     59        * svg/SVGAnimatedLength.cpp:
     60        (WebCore::sharedSVGLength): Deleted.
     61        (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): Removed
     62        ASSERT_NO_EXCEPTION, no longer needed.
     63        (WebCore::parseLengthFromString): Ditto. Also rewrote to not use
     64        a shared SVGLength; no benefit to doing that.
     65        (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): Ditto.
     66        * svg/SVGAnimatedLengthList.cpp:
     67        (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): Ditto.
     68        (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): Ditto.
     69
     70        * svg/SVGAnimatedNumber.idl: Use non-legacy exception.
     71        * svg/SVGAnimatedString.idl: Ditto.
     72
     73        * svg/SVGAnimatedType.cpp:
     74        (WebCore::SVGAnimatedType::setValueAsString): Updated since
     75        setValueAsString now uses ExceptionOr.
     76
     77        * svg/SVGAnimationElement.cpp:
     78        (WebCore::SVGAnimationElement::SVGAnimationElement): Initialized scalars
     79        in the class definition instead of here.
     80        (WebCore::SVGAnimationElement::getSimpleDuration): Removed uneeded ExceptionCode&.
     81        (WebCore::SVGAnimationElement::setCalcMode): Updated since CalcMode is now an enum class.
     82        (WebCore::SVGAnimationElement::setAttributeType): Updated since AttributeType
     83        is now an enum class.
     84        (WebCore::SVGAnimationElement::shouldApplyAnimation): Ditto.
     85        (WebCore::SVGAnimationElement::calculateKeyTimesForCalcModePaced): Ditto.
     86        (WebCore::SVGAnimationElement::calculatePercentForSpline): Ditto.
     87        (WebCore::SVGAnimationElement::calculatePercentFromKeyPoints): Ditto.
     88        (WebCore::SVGAnimationElement::calculatePercentForFromTo): Ditto.
     89        (WebCore::SVGAnimationElement::currentValuesFromKeyPoints): Ditto.
     90        (WebCore::SVGAnimationElement::currentValuesForValuesAnimation): Ditto.
     91        (WebCore::SVGAnimationElement::startedActiveInterval): Ditto.
     92        (WebCore::SVGAnimationElement::updateAnimation): Ditto.
     93        (WebCore::SVGAnimationElement::checkInvalidCSSAttributeType): Ditto.
     94
     95        * svg/SVGAnimationElement.h: Changed CalcMode into an enum class.
     96        Updated for above changes.
     97
     98        * svg/SVGAnimationElement.idl: Removed MayThrowLegacyException from
     99        getSimpleDuration.
     100
     101        * svg/SVGColor.cpp:
     102        (WebCore::SVGColor::SVGColor): Updated to take scalar in the straightforward
     103        manner instead of constt SVGColorType&.
     104        (WebCore::SVGColor::setRGBColor): Use ExceptionOr.
     105        (WebCore::SVGColor::setRGBColorICCColor): Ditto.
     106        (WebCore::SVGColor::setColor): Ditto.
     107        * svg/SVGColor.h: Updated for above changes. Removed unneeded destructor.
     108        * svg/SVGColor.idl: Use non-legacy exceptions.
     109
     110        * svg/SVGGlyphRefElement.cpp:
     111        (WebCore::SVGGlyphRefElement::SVGGlyphRefElement): Initialize data members
     112        in class definition, not here.
     113        (WebCore::parseFloat): Added helper. Used in parseAttribute.
     114        (WebCore::SVGGlyphRefElement::parseAttribute): Updated to use parseFloat helper.
     115        (WebCore::SVGGlyphRefElement::glyphRef): Deleted.
     116        (WebCore::SVGGlyphRefElement::setGlyphRef): Deleted.
     117        (WebCore::SVGGlyphRefElement::setX): Removed unused Exception& argument.
     118        (WebCore::SVGGlyphRefElement::setY): Ditto.
     119        (WebCore::SVGGlyphRefElement::setDx): Ditto.
     120        (WebCore::SVGGlyphRefElement::setDy): Ditto.
     121        * svg/SVGGlyphRefElement.h: Updated for above changes.
     122        * svg/SVGGlyphRefElement.idl: Use Reflect on glyphRef. Removed incorrect
     123        SetterMayThrowLegacyException attributes for x, y, dx, and dy. Longer term
     124        it might be nice to use [Reflect] on these too.
     125
     126        * svg/SVGGraphicsElement.idl: Use non-legacy exception.
     127
     128        * svg/SVGLength.cpp:
     129        (WebCore::parseLengthType): Changed argument type since caller does not
     130        need to know how many characters are consumed.
     131        (WebCore::SVGLength::SVGLength): Removed IGNORE_EXCEPTION and ASSERT_NO_EXCEPTION.
     132        Also removed the copy constructor, letting the compiler generate the default.
     133        (WebCore::SVGLength::setValueAsString): Use ExceptionOr.
     134        (WebCore::SVGLength::construct): Updated since setValueAsString uses ExceptionOr.
     135        (WebCore::SVGLength::value): Ditto.
     136        (WebCore::SVGLength::valueForBindings): Use ExceptionOr. Also renamed to
     137        disambiguate with the version used outside of bindings.
     138        (WebCore::SVGLength::setValue): Use ExceptionOr.
     139        (WebCore::SVGLength::newValueSpecifiedUnits): Ditto.
     140        (WebCore::SVGLength::convertToSpecifiedUnits): Ditto.
     141        (WebCore::SVGLength::fromCSSPrimitiveValue): Updated since newValueSpecifiedUnits
     142        uses ExceptionOr.
     143        (WebCore::SVGLength::lengthModeForAnimatedLengthAttribute): Rewrote map generation
     144        code to be more efficient and not unrolled. Only do one hash table lookup.
     145        * svg/SVGLength.h: Updated for above changes.
     146        * svg/SVGLength.idl: Use non-legacy exceptions.
     147
     148        * svg/SVGLengthContext.cpp:
     149        (WebCore::SVGLengthContext::valueForLength): Update since function
     150        uses ExceptionOr.
     151        (WebCore::SVGLengthContext::convertValueToUserUnits): Use ExceptionOr.
     152        (WebCore::SVGLengthContext::convertValueFromUserUnits): Ditto.
     153        (WebCore::SVGLengthContext::convertValueFromUserUnitsToPercentage): Ditto.
     154        (WebCore::SVGLengthContext::convertValueFromPercentageToUserUnits): Ditto.
     155        (WebCore::SVGLengthContext::convertValueFromUserUnitsToEMS): Ditto.
     156        (WebCore::SVGLengthContext::convertValueFromEMSToUserUnits): Ditto.
     157        (WebCore::SVGLengthContext::convertValueFromUserUnitsToEXS): Ditto.
     158        (WebCore::SVGLengthContext::convertValueFromEXSToUserUnits): Ditto.
     159        * svg/SVGLengthContext.h: Updatedfor above changes.
     160
     161        * svg/SVGLengthList.cpp:
     162        (WebCore::SVGLengthList::parse): Updated since setValueAsString uses
     163        ExceptionOr now.
     164        * svg/SVGLengthList.h: Removed unneeded constructor.
     165        * svg/SVGLengthList.idl: Use non-legacy exceptions.
     166
     167        * svg/SVGLocatable.cpp:
     168        (WebCore::SVGLocatable::getTransformToElement): Use ExceptionOr.
     169        * svg/SVGLocatable.h: Updated for above change.
     170
     171        * svg/SVGMarkerElement.h:
     172        (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
     173        Updated since setValueAsString uses ExceptionOr now.
     174
     175        * svg/SVGMatrix.h: Use ExceptionOr.
     176        * svg/SVGMatrix.idl: Use non-legacy exceptions.
     177
     178        * svg/SVGNumberList.h: Removed unneeded constructor.
     179        * svg/SVGNumberList.idl: Use non-legacy exceptions.
     180
     181        * svg/SVGPaint.cpp:
     182        (WebCore::SVGPaint::setPaint): Use ExceptionOr.
     183        * svg/SVGPaint.h: Updated for above chagne.
     184        * svg/SVGPaint.idl: Use non-legacy exception.
     185
     186        * svg/SVGPathSegList.h: Tweaked a bit.
     187        * svg/SVGPathSegList.idl: Use non-legacy exceptions.
     188
     189        * svg/SVGPointList.h: Removed unneeded constructor.
     190        * svg/SVGPointList.idl: Use non-legacy exceptions.
     191
     192        * svg/SVGPreserveAspectRatio.cpp:
     193        (WebCore::SVGPreserveAspectRatio::setAlign): Use ExceptionOr.
     194        (WebCore::SVGPreserveAspectRatio::setMeetOrSlice): Ditto.
     195        * svg/SVGPreserveAspectRatio.h: Updated for above changes.
     196        * svg/SVGPreserveAspectRatio.idl: Use non-legacy exceptions.
     197
     198        * svg/SVGSVGElement.cpp:
     199        (WebCore::SVGSVGElement::currentView): Pass a reference.
     200
     201        * svg/SVGStringList.h: Tweaked a bit.
     202        * svg/SVGStringList.idl: Use non-legacy exceptions.
     203
     204        * svg/SVGStyleElement.cpp:
     205        (WebCore::SVGStyleElement::setType): Removed unneeded ExceptionCode&.
     206        (WebCore::SVGStyleElement::setMedia): Ditto.
     207        (WebCore::SVGStyleElement::setTitle): Deleted.
     208        * svg/SVGStyleElement.h: Updated for above changes, and made the title
     209        function override be private.
     210        * svg/SVGStyleElement.idl: Use Reflect for title. Removed unneeded
     211        SetterMayThrowLegacyException on all attributes.
     212
     213        * svg/SVGTextContentElement.cpp:
     214        (WebCore::SVGTextContentElement::textLengthAnimated): Removed
     215        ASSERT_NO_EXCEPTION, won't work any more.
     216        (WebCore::SVGTextContentElement::getSubStringLength): Use ExceptionOr.
     217        Also remove redundant call to updateLayoutIgnorePendingStylesheets,
     218        called by getNumberOfChars.
     219        (WebCore::SVGTextContentElement::getStartPositionOfChar): Ditto.
     220        (WebCore::SVGTextContentElement::getEndPositionOfChar): Ditto.
     221        (WebCore::SVGTextContentElement::getExtentOfChar): Ditto.
     222        (WebCore::SVGTextContentElement::getRotationOfChar): Ditto.
     223        (WebCore::SVGTextContentElement::selectSubString): Ditto.
     224        * svg/SVGTextContentElement.h: Updated for above changes.
     225        * svg/SVGTextContentElement.idl: Use non-legacy exceptions.
     226
     227        * svg/SVGTransformList.h: Removed unneeded constructor.
     228        * svg/SVGTransformList.idl: Use non-legacy exceptions.
     229
     230        * svg/SVGViewSpec.cpp:
     231        (WebCore::SVGViewSpec::SVGViewSpec): Updated to take a reference.
     232        (WebCore::SVGViewSpec::setZoomAndPan): Use ExceptionOr.
     233        (WebCore::SVGViewSpec::setTransformString): Deleted.
     234        (WebCore::SVGViewSpec::viewBoxString): Use m_viewBox directly.
     235        (WebCore::SVGViewSpec::preserveAspectRatioString): Use
     236        m_preserveAspectRatio directly.
     237        (WebCore::SVGViewSpec::viewTarget): Use is<SVGElement>.
     238        (WebCore::SVGViewSpec::lookupOrCreateViewBoxWrapper): Use
     239        m_contextElement directly.
     240        (WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper):
     241        Ditto.
     242        (WebCore::SVGViewSpec::lookupOrCreateTransformWrapper): Ditto.
     243        (WebCore::SVGViewSpec::parseViewSpec): Set m_viewTargetString directly.
     244        * svg/SVGViewSpec.h: Updated for above changes. Removed unneeded virtual
     245        destructor, unneeded using for ref/deref, unused functions including
     246        setTransformString, setViewTargetString, non-exception setZoomAndPan,
     247        contextElement, viewBoxBaseValue, and preserveAspectRatioBaseValue.
     248        * svg/SVGViewSpec.idl: Use non-legacy exceptions. Also specify
     249        ImplementationLacksVTable.
     250
     251        * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:
     252        Use ExceptionOr.
     253        * svg/properties/SVGAnimatedStaticPropertyTearOff.h: Ditto.
     254        * svg/properties/SVGListProperty.h: Ditto.
     255        * svg/properties/SVGListPropertyTearOff.h: Ditto.
     256         * svg/properties/SVGPathSegListPropertyTearOff.cpp:
     257        (WebCore::SVGPathSegListPropertyTearOff::clear): Ditto.
     258        (WebCore::SVGPathSegListPropertyTearOff::getItem): Ditto.
     259        (WebCore::SVGPathSegListPropertyTearOff::replaceItem): Ditto.
     260        (WebCore::SVGPathSegListPropertyTearOff::removeItem): Ditto.
     261        * svg/properties/SVGPathSegListPropertyTearOff.h: Ditto.
     262        * svg/properties/SVGPropertyTearOff.h: Ditto. Also added an overload
     263        of create that knows how to deal with exceptions.
     264        * svg/properties/SVGStaticListPropertyTearOff.h: Ditto.
     265        * svg/properties/SVGTransformListPropertyTearOff.h: Ditto.
     266
    12672016-10-22  Chris Dumez  <cdumez@apple.com>
    2268
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r207689 r207716  
    1061410614                933A14B70B7D1D5200A53FFD /* JSTextEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTextEvent.h; sourceTree = "<group>"; };
    1061510615                933C7A741C0FBC440034FB97 /* NSSpellCheckerSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSSpellCheckerSPI.h; sourceTree = "<group>"; };
     10616                934305961DB9FA0E00E712A7 /* SVGGraphicsElement.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = SVGGraphicsElement.idl; sourceTree = "<group>"; };
    1061610617                9343CB7F12F25E510033C5EE /* TextCodecUTF8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextCodecUTF8.cpp; sourceTree = "<group>"; };
    1061710618                9343CB8012F25E510033C5EE /* TextCodecUTF8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCodecUTF8.h; sourceTree = "<group>"; };
     
    2071420715                                B222791F0D00BF210071B782 /* SVGGraphicsElement.cpp */,
    2071520716                                B22279200D00BF210071B782 /* SVGGraphicsElement.h */,
     20717                                934305961DB9FA0E00E712A7 /* SVGGraphicsElement.idl */,
    2071620718                                650FBF270D9AF046008FC292 /* SVGHKernElement.cpp */,
    2071720719                                650FBF280D9AF047008FC292 /* SVGHKernElement.h */,
  • trunk/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp

    r206386 r207716  
    3535JSValue JSSVGLength::value(ExecState& state) const
    3636{
    37     SVGLength& podImp = wrapped().propertyReference();
    38     ExceptionCode ec = 0;
    39     SVGLengthContext lengthContext(wrapped().contextElement());
    40     float value = podImp.value(lengthContext, ec);
    41     if (ec) {
    42         setDOMException(&state, ec);
    43         return jsUndefined();
    44     }
    45 
    46     return jsNumber(value);
     37    VM& vm = state.vm();
     38    auto scope = DECLARE_THROW_SCOPE(vm);
     39    return toJSNumber(state, scope, wrapped().propertyReference().valueForBindings(SVGLengthContext { wrapped().contextElement() }));
    4740}
    4841
     
    6255    }
    6356
    64     SVGLength& podImp = wrapped().propertyReference();
     57    auto floatValue = value.toFloat(&state);
     58    RETURN_IF_EXCEPTION(scope, void());
    6559
    66     ExceptionCode ec = 0;
    67     SVGLengthContext lengthContext(wrapped().contextElement());
    68     podImp.setValue(value.toFloat(&state), lengthContext, ec);
    69     if (ec) {
    70         setDOMException(&state, ec);
     60    auto result = wrapped().propertyReference().setValue(floatValue, SVGLengthContext { wrapped().contextElement() });
     61    if (result.hasException()) {
     62        propagateException(state, scope, result.releaseException());
    7163        return;
    7264    }
     
    8274    if (wrapped().isReadOnly()) {
    8375        setDOMException(&state, NO_MODIFICATION_ALLOWED_ERR);
    84         return jsUndefined();
     76        return { };
    8577    }
    86 
    87     SVGLength& podImp = wrapped().propertyReference();
    8878
    8979    if (state.argumentCount() < 1)
     
    9383    RETURN_IF_EXCEPTION(scope, JSValue());
    9484
    95     ExceptionCode ec = 0;
    96     SVGLengthContext lengthContext(wrapped().contextElement());
    97     podImp.convertToSpecifiedUnits(unitType, lengthContext, ec);
    98     if (ec) {
    99         setDOMException(&state, ec);
    100         return jsUndefined();
     85    auto result = wrapped().propertyReference().convertToSpecifiedUnits(unitType, SVGLengthContext { wrapped().contextElement() });
     86    if (result.hasException()) {
     87        propagateException(state, scope, result.releaseException());
     88        return { };
    10189    }
    10290
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r207715 r207716  
    35393539                        push(@implContent, "    podImpl = nativeValue;\n");
    35403540                    } else {
    3541                         push(@implContent, "    podImpl.set$implSetterFunctionName(nativeValue");
    3542                         push(@implContent, ", ec") if $setterMayThrowLegacyException;
    3543                         push(@implContent, ");\n");
     3541                        my $functionString = "podImpl.set$implSetterFunctionName(nativeValue";
     3542                        $functionString .= ", ec" if $setterMayThrowLegacyException;
     3543                        $functionString .= ")";
     3544                        $functionString = "propagateException(state, throwScope, $functionString)" if $attribute->signature->extendedAttributes->{SetterMayThrowException};
     3545                        push(@implContent, "    $functionString;\n");
    35443546                        push(@implContent, "    setDOMException(&state, throwScope, ec);\n") if $setterMayThrowLegacyException;
    35453547                    }
  • trunk/Source/WebCore/rendering/style/SVGRenderStyle.h

    r194496 r207716  
    101101    {
    102102        SVGLength length;
    103         length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION);
     103        length.newValueSpecifiedUnits(LengthTypeNumber, 0);
    104104        return length;
    105105    }
     
    108108    {
    109109        SVGLength length;
    110         length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION);
     110        length.newValueSpecifiedUnits(LengthTypeNumber, 0);
    111111        return length;
    112112    }
  • trunk/Source/WebCore/svg/SVGAltGlyphElement.cpp

    r203324 r207716  
    5656}
    5757
    58 void SVGAltGlyphElement::setGlyphRef(const AtomicString&, ExceptionCode& ec)
     58ExceptionOr<void> SVGAltGlyphElement::setGlyphRef(const AtomicString&)
    5959{
    60     ec = NO_MODIFICATION_ALLOWED_ERR;
     60    return Exception { NO_MODIFICATION_ALLOWED_ERR };
    6161}
    6262
     
    6666}
    6767
    68 void SVGAltGlyphElement::setFormat(const AtomicString&, ExceptionCode& ec)
     68ExceptionOr<void> SVGAltGlyphElement::setFormat(const AtomicString&)
    6969{
    70     ec = NO_MODIFICATION_ALLOWED_ERR;
     70    return Exception { NO_MODIFICATION_ALLOWED_ERR };
    7171}
    7272
     
    7878bool SVGAltGlyphElement::childShouldCreateRenderer(const Node& child) const
    7979{
    80     if (child.isTextNode())
    81         return true;
    82     return false;
     80    return child.isTextNode();
    8381}
    8482
     
    9189{
    9290    String target;
    93     Element* element = targetElementFromIRIString(getAttribute(XLinkNames::hrefAttr), document(), &target);
    94     if (!element)
    95         return false;
     91    auto* element = targetElementFromIRIString(getAttribute(XLinkNames::hrefAttr), document(), &target);
    9692
    97     if (is<SVGGlyphElement>(*element)) {
     93    if (is<SVGGlyphElement>(element)) {
    9894        glyphNames.append(target);
    9995        return true;
    10096    }
    10197
    102     if (is<SVGAltGlyphDefElement>(*element)
    103         && downcast<SVGAltGlyphDefElement>(*element).hasValidGlyphElements(glyphNames))
     98    if (is<SVGAltGlyphDefElement>(element) && downcast<SVGAltGlyphDefElement>(*element).hasValidGlyphElements(glyphNames))
    10499        return true;
    105100
  • trunk/Source/WebCore/svg/SVGAltGlyphElement.h

    r200041 r207716  
    2020 */
    2121
    22 #ifndef SVGAltGlyphElement_h
    23 #define SVGAltGlyphElement_h
     22#pragma once
    2423
    2524#if ENABLE(SVG_FONTS)
     
    2726#include "SVGTextPositioningElement.h"
    2827#include "SVGURIReference.h"
    29 #include <wtf/Vector.h>
    3028
    3129namespace WebCore {
     
    3331class SVGGlyphElement;
    3432
    35 class SVGAltGlyphElement final : public SVGTextPositioningElement,
    36                                  public SVGURIReference {
     33class SVGAltGlyphElement final : public SVGTextPositioningElement, public SVGURIReference {
    3734public:
    3835    static Ref<SVGAltGlyphElement> create(const QualifiedName&, Document&);
    3936
    4037    const AtomicString& glyphRef() const;
    41     void setGlyphRef(const AtomicString&, ExceptionCode&);
     38    ExceptionOr<void> setGlyphRef(const AtomicString&);
    4239    const AtomicString& format() const;
    43     void setFormat(const AtomicString&, ExceptionCode&);
     40    ExceptionOr<void> setFormat(const AtomicString&);
    4441
    4542    bool hasValidGlyphElements(Vector<String>& glyphNames) const;
     
    5956
    6057#endif
    61 #endif
  • trunk/Source/WebCore/svg/SVGAltGlyphElement.idl

    r206723 r207716  
    2727    Conditional=SVG_FONTS,
    2828] interface SVGAltGlyphElement : SVGTextPositioningElement {
    29     [SetterMayThrowLegacyException] attribute DOMString glyphRef;
    30     [SetterMayThrowLegacyException] attribute DOMString format;
     29    [SetterMayThrowException] attribute DOMString glyphRef;
     30    [SetterMayThrowException] attribute DOMString format;
    3131};
    3232
  • trunk/Source/WebCore/svg/SVGAngle.cpp

    r194819 r207716  
    2626#include "SVGParserUtilities.h"
    2727#include <wtf/MathExtras.h>
    28 #include <wtf/NeverDestroyed.h>
    2928#include <wtf/text/StringView.h>
    3029
    3130namespace WebCore {
    3231
    33 SVGAngle::SVGAngle()
    34     : m_unitType(SVG_ANGLETYPE_UNSPECIFIED)
    35     , m_valueInSpecifiedUnits(0)
    36 {
    37 }
    38 
    3932float SVGAngle::value() const
    4033{
     
    4942        return m_valueInSpecifiedUnits;
    5043    }
    51 
    5244    ASSERT_NOT_REACHED();
    5345    return 0;
     
    5951    case SVG_ANGLETYPE_GRAD:
    6052        m_valueInSpecifiedUnits = deg2grad(value);
    61         break;
     53        return;
    6254    case SVG_ANGLETYPE_RAD:
    6355        m_valueInSpecifiedUnits = deg2rad(value);
    64         break;
     56        return;
    6557    case SVG_ANGLETYPE_UNSPECIFIED:
    6658    case SVG_ANGLETYPE_UNKNOWN:
    6759    case SVG_ANGLETYPE_DEG:
    6860        m_valueInSpecifiedUnits = value;
    69         break;
    70     }
    71 }
    72 
    73 inline SVGAngle::SVGAngleType stringToAngleType(const UChar*& ptr, const UChar* end)
    74 {
    75     // If there's no unit given, the angle type is unspecified.
    76     if (ptr == end)
    77         return SVGAngle::SVG_ANGLETYPE_UNSPECIFIED;
    78 
    79     const UChar firstChar = *ptr;
    80    
    81     // If the unit contains only one character, the angle type is unknown.
    82     ++ptr;
    83     if (ptr == end)
    84         return SVGAngle::SVG_ANGLETYPE_UNKNOWN;
    85 
    86     const UChar secondChar = *ptr;
    87  
    88     // If the unit contains only two characters, the angle type is unknown.
    89     ++ptr;
    90     if (ptr == end)
    91         return SVGAngle::SVG_ANGLETYPE_UNKNOWN;
    92 
    93     const UChar thirdChar = *ptr;
    94     if (firstChar == 'd' && secondChar == 'e' && thirdChar == 'g')
    95         return SVGAngle::SVG_ANGLETYPE_DEG;
    96     if (firstChar == 'r' && secondChar == 'a' && thirdChar == 'd')
    97         return SVGAngle::SVG_ANGLETYPE_RAD;
    98 
    99     // If the unit contains three characters, but is not deg or rad, then it's unknown.
    100     ++ptr;
    101     if (ptr == end)
    102         return SVGAngle::SVG_ANGLETYPE_UNKNOWN;
    103 
    104     const UChar fourthChar = *ptr;
    105 
    106     if (firstChar == 'g' && secondChar == 'r' && thirdChar == 'a' && fourthChar == 'd')
    107         return SVGAngle::SVG_ANGLETYPE_GRAD;
    108 
    109     return SVGAngle::SVG_ANGLETYPE_UNKNOWN;
     61        return;
     62    }
     63    ASSERT_NOT_REACHED();
    11064}
    11165
     
    11367{
    11468    switch (m_unitType) {
    115     case SVG_ANGLETYPE_DEG: {
    116         static NeverDestroyed<String> degString(ASCIILiteral("deg"));
    117         return String::number(m_valueInSpecifiedUnits) + degString.get();
    118     }
    119     case SVG_ANGLETYPE_RAD: {
    120         static NeverDestroyed<String> radString(ASCIILiteral("rad"));
    121         return String::number(m_valueInSpecifiedUnits) + radString.get();
    122     }
    123     case SVG_ANGLETYPE_GRAD: {
    124         static NeverDestroyed<String> gradString(ASCIILiteral("grad"));
    125         return String::number(m_valueInSpecifiedUnits) + gradString.get();
    126     }
     69    case SVG_ANGLETYPE_DEG:
     70        return String::number(m_valueInSpecifiedUnits) + "deg";
     71    case SVG_ANGLETYPE_RAD:
     72        return String::number(m_valueInSpecifiedUnits) + "rad";
     73    case SVG_ANGLETYPE_GRAD:
     74        return String::number(m_valueInSpecifiedUnits) + "grad";
    12775    case SVG_ANGLETYPE_UNSPECIFIED:
    12876    case SVG_ANGLETYPE_UNKNOWN:
     
    13482}
    13583
    136 void SVGAngle::setValueAsString(const String& value, ExceptionCode& ec)
     84static inline SVGAngle::SVGAngleType parseAngleType(const UChar* ptr, const UChar* end)
     85{
     86    switch (end - ptr) {
     87    case 0:
     88        return SVGAngle::SVG_ANGLETYPE_UNSPECIFIED;
     89    case 3:
     90        if (ptr[0] == 'd' && ptr[1] == 'e' && ptr[2] == 'g')
     91            return SVGAngle::SVG_ANGLETYPE_DEG;
     92        if (ptr[0] == 'r' && ptr[1] == 'a' && ptr[2] == 'd')
     93            return SVGAngle::SVG_ANGLETYPE_RAD;
     94        break;
     95    case 4:
     96        if (ptr[0] == 'g' && ptr[1] == 'r' && ptr[2] == 'a' && ptr[3] == 'd')
     97            return SVGAngle::SVG_ANGLETYPE_GRAD;
     98        break;
     99    }
     100    return SVGAngle::SVG_ANGLETYPE_UNKNOWN;
     101}
     102
     103ExceptionOr<void> SVGAngle::setValueAsString(const String& value)
    137104{
    138105    if (value.isEmpty()) {
    139106        m_unitType = SVG_ANGLETYPE_UNSPECIFIED;
    140         return;
    141     }
    142 
    143     float valueInSpecifiedUnits = 0;
     107        return { };
     108    }
     109
    144110    auto upconvertedCharacters = StringView(value).upconvertedCharacters();
    145111    const UChar* ptr = upconvertedCharacters;
    146112    const UChar* end = ptr + value.length();
    147113
    148     if (!parseNumber(ptr, end, valueInSpecifiedUnits, false)) {
    149         ec = SYNTAX_ERR;
    150         return;
    151     }
    152 
    153     SVGAngleType unitType = stringToAngleType(ptr, end);
    154     if (unitType == SVG_ANGLETYPE_UNKNOWN) {
    155         ec = SYNTAX_ERR;
    156         return;
    157     }
     114    float valueInSpecifiedUnits = 0;
     115    if (!parseNumber(ptr, end, valueInSpecifiedUnits, false))
     116        return Exception { SYNTAX_ERR };
     117
     118    auto unitType = parseAngleType(ptr, end);
     119    if (unitType == SVG_ANGLETYPE_UNKNOWN)
     120        return Exception { SYNTAX_ERR };
    158121
    159122    m_unitType = unitType;
    160123    m_valueInSpecifiedUnits = valueInSpecifiedUnits;
    161 }
    162 
    163 void SVGAngle::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, ExceptionCode& ec)
    164 {
    165     if (unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD) {
    166         ec = NOT_SUPPORTED_ERR;
    167         return;
    168     }
    169 
    170     if (unitType != m_unitType)
    171         m_unitType = static_cast<SVGAngleType>(unitType);
    172 
     124    return { };
     125}
     126
     127ExceptionOr<void> SVGAngle::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits)
     128{
     129    if (unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD)
     130        return Exception { NOT_SUPPORTED_ERR };
     131
     132    m_unitType = static_cast<SVGAngleType>(unitType);
    173133    m_valueInSpecifiedUnits = valueInSpecifiedUnits;
    174 }
    175 
    176 void SVGAngle::convertToSpecifiedUnits(unsigned short unitType, ExceptionCode& ec)
    177 {
    178     if (unitType == SVG_ANGLETYPE_UNKNOWN || m_unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD) {
    179         ec = NOT_SUPPORTED_ERR;
    180         return;
    181     }
     134    return { };
     135}
     136
     137ExceptionOr<void> SVGAngle::convertToSpecifiedUnits(unsigned short unitType)
     138{
     139    if (unitType == SVG_ANGLETYPE_UNKNOWN || m_unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD)
     140        return Exception { NOT_SUPPORTED_ERR };
    182141
    183142    if (unitType == m_unitType)
    184         return;
     143        return { };
    185144
    186145    switch (m_unitType) {
     
    226185            break;
    227186        case SVG_ANGLETYPE_UNSPECIFIED:
    228             break;
    229187        case SVG_ANGLETYPE_DEG:
     188            break;
    230189        case SVG_ANGLETYPE_UNKNOWN:
    231190            ASSERT_NOT_REACHED();
     
    239198
    240199    m_unitType = static_cast<SVGAngleType>(unitType);
    241 }
    242 
    243 }
     200
     201    return { };
     202}
     203
     204}
  • trunk/Source/WebCore/svg/SVGAngle.h

    r163440 r207716  
    2020 */
    2121
    22 #ifndef SVGAngle_h
    23 #define SVGAngle_h
     22#pragma once
    2423
     24#include "ExceptionOr.h"
    2525#include "SVGPropertyTraits.h"
    2626
    2727namespace WebCore {
    2828
    29 typedef int ExceptionCode;
    30 
    3129class SVGAngle {
    3230    WTF_MAKE_FAST_ALLOCATED;
    3331public:
    34     SVGAngle();
    35 
    3632    enum SVGAngleType {
    3733        SVG_ANGLETYPE_UNKNOWN = 0,
     
    5046    float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; }
    5147
    52     void setValueAsString(const String&, ExceptionCode&);
     48    ExceptionOr<void> setValueAsString(const String&);
    5349    String valueAsString() const;
    5450
    55     void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, ExceptionCode&);
    56     void convertToSpecifiedUnits(unsigned short unitType, ExceptionCode&);
     51    ExceptionOr<void> newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits);
     52    ExceptionOr<void> convertToSpecifiedUnits(unsigned short unitType);
    5753
    5854private:
    59     SVGAngleType m_unitType;
    60     float m_valueInSpecifiedUnits;
     55    SVGAngleType m_unitType { SVG_ANGLETYPE_UNSPECIFIED };
     56    float m_valueInSpecifiedUnits { 0 };
    6157};
    6258
    63 template<>
    64 struct SVGPropertyTraits<SVGAngle> {
     59template<> struct SVGPropertyTraits<SVGAngle> {
    6560    static SVGAngle initialValue() { return SVGAngle(); }
    6661    static String toString(const SVGAngle& type) { return type.valueAsString(); }
     
    6863
    6964} // namespace WebCore
    70 
    71 #endif // SVGAngle_h
  • trunk/Source/WebCore/svg/SVGAngle.idl

    r206723 r207716  
    3333    attribute unrestricted float valueInSpecifiedUnits;
    3434
    35     [SetterMayThrowLegacyException] attribute DOMString valueAsString;
     35    [SetterMayThrowException] attribute DOMString valueAsString;
    3636
    37     [MayThrowLegacyException] void newValueSpecifiedUnits(unsigned short unitType, unrestricted float valueInSpecifiedUnits);
    38 
    39     [MayThrowLegacyException] void convertToSpecifiedUnits(unsigned short unitType);
     37    [MayThrowException] void newValueSpecifiedUnits(unsigned short unitType, unrestricted float valueInSpecifiedUnits);
     38    [MayThrowException] void convertToSpecifiedUnits(unsigned short unitType);
    4039};
    41 
  • trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp

    r207458 r207716  
    110110        percentage = 1;
    111111
    112     if (calcMode() == CalcModeDiscrete)
     112    if (calcMode() == CalcMode::Discrete)
    113113        percentage = percentage < 0.5 ? 0 : 1;
    114114
  • trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp

    r203337 r207716  
    4747    , m_hasToPointAtEndOfDuration(false)
    4848{
    49     setCalcMode(CalcModePaced);
     49    setCalcMode(CalcMode::Paced);
    5050    ASSERT(hasTagName(animateMotionTag));
    5151}
  • trunk/Source/WebCore/svg/SVGAnimateTransformElement.cpp

    r182121 r207716  
    4747        return false;
    4848
    49     if (attributeType() == AttributeTypeCSS)
     49    if (attributeType() == AttributeType::CSS)
    5050        return false;
    5151
  • trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp

    r197738 r207716  
    138138{
    139139    SVGAngle from = SVGAngle();
    140     from.setValueAsString(fromString, ASSERT_NO_EXCEPTION);
     140    from.setValueAsString(fromString);
    141141    SVGAngle to = SVGAngle();
    142     to.setValueAsString(toString, ASSERT_NO_EXCEPTION);
     142    to.setValueAsString(toString);
    143143    return fabsf(to.value() - from.value());
    144144}
  • trunk/Source/WebCore/svg/SVGAnimatedBoolean.idl

    r206723 r207716  
    2727    SkipVTableValidation
    2828] interface SVGAnimatedBoolean {
    29     [SetterMayThrowLegacyException] attribute boolean baseVal;
     29    [SetterMayThrowException] attribute boolean baseVal;
    3030    readonly attribute boolean animVal;
    3131};
  • trunk/Source/WebCore/svg/SVGAnimatedEnumeration.idl

    r206723 r207716  
    2727    SkipVTableValidation
    2828] interface SVGAnimatedEnumeration {
    29     [SetterMayThrowLegacyException] attribute unsigned short baseVal;
     29    [SetterMayThrowException] attribute unsigned short baseVal;
    3030    readonly attribute unsigned short animVal;
    3131};
  • trunk/Source/WebCore/svg/SVGAnimatedInteger.idl

    r206723 r207716  
    2727    SkipVTableValidation
    2828] interface SVGAnimatedInteger {
    29     [SetterMayThrowLegacyException] attribute long baseVal;
     29    [SetterMayThrowException] attribute long baseVal;
    3030    readonly attribute long animVal;
    3131};
  • trunk/Source/WebCore/svg/SVGAnimatedLength.cpp

    r193809 r207716  
    3131    , m_lengthMode(SVGLength::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()))
    3232{
    33 }
    34 
    35 static inline SVGLength& sharedSVGLength(SVGLengthMode mode, const String& valueAsString)
    36 {
    37     static NeverDestroyed<SVGLength> sharedLength;
    38     sharedLength.get().setValueAsString(valueAsString, mode, ASSERT_NO_EXCEPTION);
    39     return sharedLength;
    4033}
    4134
     
    7972    SVGLength& toLength = to->length();
    8073
    81     toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthContext), lengthContext, ASSERT_NO_EXCEPTION);
     74    toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthContext), lengthContext);
    8275}
    8376
    8477static SVGLength parseLengthFromString(SVGAnimationElement* animationElement, const String& string)
    8578{
    86     return sharedSVGLength(SVGLength::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()), string);
     79    SVGLength length;
     80    length.setValueAsString(string, SVGLength::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()));
     81    return length;
    8782}
    8883
     
    106101    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromSVGLength.value(lengthContext), toSVGLength.value(lengthContext), toAtEndOfDurationSVGLength.value(lengthContext), animatedNumber);
    107102
    108     animatedSVGLength.setValue(lengthContext, animatedNumber, m_lengthMode, unitType, ASSERT_NO_EXCEPTION);
     103    animatedSVGLength.setValue(lengthContext, animatedNumber, m_lengthMode, unitType);
    109104}
    110105
  • trunk/Source/WebCore/svg/SVGAnimatedLengthList.cpp

    r193809 r207716  
    7878    SVGLengthContext lengthContext(m_contextElement);
    7979    for (unsigned i = 0; i < fromLengthListSize; ++i)
    80         toLengthList[i].setValue(toLengthList[i].value(lengthContext) + fromLengthList[i].value(lengthContext), lengthContext, ASSERT_NO_EXCEPTION);
     80        toLengthList[i].setValue(toLengthList[i].value(lengthContext) + fromLengthList[i].value(lengthContext), lengthContext);
    8181}
    8282
     
    122122
    123123        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toLengthList[i].value(lengthContext), effectiveToAtEnd, animatedNumber);
    124         animatedLengthList[i].setValue(lengthContext, animatedNumber, m_lengthMode, unitType, ASSERT_NO_EXCEPTION);
     124        animatedLengthList[i].setValue(lengthContext, animatedNumber, m_lengthMode, unitType);
    125125    }
    126126}
  • trunk/Source/WebCore/svg/SVGAnimatedNumber.idl

    r206723 r207716  
    2828    SkipVTableValidation
    2929] interface SVGAnimatedNumber {
    30     [SetterMayThrowLegacyException] attribute unrestricted float baseVal;
     30    [SetterMayThrowException] attribute unrestricted float baseVal;
    3131    readonly attribute unrestricted float animVal;
    3232};
  • trunk/Source/WebCore/svg/SVGAnimatedString.idl

    r206723 r207716  
    2727    SkipVTableValidation
    2828] interface SVGAnimatedString {
    29     [SetterMayThrowLegacyException] attribute DOMString baseVal;
     29    [SetterMayThrowException] attribute DOMString baseVal;
    3030    readonly attribute DOMString animVal;
    3131};
  • trunk/Source/WebCore/svg/SVGAnimatedType.cpp

    r190003 r207716  
    277277        ASSERT(m_data.color);
    278278        *m_data.color = SVGColor::colorFromRGBColorString(value);
    279         break;
    280     case AnimatedLength: {
     279        return true;
     280    case AnimatedLength:
    281281        ASSERT(m_data.length);
    282         ExceptionCode ec = 0;
    283         m_data.length->setValueAsString(value, SVGLength::lengthModeForAnimatedLengthAttribute(attrName), ec);
    284         return !ec;
    285     }
     282        return !m_data.length->setValueAsString(value, SVGLength::lengthModeForAnimatedLengthAttribute(attrName)).hasException();
    286283    case AnimatedLengthList:
    287284        ASSERT(m_data.lengthList);
    288285        m_data.lengthList->parse(value, SVGLength::lengthModeForAnimatedLengthAttribute(attrName));
    289         break;
     286        return true;
    290287    case AnimatedNumber:
    291288        ASSERT(m_data.number);
    292289        parseNumberFromString(value, *m_data.number);
    293         break;
     290        return true;
    294291    case AnimatedRect:
    295292        ASSERT(m_data.rect);
    296293        parseRect(value, *m_data.rect);
    297         break;
     294        return true;
    298295    case AnimatedString:
    299296        ASSERT(m_data.string);
    300297        *m_data.string = value;
    301         break;
     298        return true;
    302299
    303300    // These types don't appear in the table in SVGElement::cssPropertyToTypeMap() and thus don't need setValueAsString() support.
  • trunk/Source/WebCore/svg/SVGAnimationElement.cpp

    r203337 r207716  
    5454SVGAnimationElement::SVGAnimationElement(const QualifiedName& tagName, Document& document)
    5555    : SVGSMILElement(tagName, document)
    56     , m_fromPropertyValueType(RegularPropertyValue)
    57     , m_toPropertyValueType(RegularPropertyValue)
    58     , m_animationValid(false)
    59     , m_attributeType(AttributeTypeAuto)
    60     , m_hasInvalidCSSAttributeType(false)
    61     , m_calcMode(CalcModeLinear)
    62     , m_animationMode(NoAnimation)
    6356{
    6457    registerAnimatedPropertiesForSVGAnimationElement();
     
    242235}
    243236
    244 float SVGAnimationElement::getSimpleDuration(ExceptionCode&) const
     237float SVGAnimationElement::getSimpleDuration() const
    245238{
    246239    return narrowPrecisionToFloat(simpleDuration().value());
     
    293286    static NeverDestroyed<const AtomicString> spline("spline", AtomicString::ConstructFromLiteral);
    294287    if (calcMode == discrete)
    295         setCalcMode(CalcModeDiscrete);
     288        setCalcMode(CalcMode::Discrete);
    296289    else if (calcMode == linear)
    297         setCalcMode(CalcModeLinear);
     290        setCalcMode(CalcMode::Linear);
    298291    else if (calcMode == paced)
    299         setCalcMode(CalcModePaced);
     292        setCalcMode(CalcMode::Paced);
    300293    else if (calcMode == spline)
    301         setCalcMode(CalcModeSpline);
     294        setCalcMode(CalcMode::Spline);
    302295    else
    303         setCalcMode(hasTagName(SVGNames::animateMotionTag) ? CalcModePaced : CalcModeLinear);
     296        setCalcMode(hasTagName(SVGNames::animateMotionTag) ? CalcMode::Paced : CalcMode::Linear);
    304297}
    305298
     
    309302    static NeverDestroyed<const AtomicString> xml("XML", AtomicString::ConstructFromLiteral);
    310303    if (attributeType == css)
    311         m_attributeType = AttributeTypeCSS;
     304        m_attributeType = AttributeType::CSS;
    312305    else if (attributeType == xml)
    313         m_attributeType = AttributeTypeXML;
     306        m_attributeType = AttributeType::XML;
    314307    else
    315         m_attributeType = AttributeTypeAuto;
     308        m_attributeType = AttributeType::Auto;
    316309    checkInvalidCSSAttributeType(targetElement());
    317310}
     
    369362
    370363    // If attributeType="CSS" and attributeName doesn't point to a CSS property, ignore the animation.
    371     if (attributeType() == AttributeTypeCSS)
     364    if (attributeType() == AttributeType::CSS)
    372365        return DontApplyAnimation;
    373366
     
    377370void SVGAnimationElement::calculateKeyTimesForCalcModePaced()
    378371{
    379     ASSERT(calcMode() == CalcModePaced);
     372    ASSERT(calcMode() == CalcMode::Paced);
    380373    ASSERT(animationMode() == ValuesAnimation);
    381374
     
    429422float SVGAnimationElement::calculatePercentForSpline(float percent, unsigned splineIndex) const
    430423{
    431     ASSERT(calcMode() == CalcModeSpline);
     424    ASSERT(calcMode() == CalcMode::Spline);
    432425    ASSERT_WITH_SECURITY_IMPLICATION(splineIndex < m_keySplines.size());
    433426    UnitBezier bezier = m_keySplines[splineIndex];
     
    441434{
    442435    ASSERT(!m_keyPoints.isEmpty());
    443     ASSERT(calcMode() != CalcModePaced);
     436    ASSERT(calcMode() != CalcMode::Paced);
    444437    ASSERT(m_keyTimes.size() > 1);
    445438    ASSERT(m_keyPoints.size() == m_keyTimes.size());
     
    454447    float toKeyPoint = m_keyPoints[index + 1];
    455448   
    456     if (calcMode() == CalcModeDiscrete)
     449    if (calcMode() == CalcMode::Discrete)
    457450        return fromKeyPoint;
    458451   
    459452    float keyPointPercent = (percent - fromPercent) / (toPercent - fromPercent);
    460453   
    461     if (calcMode() == CalcModeSpline) {
     454    if (calcMode() == CalcMode::Spline) {
    462455        ASSERT(m_keySplines.size() == m_keyPoints.size() - 1);
    463456        keyPointPercent = calculatePercentForSpline(keyPointPercent, index);
     
    468461float SVGAnimationElement::calculatePercentForFromTo(float percent) const
    469462{
    470     if (calcMode() == CalcModeDiscrete && m_keyTimes.size() == 2)
     463    if (calcMode() == CalcMode::Discrete && m_keyTimes.size() == 2)
    471464        return percent > m_keyTimes[1] ? 1 : 0;
    472465
     
    478471    ASSERT(!m_keyPoints.isEmpty());
    479472    ASSERT(m_keyPoints.size() == m_keyTimes.size());
    480     ASSERT(calcMode() != CalcModePaced);
     473    ASSERT(calcMode() != CalcMode::Paced);
    481474    effectivePercent = calculatePercentFromKeyPoints(percent);
    482475    unsigned index = effectivePercent == 1 ? m_values.size() - 2 : static_cast<unsigned>(effectivePercent * (m_values.size() - 1));
     
    503496        AnimatedPropertyType type = downcast<SVGAnimateElementBase>(*this).determineAnimatedPropertyType(*targetElement());
    504497        if (type == AnimatedBoolean || type == AnimatedEnumeration || type == AnimatedPreserveAspectRatio || type == AnimatedString)
    505             calcMode = CalcModeDiscrete;
    506     }
    507     if (!m_keyPoints.isEmpty() && calcMode != CalcModePaced)
     498            calcMode = CalcMode::Discrete;
     499    }
     500    if (!m_keyPoints.isEmpty() && calcMode != CalcMode::Paced)
    508501        return currentValuesFromKeyPoints(percent, effectivePercent, from, to);
    509502   
     
    513506
    514507    unsigned index = calculateKeyTimesIndex(percent);
    515     if (calcMode == CalcModeDiscrete) {
     508    if (calcMode == CalcMode::Discrete) {
    516509        if (!keyTimesCount)
    517510            index = static_cast<unsigned>(percent * valuesCount);
     
    540533    effectivePercent = (percent - fromPercent) / (toPercent - fromPercent);
    541534
    542     if (calcMode == CalcModeSpline) {
     535    if (calcMode == CalcMode::Spline) {
    543536        ASSERT(m_keySplines.size() == m_values.size() - 1);
    544537        effectivePercent = calculatePercentForSpline(effectivePercent, index);
     
    559552    AnimationMode animationMode = this->animationMode();
    560553    CalcMode calcMode = this->calcMode();
    561     if (calcMode == CalcModeSpline) {
     554    if (calcMode == CalcMode::Spline) {
    562555        unsigned splinesCount = m_keySplines.size();
    563556        if (!splinesCount
     
    588581    else if (animationMode == ValuesAnimation) {
    589582        m_animationValid = m_values.size() >= 1
    590             && (calcMode == CalcModePaced || !hasAttributeWithoutSynchronization(SVGNames::keyTimesAttr) || hasAttributeWithoutSynchronization(SVGNames::keyPointsAttr) || (m_values.size() == m_keyTimes.size()))
    591             && (calcMode == CalcModeDiscrete || !m_keyTimes.size() || m_keyTimes.last() == 1)
    592             && (calcMode != CalcModeSpline || ((m_keySplines.size() && (m_keySplines.size() == m_values.size() - 1)) || m_keySplines.size() == m_keyPoints.size() - 1))
     583            && (calcMode == CalcMode::Paced || !hasAttributeWithoutSynchronization(SVGNames::keyTimesAttr) || hasAttributeWithoutSynchronization(SVGNames::keyPointsAttr) || (m_values.size() == m_keyTimes.size()))
     584            && (calcMode == CalcMode::Discrete || !m_keyTimes.size() || m_keyTimes.last() == 1)
     585            && (calcMode != CalcMode::Spline || ((m_keySplines.size() && (m_keySplines.size() == m_values.size() - 1)) || m_keySplines.size() == m_keyPoints.size() - 1))
    593586            && (!hasAttributeWithoutSynchronization(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size()));
    594587        if (m_animationValid)
    595588            m_animationValid = calculateToAtEndOfDurationValue(m_values.last());
    596         if (calcMode == CalcModePaced && m_animationValid)
     589        if (calcMode == CalcMode::Paced && m_animationValid)
    597590            calculateKeyTimesForCalcModePaced();
    598591    } else if (animationMode == PathAnimation)
    599         m_animationValid = calcMode == CalcModePaced || !hasAttributeWithoutSynchronization(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size());
     592        m_animationValid = calcMode == CalcMode::Paced || !hasAttributeWithoutSynchronization(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size());
    600593}
    601594
     
    619612            m_lastValuesAnimationTo = to;
    620613        }
    621     } else if (!m_keyPoints.isEmpty() && calcMode != CalcModePaced)
     614    } else if (!m_keyPoints.isEmpty() && calcMode != CalcMode::Paced)
    622615        effectivePercent = calculatePercentFromKeyPoints(percent);
    623     else if (m_keyPoints.isEmpty() && calcMode == CalcModeSpline && m_keyTimes.size() > 1)
     616    else if (m_keyPoints.isEmpty() && calcMode == CalcMode::Spline && m_keyTimes.size() > 1)
    624617        effectivePercent = calculatePercentForSpline(percent, calculateKeyTimesIndex(percent));
    625618    else if (animationMode == FromToAnimation || animationMode == ToAnimation)
     
    690683void SVGAnimationElement::checkInvalidCSSAttributeType(SVGElement* target)
    691684{
    692     m_hasInvalidCSSAttributeType = target && hasValidAttributeName() && attributeType() == AttributeTypeCSS && !isTargetAttributeCSSProperty(target, attributeName());
    693 }
    694 
    695 }
     685    m_hasInvalidCSSAttributeType = target && hasValidAttributeName() && attributeType() == AttributeType::CSS && !isTargetAttributeCSSProperty(target, attributeName());
     686}
     687
     688}
  • trunk/Source/WebCore/svg/SVGAnimationElement.h

    r197563 r207716  
    2323 */
    2424
    25 #ifndef SVGAnimationElement_h
    26 #define SVGAnimationElement_h
     25#pragma once
    2726
    2827#include "SMILTime.h"
     
    3433
    3534namespace WebCore {
     35
     36class ConditionEventListener;
     37class SVGAnimatedType;
     38class TimeContainer;
    3639
    3740enum AnimationMode {
     
    4750// If we have 'currentColor' or 'inherit' as animation value, we need to grab
    4851// the value during the animation since the value can be animated itself.
    49 enum AnimatedPropertyValueType {
    50     RegularPropertyValue,
    51     CurrentColorValue,
    52     InheritValue
    53 };
    54 
    55 enum CalcMode {
    56     CalcModeDiscrete,
    57     CalcModeLinear,
    58     CalcModePaced,
    59     CalcModeSpline
    60 };
    61 
    62 class ConditionEventListener;
    63 class TimeContainer;
    64 class SVGAnimatedType;
    65 
    66 class SVGAnimationElement : public SVGSMILElement,
    67                             public SVGTests,
    68                             public SVGExternalResourcesRequired {
     52enum AnimatedPropertyValueType { RegularPropertyValue, CurrentColorValue, InheritValue };
     53
     54enum class CalcMode { Discrete, Linear, Paced, Spline };
     55
     56class SVGAnimationElement : public SVGSMILElement, public SVGTests, public SVGExternalResourcesRequired {
    6957public:
    70     // SVGAnimationElement
    7158    float getStartTime() const;
    7259    float getCurrentTime() const;
    73     float getSimpleDuration(ExceptionCode&) const;
     60    float getSimpleDuration() const;
    7461
    7562    void beginElement();
     
    9784    AnimatedPropertyValueType toPropertyValueType() const { return m_toPropertyValueType; }
    9885
    99     template<typename AnimatedType>
    100     void adjustForInheritance(AnimatedType (*parseTypeFromString)(SVGAnimationElement*, const String&),
    101                               AnimatedPropertyValueType valueType, AnimatedType& animatedType, SVGElement* contextElement)
     86    template<typename AnimatedType> void adjustForInheritance(AnimatedType (*parseTypeFromString)(SVGAnimationElement*, const String&), AnimatedPropertyValueType valueType, AnimatedType& animatedType, SVGElement* contextElement)
    10287    {
    10388        if (valueType != InheritValue)
     
    11095    }
    11196
    112     template<typename AnimatedType>
    113     bool adjustFromToListValues(const AnimatedType& fromList, const AnimatedType& toList, AnimatedType& animatedList, float percentage, bool resizeAnimatedListIfNeeded = true)
     97    template<typename AnimatedType> bool adjustFromToListValues(const AnimatedType& fromList, const AnimatedType& toList, AnimatedType& animatedList, float percentage, bool resizeAnimatedListIfNeeded = true)
    11498    {
    11599        // If no 'to' value is given, nothing to animate.
     
    137121    }
    138122
    139     template<typename AnimatedType>
    140     void animateDiscreteType(float percentage, const AnimatedType& fromType, const AnimatedType& toType, AnimatedType& animatedType)
     123    template<typename AnimatedType> void animateDiscreteType(float percentage, const AnimatedType& fromType, const AnimatedType& toType, AnimatedType& animatedType)
    141124    {
    142125        if ((animationMode() == FromToAnimation && percentage > 0.5) || animationMode() == ToAnimation || percentage == 1) {
     
    150133    {
    151134        float number;
    152         if (calcMode() == CalcModeDiscrete)
     135        if (calcMode() == CalcMode::Discrete)
    153136            number = percentage < 0.5 ? fromNumber : toNumber;
    154137        else
     
    175158    void svgAttributeChanged(const QualifiedName&) override;
    176159
    177     enum AttributeType {
    178         AttributeTypeCSS,
    179         AttributeTypeXML,
    180         AttributeTypeAuto
    181     };
     160    enum class AttributeType { CSS, XML, Auto };
    182161    AttributeType attributeType() const { return m_attributeType; }
    183162
     
    192171    void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement) override;
    193172
    194     AnimatedPropertyValueType m_fromPropertyValueType;
    195     AnimatedPropertyValueType m_toPropertyValueType;
     173    AnimatedPropertyValueType m_fromPropertyValueType { RegularPropertyValue };
     174    AnimatedPropertyValueType m_toPropertyValueType { RegularPropertyValue };
    196175
    197176    void setTargetElement(SVGElement*) override;
     
    236215    void setCalcMode(const AtomicString&);
    237216
    238     bool m_animationValid;
    239 
    240     AttributeType m_attributeType;
     217    bool m_animationValid { false };
     218
     219    AttributeType m_attributeType { AttributeType::Auto };
    241220    Vector<String> m_values;
    242221    Vector<float> m_keyTimes;
     
    245224    String m_lastValuesAnimationFrom;
    246225    String m_lastValuesAnimationTo;
    247     bool m_hasInvalidCSSAttributeType;
    248     CalcMode m_calcMode;
    249     AnimationMode m_animationMode;
     226    bool m_hasInvalidCSSAttributeType { false };
     227    CalcMode m_calcMode { CalcMode::Linear };
     228    AnimationMode m_animationMode { NoAnimation };
    250229};
    251230
    252231} // namespace WebCore
    253 
    254 #endif // SVGAnimationElement_h
  • trunk/Source/WebCore/svg/SVGAnimationElement.idl

    r206723 r207716  
    3030    unrestricted float getStartTime();
    3131    unrestricted float getCurrentTime();
    32     [MayThrowLegacyException] unrestricted float getSimpleDuration();
     32    unrestricted float getSimpleDuration();
    3333
    3434    void beginElement();
  • trunk/Source/WebCore/svg/SVGColor.cpp

    r207361 r207716  
    2929namespace WebCore {
    3030
    31 SVGColor::SVGColor(const SVGColorType& colorType)
     31SVGColor::SVGColor(SVGColorType colorType)
    3232    : CSSValue(SVGColorClass)
    3333    , m_colorType(colorType)
     
    3535}
    3636
    37 SVGColor::SVGColor(ClassType classType, const SVGColorType& colorType)
     37SVGColor::SVGColor(ClassType classType, SVGColorType colorType)
    3838    : CSSValue(classType)
    3939    , m_colorType(colorType)
     
    5555}
    5656
    57 void SVGColor::setRGBColor(const String&, ExceptionCode& ec)
     57ExceptionOr<void> SVGColor::setRGBColor(const String&)
    5858{
    5959    // The whole SVGColor interface is deprecated in SVG 1.1 (2nd edition).
    6060    // Since the setters are the most problematic part, we removed the support for those first.
    61     ec = NO_MODIFICATION_ALLOWED_ERR;
     61    return Exception { NO_MODIFICATION_ALLOWED_ERR };
    6262}
    6363
    64 void SVGColor::setRGBColorICCColor(const String&, const String&, ExceptionCode& ec)
     64ExceptionOr<void> SVGColor::setRGBColorICCColor(const String&, const String&)
    6565{
    66     ec = NO_MODIFICATION_ALLOWED_ERR;
     66    return Exception { NO_MODIFICATION_ALLOWED_ERR };
    6767}
    6868
    69 void SVGColor::setColor(unsigned short, const String&, const String&, ExceptionCode& ec)
     69ExceptionOr<void> SVGColor::setColor(unsigned short, const String&, const String&)
    7070{
    71     ec = NO_MODIFICATION_ALLOWED_ERR;
     71    return Exception { NO_MODIFICATION_ALLOWED_ERR };
    7272}
    7373
  • trunk/Source/WebCore/svg/SVGColor.h

    r183611 r207716  
    2020 */
    2121
    22 #ifndef SVGColor_h
    23 #define SVGColor_h
     22#pragma once
    2423
    2524#include "CSSValue.h"
     
    6463    static Color colorFromRGBColorString(const String&);
    6564
    66     void setRGBColor(const String& rgbColor, ExceptionCode&);
    67     void setRGBColorICCColor(const String& rgbColor, const String& iccColor, ExceptionCode&);
    68     void setColor(unsigned short colorType, const String& rgbColor, const String& iccColor, ExceptionCode&);
     65    ExceptionOr<void> setRGBColor(const String&);
     66    ExceptionOr<void> setRGBColorICCColor(const String& rgbColor, const String& iccColor);
     67    ExceptionOr<void> setColor(unsigned short colorType, const String& rgbColor, const String& iccColor);
    6968
    7069    String customCSSText() const;
    7170
    72     ~SVGColor() { }
    73    
    7471    Ref<SVGColor> cloneForCSSOM() const;
    7572
     
    7976    friend class CSSComputedStyleDeclaration;
    8077
    81     SVGColor(ClassType, const SVGColorType&);
     78    SVGColor(ClassType, SVGColorType);
    8279    SVGColor(ClassType, const SVGColor& cloneFrom);
    8380
     
    8683
    8784private:
    88     SVGColor(const SVGColorType&);
     85    explicit SVGColor(SVGColorType);
    8986
    9087    Color m_color;
     
    9592
    9693SPECIALIZE_TYPE_TRAITS_CSS_VALUE(SVGColor, isSVGColor())
    97 
    98 #endif // SVGColor_h
  • trunk/Source/WebCore/svg/SVGColor.idl

    r206723 r207716  
    3232    // FIXME: readonly attribute SVGICCColor iccColor;
    3333
    34     [MayThrowLegacyException] void setRGBColor(DOMString rgbColor);
    35 
    36     [MayThrowLegacyException] void setRGBColorICCColor(DOMString rgbColor, DOMString iccColor);
    37 
    38     [MayThrowLegacyException] void setColor(unsigned short colorType, DOMString rgbColor, DOMString iccColor);
     34    [MayThrowException] void setRGBColor(DOMString rgbColor);
     35    [MayThrowException] void setRGBColorICCColor(DOMString rgbColor, DOMString iccColor);
     36    [MayThrowException] void setColor(unsigned short colorType, DOMString rgbColor, DOMString iccColor);
    3937};
    40 
  • trunk/Source/WebCore/svg/SVGGlyphRefElement.cpp

    r203324 r207716  
    2828#include "XLinkNames.h"
    2929#include <wtf/text/AtomicString.h>
    30 #include <wtf/text/StringView.h>
    3130
    3231namespace WebCore {
     
    4241inline SVGGlyphRefElement::SVGGlyphRefElement(const QualifiedName& tagName, Document& document)
    4342    : SVGElement(tagName, document)
    44     , m_x(0)
    45     , m_y(0)
    46     , m_dx(0)
    47     , m_dy(0)
    4843{
    4944    ASSERT(hasTagName(SVGNames::glyphRefTag));
     
    6358}
    6459
     60static float parseFloat(const AtomicString& value)
     61{
     62    float result;
     63    if (!parseNumberFromString(value, result))
     64        return 0;
     65    return result;
     66}
     67
    6568void SVGGlyphRefElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    6669{
    67     auto upconvertedCharacters = StringView(value.string()).upconvertedCharacters();
    68     const UChar* startPtr = upconvertedCharacters;
    69     const UChar* endPtr = startPtr + value.length();
    70 
    71     // FIXME: We need some error handling here.
     70    // FIXME: Is the error handling in parseFloat correct for these attributes?
    7271    if (name == SVGNames::xAttr)
    73         parseNumber(startPtr, endPtr, m_x);
     72        m_x = parseFloat(value);
    7473    else if (name == SVGNames::yAttr)
    75         parseNumber(startPtr, endPtr, m_y);
     74        m_y = parseFloat(value);
    7675    else if (name == SVGNames::dxAttr)
    77         parseNumber(startPtr, endPtr, m_dx);
     76        m_dx = parseFloat(value);
    7877    else if (name == SVGNames::dyAttr)
    79         parseNumber(startPtr, endPtr, m_dy);
     78        m_dy = parseFloat(value);
    8079    else {
    8180        SVGURIReference::parseAttribute(name, value);
     
    8483}
    8584
    86 const AtomicString& SVGGlyphRefElement::glyphRef() const
     85void SVGGlyphRefElement::setX(float x)
    8786{
    88     return attributeWithoutSynchronization(SVGNames::glyphRefAttr);
     87    setAttribute(SVGNames::xAttr, AtomicString::number(x));
    8988}
    9089
    91 void SVGGlyphRefElement::setGlyphRef(const AtomicString&, ExceptionCode&)
     90void SVGGlyphRefElement::setY(float y)
    9291{
    93     // FIXME: Set and honor attribute change.
    94     // https://bugs.webkit.org/show_bug.cgi?id=64787
     92    setAttribute(SVGNames::yAttr, AtomicString::number(y));
    9593}
    9694
    97 void SVGGlyphRefElement::setX(float x, ExceptionCode&)
     95void SVGGlyphRefElement::setDx(float dx)
    9896{
    99     // FIXME: Honor attribute change.
    100     // https://bugs.webkit.org/show_bug.cgi?id=64787
    101     m_x = x;
     97    setAttribute(SVGNames::dxAttr, AtomicString::number(dx));
    10298}
    10399
    104 void SVGGlyphRefElement::setY(float y , ExceptionCode&)
     100void SVGGlyphRefElement::setDy(float dy)
    105101{
    106     // FIXME: Honor attribute change.
    107     // https://bugs.webkit.org/show_bug.cgi?id=64787
    108     m_y = y;
    109 }
    110 
    111 void SVGGlyphRefElement::setDx(float dx, ExceptionCode&)
    112 {
    113     // FIXME: Honor attribute change.
    114     // https://bugs.webkit.org/show_bug.cgi?id=64787
    115     m_dx = dx;
    116 }
    117 
    118 void SVGGlyphRefElement::setDy(float dy, ExceptionCode&)
    119 {
    120     // FIXME: Honor attribute change.
    121     // https://bugs.webkit.org/show_bug.cgi?id=64787
    122     m_dy = dy;
     102    setAttribute(SVGNames::dyAttr, AtomicString::number(dy));
    123103}
    124104
  • trunk/Source/WebCore/svg/SVGGlyphRefElement.h

    r203469 r207716  
    1818 */
    1919
    20 #ifndef SVGGlyphRefElement_h
    21 #define SVGGlyphRefElement_h
     20#pragma once
    2221
    2322#if ENABLE(SVG_FONTS)
     23
    2424#include "SVGElement.h"
    2525#include "SVGURIReference.h"
     
    2727namespace WebCore {
    2828
    29 class SVGGlyphRefElement final : public SVGElement,
    30                                  public SVGURIReference {
     29class SVGGlyphRefElement final : public SVGElement, public SVGURIReference {
    3130public:
    3231    static Ref<SVGGlyphRefElement> create(const QualifiedName&, Document&);
    3332
    3433    bool hasValidGlyphElement(String& glyphName) const;
    35     void parseAttribute(const QualifiedName&, const AtomicString&) final;
    3634
    37     // DOM interface
    38     const AtomicString& glyphRef() const;
    39     void setGlyphRef(const AtomicString&, ExceptionCode&);
    4035    float x() const { return m_x; }
    41     void setX(float, ExceptionCode&);
     36    void setX(float);
    4237    float y() const { return m_y; }
    43     void setY(float, ExceptionCode&);
     38    void setY(float);
    4439    float dx() const { return m_dx; }
    45     void setDx(float, ExceptionCode&);
     40    void setDx(float);
    4641    float dy() const { return m_dy; }
    47     void setDy(float, ExceptionCode&);
     42    void setDy(float);
    4843
    4944private:
    5045    SVGGlyphRefElement(const QualifiedName&, Document&);
    5146
     47    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    5248    bool rendererIsNeeded(const RenderStyle&) final { return false; }
    5349
     
    5652    END_DECLARE_ANIMATED_PROPERTIES
    5753
    58     float m_x;
    59     float m_y;
    60     float m_dx;
    61     float m_dy;
     54    float m_x { 0 };
     55    float m_y { 0 };
     56    float m_dx { 0 };
     57    float m_dy { 0 };
    6258};
    6359
     
    6561
    6662#endif
    67 #endif
  • trunk/Source/WebCore/svg/SVGGlyphRefElement.idl

    r206723 r207716  
    2121    Conditional=SVG_FONTS
    2222] interface SVGGlyphRefElement : SVGElement {
    23     // FIXME: Use [Reflect] after https://bugs.webkit.org/show_bug.cgi?id=64843 is fixed.
    24     [SetterMayThrowLegacyException] attribute DOMString glyphRef;
     23    [Reflect=glyphRef] attribute DOMString glyphRef;
    2524    [Reflect] attribute DOMString format;
    26     [SetterMayThrowLegacyException] attribute unrestricted float x;
    27     [SetterMayThrowLegacyException] attribute unrestricted float y;
    28     [SetterMayThrowLegacyException] attribute unrestricted float dx;
    29     [SetterMayThrowLegacyException] attribute unrestricted float dy;
     25    attribute unrestricted float x;
     26    attribute unrestricted float y;
     27    attribute unrestricted float dx;
     28    attribute unrestricted float dy;
    3029};
    3130
  • trunk/Source/WebCore/svg/SVGGraphicsElement.idl

    r206723 r207716  
    3333    SVGMatrix getCTM();
    3434    SVGMatrix getScreenCTM();
    35     [MayThrowLegacyException] SVGMatrix getTransformToElement(optional SVGElement? element = null);
     35    [MayThrowException] SVGMatrix getTransformToElement(optional SVGElement? element = null);
    3636};
    3737
  • trunk/Source/WebCore/svg/SVGLength.cpp

    r207396 r207716  
    2626#include "CSSPrimitiveValue.h"
    2727#include "ExceptionCode.h"
    28 #include "ExceptionCodePlaceholder.h"
    2928#include "FloatConversion.h"
    3029#include "SVGNames.h"
     
    8685}
    8786
    88 inline SVGLengthType stringToLengthType(const UChar*& ptr, const UChar* end)
     87inline SVGLengthType parseLengthType(const UChar* ptr, const UChar* end)
    8988{
    9089    if (ptr == end)
     
    125124    , m_unit(storeUnit(mode, LengthTypeNumber))
    126125{
    127     setValueAsString(valueAsString, IGNORE_EXCEPTION);
     126    setValueAsString(valueAsString);
    128127}
    129128
     
    132131    , m_unit(storeUnit(mode, unitType))
    133132{
    134     setValue(value, context, ASSERT_NO_EXCEPTION);
    135 }
    136 
    137 SVGLength::SVGLength(const SVGLength& other)
    138     : m_valueInSpecifiedUnits(other.m_valueInSpecifiedUnits)
    139     , m_unit(other.m_unit)
    140 {
    141 }
    142 
    143 void SVGLength::setValueAsString(const String& valueAsString, SVGLengthMode mode, ExceptionCode& ec)
     133    setValue(value, context);
     134}
     135
     136ExceptionOr<void> SVGLength::setValueAsString(const String& valueAsString, SVGLengthMode mode)
    144137{
    145138    m_valueInSpecifiedUnits = 0;
    146139    m_unit = storeUnit(mode, LengthTypeNumber);
    147     setValueAsString(valueAsString, ec);
     140    return setValueAsString(valueAsString);
    148141}
    149142
     
    161154SVGLength SVGLength::construct(SVGLengthMode mode, const String& valueAsString, SVGParsingError& parseError, SVGLengthNegativeValuesMode negativeValuesMode)
    162155{
    163     ExceptionCode ec = 0;
    164156    SVGLength length(mode);
    165157
    166     length.setValueAsString(valueAsString, ec);
    167 
    168     if (ec)
     158    if (length.setValueAsString(valueAsString).hasException())
    169159        parseError = ParsingAttributeFailedError;
    170160    else if (negativeValuesMode == ForbidNegativeLengths && length.valueInSpecifiedUnits() < 0)
     
    186176float SVGLength::value(const SVGLengthContext& context) const
    187177{
    188     return value(context, IGNORE_EXCEPTION);
    189 }
    190 
    191 float SVGLength::value(const SVGLengthContext& context, ExceptionCode& ec) const
    192 {
    193     return context.convertValueToUserUnits(m_valueInSpecifiedUnits, extractMode(m_unit), extractType(m_unit), ec);
    194 }
    195 
    196 void SVGLength::setValue(const SVGLengthContext& context, float value, SVGLengthMode mode, SVGLengthType unitType, ExceptionCode& ec)
    197 {
     178    auto result = valueForBindings(context);
     179    if (result.hasException())
     180        return 0;
     181    return result.releaseReturnValue();
     182}
     183
     184ExceptionOr<float> SVGLength::valueForBindings(const SVGLengthContext& context) const
     185{
     186    return context.convertValueToUserUnits(m_valueInSpecifiedUnits, extractMode(m_unit), extractType(m_unit));
     187}
     188
     189ExceptionOr<void> SVGLength::setValue(const SVGLengthContext& context, float value, SVGLengthMode mode, SVGLengthType unitType)
     190{
     191    // FIXME: Seems like a bug that we change the value of m_unit even if setValue throws an exception.
    198192    m_unit = storeUnit(mode, unitType);
    199     setValue(value, context, ec);
    200 }
    201 
    202 void SVGLength::setValue(float value, const SVGLengthContext& context, ExceptionCode& ec)
     193    return setValue(value, context);
     194}
     195
     196ExceptionOr<void> SVGLength::setValue(float value, const SVGLengthContext& context)
    203197{
    204198    // 100% = 100.0 instead of 1.0 for historical reasons, this could eventually be changed
     
    206200        value = value / 100;
    207201
    208     ec = 0;
    209     float convertedValue = context.convertValueFromUserUnits(value, extractMode(m_unit), extractType(m_unit), ec);
    210     if (!ec)
    211         m_valueInSpecifiedUnits = convertedValue;
     202    auto convertedValue = context.convertValueFromUserUnits(value, extractMode(m_unit), extractType(m_unit));
     203    if (convertedValue.hasException())
     204        return convertedValue.releaseException();
     205    m_valueInSpecifiedUnits = convertedValue.releaseReturnValue();
     206    return { };
    212207}
    213208float SVGLength::valueAsPercentage() const
     
    220215}
    221216
    222 void SVGLength::setValueAsString(const String& string, ExceptionCode& ec)
     217ExceptionOr<void> SVGLength::setValueAsString(const String& string)
    223218{
    224219    if (string.isEmpty())
    225         return;
     220        return { };
    226221
    227222    float convertedNumber = 0;
     
    230225    const UChar* end = ptr + string.length();
    231226
    232     if (!parseNumber(ptr, end, convertedNumber, false)) {
    233         ec = SYNTAX_ERR;
    234         return;
    235     }
    236 
    237     SVGLengthType type = stringToLengthType(ptr, end);
    238     ASSERT(ptr <= end);
    239     if (type == LengthTypeUnknown) {
    240         ec = SYNTAX_ERR;
    241         return;
    242     }
     227    if (!parseNumber(ptr, end, convertedNumber, false))
     228        return Exception { SYNTAX_ERR };
     229
     230    auto type = parseLengthType(ptr, end);
     231    if (type == LengthTypeUnknown)
     232        return Exception { SYNTAX_ERR };
    243233
    244234    m_unit = storeUnit(extractMode(m_unit), type);
    245235    m_valueInSpecifiedUnits = convertedNumber;
     236    return { };
    246237}
    247238
     
    251242}
    252243
    253 void SVGLength::newValueSpecifiedUnits(unsigned short type, float value, ExceptionCode& ec)
    254 {
    255     if (type == LengthTypeUnknown || type > LengthTypePC) {
    256         ec = NOT_SUPPORTED_ERR;
    257         return;
    258     }
     244ExceptionOr<void> SVGLength::newValueSpecifiedUnits(unsigned short type, float value)
     245{
     246    if (type == LengthTypeUnknown || type > LengthTypePC)
     247        return Exception { NOT_SUPPORTED_ERR };
    259248
    260249    m_unit = storeUnit(extractMode(m_unit), static_cast<SVGLengthType>(type));
    261250    m_valueInSpecifiedUnits = value;
    262 }
    263 
    264 void SVGLength::convertToSpecifiedUnits(unsigned short type, const SVGLengthContext& context, ExceptionCode& ec)
    265 {
    266     if (type == LengthTypeUnknown || type > LengthTypePC) {
    267         ec = NOT_SUPPORTED_ERR;
    268         return;
     251    return { };
     252}
     253
     254ExceptionOr<void> SVGLength::convertToSpecifiedUnits(unsigned short type, const SVGLengthContext& context)
     255{
     256    if (type == LengthTypeUnknown || type > LengthTypePC)
     257        return Exception { NOT_SUPPORTED_ERR };
     258
     259    auto valueInUserUnits = valueForBindings(context);
     260    if (valueInUserUnits.hasException())
     261        return valueInUserUnits.releaseException();
     262
     263    auto originalUnitAndType = m_unit;
     264    m_unit = storeUnit(extractMode(m_unit), static_cast<SVGLengthType>(type));
     265    auto result = setValue(valueInUserUnits.releaseReturnValue(), context);
     266    if (result.hasException()) {
     267        m_unit = originalUnitAndType;
     268        return result.releaseException();
    269269    }
    270270
    271     float valueInUserUnits = value(context, ec);
    272     if (ec)
    273         return;
    274 
    275     unsigned int originalUnitAndType = m_unit;   
    276     m_unit = storeUnit(extractMode(m_unit), static_cast<SVGLengthType>(type));
    277     setValue(valueInUserUnits, context, ec);
    278     if (!ec)
    279         return;
    280 
    281     // Eventually restore old unit and type
    282     m_unit = originalUnitAndType;
     271    return { };
    283272}
    284273
     
    326315        return SVGLength();
    327316
    328     ExceptionCode ec = 0;
    329317    SVGLength length;
    330     length.newValueSpecifiedUnits(svgType, value.floatValue(), ec);
    331     if (ec)   
    332         return SVGLength();
    333 
     318    length.newValueSpecifiedUnits(svgType, value.floatValue());
    334319    return length;
    335320}
     
    378363SVGLengthMode SVGLength::lengthModeForAnimatedLengthAttribute(const QualifiedName& attrName)
    379364{
    380     typedef HashMap<QualifiedName, SVGLengthMode> LengthModeForLengthAttributeMap;
    381     static NeverDestroyed<LengthModeForLengthAttributeMap> s_lengthModeMap;
     365    using Map = HashMap<QualifiedName, SVGLengthMode>;
     366    static NeverDestroyed<Map> map = [] {
     367        struct Mode {
     368            const QualifiedName& name;
     369            SVGLengthMode mode;
     370        };
     371        static const Mode modes[] = {
     372            { SVGNames::xAttr, LengthModeWidth },
     373            { SVGNames::yAttr, LengthModeHeight },
     374            { SVGNames::cxAttr, LengthModeWidth },
     375            { SVGNames::cyAttr, LengthModeHeight },
     376            { SVGNames::dxAttr, LengthModeWidth },
     377            { SVGNames::dyAttr, LengthModeHeight },
     378            { SVGNames::fxAttr, LengthModeWidth },
     379            { SVGNames::fyAttr, LengthModeHeight },
     380            { SVGNames::widthAttr, LengthModeWidth },
     381            { SVGNames::heightAttr, LengthModeHeight },
     382            { SVGNames::x1Attr, LengthModeWidth },
     383            { SVGNames::x2Attr, LengthModeWidth },
     384            { SVGNames::y1Attr, LengthModeHeight },
     385            { SVGNames::y2Attr, LengthModeHeight },
     386            { SVGNames::refXAttr, LengthModeWidth },
     387            { SVGNames::refYAttr, LengthModeHeight },
     388            { SVGNames::markerWidthAttr, LengthModeWidth },
     389            { SVGNames::markerHeightAttr, LengthModeHeight },
     390            { SVGNames::textLengthAttr, LengthModeWidth },
     391            { SVGNames::startOffsetAttr, LengthModeWidth },
     392        };
     393        Map map;
     394        for (auto& mode : modes)
     395            map.add(mode.name, mode.mode);
     396        return map;
     397    }();
    382398   
    383     if (s_lengthModeMap.get().isEmpty()) {
    384         s_lengthModeMap.get().set(SVGNames::xAttr, LengthModeWidth);
    385         s_lengthModeMap.get().set(SVGNames::yAttr, LengthModeHeight);
    386         s_lengthModeMap.get().set(SVGNames::cxAttr, LengthModeWidth);
    387         s_lengthModeMap.get().set(SVGNames::cyAttr, LengthModeHeight);
    388         s_lengthModeMap.get().set(SVGNames::dxAttr, LengthModeWidth);
    389         s_lengthModeMap.get().set(SVGNames::dyAttr, LengthModeHeight);
    390         s_lengthModeMap.get().set(SVGNames::fxAttr, LengthModeWidth);
    391         s_lengthModeMap.get().set(SVGNames::fyAttr, LengthModeHeight);
    392         s_lengthModeMap.get().set(SVGNames::rAttr, LengthModeOther);
    393         s_lengthModeMap.get().set(SVGNames::widthAttr, LengthModeWidth);
    394         s_lengthModeMap.get().set(SVGNames::heightAttr, LengthModeHeight);
    395         s_lengthModeMap.get().set(SVGNames::x1Attr, LengthModeWidth);
    396         s_lengthModeMap.get().set(SVGNames::x2Attr, LengthModeWidth);
    397         s_lengthModeMap.get().set(SVGNames::y1Attr, LengthModeHeight);
    398         s_lengthModeMap.get().set(SVGNames::y2Attr, LengthModeHeight);
    399         s_lengthModeMap.get().set(SVGNames::refXAttr, LengthModeWidth);
    400         s_lengthModeMap.get().set(SVGNames::refYAttr, LengthModeHeight);
    401         s_lengthModeMap.get().set(SVGNames::markerWidthAttr, LengthModeWidth);
    402         s_lengthModeMap.get().set(SVGNames::markerHeightAttr, LengthModeHeight);       
    403         s_lengthModeMap.get().set(SVGNames::textLengthAttr, LengthModeWidth);
    404         s_lengthModeMap.get().set(SVGNames::startOffsetAttr, LengthModeWidth);
    405     }
    406    
    407     if (s_lengthModeMap.get().contains(attrName))
    408         return s_lengthModeMap.get().get(attrName);
    409    
    410     return LengthModeOther;
     399    auto result = map.get().find(attrName);
     400    if (result == map.get().end())
     401        return LengthModeOther;
     402    return result->value;
    411403}
    412404
  • trunk/Source/WebCore/svg/SVGLength.h

    r200341 r207716  
    1919 */
    2020
    21 #ifndef SVGLength_h
    22 #define SVGLength_h
     21#pragma once
    2322
    2423#include "AnimationUtilities.h"
     
    3130class CSSPrimitiveValue;
    3231class QualifiedName;
    33 
    34 typedef int ExceptionCode;
    3532
    3633enum SVGLengthNegativeValuesMode {
     
    6057    SVGLength(SVGLengthMode = LengthModeOther, const String& valueAsString = String());
    6158    SVGLength(const SVGLengthContext&, float, SVGLengthMode = LengthModeOther, SVGLengthType = LengthTypeNumber);
    62     SVGLength(const SVGLength&);
    6359
    6460    SVGLengthType unitType() const;
     
    7167
    7268    float value(const SVGLengthContext&) const;
    73     float value(const SVGLengthContext&, ExceptionCode&) const;
    74     void setValue(float, const SVGLengthContext&, ExceptionCode&);
    75     void setValue(const SVGLengthContext&, float, SVGLengthMode, SVGLengthType, ExceptionCode&);
     69    ExceptionOr<float> valueForBindings(const SVGLengthContext&) const;
     70    ExceptionOr<void> setValue(float, const SVGLengthContext&);
     71    ExceptionOr<void> setValue(const SVGLengthContext&, float, SVGLengthMode, SVGLengthType);
    7672
    7773    float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; }
     
    8177
    8278    String valueAsString() const;
    83     void setValueAsString(const String&, ExceptionCode&);
    84     void setValueAsString(const String&, SVGLengthMode, ExceptionCode&);
     79    ExceptionOr<void> setValueAsString(const String&);
     80    ExceptionOr<void> setValueAsString(const String&, SVGLengthMode);
    8581   
    86     void newValueSpecifiedUnits(unsigned short, float valueInSpecifiedUnits, ExceptionCode&);
    87     void convertToSpecifiedUnits(unsigned short, const SVGLengthContext&, ExceptionCode&);
     82    ExceptionOr<void> newValueSpecifiedUnits(unsigned short, float valueInSpecifiedUnits);
     83    ExceptionOr<void> convertToSpecifiedUnits(unsigned short, const SVGLengthContext&);
    8884
    8985    // Helper functions
    90     inline bool isRelative() const
     86    bool isRelative() const
    9187    {
    9288        SVGLengthType type = unitType();
     
    9591
    9692    bool isZero() const
    97     { 
     93    {
    9894        return !m_valueInSpecifiedUnits;
    9995    }
     
    116112
    117113        SVGLength length;
    118         ExceptionCode ec = 0;
    119114
    120115        if (fromType == LengthTypePercentage || toType == LengthTypePercentage) {
    121116            float fromPercent = from.valueAsPercentage() * 100;
    122117            float toPercent = valueAsPercentage() * 100;
    123             length.newValueSpecifiedUnits(LengthTypePercentage, WebCore::blend(fromPercent, toPercent, progress), ec);
    124             if (ec)
     118            auto result = length.newValueSpecifiedUnits(LengthTypePercentage, WebCore::blend(fromPercent, toPercent, progress));
     119            if (result.hasException())
    125120                return SVGLength();
    126121            return length;
     
    130125            float fromValue = from.valueInSpecifiedUnits();
    131126            float toValue = valueInSpecifiedUnits();
    132             if (isZero())
    133                 length.newValueSpecifiedUnits(fromType, WebCore::blend(fromValue, toValue, progress), ec);
    134             else
    135                 length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue, toValue, progress), ec);
    136             if (ec)
    137                 return SVGLength();
     127            if (isZero()) {
     128                auto result = length.newValueSpecifiedUnits(fromType, WebCore::blend(fromValue, toValue, progress));
     129                if (result.hasException())
     130                    return SVGLength();
     131            } else {
     132                auto result = length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue, toValue, progress));
     133                if (result.hasException())
     134                    return SVGLength();
     135            }
    138136            return length;
    139137        }
     
    143141
    144142        SVGLengthContext nonRelativeLengthContext(nullptr);
    145         float fromValueInUserUnits = nonRelativeLengthContext.convertValueToUserUnits(from.valueInSpecifiedUnits(), from.unitMode(), fromType, ec);
    146         if (ec)
     143        auto fromValueInUserUnits = nonRelativeLengthContext.convertValueToUserUnits(from.valueInSpecifiedUnits(), from.unitMode(), fromType);
     144        if (fromValueInUserUnits.hasException())
    147145            return SVGLength();
    148146
    149         float fromValue = nonRelativeLengthContext.convertValueFromUserUnits(fromValueInUserUnits, unitMode(), toType, ec);
    150         if (ec)
     147        auto fromValue = nonRelativeLengthContext.convertValueFromUserUnits(fromValueInUserUnits.releaseReturnValue(), unitMode(), toType);
     148        if (fromValue.hasException())
    151149            return SVGLength();
    152150
    153151        float toValue = valueInSpecifiedUnits();
    154         length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue, toValue, progress), ec);
    155 
    156         if (ec)
     152        auto result = length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue.releaseReturnValue(), toValue, progress));
     153        if (result.hasException())
    157154            return SVGLength();
    158155        return length;
     
    161158private:
    162159    float m_valueInSpecifiedUnits;
    163     unsigned int m_unit;
     160    unsigned m_unit;
    164161};
    165162
    166 template<>
    167 struct SVGPropertyTraits<SVGLength> {
     163template<> struct SVGPropertyTraits<SVGLength> {
    168164    static SVGLength initialValue() { return SVGLength(); }
    169165    static String toString(const SVGLength& type) { return type.valueAsString(); }
     
    173169
    174170} // namespace WebCore
    175 
    176 #endif // SVGLength_h
  • trunk/Source/WebCore/svg/SVGLength.idl

    r206723 r207716  
    2323interface SVGLength {
    2424    // Length Unit Types
    25     const unsigned short SVG_LENGTHTYPE_UNKNOWN    = 0;
    26     const unsigned short SVG_LENGTHTYPE_NUMBER     = 1;
     25    const unsigned short SVG_LENGTHTYPE_UNKNOWN = 0;
     26    const unsigned short SVG_LENGTHTYPE_NUMBER = 1;
    2727    const unsigned short SVG_LENGTHTYPE_PERCENTAGE = 2;
    28     const unsigned short SVG_LENGTHTYPE_EMS        = 3;
    29     const unsigned short SVG_LENGTHTYPE_EXS        = 4;
    30     const unsigned short SVG_LENGTHTYPE_PX         = 5;
    31     const unsigned short SVG_LENGTHTYPE_CM         = 6;
    32     const unsigned short SVG_LENGTHTYPE_MM         = 7;
    33     const unsigned short SVG_LENGTHTYPE_IN         = 8;
    34     const unsigned short SVG_LENGTHTYPE_PT         = 9;
    35     const unsigned short SVG_LENGTHTYPE_PC         = 10;
     28    const unsigned short SVG_LENGTHTYPE_EMS = 3;
     29    const unsigned short SVG_LENGTHTYPE_EXS = 4;
     30    const unsigned short SVG_LENGTHTYPE_PX = 5;
     31    const unsigned short SVG_LENGTHTYPE_CM = 6;
     32    const unsigned short SVG_LENGTHTYPE_MM = 7;
     33    const unsigned short SVG_LENGTHTYPE_IN = 8;
     34    const unsigned short SVG_LENGTHTYPE_PT = 9;
     35    const unsigned short SVG_LENGTHTYPE_PC = 10;
    3636
    3737    readonly attribute unsigned short unitType;
    38     [GetterMayThrowLegacyException, SetterMayThrowLegacyException, Custom] attribute unrestricted float value;
     38    [Custom, GetterMayThrowException, SetterMayThrowException] attribute unrestricted float value;
    3939
    4040    attribute unrestricted float valueInSpecifiedUnits;
     41    [SetterMayThrowException] attribute DOMString valueAsString;
    4142
    42     [SetterMayThrowLegacyException] attribute DOMString valueAsString;
    43 
    44     [MayThrowLegacyException] void newValueSpecifiedUnits(unsigned short unitType,
    45                                                      unrestricted float valueInSpecifiedUnits);
    46 
    47     [Custom, MayThrowLegacyException] void convertToSpecifiedUnits(unsigned short unitType);
     43    [MayThrowException] void newValueSpecifiedUnits(unsigned short unitType, unrestricted float valueInSpecifiedUnits);
     44    [Custom, MayThrowException] void convertToSpecifiedUnits(unsigned short unitType);
    4845};
    49 
  • trunk/Source/WebCore/svg/SVGLengthContext.cpp

    r205392 r207716  
    9090float SVGLengthContext::valueForLength(const Length& length, SVGLengthMode mode)
    9191{
    92     if (length.isPercent())
    93         return convertValueFromPercentageToUserUnits(length.value() / 100, mode, IGNORE_EXCEPTION);
     92    if (length.isPercent()) {
     93        auto result = convertValueFromPercentageToUserUnits(length.value() / 100, mode);
     94        if (result.hasException())
     95            return 0;
     96        return result.releaseReturnValue();
     97    }
    9498    if (length.isAuto() || !length.isSpecified())
    9599        return 0;
     
    104108        return floatValueForLength(length, viewportSize.height());
    105109    case LengthModeOther:
    106         return floatValueForLength(length, sqrtf(viewportSize.diagonalLengthSquared() / 2));
     110        return floatValueForLength(length, std::sqrt(viewportSize.diagonalLengthSquared() / 2));
    107111    };
    108112    return 0;
    109113}
    110114
    111 float SVGLengthContext::convertValueToUserUnits(float value, SVGLengthMode mode, SVGLengthType fromUnit, ExceptionCode& ec) const
     115ExceptionOr<float> SVGLengthContext::convertValueToUserUnits(float value, SVGLengthMode mode, SVGLengthType fromUnit) const
    112116{
    113117    // If the SVGLengthContext carries a custom viewport, force resolving against it.
     
    116120        if (fromUnit == LengthTypePercentage)
    117121            value /= 100;
    118         return convertValueFromPercentageToUserUnits(value, mode, ec);
     122        return convertValueFromPercentageToUserUnits(value, mode);
    119123    }
    120124
    121125    switch (fromUnit) {
    122126    case LengthTypeUnknown:
    123         ec = NOT_SUPPORTED_ERR;
    124         return 0;
     127        return Exception { NOT_SUPPORTED_ERR };
    125128    case LengthTypeNumber:
    126129        return value;
     
    128131        return value;
    129132    case LengthTypePercentage:
    130         return convertValueFromPercentageToUserUnits(value / 100, mode, ec);
     133        return convertValueFromPercentageToUserUnits(value / 100, mode);
    131134    case LengthTypeEMS:
    132         return convertValueFromEMSToUserUnits(value, ec);
     135        return convertValueFromEMSToUserUnits(value);
    133136    case LengthTypeEXS:
    134         return convertValueFromEXSToUserUnits(value, ec);
     137        return convertValueFromEXSToUserUnits(value);
    135138    case LengthTypeCM:
    136139        return value * cssPixelsPerInch / 2.54f;
     
    149152}
    150153
    151 float SVGLengthContext::convertValueFromUserUnits(float value, SVGLengthMode mode, SVGLengthType toUnit, ExceptionCode& ec) const
     154ExceptionOr<float> SVGLengthContext::convertValueFromUserUnits(float value, SVGLengthMode mode, SVGLengthType toUnit) const
    152155{
    153156    switch (toUnit) {
    154157    case LengthTypeUnknown:
    155         ec = NOT_SUPPORTED_ERR;
    156         return 0;
     158        return Exception { NOT_SUPPORTED_ERR };
    157159    case LengthTypeNumber:
    158160        return value;
    159161    case LengthTypePercentage:
    160         return convertValueFromUserUnitsToPercentage(value * 100, mode, ec);
     162        return convertValueFromUserUnitsToPercentage(value * 100, mode);
    161163    case LengthTypeEMS:
    162         return convertValueFromUserUnitsToEMS(value, ec);
     164        return convertValueFromUserUnitsToEMS(value);
    163165    case LengthTypeEXS:
    164         return convertValueFromUserUnitsToEXS(value, ec);
     166        return convertValueFromUserUnitsToEXS(value);
    165167    case LengthTypePX:
    166168        return value;
     
    181183}
    182184
    183 float SVGLengthContext::convertValueFromUserUnitsToPercentage(float value, SVGLengthMode mode, ExceptionCode& ec) const
     185ExceptionOr<float> SVGLengthContext::convertValueFromUserUnitsToPercentage(float value, SVGLengthMode mode) const
    184186{
    185187    FloatSize viewportSize;
    186     if (!determineViewport(viewportSize)) {
    187         ec = NOT_SUPPORTED_ERR;
    188         return 0;
    189     }
     188    if (!determineViewport(viewportSize))
     189        return Exception { NOT_SUPPORTED_ERR };
    190190
    191191    switch (mode) {
     
    195195        return value / viewportSize.height() * 100;
    196196    case LengthModeOther:
    197         return value / (sqrtf(viewportSize.diagonalLengthSquared() / 2)) * 100;
     197        return value / (std::sqrt(viewportSize.diagonalLengthSquared() / 2)) * 100;
    198198    };
    199199
     
    202202}
    203203
    204 float SVGLengthContext::convertValueFromPercentageToUserUnits(float value, SVGLengthMode mode, ExceptionCode& ec) const
     204ExceptionOr<float> SVGLengthContext::convertValueFromPercentageToUserUnits(float value, SVGLengthMode mode) const
    205205{
    206206    FloatSize viewportSize;
    207     if (!determineViewport(viewportSize)) {
    208         ec = NOT_SUPPORTED_ERR;
    209         return 0;
    210     }
     207    if (!determineViewport(viewportSize))
     208        return Exception { NOT_SUPPORTED_ERR };
    211209
    212210    switch (mode) {
     
    216214        return value * viewportSize.height();
    217215    case LengthModeOther:
    218         return value * sqrtf(viewportSize.diagonalLengthSquared() / 2);
     216        return value * std::sqrt(viewportSize.diagonalLengthSquared() / 2);
    219217    };
    220218
     
    240238}
    241239
    242 float SVGLengthContext::convertValueFromUserUnitsToEMS(float value, ExceptionCode& ec) const
     240ExceptionOr<float> SVGLengthContext::convertValueFromUserUnitsToEMS(float value) const
    243241{
    244242    auto* style = renderStyleForLengthResolving(m_context);
    245     if (!style) {
    246         ec = NOT_SUPPORTED_ERR;
    247         return 0;
    248     }
     243    if (!style)
     244        return Exception { NOT_SUPPORTED_ERR };
    249245
    250246    float fontSize = style->fontSize();
    251     if (!fontSize) {
    252         ec = NOT_SUPPORTED_ERR;
    253         return 0;
    254     }
     247    if (!fontSize)
     248        return Exception { NOT_SUPPORTED_ERR };
    255249
    256250    return value / fontSize;
    257251}
    258252
    259 float SVGLengthContext::convertValueFromEMSToUserUnits(float value, ExceptionCode& ec) const
     253ExceptionOr<float> SVGLengthContext::convertValueFromEMSToUserUnits(float value) const
    260254{
    261255    auto* style = renderStyleForLengthResolving(m_context);
    262     if (!style) {
    263         ec = NOT_SUPPORTED_ERR;
    264         return 0;
    265     }
     256    if (!style)
     257        return Exception { NOT_SUPPORTED_ERR };
    266258
    267259    return value * style->fontSize();
    268260}
    269261
    270 float SVGLengthContext::convertValueFromUserUnitsToEXS(float value, ExceptionCode& ec) const
     262ExceptionOr<float> SVGLengthContext::convertValueFromUserUnitsToEXS(float value) const
    271263{
    272264    auto* style = renderStyleForLengthResolving(m_context);
    273     if (!style) {
    274         ec = NOT_SUPPORTED_ERR;
    275         return 0;
    276     }
     265    if (!style)
     266        return Exception { NOT_SUPPORTED_ERR };
    277267
    278268    // Use of ceil allows a pixel match to the W3Cs expected output of coords-units-03-b.svg
    279269    // if this causes problems in real world cases maybe it would be best to remove this
    280     float xHeight = ceilf(style->fontMetrics().xHeight());
    281     if (!xHeight) {
    282         ec = NOT_SUPPORTED_ERR;
    283         return 0;
    284     }
     270    float xHeight = std::ceil(style->fontMetrics().xHeight());
     271    if (!xHeight)
     272        return Exception { NOT_SUPPORTED_ERR };
    285273
    286274    return value / xHeight;
    287275}
    288276
    289 float SVGLengthContext::convertValueFromEXSToUserUnits(float value, ExceptionCode& ec) const
     277ExceptionOr<float> SVGLengthContext::convertValueFromEXSToUserUnits(float value) const
    290278{
    291279    auto* style = renderStyleForLengthResolving(m_context);
    292     if (!style) {
    293         ec = NOT_SUPPORTED_ERR;
    294         return 0;
    295     }
     280    if (!style)
     281        return Exception { NOT_SUPPORTED_ERR };
    296282
    297283    // Use of ceil allows a pixel match to the W3Cs expected output of coords-units-03-b.svg
    298284    // if this causes problems in real world cases maybe it would be best to remove this
    299     return value * ceilf(style->fontMetrics().xHeight());
     285    return value * std::ceil(style->fontMetrics().xHeight());
    300286}
    301287
  • trunk/Source/WebCore/svg/SVGLengthContext.h

    r171341 r207716  
    1818 */
    1919
    20 #ifndef SVGLengthContext_h
    21 #define SVGLengthContext_h
     20#pragma once
    2221
     22#include "ExceptionOr.h"
    2323#include "FloatRect.h"
    2424#include "SVGUnitTypes.h"
     
    2828class SVGElement;
    2929class SVGLength;
     30
    3031struct Length;
    31 
    32 typedef int ExceptionCode;
    3332
    3433enum SVGLengthType {
     
    6766
    6867    float valueForLength(const Length&, SVGLengthMode = LengthModeOther);
    69     float convertValueToUserUnits(float, SVGLengthMode, SVGLengthType fromUnit, ExceptionCode&) const;
    70     float convertValueFromUserUnits(float, SVGLengthMode, SVGLengthType toUnit, ExceptionCode&) const;
     68    ExceptionOr<float> convertValueToUserUnits(float, SVGLengthMode, SVGLengthType fromUnit) const;
     69    ExceptionOr<float> convertValueFromUserUnits(float, SVGLengthMode, SVGLengthType toUnit) const;
    7170
    7271    bool determineViewport(FloatSize&) const;
     
    7574    SVGLengthContext(const SVGElement*, const FloatRect& viewport);
    7675
    77     float convertValueFromUserUnitsToPercentage(float value, SVGLengthMode, ExceptionCode&) const;
    78     float convertValueFromPercentageToUserUnits(float value, SVGLengthMode, ExceptionCode&) const;
     76    ExceptionOr<float> convertValueFromUserUnitsToPercentage(float value, SVGLengthMode) const;
     77    ExceptionOr<float> convertValueFromPercentageToUserUnits(float value, SVGLengthMode) const;
    7978
    80     float convertValueFromUserUnitsToEMS(float value, ExceptionCode&) const;
    81     float convertValueFromEMSToUserUnits(float value, ExceptionCode&) const;
     79    ExceptionOr<float> convertValueFromUserUnitsToEMS(float value) const;
     80    ExceptionOr<float> convertValueFromEMSToUserUnits(float value) const;
    8281
    83     float convertValueFromUserUnitsToEXS(float value, ExceptionCode&) const;
    84     float convertValueFromEXSToUserUnits(float value, ExceptionCode&) const;
     82    ExceptionOr<float> convertValueFromUserUnitsToEXS(float value) const;
     83    ExceptionOr<float> convertValueFromEXSToUserUnits(float value) const;
    8584
    8685    const SVGElement* m_context;
     
    8988
    9089} // namespace WebCore
    91 
    92 #endif // SVGLengthContext_h
  • trunk/Source/WebCore/svg/SVGLengthList.cpp

    r165848 r207716  
    3030{
    3131    clear();
    32     ExceptionCode ec = 0;
    3332
    3433    auto upconvertedCharacters = StringView(value).upconvertedCharacters();
     
    4645        if (valueString.isEmpty())
    4746            return;
    48         length.setValueAsString(valueString, ec);
    49         if (ec)
     47        if (length.setValueAsString(valueString).hasException())
    5048            return;
    5149        append(length);
  • trunk/Source/WebCore/svg/SVGLengthList.h

    r203275 r207716  
    1919 */
    2020
    21 #ifndef SVGLengthList_h
    22 #define SVGLengthList_h
     21#pragma once
    2322
    2423#include "SVGLength.h"
     
    2928class SVGLengthList final : public Vector<SVGLength> {
    3029public:
    31     SVGLengthList() { }
    32 
    33     void parse(const String& value, SVGLengthMode);
     30    void parse(const String& value, SVGLengthMode);
    3431    String valueAsString() const;
    3532};
    3633
    37 template<>
    38 struct SVGPropertyTraits<SVGLengthList> {
     34template<> struct SVGPropertyTraits<SVGLengthList> {
    3935    typedef SVGLength ListItemType;
    4036
     
    4440
    4541} // namespace WebCore
    46 
    47 #endif
  • trunk/Source/WebCore/svg/SVGLengthList.idl

    r206723 r207716  
    2828    readonly attribute unsigned long numberOfItems;
    2929
    30     [MayThrowLegacyException] void clear();
    31     [MayThrowLegacyException] SVGLength initialize(SVGLength item);
    32     [MayThrowLegacyException] SVGLength getItem(unsigned long index);
    33     [MayThrowLegacyException] SVGLength insertItemBefore(SVGLength item, unsigned long index);
    34     [MayThrowLegacyException] SVGLength replaceItem(SVGLength item, unsigned long index);
    35     [MayThrowLegacyException] SVGLength removeItem(unsigned long index);
    36     [MayThrowLegacyException] SVGLength appendItem(SVGLength item);
     30    [MayThrowException] void clear();
     31    [MayThrowException] SVGLength initialize(SVGLength item);
     32    [MayThrowException] SVGLength getItem(unsigned long index);
     33    [MayThrowException] SVGLength insertItemBefore(SVGLength item, unsigned long index);
     34    [MayThrowException] SVGLength replaceItem(SVGLength item, unsigned long index);
     35    [MayThrowException] SVGLength removeItem(unsigned long index);
     36    [MayThrowException] SVGLength appendItem(SVGLength item);
    3737};
  • trunk/Source/WebCore/svg/SVGLocatable.cpp

    r192900 r207716  
    9898}
    9999
    100 AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, ExceptionCode& ec, StyleUpdateStrategy styleUpdateStrategy)
     100ExceptionOr<AffineTransform> SVGLocatable::getTransformToElement(SVGElement* target, StyleUpdateStrategy styleUpdateStrategy)
    101101{
    102102    AffineTransform ctm = getCTM(styleUpdateStrategy);
     
    106106        if (auto inverse = targetCTM.inverse())
    107107            ctm = inverse.value() * ctm;
    108         else {
    109             ec = SVGException::SVG_MATRIX_NOT_INVERTABLE;
    110             return ctm;
    111         }
     108        else
     109            return Exception { SVGException::SVG_MATRIX_NOT_INVERTABLE };
    112110    }
    113111
    114     return ctm;
     112    return WTFMove(ctm);
    115113}
    116114
  • trunk/Source/WebCore/svg/SVGLocatable.h

    r163440 r207716  
    2020 */
    2121
    22 #ifndef SVGLocatable_h
    23 #define SVGLocatable_h
     22#pragma once
    2423
    2524#include "AffineTransform.h"
     25#include "ExceptionOr.h"
    2626
    2727namespace WebCore {
     
    2929class FloatRect;
    3030class SVGElement;
    31 
    32 typedef int ExceptionCode;
    3331
    3432class SVGLocatable {
     
    4543    virtual AffineTransform getCTM(StyleUpdateStrategy) = 0;
    4644    virtual AffineTransform getScreenCTM(StyleUpdateStrategy) = 0;
    47     AffineTransform getTransformToElement(SVGElement*, ExceptionCode&, StyleUpdateStrategy = AllowStyleUpdate);
     45    ExceptionOr<AffineTransform> getTransformToElement(SVGElement*, StyleUpdateStrategy = AllowStyleUpdate);
    4846
    4947    static SVGElement* nearestViewportElement(const SVGElement*);
     
    6361
    6462} // namespace WebCore
    65 
    66 #endif // SVGLocatable_h
  • trunk/Source/WebCore/svg/SVGMarkerElement.h

    r200041 r207716  
    8282inline unsigned SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue() { return SVGMarkerOrientAngle; }
    8383
    84 template<>
    85 struct SVGPropertyTraits<SVGMarkerOrientType> {
     84template<> struct SVGPropertyTraits<SVGMarkerOrientType> {
    8685    static unsigned highestEnumValue() { return SVGMarkerOrientAutoStartReverse; }
    8786
     
    9493        if (value == "auto-start-reverse")
    9594            return SVGMarkerOrientAutoStartReverse;
    96 
    97         ExceptionCode ec = 0;
    98         angle.setValueAsString(value, ec);
    99         if (!ec)
    100             return SVGMarkerOrientAngle;
    101         return SVGMarkerOrientUnknown;
     95        auto setValueResult = angle.setValueAsString(value);
     96        if (setValueResult.hasException())
     97            return SVGMarkerOrientUnknown;
     98        return SVGMarkerOrientAngle;
    10299    }
    103100};
  • trunk/Source/WebCore/svg/SVGMatrix.h

    r203275 r207716  
    1818 */
    1919
    20 #ifndef SVGMatrix_h
    21 #define SVGMatrix_h
     20#pragma once
    2221
    2322#include "AffineTransform.h"
     23#include "ExceptionOr.h"
    2424#include "SVGException.h"
    2525
    2626namespace WebCore {
    2727
    28 typedef int ExceptionCode;
    29 
    30 // Only used in the bindings.
    3128class SVGMatrix final : public AffineTransform {
    3229public:
     
    4441    SVGMatrix translate(double tx, double ty)
    4542    {
    46         AffineTransform copy = *this;
     43        AffineTransform copy { *this };
    4744        copy.translate(tx, ty);
    48         return static_cast<SVGMatrix>(copy);
     45        return SVGMatrix { copy };
    4946    }
    5047
    5148    SVGMatrix scale(double s)
    5249    {
    53         AffineTransform copy = *this;
     50        AffineTransform copy { *this };
    5451        copy.scale(s, s);
    55         return static_cast<SVGMatrix>(copy);
     52        return SVGMatrix { copy };
    5653    }
    5754
    5855    SVGMatrix scaleNonUniform(double sx, double sy)
    5956    {
    60         AffineTransform copy = *this;
     57        AffineTransform copy { *this };
    6158        copy.scale(sx, sy);
    62         return static_cast<SVGMatrix>(copy);
     59        return SVGMatrix { copy };
    6360    }
    6461
    6562    SVGMatrix rotate(double d)
    6663    {
    67         AffineTransform copy = *this;
     64        AffineTransform copy { *this };
    6865        copy.rotate(d);
    69         return static_cast<SVGMatrix>(copy);
     66        return SVGMatrix { copy };
    7067    }
    7168
    7269    SVGMatrix flipX()
    7370    {
    74         AffineTransform copy = *this;
     71        AffineTransform copy { *this };
    7572        copy.flipX();
    76         return static_cast<SVGMatrix>(copy);
     73        return SVGMatrix { copy };
    7774    }
    7875
    7976    SVGMatrix flipY()
    8077    {
    81         AffineTransform copy = *this;
     78        AffineTransform copy { *this };
    8279        copy.flipY();
    83         return static_cast<SVGMatrix>(copy);
     80        return SVGMatrix { copy };
    8481    }
    8582
    8683    SVGMatrix skewX(double angle)
    8784    {
    88         AffineTransform copy = *this;
     85        AffineTransform copy { *this };
    8986        copy.skewX(angle);
    90         return static_cast<SVGMatrix>(copy);
     87        return SVGMatrix { copy };
    9188    }
    9289
    9390    SVGMatrix skewY(double angle)
    9491    {
    95         AffineTransform copy = *this;
     92        AffineTransform copy { *this };
    9693        copy.skewY(angle);
    97         return static_cast<SVGMatrix>(copy);
     94        return SVGMatrix { copy };
    9895    }
    9996
    10097    SVGMatrix multiply(const SVGMatrix& other)
    10198    {
    102         AffineTransform copy = *this;
     99        AffineTransform copy { *this };
    103100        copy *= static_cast<const AffineTransform&>(other);
    104         return static_cast<SVGMatrix>(copy);
     101        return SVGMatrix { copy };
    105102    }
    106103
    107     SVGMatrix inverse(ExceptionCode& ec) const
     104    ExceptionOr<SVGMatrix> inverse() const
    108105    {
    109106        if (auto inverse = AffineTransform::inverse())
    110             return inverse.value();
     107            return SVGMatrix { inverse.value() };
    111108       
    112         ec = SVGException::SVG_MATRIX_NOT_INVERTABLE;
    113         return AffineTransform();
     109        return Exception { SVGException::SVG_MATRIX_NOT_INVERTABLE };
    114110    }
    115111
    116     SVGMatrix rotateFromVector(double x, double y, ExceptionCode& ec)
     112    ExceptionOr<SVGMatrix> rotateFromVector(double x, double y)
    117113    {
    118114        if (!x || !y)
    119             ec = SVGException::SVG_INVALID_VALUE_ERR;
     115            return Exception { SVGException::SVG_INVALID_VALUE_ERR };
    120116
    121         AffineTransform copy = *this;
     117        AffineTransform copy { *this };
    122118        copy.rotateFromVector(x, y);
    123         return static_cast<SVGMatrix>(copy);
     119        return SVGMatrix { copy };
    124120    }
    125121
     
    127123
    128124} // namespace WebCore
    129 
    130 #endif
  • trunk/Source/WebCore/svg/SVGMatrix.idl

    r206723 r207716  
    3232
    3333    SVGMatrix multiply(SVGMatrix secondMatrix);
    34     [MayThrowLegacyException] SVGMatrix inverse();
     34    [MayThrowException] SVGMatrix inverse();
    3535    [Immutable] SVGMatrix translate(unrestricted float x, unrestricted float y);
    3636    [Immutable] SVGMatrix scale(unrestricted float scaleFactor);
    3737    [Immutable] SVGMatrix scaleNonUniform(unrestricted float scaleFactorX, unrestricted float scaleFactorY);
    3838    [Immutable] SVGMatrix rotate(unrestricted float angle);
    39     [MayThrowLegacyException] SVGMatrix rotateFromVector(unrestricted float x, unrestricted float y);
     39    [MayThrowException] SVGMatrix rotateFromVector(unrestricted float x, unrestricted float y);
    4040    [Immutable] SVGMatrix flipX();
    4141    [Immutable] SVGMatrix flipY();
     
    4343    [Immutable] SVGMatrix skewY(unrestricted float angle);
    4444};
    45 
  • trunk/Source/WebCore/svg/SVGNumberList.h

    r203275 r207716  
    1919 */
    2020
    21 #ifndef SVGNumberList_h
    22 #define SVGNumberList_h
     21#pragma once
    2322
    2423#include "SVGPropertyTraits.h"
     
    2928class SVGNumberList final : public Vector<float> {
    3029public:
    31     SVGNumberList() { }
    32 
    3330    void parse(const String&);
    3431    String valueAsString() const;
    3532};
    3633
    37 template<>
    38 struct SVGPropertyTraits<SVGNumberList> {
     34template<> struct SVGPropertyTraits<SVGNumberList> {
    3935    typedef float ListItemType;
    4036
     
    4440
    4541} // namespace WebCore
    46 
    47 #endif
  • trunk/Source/WebCore/svg/SVGNumberList.idl

    r206723 r207716  
    2828    readonly attribute unsigned long numberOfItems;
    2929
    30     [MayThrowLegacyException] void clear();
    31     [MayThrowLegacyException] SVGNumber initialize(SVGNumber item);
    32     [MayThrowLegacyException] SVGNumber getItem(unsigned long index);
    33     [MayThrowLegacyException] SVGNumber insertItemBefore(SVGNumber item, unsigned long index);
    34     [MayThrowLegacyException] SVGNumber replaceItem(SVGNumber item, unsigned long index);
    35     [MayThrowLegacyException] SVGNumber removeItem(unsigned long index);
    36     [MayThrowLegacyException] SVGNumber appendItem(SVGNumber item);
     30    [MayThrowException] void clear();
     31    [MayThrowException] SVGNumber initialize(SVGNumber item);
     32    [MayThrowException] SVGNumber getItem(unsigned long index);
     33    [MayThrowException] SVGNumber insertItemBefore(SVGNumber item, unsigned long index);
     34    [MayThrowException] SVGNumber replaceItem(SVGNumber item, unsigned long index);
     35    [MayThrowException] SVGNumber removeItem(unsigned long index);
     36    [MayThrowException] SVGNumber appendItem(SVGNumber item);
    3737};
  • trunk/Source/WebCore/svg/SVGPaint.cpp

    r183536 r207716  
    6565}
    6666
    67 void SVGPaint::setPaint(unsigned short, const String&, const String&, const String&, ExceptionCode& ec)
     67ExceptionOr<void> SVGPaint::setPaint(unsigned short, const String&, const String&, const String&)
    6868{
    69     ec = NO_MODIFICATION_ALLOWED_ERR;
     69    return Exception { NO_MODIFICATION_ALLOWED_ERR };
    7070}
    7171
  • trunk/Source/WebCore/svg/SVGPaint.h

    r203275 r207716  
    2121 */
    2222
    23 #ifndef SVGPaint_h
    24 #define SVGPaint_h
     23#pragma once
    2524
    2625#include "SVGColor.h"
    27 #include <wtf/text/WTFString.h>
    2826
    2927namespace WebCore {
     
    8280
    8381    void setUri(const String&);
    84     void setPaint(unsigned short paintType, const String& uri, const String& rgbColor, const String& iccColor, ExceptionCode&);
     82    ExceptionOr<void> setPaint(unsigned short paintType, const String& uri, const String& rgbColor, const String& iccColor);
    8583
    8684    String customCSSText() const;
     
    111109
    112110SPECIALIZE_TYPE_TRAITS_CSS_VALUE(SVGPaint, isSVGPaint())
    113 
    114 #endif // SVGPaint_h
  • trunk/Source/WebCore/svg/SVGPaint.idl

    r206723 r207716  
    4242
    4343    void setUri(DOMString uri);
    44     [MayThrowLegacyException] void setPaint(unsigned short paintType, DOMString uri, DOMString rgbColor, DOMString iccColor);
     44    [MayThrowException] void setPaint(unsigned short paintType, DOMString uri, DOMString rgbColor, DOMString iccColor);
    4545};
    46 
  • trunk/Source/WebCore/svg/SVGPathSegList.h

    r163440 r207716  
    1818 */
    1919
    20 #ifndef SVGPathSegList_h
    21 #define SVGPathSegList_h
     20#pragma once
    2221
    2322#include "SVGListProperty.h"
    2423#include "SVGPathSeg.h"
    2524#include "SVGPropertyTraits.h"
    26 
    2725#include <wtf/Vector.h>
    2826#include <wtf/text/WTFString.h>
     
    3432class SVGPathSegList : public Vector<RefPtr<SVGPathSeg>> {
    3533public:
    36     SVGPathSegList(SVGPathSegRole role)
     34    explicit SVGPathSegList(SVGPathSegRole role)
    3735        : m_role(role)
    3836    {
     
    4846};
    4947
    50 template<>
    51 struct SVGPropertyTraits<SVGPathSegList> {
     48template<> struct SVGPropertyTraits<SVGPathSegList> {
    5249    static SVGPathSegList initialValue() { return SVGPathSegList(PathSegUndefinedRole); }
    5350    typedef RefPtr<SVGPathSeg> ListItemType;
     
    5552
    5653} // namespace WebCore
    57 
    58 #endif
  • trunk/Source/WebCore/svg/SVGPathSegList.idl

    r206723 r207716  
    2828    readonly attribute unsigned long numberOfItems;
    2929
    30     [MayThrowLegacyException] void clear();
    31     [MayThrowLegacyException] SVGPathSeg initialize(SVGPathSeg? newItem); // FIXME: Should not be nullable.
    32     [MayThrowLegacyException] SVGPathSeg getItem(unsigned long index);
    33     [MayThrowLegacyException] SVGPathSeg insertItemBefore(SVGPathSeg? newItem, unsigned long index); // FIXME: Should not be nullable.
    34     [MayThrowLegacyException] SVGPathSeg replaceItem(SVGPathSeg? newItem, unsigned long index); // FIXME: Should not be nullable.
    35     [MayThrowLegacyException] SVGPathSeg removeItem(unsigned long index);
    36     [MayThrowLegacyException] SVGPathSeg appendItem(SVGPathSeg? newItem); // FIXME: Should not be nullable.
     30    [MayThrowException] void clear();
     31    [MayThrowException] SVGPathSeg initialize(SVGPathSeg? newItem); // FIXME: Should not be nullable.
     32    [MayThrowException] SVGPathSeg getItem(unsigned long index);
     33    [MayThrowException] SVGPathSeg insertItemBefore(SVGPathSeg? newItem, unsigned long index); // FIXME: Should not be nullable.
     34    [MayThrowException] SVGPathSeg replaceItem(SVGPathSeg? newItem, unsigned long index); // FIXME: Should not be nullable.
     35    [MayThrowException] SVGPathSeg removeItem(unsigned long index);
     36    [MayThrowException] SVGPathSeg appendItem(SVGPathSeg? newItem); // FIXME: Should not be nullable.
    3737};
  • trunk/Source/WebCore/svg/SVGPointList.h

    r203275 r207716  
    1919 */
    2020
    21 #ifndef SVGPointList_h
    22 #define SVGPointList_h
     21#pragma once
    2322
    2423#include "SVGPoint.h"
     
    3029class SVGPointList final : public Vector<SVGPoint> {
    3130public:
    32     SVGPointList() { }
    33 
    3431    String valueAsString() const;
    3532};
    3633
    37 template<>
    38 struct SVGPropertyTraits<SVGPointList> {
     34template<> struct SVGPropertyTraits<SVGPointList> {
    3935    static SVGPointList initialValue() { return SVGPointList(); }
    4036    typedef SVGPoint ListItemType;
     
    4238
    4339} // namespace WebCore
    44 
    45 #endif
  • trunk/Source/WebCore/svg/SVGPointList.idl

    r206723 r207716  
    2727    readonly attribute unsigned long numberOfItems;
    2828
    29     [MayThrowLegacyException] void clear();
    30     [MayThrowLegacyException] SVGPoint initialize(SVGPoint item);
    31     [MayThrowLegacyException] SVGPoint getItem(unsigned long index);
    32     [MayThrowLegacyException] SVGPoint insertItemBefore(SVGPoint item, unsigned long index);
    33     [MayThrowLegacyException] SVGPoint replaceItem(SVGPoint item, unsigned long index);
    34     [MayThrowLegacyException] SVGPoint removeItem(unsigned long index);
    35     [MayThrowLegacyException] SVGPoint appendItem(SVGPoint item);
     29    [MayThrowException] void clear();
     30    [MayThrowException] SVGPoint initialize(SVGPoint item);
     31    [MayThrowException] SVGPoint getItem(unsigned long index);
     32    [MayThrowException] SVGPoint insertItemBefore(SVGPoint item, unsigned long index);
     33    [MayThrowException] SVGPoint replaceItem(SVGPoint item, unsigned long index);
     34    [MayThrowException] SVGPoint removeItem(unsigned long index);
     35    [MayThrowException] SVGPoint appendItem(SVGPoint item);
    3636};
  • trunk/Source/WebCore/svg/SVGPreserveAspectRatio.cpp

    r183026 r207716  
    3737}
    3838
    39 void SVGPreserveAspectRatio::setAlign(unsigned short align, ExceptionCode& ec)
    40 {
    41     if (align == SVG_PRESERVEASPECTRATIO_UNKNOWN || align > SVG_PRESERVEASPECTRATIO_XMAXYMAX) {
    42         ec = NOT_SUPPORTED_ERR;
    43         return;
    44     }
     39ExceptionOr<void> SVGPreserveAspectRatio::setAlign(unsigned short align)
     40{
     41    if (align == SVG_PRESERVEASPECTRATIO_UNKNOWN || align > SVG_PRESERVEASPECTRATIO_XMAXYMAX)
     42        return Exception { NOT_SUPPORTED_ERR };
    4543
    4644    m_align = static_cast<SVGPreserveAspectRatioType>(align);
    47 }
    48 
    49 void SVGPreserveAspectRatio::setMeetOrSlice(unsigned short meetOrSlice, ExceptionCode& ec)
    50 {
    51     if (meetOrSlice == SVG_MEETORSLICE_UNKNOWN || meetOrSlice > SVG_MEETORSLICE_SLICE) {
    52         ec = NOT_SUPPORTED_ERR;
    53         return;
    54     }
     45    return { };
     46}
     47
     48ExceptionOr<void> SVGPreserveAspectRatio::setMeetOrSlice(unsigned short meetOrSlice)
     49{
     50    if (meetOrSlice == SVG_MEETORSLICE_UNKNOWN || meetOrSlice > SVG_MEETORSLICE_SLICE)
     51        return Exception { NOT_SUPPORTED_ERR };
    5552
    5653    m_meetOrSlice = static_cast<SVGMeetOrSliceType>(meetOrSlice);
     54    return { };
    5755}
    5856
  • trunk/Source/WebCore/svg/SVGPreserveAspectRatio.h

    r164276 r207716  
    1919 */
    2020
    21 #ifndef SVGPreserveAspectRatio_h
    22 #define SVGPreserveAspectRatio_h
     21#pragma once
    2322
     23#include "ExceptionOr.h"
    2424#include "SVGPropertyTraits.h"
    2525
     
    2828class AffineTransform;
    2929class FloatRect;
    30 
    31 typedef int ExceptionCode;
    3230
    3331class SVGPreserveAspectRatio {
     
    5654    SVGPreserveAspectRatio();
    5755
    58     void setAlign(unsigned short align, ExceptionCode&);
     56    ExceptionOr<void> setAlign(unsigned short);
    5957    unsigned short align() const { return m_align; }
    6058
    61     void setMeetOrSlice(unsigned short, ExceptionCode&);
     59    ExceptionOr<void> setMeetOrSlice(unsigned short);
    6260    unsigned short meetOrSlice() const { return m_meetOrSlice; }
    6361
    6462    void transformRect(FloatRect& destRect, FloatRect& srcRect);
    6563
    66     AffineTransform getCTM(float logicX, float logicY,
    67                            float logicWidth, float logicHeight,
    68                            float physWidth, float physHeight) const;
     64    AffineTransform getCTM(float logicalX, float logicalY, float logicalWidth, float logicalHeight, float physicalWidth, float physicalHeight) const;
    6965
    7066    void parse(const String&);
     
    8076};
    8177
    82 template<>
    83 struct SVGPropertyTraits<SVGPreserveAspectRatio> {
     78template<> struct SVGPropertyTraits<SVGPreserveAspectRatio> {
    8479    static SVGPreserveAspectRatio initialValue() { return SVGPreserveAspectRatio(); }
    8580    static String toString(const SVGPreserveAspectRatio& type) { return type.valueAsString(); }
     
    8782
    8883} // namespace WebCore
    89 
    90 #endif // SVGPreserveAspectRatio_h
  • trunk/Source/WebCore/svg/SVGPreserveAspectRatio.idl

    r206723 r207716  
    4343    const unsigned short SVG_MEETORSLICE_SLICE = 2;
    4444
    45     [SetterMayThrowLegacyException] attribute unsigned short align;
    46 
    47     [SetterMayThrowLegacyException] attribute unsigned short meetOrSlice;
     45    [SetterMayThrowException] attribute unsigned short align;
     46    [SetterMayThrowException] attribute unsigned short meetOrSlice;
    4847};
    49 
  • trunk/Source/WebCore/svg/SVGSVGElement.cpp

    r203324 r207716  
    154154{
    155155    if (!m_viewSpec)
    156         m_viewSpec = SVGViewSpec::create(this);
     156        m_viewSpec = SVGViewSpec::create(*this);
    157157    return *m_viewSpec;
    158158}
  • trunk/Source/WebCore/svg/SVGStringList.h

    r203275 r207716  
    1919 */
    2020
    21 #ifndef SVGStringList_h
    22 #define SVGStringList_h
     21#pragma once
    2322
    2423#include "QualifiedName.h"
     
    4948};
    5049
    51 template<>
    52 struct SVGPropertyTraits<SVGStringList> {
     50template<> struct SVGPropertyTraits<SVGStringList> {
    5351    typedef String ListItemType;
    5452};
    5553
    5654} // namespace WebCore
    57 
    58 #endif
  • trunk/Source/WebCore/svg/SVGStringList.idl

    r206723 r207716  
    2727    readonly attribute unsigned long numberOfItems;
    2828
    29     [MayThrowLegacyException] void clear();
    30     [MayThrowLegacyException] DOMString initialize(DOMString item);
    31     [MayThrowLegacyException] DOMString getItem(unsigned long index);
    32     [MayThrowLegacyException] DOMString insertItemBefore(DOMString item, unsigned long index);
    33     [MayThrowLegacyException] DOMString replaceItem(DOMString item, unsigned long index);
    34     [MayThrowLegacyException] DOMString removeItem(unsigned long index);
    35     [MayThrowLegacyException] DOMString appendItem(DOMString item);
     29    [MayThrowException] void clear();
     30    [MayThrowException] DOMString initialize(DOMString item);
     31    [MayThrowException] DOMString getItem(unsigned long index);
     32    [MayThrowException] DOMString insertItemBefore(DOMString item, unsigned long index);
     33    [MayThrowException] DOMString replaceItem(DOMString item, unsigned long index);
     34    [MayThrowException] DOMString removeItem(unsigned long index);
     35    [MayThrowException] DOMString appendItem(DOMString item);
    3636};
    37 
  • trunk/Source/WebCore/svg/SVGStyleElement.cpp

    r206880 r207716  
    6868}
    6969
    70 void SVGStyleElement::setType(const AtomicString& type, ExceptionCode&)
     70void SVGStyleElement::setType(const AtomicString& type)
    7171{
    7272    setAttribute(SVGNames::typeAttr, type);
     
    8080}
    8181
    82 void SVGStyleElement::setMedia(const AtomicString& media, ExceptionCode&)
     82void SVGStyleElement::setMedia(const AtomicString& media)
    8383{
    8484    setAttributeWithoutSynchronization(SVGNames::mediaAttr, media);
     
    8888{
    8989    return attributeWithoutSynchronization(SVGNames::titleAttr);
    90 }
    91 
    92 void SVGStyleElement::setTitle(const AtomicString& title, ExceptionCode&)
    93 {
    94     setAttributeWithoutSynchronization(SVGNames::titleAttr, title);
    9590}
    9691
  • trunk/Source/WebCore/svg/SVGStyleElement.h

    r203469 r207716  
    2020 */
    2121
    22 #ifndef SVGStyleElement_h
    23 #define SVGStyleElement_h
     22#pragma once
    2423
    2524#include "InlineStyleSheetOwner.h"
     
    3938                         
    4039    const AtomicString& type() const;
    41     void setType(const AtomicString&, ExceptionCode&);
     40    void setType(const AtomicString&);
    4241
    4342    const AtomicString& media() const;
    44     void setMedia(const AtomicString&, ExceptionCode&);
    45 
    46     String title() const final;
    47     void setTitle(const AtomicString&, ExceptionCode&);
     43    void setMedia(const AtomicString&);
    4844
    4945private:
     
    6460    Timer* svgLoadEventTimer() final { return &m_svgLoadEventTimer; }
    6561
     62    String title() const final;
     63
    6664    InlineStyleSheetOwner m_styleSheetOwner;
    6765    Timer m_svgLoadEventTimer;
     
    6967
    7068} // namespace WebCore
    71 
    72 #endif // SVGStyleElement_h
  • trunk/Source/WebCore/svg/SVGStyleElement.idl

    r206723 r207716  
    2626
    2727interface SVGStyleElement : SVGElement {
    28              attribute boolean disabled;
    29              [SetterMayThrowLegacyException] attribute DOMString type;
    30              [SetterMayThrowLegacyException] attribute DOMString media;
    31              [SetterMayThrowLegacyException] attribute DOMString title;
     28     attribute boolean disabled;
     29     attribute DOMString type;
     30     attribute DOMString media;
     31     [Reflect] attribute DOMString title;
    3232};
    33 
  • trunk/Source/WebCore/svg/SVGTextContentElement.cpp

    r189770 r207716  
    9494    static NeverDestroyed<SVGLength> defaultTextLength(LengthModeOther);
    9595    if (m_specifiedTextLength == defaultTextLength)
    96         m_textLength.value.newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength(), ASSERT_NO_EXCEPTION);
     96        m_textLength.value.newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength());
    9797
    9898    m_textLength.shouldSynchronize = true;
    9999    return static_reference_cast<SVGAnimatedLength>(lookupOrCreateTextLengthWrapper(this));
    100 
    101100}
    102101
     
    113112}
    114113
    115 float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode& ec)
    116 {
    117     document().updateLayoutIgnorePendingStylesheets();
    118 
     114ExceptionOr<float> SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchars)
     115{
    119116    unsigned numberOfChars = getNumberOfChars();
    120     if (charnum >= numberOfChars) {
    121         ec = INDEX_SIZE_ERR;
    122         return 0.0f;
    123     }
     117    if (charnum >= numberOfChars)
     118        return Exception { INDEX_SIZE_ERR };
    124119
    125120    nchars = std::min(nchars, numberOfChars - charnum);
     
    127122}
    128123
    129 SVGPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, ExceptionCode& ec)
    130 {
    131     document().updateLayoutIgnorePendingStylesheets();
    132 
    133     if (charnum > getNumberOfChars()) {
    134         ec = INDEX_SIZE_ERR;
    135         return SVGPoint();
    136     }
     124ExceptionOr<SVGPoint> SVGTextContentElement::getStartPositionOfChar(unsigned charnum)
     125{
     126    if (charnum > getNumberOfChars())
     127        return Exception { INDEX_SIZE_ERR };
    137128
    138129    return SVGTextQuery(renderer()).startPositionOfCharacter(charnum);
    139130}
    140131
    141 SVGPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, ExceptionCode& ec)
    142 {
    143     document().updateLayoutIgnorePendingStylesheets();
    144 
    145     if (charnum > getNumberOfChars()) {
    146         ec = INDEX_SIZE_ERR;
    147         return SVGPoint();
    148     }
     132ExceptionOr<SVGPoint> SVGTextContentElement::getEndPositionOfChar(unsigned charnum)
     133{
     134    if (charnum > getNumberOfChars())
     135        return Exception { INDEX_SIZE_ERR };
    149136
    150137    return SVGTextQuery(renderer()).endPositionOfCharacter(charnum);
    151138}
    152139
    153 FloatRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionCode& ec)
    154 {
    155     document().updateLayoutIgnorePendingStylesheets();
    156 
    157     if (charnum > getNumberOfChars()) {
    158         ec = INDEX_SIZE_ERR;
    159         return FloatRect();
    160     }
     140ExceptionOr<FloatRect> SVGTextContentElement::getExtentOfChar(unsigned charnum)
     141{
     142    if (charnum > getNumberOfChars())
     143        return Exception { INDEX_SIZE_ERR };
    161144
    162145    return SVGTextQuery(renderer()).extentOfCharacter(charnum);
    163146}
    164147
    165 float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionCode& ec)
    166 {
    167     document().updateLayoutIgnorePendingStylesheets();
    168 
    169     if (charnum > getNumberOfChars()) {
    170         ec = INDEX_SIZE_ERR;
    171         return 0.0f;
    172     }
     148ExceptionOr<float> SVGTextContentElement::getRotationOfChar(unsigned charnum)
     149{
     150    if (charnum > getNumberOfChars())
     151        return Exception { INDEX_SIZE_ERR };
    173152
    174153    return SVGTextQuery(renderer()).rotationOfCharacter(charnum);
     
    181160}
    182161
    183 void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, ExceptionCode& ec)
     162ExceptionOr<void> SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars)
    184163{
    185164    unsigned numberOfChars = getNumberOfChars();
    186     if (charnum >= numberOfChars) {
    187         ec = INDEX_SIZE_ERR;
    188         return;
    189     }
     165    if (charnum >= numberOfChars)
     166        return Exception { INDEX_SIZE_ERR };
    190167
    191168    nchars = std::min(nchars, numberOfChars - charnum);
     
    206183
    207184    selection.setSelection(VisibleSelection(start, end));
     185
     186    return { };
    208187}
    209188
  • trunk/Source/WebCore/svg/SVGTextContentElement.h

    r197566 r207716  
    1919 */
    2020
    21 #ifndef SVGTextContentElement_h
    22 #define SVGTextContentElement_h
     21#pragma once
    2322
    2423#include "SVGAnimatedBoolean.h"
     
    3635};
    3736
    38 template<>
    39 struct SVGPropertyTraits<SVGLengthAdjustType> {
     37template<> struct SVGPropertyTraits<SVGLengthAdjustType> {
    4038    static unsigned highestEnumValue() { return SVGLengthAdjustSpacingAndGlyphs; }
    4139
     
    6765class SVGTextContentElement : public SVGGraphicsElement, public SVGExternalResourcesRequired {
    6866public:
    69     // Forward declare enumerations in the W3C naming scheme, for IDL generation.
    7067    enum {
    7168        LENGTHADJUST_UNKNOWN = SVGLengthAdjustUnknown,
     
    7673    unsigned getNumberOfChars();
    7774    float getComputedTextLength();
    78     float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode&);
    79     SVGPoint getStartPositionOfChar(unsigned charnum, ExceptionCode&);
    80     SVGPoint getEndPositionOfChar(unsigned charnum, ExceptionCode&);
    81     FloatRect getExtentOfChar(unsigned charnum, ExceptionCode&);
    82     float getRotationOfChar(unsigned charnum, ExceptionCode&);
     75    ExceptionOr<float> getSubStringLength(unsigned charnum, unsigned nchars);
     76    ExceptionOr<SVGPoint> getStartPositionOfChar(unsigned charnum);
     77    ExceptionOr<SVGPoint> getEndPositionOfChar(unsigned charnum);
     78    ExceptionOr<FloatRect> getExtentOfChar(unsigned charnum);
     79    ExceptionOr<float> getRotationOfChar(unsigned charnum);
    8380    int getCharNumAtPosition(const SVGPoint&);
    84     void selectSubString(unsigned charnum, unsigned nchars, ExceptionCode&);
     81    ExceptionOr<void> selectSubString(unsigned charnum, unsigned nchars);
    8582
    8683    static SVGTextContentElement* elementFromRenderer(RenderObject*);
     
    127124    static bool isType(const WebCore::Node& node) { return is<WebCore::SVGElement>(node) && isType(downcast<WebCore::SVGElement>(node)); }
    128125SPECIALIZE_TYPE_TRAITS_END()
    129 
    130 #endif
  • trunk/Source/WebCore/svg/SVGTextContentElement.idl

    r206723 r207716  
    2626interface SVGTextContentElement : SVGGraphicsElement {
    2727    // lengthAdjust Types
    28     const unsigned short LENGTHADJUST_UNKNOWN          = 0;
    29     const unsigned short LENGTHADJUST_SPACING          = 1;
     28    const unsigned short LENGTHADJUST_UNKNOWN = 0;
     29    const unsigned short LENGTHADJUST_SPACING = 1;
    3030    const unsigned short LENGTHADJUST_SPACINGANDGLYPHS = 2;
    3131
    32     readonly attribute SVGAnimatedLength      textLength;
     32    readonly attribute SVGAnimatedLength textLength;
    3333    readonly attribute SVGAnimatedEnumeration lengthAdjust;
    3434
    3535    long getNumberOfChars();
    3636    unrestricted float getComputedTextLength();
    37     [MayThrowLegacyException] unrestricted float getSubStringLength(optional unsigned long offset = 0,
    38                              optional unsigned long length = 0);
    39     [MayThrowLegacyException] SVGPoint getStartPositionOfChar(optional unsigned long offset = 0);
    40     [MayThrowLegacyException] SVGPoint getEndPositionOfChar(optional unsigned long offset = 0);
    41     [MayThrowLegacyException] SVGRect getExtentOfChar(optional unsigned long offset = 0);
    42     [MayThrowLegacyException] unrestricted float getRotationOfChar(optional unsigned long offset = 0);
     37    [MayThrowException] unrestricted float getSubStringLength(optional unsigned long offset = 0, optional unsigned long length = 0);
     38    [MayThrowException] SVGPoint getStartPositionOfChar(optional unsigned long offset = 0);
     39    [MayThrowException] SVGPoint getEndPositionOfChar(optional unsigned long offset = 0);
     40    [MayThrowException] SVGRect getExtentOfChar(optional unsigned long offset = 0);
     41    [MayThrowException] unrestricted float getRotationOfChar(optional unsigned long offset = 0);
    4342    long getCharNumAtPosition(SVGPoint point);
    44     [MayThrowLegacyException] void selectSubString(optional unsigned long offset = 0, optional unsigned long length = 0);
     43    [MayThrowException] void selectSubString(optional unsigned long offset = 0, optional unsigned long length = 0);
    4544};
    4645
  • trunk/Source/WebCore/svg/SVGTransformList.h

    r203275 r207716  
    1919 */
    2020
    21 #ifndef SVGTransformList_h
    22 #define SVGTransformList_h
     21#pragma once
    2322
    2423#include "SVGPropertyTraits.h"
     
    3029class SVGTransformList final : public Vector<SVGTransform, 1> {
    3130public:
    32     SVGTransformList() { }
    33 
    3431    SVGTransform createSVGTransformFromMatrix(const SVGMatrix&) const;
    3532    SVGTransform consolidate();
    3633
    37     // Internal use only
    3834    bool concatenate(AffineTransform& result) const;
    3935 
     
    4238};
    4339
    44 template<>
    45 struct SVGPropertyTraits<SVGTransformList> {
     40template<> struct SVGPropertyTraits<SVGTransformList> {
    4641    static SVGTransformList initialValue() { return SVGTransformList(); }
    4742    static String toString(const SVGTransformList& type) { return type.valueAsString(); }
     
    5045
    5146} // namespace WebCore
    52 
    53 #endif // SVGTransformList_h
  • trunk/Source/WebCore/svg/SVGTransformList.idl

    r206723 r207716  
    2828    readonly attribute unsigned long numberOfItems;
    2929
    30     [MayThrowLegacyException] void clear();
    31     [MayThrowLegacyException] SVGTransform initialize(SVGTransform item);
    32     [MayThrowLegacyException] SVGTransform getItem(unsigned long index);
    33     [MayThrowLegacyException] SVGTransform insertItemBefore(SVGTransform item, unsigned long index);
    34     [MayThrowLegacyException] SVGTransform replaceItem(SVGTransform item, unsigned long index);
    35     [MayThrowLegacyException] SVGTransform removeItem(unsigned long index);
    36     [MayThrowLegacyException] SVGTransform appendItem(SVGTransform item);
     30    [MayThrowException] void clear();
     31    [MayThrowException] SVGTransform initialize(SVGTransform item);
     32    [MayThrowException] SVGTransform getItem(unsigned long index);
     33    [MayThrowException] SVGTransform insertItemBefore(SVGTransform item, unsigned long index);
     34    [MayThrowException] SVGTransform replaceItem(SVGTransform item, unsigned long index);
     35    [MayThrowException] SVGTransform removeItem(unsigned long index);
     36    [MayThrowException] SVGTransform appendItem(SVGTransform item);
    3737
    38     [MayThrowLegacyException] SVGTransform createSVGTransformFromMatrix(SVGMatrix matrix);
     38    [MayThrowException] SVGTransform createSVGTransformFromMatrix(SVGMatrix matrix);
    3939
    40     [MayThrowLegacyException] SVGTransform consolidate();
     40    [MayThrowException] SVGTransform consolidate();
    4141};
  • trunk/Source/WebCore/svg/SVGViewSpec.cpp

    r196268 r207716  
    7676}
    7777
    78 SVGViewSpec::SVGViewSpec(SVGElement* contextElement)
    79     : m_contextElement(contextElement)
    80     , m_zoomAndPan(SVGZoomAndPanMagnify)
    81 {
    82     ASSERT(m_contextElement);
     78SVGViewSpec::SVGViewSpec(SVGElement& contextElement)
     79    : m_contextElement(&contextElement)
     80{
    8381}
    8482
     
    10199}
    102100
    103 void SVGViewSpec::setZoomAndPan(unsigned short, ExceptionCode& ec)
     101ExceptionOr<void> SVGViewSpec::setZoomAndPan(unsigned short)
    104102{
    105103    // SVGViewSpec and all of its content is read-only.
    106     ec = NO_MODIFICATION_ALLOWED_ERR;
    107 }
    108 
    109 void SVGViewSpec::setTransformString(const String& transform)
    110 {
    111     if (!m_contextElement)
    112         return;
    113 
    114     SVGTransformList newList;
    115     newList.parse(transform);
    116 
    117     if (auto wrapper = SVGAnimatedProperty::lookupWrapper<SVGElement, SVGAnimatedTransformList>(m_contextElement, transformPropertyInfo()))
    118         static_pointer_cast<SVGAnimatedTransformList>(wrapper)->detachListWrappers(newList.size());
    119 
    120     m_transform = newList;
     104    return Exception { NO_MODIFICATION_ALLOWED_ERR };
    121105}
    122106
     
    128112String SVGViewSpec::viewBoxString() const
    129113{
    130     return SVGPropertyTraits<FloatRect>::toString(viewBoxBaseValue());
     114    return SVGPropertyTraits<FloatRect>::toString(m_viewBox);
    131115}
    132116
    133117String SVGViewSpec::preserveAspectRatioString() const
    134118{
    135     return SVGPropertyTraits<SVGPreserveAspectRatio>::toString(preserveAspectRatioBaseValue());
     119    return SVGPropertyTraits<SVGPreserveAspectRatio>::toString(m_preserveAspectRatio);
    136120}
    137121
     
    140124    if (!m_contextElement)
    141125        return nullptr;
    142     Element* element = m_contextElement->treeScope().getElementById(m_viewTargetString);
    143     if (!element || !element->isSVGElement())
     126    auto* element = m_contextElement->treeScope().getElementById(m_viewTargetString);
     127    if (!is<SVGElement>(element))
    144128        return nullptr;
    145129    return downcast<SVGElement>(element);
     
    171155{
    172156    ASSERT(ownerType);
    173     ASSERT(ownerType->contextElement());
    174     return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedRect, FloatRect>(ownerType->contextElement(), viewBoxPropertyInfo(), ownerType->m_viewBox);
     157    ASSERT(ownerType->m_contextElement);
     158    return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedRect, FloatRect>(ownerType->m_contextElement, viewBoxPropertyInfo(), ownerType->m_viewBox);
    175159}
    176160
     
    178162{
    179163    ASSERT(ownerType);
    180     ASSERT(ownerType->contextElement());
    181     return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedPreserveAspectRatio, SVGPreserveAspectRatio>(ownerType->contextElement(), preserveAspectRatioPropertyInfo(), ownerType->m_preserveAspectRatio);
     164    ASSERT(ownerType->m_contextElement);
     165    return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedPreserveAspectRatio, SVGPreserveAspectRatio>(ownerType->m_contextElement, preserveAspectRatioPropertyInfo(), ownerType->m_preserveAspectRatio);
    182166}
    183167
     
    185169{
    186170    ASSERT(ownerType);
    187     ASSERT(ownerType->contextElement());
    188     return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedTransformList, SVGTransformList>(ownerType->contextElement(), transformPropertyInfo(), ownerType->m_transform);
     171    ASSERT(ownerType->m_contextElement);
     172    return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedTransformList, SVGTransformList>(ownerType->m_contextElement, transformPropertyInfo(), ownerType->m_transform);
    189173}
    190174
     
    242226                if (currViewSpec >= end)
    243227                    return false;
    244                 setViewTargetString(String(viewTargetStart, currViewSpec - viewTargetStart));
     228                m_viewTargetString = String(viewTargetStart, currViewSpec - viewTargetStart);
    245229                currViewSpec++;
    246230            } else
  • trunk/Source/WebCore/svg/SVGViewSpec.h

    r203275 r207716  
    1818 */
    1919
    20 #ifndef SVGViewSpec_h
    21 #define SVGViewSpec_h
     20#pragma once
    2221
    2322#include "SVGAnimatedPreserveAspectRatio.h"
     
    3231class SVGTransformListPropertyTearOff;
    3332
    34 class SVGViewSpec final : public RefCounted<SVGViewSpec>
    35                   , public SVGZoomAndPan
    36                   , public SVGFitToViewBox {
     33class SVGViewSpec final : public RefCounted<SVGViewSpec>, public SVGZoomAndPan, public SVGFitToViewBox {
    3734public:
    38     virtual ~SVGViewSpec() { }
    39 
    40     using RefCounted<SVGViewSpec>::ref;
    41     using RefCounted<SVGViewSpec>::deref;
    42 
    43     static Ref<SVGViewSpec> create(SVGElement* contextElement)
     35    static Ref<SVGViewSpec> create(SVGElement& contextElement)
    4436    {
    4537        return adoptRef(*new SVGViewSpec(contextElement));
     
    5042
    5143    SVGElement* viewTarget() const;
     44
     45    String transformString() const;
    5246    String viewBoxString() const;
    53 
    5447    String preserveAspectRatioString() const;
    55 
    56     void setTransformString(const String&);
    57     String transformString() const;
    58 
    59     void setViewTargetString(const String& string) { m_viewTargetString = string; }
    60     String viewTargetString() const { return m_viewTargetString; }
     48    const String& viewTargetString() const { return m_viewTargetString; }
    6149
    6250    SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; }
    63     void setZoomAndPan(unsigned short zoomAndPan) { setZoomAndPanBaseValue(zoomAndPan); }
    64     void setZoomAndPan(unsigned short, ExceptionCode&);
     51    ExceptionOr<void> setZoomAndPan(unsigned short);
    6552    void setZoomAndPanBaseValue(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); }
    6653
    67     SVGElement* contextElement() const { return m_contextElement; }
    6854    void resetContextElement() { m_contextElement = nullptr; }
    6955
     
    7561    RefPtr<SVGAnimatedRect> viewBoxAnimated();
    7662    FloatRect& viewBox() { return m_viewBox; }
    77     FloatRect viewBoxBaseValue() const { return m_viewBox; }
    7863    void setViewBoxBaseValue(const FloatRect& viewBox) { m_viewBox = viewBox; }
    7964
     
    8166    RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated();
    8267    SVGPreserveAspectRatio& preserveAspectRatio() { return m_preserveAspectRatio; }
    83     SVGPreserveAspectRatio preserveAspectRatioBaseValue() const { return m_preserveAspectRatio; }
    8468    void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatio& preserveAspectRatio) { m_preserveAspectRatio = preserveAspectRatio; }
    8569
    8670private:
    87     SVGViewSpec(SVGElement*);
     71    explicit SVGViewSpec(SVGElement&);
    8872
    8973    static const SVGPropertyInfo* transformPropertyInfo();
     
    10084
    10185    SVGElement* m_contextElement;
    102     SVGZoomAndPanType m_zoomAndPan;
    103 
     86    SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify };
    10487    SVGTransformList m_transform;
    10588    FloatRect m_viewBox;
     
    10992
    11093} // namespace WebCore
    111 
    112 #endif
  • trunk/Source/WebCore/svg/SVGViewSpec.idl

    r206723 r207716  
    2727// It would require that any of those classes would be RefCounted, and we want to avoid that.
    2828[
    29     JSGenerateToJSObject
     29    ImplementationLacksVTable,
     30    JSGenerateToJSObject,
    3031] interface SVGViewSpec {
    31       readonly attribute SVGTransformList transform;
    32       readonly attribute SVGElement viewTarget;
    33       readonly attribute DOMString viewBoxString;
    34       readonly attribute DOMString preserveAspectRatioString;
    35       readonly attribute DOMString transformString;
    36       readonly attribute DOMString viewTargetString;
     32    readonly attribute SVGTransformList transform;
     33    readonly attribute SVGElement viewTarget;
     34    readonly attribute DOMString viewBoxString;
     35    readonly attribute DOMString preserveAspectRatioString;
     36    readonly attribute DOMString transformString;
     37    readonly attribute DOMString viewTargetString;
    3738
    38       // SVGZoomAndPan
    39       [SetterMayThrowLegacyException] attribute unsigned short zoomAndPan;
     39    // SVGZoomAndPan
     40    [SetterMayThrowException] attribute unsigned short zoomAndPan;
    4041};
    4142
  • trunk/Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h

    r203469 r207716  
    5050    }
    5151
    52     void setBaseVal(const unsigned& property, ExceptionCode& ec) final
     52    ExceptionOr<void> setBaseVal(const unsigned& property) final
    5353    {
    5454        // All SVG enumeration values, that are allowed to be set via SVG DOM start with 1, 0 corresponds to unknown and is not settable through SVG DOM.
    55         if (!property || property > SVGIDLEnumLimits<EnumType>::highestExposedEnumValue()) {
    56             ec = SVGException::SVG_INVALID_VALUE_ERR;
    57             return;
    58         }
    59         SVGAnimatedStaticPropertyTearOff<unsigned>::setBaseVal(property, ec);
     55        if (!property || property > SVGIDLEnumLimits<EnumType>::highestExposedEnumValue())
     56            return Exception { SVGException::SVG_INVALID_VALUE_ERR };
     57        return SVGAnimatedStaticPropertyTearOff<unsigned>::setBaseVal(property);
    6058    }
    6159
  • trunk/Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h

    r198316 r207716  
    1919 */
    2020
    21 #ifndef SVGAnimatedStaticPropertyTearOff_h
    22 #define SVGAnimatedStaticPropertyTearOff_h
     21#pragma once
    2322
    24 #include "ExceptionCode.h"
     23#include "ExceptionOr.h"
    2524#include "SVGAnimatedProperty.h"
    2625
     
    4443    }
    4544
    46     virtual void setBaseVal(const PropertyType& property, ExceptionCode&)
     45    virtual ExceptionOr<void> setBaseVal(const PropertyType& property)
    4746    {
    4847        m_property = property;
    4948        commitChange();
     49        return { };
    5050    }
    5151
     
    108108
    109109}
    110 
    111 #endif // SVGAnimatedStaticPropertyTearOff_h
  • trunk/Source/WebCore/svg/properties/SVGListProperty.h

    r202242 r207716  
    1818 */
    1919
    20 #ifndef SVGListProperty_h
    21 #define SVGListProperty_h
     20#pragma once
    2221
    2322#include "SVGException.h"
     
    4342    typedef SVGListProperty<PropertyType> Self;
    4443
    45     typedef typename SVGPropertyTraits<PropertyType>::ListItemType ListItemType;
    46     typedef SVGPropertyTearOff<ListItemType> ListItemTearOff;
    47     typedef RefPtr<ListItemTearOff> PtrListItemTearOff;
    48     typedef SVGAnimatedListPropertyTearOff<PropertyType> AnimatedListPropertyTearOff;
    49     typedef typename SVGAnimatedListPropertyTearOff<PropertyType>::ListWrapperCache ListWrapperCache;
    50 
    51     bool canAlterList(ExceptionCode& ec) const
    52     {
    53         if (m_role == AnimValRole) {
    54             ec = NO_MODIFICATION_ALLOWED_ERR;
    55             return false;
    56         }
     44    using ListItemType = typename SVGPropertyTraits<PropertyType>::ListItemType;
     45    using ListItemTearOff = SVGPropertyTearOff<ListItemType>;
     46    using PtrListItemTearOff = RefPtr<ListItemTearOff>;
     47    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<PropertyType>;
     48    using ListWrapperCache = typename AnimatedListPropertyTearOff::ListWrapperCache;
     49
     50    ExceptionOr<bool> canAlterList() const
     51    {
     52        if (m_role == AnimValRole)
     53            return Exception { NO_MODIFICATION_ALLOWED_ERR };
    5754
    5855        return true;
     
    9693
    9794    // SVGList::clear()
    98     void clearValues(ExceptionCode& ec)
    99     {
    100         if (!canAlterList(ec))
    101             return;
     95    ExceptionOr<void> clearValues()
     96    {
     97        auto result = canAlterList();
     98        if (result.hasException())
     99            return result.releaseException();
     100        if (!result.releaseReturnValue())
     101            return { };
    102102
    103103        m_values->clear();
    104104        commitChange();
    105     }
    106 
    107     void clearValuesAndWrappers(ExceptionCode& ec)
    108     {
    109         if (!canAlterList(ec))
    110             return;
     105        return { };
     106    }
     107
     108    ExceptionOr<void> clearValuesAndWrappers()
     109    {
     110        auto result = canAlterList();
     111        if (result.hasException())
     112            return result.releaseException();
     113        if (!result.releaseReturnValue())
     114            return { };
    111115
    112116        detachListWrappers(0);
    113117        m_values->clear();
    114118        commitChange();
     119        return { };
    115120    }
    116121
     
    122127
    123128    // SVGList::initialize()
    124     ListItemType initializeValues(const ListItemType& newItem, ExceptionCode& ec)
    125     {
    126         if (!canAlterList(ec))
    127             return ListItemType();
     129    ExceptionOr<ListItemType> initializeValues(const ListItemType& newItem)
     130    {
     131        auto result = canAlterList();
     132        if (result.hasException())
     133            return result.releaseException();
     134        if (!result.releaseReturnValue())
     135            return ListItemType { };
    128136
    129137        // Spec: If the inserted item is already in a list, it is removed from its previous list before it is inserted into this list.
     
    135143
    136144        commitChange();
    137         return newItem;
    138     }
    139 
    140     PtrListItemTearOff initializeValuesAndWrappers(PtrListItemTearOff newItem, ExceptionCode& ec)
    141     {
    142         ASSERT(m_wrappers);
    143         if (!canAlterList(ec))
     145        return ListItemType { newItem };
     146    }
     147
     148    ExceptionOr<PtrListItemTearOff> initializeValuesAndWrappers(PtrListItemTearOff newItem)
     149    {
     150        ASSERT(m_wrappers);
     151
     152        auto result = canAlterList();
     153        if (result.hasException())
     154            return result.releaseException();
     155        if (!result.releaseReturnValue())
    144156            return nullptr;
    145157
    146158        // Not specified, but FF/Opera do it this way, and it's just sane.
    147         if (!newItem) {
    148             ec = SVGException::SVG_WRONG_TYPE_ERR;
    149             return nullptr;
    150         }
     159        if (!newItem)
     160            return Exception { SVGException::SVG_WRONG_TYPE_ERR };
    151161
    152162        ASSERT(m_values->size() == m_wrappers->size());
     
    163173
    164174        commitChange();
    165         return newItem;
     175        return WTFMove(newItem);
    166176    }
    167177
    168178    // SVGList::getItem()
    169     bool canGetItem(unsigned index, ExceptionCode& ec)
    170     {
    171         if (index >= m_values->size()) {
    172             ec = INDEX_SIZE_ERR;
    173             return false;
    174         }
     179    ExceptionOr<bool> canGetItem(unsigned index)
     180    {
     181        if (index >= m_values->size())
     182            return Exception { INDEX_SIZE_ERR };
    175183
    176184        return true;
    177185    }
    178186
    179     ListItemType getItemValues(unsigned index, ExceptionCode& ec)
    180     {
    181         if (!canGetItem(index, ec))
    182             return ListItemType();
     187    ExceptionOr<ListItemType> getItemValues(unsigned index)
     188    {
     189        auto result = canGetItem(index);
     190        if (result.hasException())
     191            return result.releaseException();
     192        if (!result.releaseReturnValue())
     193            return ListItemType { };
    183194
    184195        // Spec: Returns the specified item from the list. The returned item is the item itself and not a copy.
    185         return m_values->at(index);
    186     }
    187 
    188     PtrListItemTearOff getItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionCode& ec)
    189     {
    190         ASSERT(m_wrappers);
    191         if (!canGetItem(index, ec))
     196        return ListItemType { m_values->at(index) };
     197    }
     198
     199    ExceptionOr<PtrListItemTearOff> getItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index)
     200    {
     201        ASSERT(m_wrappers);
     202
     203        auto result = canGetItem(index);
     204        if (result.hasException())
     205            return result.releaseException();
     206        if (!result.releaseReturnValue())
    192207            return nullptr;
    193208
     
    208223
    209224    // SVGList::insertItemBefore()
    210     ListItemType insertItemBeforeValues(const ListItemType& newItem, unsigned index, ExceptionCode& ec)
    211     {
    212         if (!canAlterList(ec))
    213             return ListItemType();
     225    ExceptionOr<ListItemType> insertItemBeforeValues(const ListItemType& newItem, unsigned index)
     226    {
     227        auto result = canAlterList();
     228        if (result.hasException())
     229            return result.releaseException();
     230        if (!result.releaseReturnValue())
     231            return ListItemType { };
    214232
    215233        // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
     
    220238        if (!processIncomingListItemValue(newItem, &index)) {
    221239            // Inserting the item before itself is a no-op.
    222             return newItem;
     240            return ListItemType { newItem };
    223241        }
    224242
     
    228246
    229247        commitChange();
    230         return newItem;
    231     }
    232 
    233     PtrListItemTearOff insertItemBeforeValuesAndWrappers(PtrListItemTearOff newItem, unsigned index, ExceptionCode& ec)
    234     {
    235         ASSERT(m_wrappers);
    236         if (!canAlterList(ec))
     248        return ListItemType { newItem };
     249    }
     250
     251    ExceptionOr<PtrListItemTearOff> insertItemBeforeValuesAndWrappers(PtrListItemTearOff newItem, unsigned index)
     252    {
     253        ASSERT(m_wrappers);
     254
     255        auto result = canAlterList();
     256        if (result.hasException())
     257            return result.releaseException();
     258        if (!result.releaseReturnValue())
    237259            return nullptr;
    238260
    239261        // Not specified, but FF/Opera do it this way, and it's just sane.
    240         if (!newItem) {
    241             ec = SVGException::SVG_WRONG_TYPE_ERR;
    242             return nullptr;
    243         }
     262        if (!newItem)
     263            return Exception { SVGException::SVG_WRONG_TYPE_ERR };
    244264
    245265        // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
    246266        if (index > m_values->size())
    247              index = m_values->size();
     267            index = m_values->size();
    248268
    249269        ASSERT(m_values->size() == m_wrappers->size());
     
    265285
    266286    // SVGList::replaceItem()
    267     bool canReplaceItem(unsigned index, ExceptionCode& ec)
    268     {
    269         if (!canAlterList(ec))
     287    ExceptionOr<bool> canReplaceItem(unsigned index)
     288    {
     289        auto result = canAlterList();
     290        if (result.hasException())
     291            return result.releaseException();
     292        if (!result.releaseReturnValue())
    270293            return false;
    271294
    272         if (index >= m_values->size()) {
    273             ec = INDEX_SIZE_ERR;
    274             return false;
    275         }
     295        if (index >= m_values->size())
     296            return Exception { INDEX_SIZE_ERR };
    276297
    277298        return true;
    278299    }
    279300
    280     ListItemType replaceItemValues(const ListItemType& newItem, unsigned index, ExceptionCode& ec)
    281     {
    282         if (!canReplaceItem(index, ec))
    283             return ListItemType();
     301    ExceptionOr<ListItemType> replaceItemValues(const ListItemType& newItem, unsigned index)
     302    {
     303        auto result = canReplaceItem(index);
     304        if (result.hasException())
     305            return result.releaseException();
     306        if (!result.releaseReturnValue())
     307            return ListItemType { };
    284308
    285309        // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
     
    287311        if (!processIncomingListItemValue(newItem, &index)) {
    288312            // Replacing the item with itself is a no-op.
    289             return newItem;
     313            return ListItemType { newItem };
    290314        }
    291315
    292316        if (m_values->isEmpty()) {
    293317            // 'newItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace.
    294             ec = INDEX_SIZE_ERR;
    295             return ListItemType();
     318            return Exception { INDEX_SIZE_ERR };
    296319        }
    297320
     
    300323
    301324        commitChange();
    302         return newItem;
    303     }
    304 
    305     PtrListItemTearOff replaceItemValuesAndWrappers(PtrListItemTearOff newItem, unsigned index, ExceptionCode& ec)
    306     {
    307         ASSERT(m_wrappers);
    308         if (!canReplaceItem(index, ec))
     325        return ListItemType { newItem };
     326    }
     327
     328    ExceptionOr<PtrListItemTearOff> replaceItemValuesAndWrappers(PtrListItemTearOff newItem, unsigned index)
     329    {
     330        ASSERT(m_wrappers);
     331
     332        auto result = canReplaceItem(index);
     333        if (result.hasException())
     334            return result.releaseException();
     335        if (!result.releaseReturnValue())
    309336            return nullptr;
    310337
    311338        // Not specified, but FF/Opera do it this way, and it's just sane.
    312         if (!newItem) {
    313             ec = SVGException::SVG_WRONG_TYPE_ERR;
    314             return nullptr;
    315         }
     339        if (!newItem)
     340            return Exception { SVGException::SVG_WRONG_TYPE_ERR };
    316341
    317342        ASSERT(m_values->size() == m_wrappers->size());
     
    320345        // Spec: If the item is already in this list, note that the index of the item to replace is before the removal of the item.
    321346        if (!processIncomingListItemWrapper(newItem, &index))
    322             return newItem;
     347            return WTFMove(newItem);
    323348
    324349        if (m_values->isEmpty()) {
    325350            ASSERT(m_wrappers->isEmpty());
    326351            // 'newItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace.
    327             ec = INDEX_SIZE_ERR;
    328             return nullptr;
     352            return Exception { INDEX_SIZE_ERR };
    329353        }
    330354
     
    339363
    340364        commitChange();
    341         return newItem;
     365        return WTFMove(newItem);
    342366    }
    343367
    344368    // SVGList::removeItem()
    345     bool canRemoveItem(unsigned index, ExceptionCode& ec)
    346     {
    347         if (!canAlterList(ec))
     369    ExceptionOr<bool> canRemoveItem(unsigned index)
     370    {
     371        auto result = canAlterList();
     372        if (result.hasException())
     373            return result.releaseException();
     374        if (!result.releaseReturnValue())
    348375            return false;
    349376
    350         if (index >= m_values->size()) {
    351             ec = INDEX_SIZE_ERR;
    352             return false;
    353         }
     377        if (index >= m_values->size())
     378            return Exception { INDEX_SIZE_ERR };
    354379
    355380        return true;
    356381    }
    357382
    358     ListItemType removeItemValues(unsigned index, ExceptionCode& ec)
    359     {
    360         if (!canRemoveItem(index, ec))
    361             return ListItemType();
     383    ExceptionOr<ListItemType> removeItemValues(unsigned index)
     384    {
     385        auto result = canRemoveItem(index);
     386        if (result.hasException())
     387            return result.releaseException();
     388        if (!result.releaseReturnValue())
     389            return ListItemType { };
    362390
    363391        ListItemType oldItem = m_values->at(index);
     
    365393
    366394        commitChange();
    367         return oldItem;
    368     }
    369 
    370     PtrListItemTearOff removeItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionCode& ec)
    371     {
    372         ASSERT(m_wrappers);
    373         if (!canRemoveItem(index, ec))
     395        return WTFMove(oldItem);
     396    }
     397
     398    ExceptionOr<PtrListItemTearOff> removeItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index)
     399    {
     400        ASSERT(m_wrappers);
     401
     402        auto result = canRemoveItem(index);
     403        if (result.hasException())
     404            return result.releaseException();
     405        if (!result.releaseReturnValue())
    374406            return nullptr;
    375407
     
    390422
    391423    // SVGList::appendItem()
    392     ListItemType appendItemValues(const ListItemType& newItem, ExceptionCode& ec)
    393     {
    394         if (!canAlterList(ec))
    395             return ListItemType();
     424    ExceptionOr<ListItemType> appendItemValues(const ListItemType& newItem)
     425    {
     426        auto result = canAlterList();
     427        if (result.hasException())
     428            return result.releaseException();
     429        if (!result.releaseReturnValue())
     430            return ListItemType { };
    396431
    397432        // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
     
    402437
    403438        commitChange(ListModificationAppend);
    404         return newItem;
    405     }
    406 
    407     PtrListItemTearOff appendItemValuesAndWrappers(PtrListItemTearOff newItem, ExceptionCode& ec)
    408     {
    409         ASSERT(m_wrappers);
    410         if (!canAlterList(ec))
     439        return ListItemType { newItem };
     440    }
     441
     442    ExceptionOr<PtrListItemTearOff> appendItemValuesAndWrappers(PtrListItemTearOff newItem)
     443    {
     444        ASSERT(m_wrappers);
     445
     446        auto result = canAlterList();
     447        if (result.hasException())
     448            return result.releaseException();
     449        if (!result.releaseReturnValue())
    411450            return nullptr;
    412451
    413452        // Not specified, but FF/Opera do it this way, and it's just sane.
    414         if (!newItem) {
    415             ec = SVGException::SVG_WRONG_TYPE_ERR;
    416             return nullptr;
    417         }
     453        if (!newItem)
     454            return Exception { SVGException::SVG_WRONG_TYPE_ERR };
    418455
    419456        ASSERT(m_values->size() == m_wrappers->size());
     
    427464
    428465        commitChange(ListModificationAppend);
    429         return newItem;
     466        return WTFMove(newItem);
    430467    }
    431468
     
    473510
    474511}
    475 
    476 #endif // SVGListProperty_h
  • trunk/Source/WebCore/svg/properties/SVGListPropertyTearOff.h

    r197563 r207716  
    1818 */
    1919
    20 #ifndef SVGListPropertyTearOff_h
    21 #define SVGListPropertyTearOff_h
     20#pragma once
    2221
    2322#include "SVGListProperty.h"
     
    7978
    8079    // SVGList API
    81     void clear(ExceptionCode& ec)
    82     {
    83         Base::clearValuesAndWrappers(ec);
    84     }
    85 
    86     PtrListItemTearOff initialize(PtrListItemTearOff newItem, ExceptionCode& ec)
    87     {
    88         return Base::initializeValuesAndWrappers(newItem, ec);
    89     }
    90 
    91     PtrListItemTearOff getItem(unsigned index, ExceptionCode& ec)
    92     {
    93         return Base::getItemValuesAndWrappers(m_animatedProperty.get(), index, ec);
    94     }
    95 
    96     PtrListItemTearOff insertItemBefore(PtrListItemTearOff newItem, unsigned index, ExceptionCode& ec)
    97     {
    98         return Base::insertItemBeforeValuesAndWrappers(newItem, index, ec);
    99     }
    100 
    101     PtrListItemTearOff replaceItem(PtrListItemTearOff newItem, unsigned index, ExceptionCode& ec)
    102     {
    103         return Base::replaceItemValuesAndWrappers(newItem, index, ec);
    104     }
    105 
    106     PtrListItemTearOff removeItem(unsigned index, ExceptionCode& ec)
    107     {
    108         return Base::removeItemValuesAndWrappers(m_animatedProperty.get(), index, ec);
    109     }
    110 
    111     PtrListItemTearOff appendItem(PtrListItemTearOff newItem, ExceptionCode& ec)
    112     {
    113         return Base::appendItemValuesAndWrappers(newItem, ec);
     80    ExceptionOr<void> clear()
     81    {
     82        return Base::clearValuesAndWrappers();
     83    }
     84
     85    ExceptionOr<PtrListItemTearOff> initialize(PtrListItemTearOff newItem)
     86    {
     87        return Base::initializeValuesAndWrappers(newItem);
     88    }
     89
     90    ExceptionOr<PtrListItemTearOff> getItem(unsigned index)
     91    {
     92        return Base::getItemValuesAndWrappers(m_animatedProperty.get(), index);
     93    }
     94
     95    ExceptionOr<PtrListItemTearOff> insertItemBefore(PtrListItemTearOff newItem, unsigned index)
     96    {
     97        return Base::insertItemBeforeValuesAndWrappers(newItem, index);
     98    }
     99
     100    ExceptionOr<PtrListItemTearOff> replaceItem(PtrListItemTearOff newItem, unsigned index)
     101    {
     102        return Base::replaceItemValuesAndWrappers(newItem, index);
     103    }
     104
     105    ExceptionOr<PtrListItemTearOff> removeItem(unsigned index)
     106    {
     107        return Base::removeItemValuesAndWrappers(m_animatedProperty.get(), index);
     108    }
     109
     110    ExceptionOr<PtrListItemTearOff> appendItem(PtrListItemTearOff newItem)
     111    {
     112        return Base::appendItemValuesAndWrappers(newItem);
    114113    }
    115114
     
    215214
    216215}
    217 
    218 #endif // SVGListPropertyTearOff_h
  • trunk/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp

    r196268 r207716  
    3636}
    3737
    38 void SVGPathSegListPropertyTearOff::clear(ExceptionCode& ec)
     38ExceptionOr<void> SVGPathSegListPropertyTearOff::clear()
    3939{
    4040    ASSERT(m_values);
    4141    if (m_values->isEmpty())
    42         return;
     42        return { };
    4343
    4444    clearContextAndRoles();
    45     SVGPathSegListPropertyTearOff::Base::clearValues(ec);
     45    return SVGPathSegListPropertyTearOff::Base::clearValues();
    4646}
    4747
    48 SVGPathSegListPropertyTearOff::PtrListItemType SVGPathSegListPropertyTearOff::getItem(unsigned index, ExceptionCode& ec)
     48ExceptionOr<SVGPathSegListPropertyTearOff::PtrListItemType> SVGPathSegListPropertyTearOff::getItem(unsigned index)
    4949{
    50     ListItemType returnedItem = Base::getItemValues(index, ec);
    51     if (returnedItem) {
    52         ASSERT(static_cast<SVGPathSegWithContext*>(returnedItem.get())->contextElement() == contextElement());
    53         ASSERT(static_cast<SVGPathSegWithContext*>(returnedItem.get())->role() == m_pathSegRole);
    54     }
    55     return returnedItem;
     50    return Base::getItemValues(index);
    5651}
    5752
    58 SVGPathSegListPropertyTearOff::PtrListItemType SVGPathSegListPropertyTearOff::replaceItem(PtrListItemType newItem, unsigned index, ExceptionCode& ec)
     53ExceptionOr<SVGPathSegListPropertyTearOff::PtrListItemType> SVGPathSegListPropertyTearOff::replaceItem(PtrListItemType newItem, unsigned index)
    5954{
    6055    // Not specified, but FF/Opera do it this way, and it's just sane.
    61     if (!newItem) {
    62         ec = SVGException::SVG_WRONG_TYPE_ERR;
    63         return 0;
    64     }
     56    if (!newItem)
     57        return Exception { SVGException::SVG_WRONG_TYPE_ERR };
    6558
    6659    if (index < m_values->size()) {
     
    7063    }
    7164
    72     return Base::replaceItemValues(newItem, index, ec);
     65    return Base::replaceItemValues(newItem, index);
    7366}
    7467
    75 SVGPathSegListPropertyTearOff::PtrListItemType SVGPathSegListPropertyTearOff::removeItem(unsigned index, ExceptionCode& ec)
     68ExceptionOr<SVGPathSegListPropertyTearOff::PtrListItemType> SVGPathSegListPropertyTearOff::removeItem(unsigned index)
    7669{
    77     SVGPathSegListPropertyTearOff::ListItemType removedItem = SVGPathSegListPropertyTearOff::Base::removeItemValues(index, ec);
     70    auto result = SVGPathSegListPropertyTearOff::Base::removeItemValues(index);
     71    if (result.hasException())
     72        return result;
     73    auto removedItem = result.releaseReturnValue();
    7874    if (removedItem)
    79         static_cast<SVGPathSegWithContext*>(removedItem.get())->setContextAndRole(nullptr, PathSegUndefinedRole);
    80     return removedItem;
     75        static_cast<SVGPathSegWithContext&>(*removedItem).setContextAndRole(nullptr, PathSegUndefinedRole);
     76    return WTFMove(removedItem);
    8177}
    8278
  • trunk/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.h

    r203469 r207716  
    1818 */
    1919
    20 #ifndef SVGPathSegListPropertyTearOff_h
    21 #define SVGPathSegListPropertyTearOff_h
     20#pragma once
    2221
    2322#include "SVGAnimatedListPropertyTearOff.h"
     
    3029class SVGPathSegListPropertyTearOff final : public SVGListProperty<SVGPathSegList> {
    3130public:
    32     typedef SVGListProperty<SVGPathSegList> Base;
    33     typedef SVGAnimatedListPropertyTearOff<SVGPathSegList> AnimatedListPropertyTearOff;
    34     typedef SVGPropertyTraits<SVGPathSegList>::ListItemType ListItemType;
    35     typedef RefPtr<SVGPathSeg> PtrListItemType;
     31    using Base = SVGListProperty<SVGPathSegList>;
     32    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGPathSegList>;
     33    using ListItemType = SVGPropertyTraits<SVGPathSegList>::ListItemType;
     34    using PtrListItemType = RefPtr<SVGPathSeg>;
    3635
    3736    static Ref<SVGPathSegListPropertyTearOff> create(AnimatedListPropertyTearOff* animatedProperty, SVGPropertyRole role, SVGPathSegRole pathSegRole, SVGPathSegList& values, ListWrapperCache& wrappers)
     
    6665
    6766    // SVGList API
    68     void clear(ExceptionCode&);
     67    ExceptionOr<void> clear();
    6968
    70     PtrListItemType initialize(PtrListItemType newItem, ExceptionCode& ec)
     69    ExceptionOr<PtrListItemType> initialize(PtrListItemType newItem)
    7170    {
    7271        // Not specified, but FF/Opera do it this way, and it's just sane.
    73         if (!newItem) {
    74             ec = SVGException::SVG_WRONG_TYPE_ERR;
    75             return nullptr;
    76         }
     72        if (!newItem)
     73            return Exception { SVGException::SVG_WRONG_TYPE_ERR };
    7774
    7875        clearContextAndRoles();
    79         return Base::initializeValues(newItem, ec);
     76        return Base::initializeValues(newItem);
    8077    }
    8178
    82     PtrListItemType getItem(unsigned index, ExceptionCode&);
     79    ExceptionOr<PtrListItemType> getItem(unsigned index);
    8380
    84     PtrListItemType insertItemBefore(PtrListItemType newItem, unsigned index, ExceptionCode& ec)
     81    ExceptionOr<PtrListItemType> insertItemBefore(PtrListItemType newItem, unsigned index)
    8582    {
    8683        // Not specified, but FF/Opera do it this way, and it's just sane.
    87         if (!newItem) {
    88             ec = SVGException::SVG_WRONG_TYPE_ERR;
    89             return 0;
    90         }
     84        if (!newItem)
     85            return Exception { SVGException::SVG_WRONG_TYPE_ERR };
    9186
    92         return Base::insertItemBeforeValues(newItem, index, ec);
     87        return Base::insertItemBeforeValues(newItem, index);
    9388    }
    9489
    95     PtrListItemType replaceItem(PtrListItemType, unsigned index, ExceptionCode&);
     90    ExceptionOr<PtrListItemType> replaceItem(PtrListItemType, unsigned index);
    9691
    97     PtrListItemType removeItem(unsigned index, ExceptionCode&);
     92    ExceptionOr<PtrListItemType> removeItem(unsigned index);
    9893
    99     PtrListItemType appendItem(PtrListItemType newItem, ExceptionCode& ec)
     94    ExceptionOr<PtrListItemType> appendItem(PtrListItemType newItem)
    10095    {
    10196        // Not specified, but FF/Opera do it this way, and it's just sane.
    102         if (!newItem) {
    103             ec = SVGException::SVG_WRONG_TYPE_ERR;
    104             return nullptr;
    105         }
     97        if (!newItem)
     98            return Exception { SVGException::SVG_WRONG_TYPE_ERR };
    10699
    107         return Base::appendItemValues(newItem, ec);
     100        return Base::appendItemValues(newItem);
    108101    }
    109102
     
    162155
    163156}
    164 
    165 #endif // SVGListPropertyTearOff_h
  • trunk/Source/WebCore/svg/properties/SVGPropertyTearOff.h

    r197967 r207716  
    1919 */
    2020
    21 #ifndef SVGPropertyTearOff_h
    22 #define SVGPropertyTearOff_h
     21#pragma once
    2322
    2423#include "SVGAnimatedProperty.h"
     
    5655    {
    5756        return adoptRef(*new Self(initialValue));
     57    }
     58
     59    template<typename T> static ExceptionOr<Ref<Self>> create(ExceptionOr<T>&& initialValue)
     60    {
     61        if (initialValue.hasException())
     62            return initialValue.releaseException();
     63        return create(initialValue.releaseReturnValue());
    5864    }
    5965
     
    173179
    174180}
    175 
    176 #endif // SVGPropertyTearOff_h
  • trunk/Source/WebCore/svg/properties/SVGStaticListPropertyTearOff.h

    r203275 r207716  
    1818 */
    1919
    20 #ifndef SVGStaticListPropertyTearOff_h
    21 #define SVGStaticListPropertyTearOff_h
     20#pragma once
    2221
    2322#include "SVGListProperty.h"
     
    2524namespace WebCore {
    2625
    27 template<typename PropertyType>
    28 class SVGStaticListPropertyTearOff final : public SVGListProperty<PropertyType> {
     26template<typename PropertyType> class SVGStaticListPropertyTearOff final : public SVGListProperty<PropertyType> {
    2927public:
    30     typedef SVGListProperty<PropertyType> Base;
    31 
    32     typedef typename SVGPropertyTraits<PropertyType>::ListItemType ListItemType;
    33     typedef SVGPropertyTearOff<ListItemType> ListItemTearOff;
     28    using Base = SVGListProperty<PropertyType>;
     29    using ListItemType = typename SVGPropertyTraits<PropertyType>::ListItemType;
     30    using ListItemTearOff = SVGPropertyTearOff<ListItemType>;
    3431
    3532    using Base::m_role;
     
    3835    static Ref<SVGStaticListPropertyTearOff<PropertyType>> create(SVGElement& contextElement, PropertyType& values)
    3936    {
    40         return adoptRef(*new SVGStaticListPropertyTearOff<PropertyType>(&contextElement, values));
     37        return adoptRef(*new SVGStaticListPropertyTearOff(contextElement, values));
    4138    }
    4239
    43     // SVGList API
    44     void clear(ExceptionCode& ec)
     40    ExceptionOr<void> clear()
    4541    {
    46         Base::clearValues(ec);
     42        return Base::clearValues();
    4743    }
    4844
    49     ListItemType initialize(const ListItemType& newItem, ExceptionCode& ec)
     45    ExceptionOr<ListItemType> initialize(const ListItemType& newItem)
    5046    {
    51         return Base::initializeValues(newItem, ec);
     47        return Base::initializeValues(newItem);
    5248    }
    5349
    54     ListItemType getItem(unsigned index, ExceptionCode& ec)
     50    ExceptionOr<ListItemType> getItem(unsigned index)
    5551    {
    56         return Base::getItemValues(index, ec);
     52        return Base::getItemValues(index);
    5753    }
    5854
    59     ListItemType insertItemBefore(const ListItemType& newItem, unsigned index, ExceptionCode& ec)
     55    ExceptionOr<ListItemType> insertItemBefore(const ListItemType& newItem, unsigned index)
    6056    {
    61         return Base::insertItemBeforeValues(newItem, index, ec);
     57        return Base::insertItemBeforeValues(newItem, index);
    6258    }
    6359
    64     ListItemType replaceItem(const ListItemType& newItem, unsigned index, ExceptionCode& ec)
     60    ExceptionOr<ListItemType> replaceItem(const ListItemType& newItem, unsigned index)
    6561    {
    66         return Base::replaceItemValues(newItem, index, ec);
     62        return Base::replaceItemValues(newItem, index);
    6763    }
    6864
    69     ListItemType removeItem(unsigned index, ExceptionCode& ec)
     65    ExceptionOr<ListItemType> removeItem(unsigned index)
    7066    {
    71         return Base::removeItemValues(index, ec);
     67        return Base::removeItemValues(index);
    7268    }
    7369
    74     ListItemType appendItem(const ListItemType& newItem, ExceptionCode& ec)
     70    ExceptionOr<ListItemType> appendItem(const ListItemType& newItem)
    7571    {
    76         return Base::appendItemValues(newItem, ec);
     72        return Base::appendItemValues(newItem);
    7773    }
    7874
    7975private:
    80     SVGStaticListPropertyTearOff(SVGElement* contextElement, PropertyType& values)
    81         : SVGListProperty<PropertyType>(UndefinedRole, values, 0)
     76    SVGStaticListPropertyTearOff(SVGElement& contextElement, PropertyType& values)
     77        : SVGListProperty<PropertyType>(UndefinedRole, values, nullptr)
    8278        , m_contextElement(contextElement)
    8379    {
     
    9288    {
    9389        ASSERT(m_values);
    94         m_values->commitChange(m_contextElement.get());
     90        m_values->commitChange(m_contextElement.ptr());
    9591    }
    9692
     
    107103    }
    108104
    109 private:
    110     RefPtr<SVGElement> m_contextElement;
     105    Ref<SVGElement> m_contextElement;
    111106};
    112107
    113108}
    114 
    115 #endif // SVGStaticListPropertyTearOff_h
  • trunk/Source/WebCore/svg/properties/SVGTransformListPropertyTearOff.h

    r203275 r207716  
    1818 */
    1919
    20 #ifndef SVGTransformListPropertyTearOff_h
    21 #define SVGTransformListPropertyTearOff_h
     20#pragma once
    2221
    2322#include "SVGListPropertyTearOff.h"
     
    2625namespace WebCore {
    2726
    28 // SVGTransformList contains two additional methods, that can be exposed to the bindings.
    2927class SVGTransformListPropertyTearOff final : public SVGListPropertyTearOff<SVGTransformList> {
    3028public:
    31     typedef SVGAnimatedListPropertyTearOff<SVGTransformList> AnimatedListPropertyTearOff;
    32     typedef SVGAnimatedListPropertyTearOff<SVGTransformList>::ListWrapperCache ListWrapperCache;
     29    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGTransformList>;
     30    using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
    3331
    3432    static Ref<SVGListPropertyTearOff<SVGTransformList>> create(AnimatedListPropertyTearOff* animatedProperty, SVGPropertyRole role, SVGTransformList& values, ListWrapperCache& wrappers)
     
    3836    }
    3937
    40     RefPtr<SVGPropertyTearOff<SVGTransform>> createSVGTransformFromMatrix(SVGPropertyTearOff<SVGMatrix>* matrix, ExceptionCode& ec)
     38    ExceptionOr<Ref<SVGPropertyTearOff<SVGTransform>>> createSVGTransformFromMatrix(SVGPropertyTearOff<SVGMatrix>* matrix)
    4139    {
    4240        ASSERT(m_values);
    43         if (!matrix) {
    44             ec = TYPE_MISMATCH_ERR;
    45             return nullptr;
    46         }
     41        if (!matrix)
     42            return Exception { TYPE_MISMATCH_ERR };
    4743        return SVGPropertyTearOff<SVGTransform>::create(m_values->createSVGTransformFromMatrix(matrix->propertyReference()));
    4844    }
    4945
    50     RefPtr<SVGPropertyTearOff<SVGTransform>> consolidate(ExceptionCode& ec)
     46    ExceptionOr<RefPtr<SVGPropertyTearOff<SVGTransform>>> consolidate()
    5147    {
    5248        ASSERT(m_values);
    5349        ASSERT(m_wrappers);
    54         if (!canAlterList(ec))
     50
     51        auto result = canAlterList();
     52        if (result.hasException())
     53            return result.releaseException();
     54        if (!result.releaseReturnValue())
    5555            return nullptr;
    5656
     
    6666
    6767        ASSERT(m_values->size() == m_wrappers->size());
    68         return wrapper;
     68        return WTFMove(wrapper);
    6969    }
    7070
     
    7777
    7878}
    79 
    80 #endif // SVGListPropertyTearOff_h
Note: See TracChangeset for help on using the changeset viewer.